* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    color: #333;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

header {
    background: #2c3e50;
    color: white;
    padding: 15px;
    border-radius: 0;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-company {
    font-size: 16px;
    font-weight: bold;
    line-height: 1.2;
}

.header-details {
    font-size: 11px;
    opacity: 0.9;
    line-height: 1.2;
}

.header-logo {
    height: 32px;
    width: auto;
}

header h1 {
    font-size: 20px;
    margin: 0;
}

header a {
    color: white;
    text-decoration: none;
    font-size: 14px;
}

nav {
    background: white;
    padding: 10px;
    border-radius: 0;
    margin-bottom: 15px;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.mobile-menu-toggle {
    display: block;
    background: #2c3e50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
}

.nav-links {
    display: none;
    flex-direction: column;
    margin-top: 10px;
}

.nav-links.active {
    display: flex;
}

.nav-links a {
    color: #2c3e50;
    text-decoration: none;
    padding: 10px 15px;
    margin: 2px 0;
    border-radius: 3px;
    display: block;
    font-size: 14px;
}

.nav-links a:hover {
    background: #ecf0f1;
}

/* Desktop styles */
@media (min-width: 768px) {
    body {
        padding-top: 140px;
    }
    
    .container {
        padding: 20px;
    }
    
    header {
        padding: 20px;
    }
    
    .header-logo {
        height: 48px;
    }
    
    .header-company {
        font-size: 20px;
    }
    
    .header-details {
        font-size: 13px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    header a {
        font-size: 16px;
    }
    
    nav {
        padding: 15px;
        top: 70px;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    .nav-links {
        display: flex;
        flex-direction: row;
        margin-top: 0;
    }
    
    .nav-links a {
        padding: 10px 20px;
        margin: 0 10px 0 0;
        font-size: 16px;
        display: inline-block;
    }
}

.dashboard-cards, .summary-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 15px 0;
}

.card {
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 16px;
}

.card p {
    font-size: 14px;
}

.big-number {
    font-size: 24px;
    font-weight: bold;
    color: #27ae60;
}

.btn {
    background: #3498db;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    width: 100%;
    text-align: center;
}

.btn:hover {
    background: #2980b9;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    width: auto;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #7f8c8d;
}

/* Tablet and Desktop */
@media (min-width: 600px) {
    .dashboard-cards, .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin: 20px 0;
    }
    
    .big-number {
        font-size: 32px;
    }
    
    .btn {
        width: auto;
    }
}

@media (min-width: 900px) {
    .dashboard-cards, .summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .card {
        padding: 20px;
    }
    
    .card h3 {
        font-size: 18px;
    }
}

table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    margin: 15px 0;
    border-radius: 5px;
    overflow: hidden;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

table th, table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-size: 13px;
}

table th {
    background: #34495e;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

table tr:hover {
    background: #f5f5f5;
}

.message {
    background: #2ecc71;
    color: white;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.error {
    background: #e74c3c;
    color: white;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.badge {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
}

.badge.paid {
    background: #2ecc71;
    color: white;
}

.badge.credit, .badge.pending {
    background: #e67e22;
    color: white;
}

.badge.cleared {
    background: #95a5a6;
    color: white;
}

/* Desktop table styles */
@media (min-width: 768px) {
    table {
        display: table;
        margin: 20px 0;
    }
    
    table th, table td {
        padding: 12px;
        font-size: 14px;
    }
    
    .badge {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .message, .error {
        padding: 15px;
        font-size: 16px;
    }
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

.login-box {
    background: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 20px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 15px 0;
}

.form-section, .list-section {
    background: white;
    padding: 15px;
    border-radius: 5px;
}

.filter-section {
    background: white;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.filter-section form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-section label {
    font-size: 14px;
    font-weight: bold;
}

.filter-section input[type="date"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 20px auto;
    padding: 20px;
    border-radius: 5px;
    width: 90%;
    max-width: 500px;
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

/* Tablet styles */
@media (min-width: 600px) {
    .login-box {
        padding: 30px;
    }
    
    .login-box h1 {
        font-size: 24px;
    }
    
    .filter-section form {
        flex-direction: row;
        align-items: center;
    }
    
    .filter-section label {
        margin-bottom: 0;
    }
}

/* Desktop styles */
@media (min-width: 768px) {
    .login-box {
        padding: 40px;
    }
    
    .content-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin: 20px 0;
    }
    
    .form-section, .list-section {
        padding: 20px;
    }
    
    .filter-section {
        padding: 15px;
    }
    
    .modal-content {
        margin: 10% auto;
    }
}


/* Additional responsive utilities */
.user-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

h2 {
    font-size: 18px;
    margin: 15px 0 10px 0;
}

/* Mobile-specific improvements */
@media (max-width: 767px) {
    body {
        font-size: 14px;
        padding-top: 120px;
    }
    
    header {
        padding: 10px 15px;
    }
    
    .header-logo {
        height: 32px;
    }
    
    .header-company {
        font-size: 14px;
    }
    
    .header-details {
        font-size: 10px;
    }
    
    header h1 {
        font-size: 18px;
    }
    
    nav {
        top: 60px;
    }
    
    h2 {
        font-size: 16px;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }
    
    /* Make buttons stack on mobile */
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* Improve table readability on mobile */
    table {
        font-size: 12px;
    }
    
    table th, table td {
        padding: 6px 4px;
    }
    
    /* Stack form and list sections on mobile */
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 1023px) {
    h2 {
        font-size: 20px;
    }
    
    .container {
        padding: 15px;
    }
}

/* Large desktop */
@media (min-width: 1200px) {
    h2 {
        font-size: 22px;
    }
}

/* Print styles */
@media print {
    nav, .btn, .mobile-menu-toggle, header a {
        display: none;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    table {
        page-break-inside: auto;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}


/* ============================================
   DARK MODE THEME
   ============================================ */

:root {
    --bg-primary: #f4f4f4;
    --bg-secondary: #ffffff;
    --bg-tertiary: #ecf0f1;
    --text-primary: #333333;
    --text-secondary: #7f8c8d;
    --text-inverse: #ffffff;
    --border-color: #dddddd;
    --header-bg: #2c3e50;
    --header-text: #ffffff;
    --nav-bg: #ffffff;
    --nav-hover: #ecf0f1;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --table-header-bg: #34495e;
    --table-row-hover: #f5f5f5;
    --input-bg: #ffffff;
    --input-border: #dddddd;
    --btn-primary: #3498db;
    --btn-primary-hover: #2980b9;
    --btn-success: #2ecc71;
    --btn-danger: #e74c3c;
    --btn-danger-hover: #c0392b;
    --modal-overlay: rgba(0, 0, 0, 0.5);
}

.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-inverse: #ffffff;
    --border-color: #444444;
    --header-bg: #1e1e1e;
    --header-text: #ffffff;
    --nav-bg: #2d2d2d;
    --nav-hover: #3a3a3a;
    --card-bg: #2d2d2d;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --table-header-bg: #1e1e1e;
    --table-row-hover: #3a3a3a;
    --input-bg: #3a3a3a;
    --input-border: #555555;
    --btn-primary: #3498db;
    --btn-primary-hover: #2980b9;
    --btn-success: #27ae60;
    --btn-danger: #e74c3c;
    --btn-danger-hover: #c0392b;
    --modal-overlay: rgba(0, 0, 0, 0.7);
}

/* Apply theme variables */
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

header {
    background: var(--header-bg);
    color: var(--header-text);
}

header a {
    color: var(--header-text);
}

nav {
    background: var(--nav-bg);
}

.mobile-menu-toggle {
    background: var(--header-bg);
    color: var(--header-text);
}

.nav-links a {
    color: var(--text-primary);
}

.nav-links a:hover {
    background: var(--nav-hover);
}

.card, .form-section, .list-section, .filter-section {
    background: var(--card-bg);
    box-shadow: 0 2px 5px var(--card-shadow);
}

.card h3 {
    color: var(--text-primary);
}

table {
    background: var(--card-bg);
}

table th {
    background: var(--table-header-bg);
    color: var(--text-inverse);
}

table td {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

table tr:hover {
    background: var(--table-row-hover);
}

.form-group label {
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--input-border);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid var(--btn-primary);
    outline-offset: 2px;
}

.form-group small {
    color: var(--text-secondary);
}

.login-box {
    background: var(--card-bg);
    color: var(--text-primary);
}

.login-box h1 {
    color: var(--text-primary);
}

.modal-content {
    background: var(--card-bg);
    color: var(--text-primary);
}

.modal {
    background: var(--modal-overlay);
}

.input-icon {
    color: var(--text-secondary);
}

/* Theme toggle button */
.theme-toggle {
    background: var(--btn-primary);
    color: var(--text-inverse);
    border: none;
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s ease;
}

.theme-toggle:hover {
    background: var(--btn-primary-hover);
}

/* Dark mode specific adjustments */
.dark-mode .error {
    background: #c0392b;
}

.dark-mode .message {
    background: #27ae60;
}

.dark-mode .badge.paid {
    background: #27ae60;
}

.dark-mode .badge.credit,
.dark-mode .badge.pending {
    background: #d35400;
}

.dark-mode .badge.cleared {
    background: #7f8c8d;
}

.dark-mode .login-header {
    background: var(--header-bg);
}

.dark-mode .change-password-link {
    color: #5dade2;
}

.dark-mode .change-password-link:hover {
    color: #3498db;
}

/* Smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Prevent transition on page load */
.no-transition * {
    transition: none !important;
}


/* ============================================
   FOOTER
   ============================================ */

.app-footer {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 15px 20px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 14px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.footer-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer-item strong {
    font-weight: 600;
}

.footer-copyright {
    opacity: 0.8;
    font-size: 13px;
}

/* Add padding to body to prevent content from being hidden behind footer */
body {
    padding-bottom: 60px;
}

/* Mobile footer adjustments */
@media (max-width: 767px) {
    .app-footer {
        flex-direction: column;
        align-items: center;
        padding: 10px 15px;
        font-size: 12px;
        text-align: center;
    }
    
    .footer-section {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }
    
    .footer-copyright {
        font-size: 11px;
    }
    
    body {
        padding-bottom: 100px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .app-footer {
        font-size: 13px;
    }
    
    .footer-copyright {
        font-size: 12px;
    }
}


/* ============================================
   USER DROPDOWN MENU
   ============================================ */

.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-dropdown-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.3s ease;
}

.user-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.user-dropdown-toggle::after {
    content: '▼';
    font-size: 10px;
    margin-left: 5px;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    z-index: 1000;
}

.user-dropdown-menu.active {
    display: block;
}

.user-dropdown-menu a,
.user-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 12px 15px;
    text-align: left;
    text-decoration: none;
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.user-dropdown-menu a:hover,
.user-dropdown-menu button:hover {
    background: var(--nav-hover);
}

.user-dropdown-menu a:first-child,
.user-dropdown-menu button:first-child {
    border-radius: 5px 5px 0 0;
}

.user-dropdown-menu a:last-child,
.user-dropdown-menu button:last-child {
    border-radius: 0 0 5px 5px;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

.user-info-header {
    padding: 10px 15px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.user-info-header strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 3px;
}

@media (max-width: 767px) {
    .user-dropdown-toggle {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .user-dropdown-menu {
        min-width: 180px;
    }
}
