body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background: #35424a;
    color: #ffffff;
    padding: 1rem 2rem;
    border-bottom: #e8491d 3px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: none; /* Hidden on desktop */
}

header h1 {
    margin: 0;
}

.desktop-nav a {
    color: #ffffff;
    text-decoration: none;
    margin-left: 1rem;
    font-size: 0.9rem;
}

.desktop-nav a:hover {
    color: #e8491d;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px; /* Hidden by default */
    width: 280px;
    height: 100%;
    background: #35424a;
    color: white;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar-nav {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}

.sidebar-nav a {
    padding: 1rem 1.5rem;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.2s;
}

.sidebar-nav a:hover {
    background: #455a64;
    color: #e8491d;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.overlay.visible {
    display: block;
}

main {
    padding: 1rem;
}

.container {
    max-width: 1000px;
    margin: auto;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.8rem;
    background: #35424a;
    color: white;
    padding: 1.2rem;
    border-radius: 8px;
    gap: 1rem;
}

.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
}

.month-nav h2 {
    margin: 0;
    font-size: 1.5rem;
    text-align: center;
}

.nav-arrow {
    color: white;
    font-size: 1.4rem;
    text-decoration: none;
    padding: 0.5rem;
    transition: color 0.3s;
}

.nav-arrow:hover {
    color: #e8491d;
}

.total-badge {
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    padding-top: 0.8rem;
}

.total-badge .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.2rem;
}

.total-badge .amount {
    font-size: 2rem;
    font-weight: bold;
    color: #e8491d;
}

.card {
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 0.8rem;
    border: 1px solid #eee;
}

.entry-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.inline-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    font-size: 1rem;
    box-sizing: border-box;
    height: 38px; /* Standardize height */
}

.history-section {
    margin-top: 1rem;
    background: #fff;
    padding: 0.5rem;
    border-radius: 8px;
}

.history-section h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    table-layout: fixed; /* Force table to respect container width */
}

.user-table th, .user-table td {
    text-align: left;
    padding: 0.8rem 0.4rem;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
    word-wrap: break-word; /* Allow content to wrap within cells */
}

.user-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.empty-row td {
    text-align: center;
    padding: 2rem 1rem;
    color: #777;
    font-style: italic;
}

/* Common UI Elements */
.form-group {
    margin-bottom: 0.8rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    height: 38px;
}

button {
    background: #e8491d;
    color: #fff;
    padding: 0 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

button:hover {
    background: #cf3d15;
}

.error {
    color: #d9534f;
    background: #f2dede;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.success {
    color: #3c763d;
    background: #dff0d8;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    background: #e8491d;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    height: 38px;
    box-sizing: border-box;
}

.btn:hover {
    background: #cf3d15;
}

.btn-danger {
    background: #d9534f;
}

.btn-danger:hover {
    background: #c9302c;
}

.btn-secondary {
    background: #777;
}

.btn-secondary:hover {
    background: #555;
}

.btn-sm {
    padding: 0 0.8rem;
    font-size: 0.9rem;
    height: 30px;
}

.btn-sm i {
    font-size: 0.85rem;
    width: 1rem;
    text-align: center;
}

.user-table td:last-child {
    white-space: nowrap;
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.profile-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

footer {
    text-align: center;
    padding: 0.8rem 1rem;
    background: #35424a;
    color: #fff;
    margin-top: 2rem;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
    header {
        padding: 0.8rem 1rem;
    }

    .menu-btn {
        display: block; /* Show hamburger on mobile */
    }

    .desktop-nav {
        display: none; /* Hide desktop nav on mobile */
    }

    .container {
        padding: 0.5rem;
    }

    .dashboard-header {
        padding: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .month-nav h2 {
        font-size: 1.2rem;
    }

    .nav-arrow {
        font-size: 1.2rem;
    }

    .total-badge .amount {
        font-size: 1.5rem !important;
    }

    .card {
        padding: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .entry-section h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .inline-form {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 0.5rem;
    }

    .inline-form .form-group:nth-child(1) {
        flex: 0 0 100%; /* Force Date to take full width */
        margin-bottom: 0.2rem;
    }

    .inline-form .form-group:nth-child(2) {
        flex: 1; /* Equal space */
        min-width: 0;
        margin-bottom: 0.5rem;
    }

    .inline-form .form-group:nth-child(3) {
        flex: 1; /* Equal space */
        min-width: 0;
        margin-bottom: 0.5rem;
    }

    .inline-form button {
        flex: 0 0 100%; /* Force button to take full width below inputs */
        margin-top: 0.5rem;
    }

    /* Force identical height for all inputs and selects on mobile */
    .inline-form input, 
    .inline-form select, 
    .inline-form button {
        height: 38px !important;
        box-sizing: border-box !important;
        padding: 0 0.5rem !important;
        line-height: normal !important;
    }

    /* Condensed Table for Mobile - NO SCROLL */
    .history-section {
        margin-top: 0.5rem;
        padding: 0;
    }

    .history-section h3 {
        font-size: 1rem;
        margin-left: 0.5rem;
    }

    .user-table {
        table-layout: auto; /* Switch back to auto for better fit on tiny screens */
    }

    .user-table th, .user-table td {
        padding: 0.5rem 0.15rem;
        font-size: 0.7rem; /* Very small but readable for compact view */
    }

    .user-table th {
        font-size: 0.6rem;
    }

    /* Target columns for better space distribution */
    .entries-table th:nth-child(1), .entries-table tr:not(.empty-row) td:nth-child(1) { width: 22%; } /* Date */
    .entries-table th:nth-child(2), .entries-table tr:not(.empty-row) td:nth-child(2) { width: 18%; } /* Type */
    .entries-table th:nth-child(3), .entries-table tr:not(.empty-row) td:nth-child(3) { width: 15%; } /* Liters */
    .entries-table th:nth-child(4), .entries-table tr:not(.empty-row) td:nth-child(4) { width: 15%; } /* Rate */
    .entries-table th:nth-child(5), .entries-table tr:not(.empty-row) td:nth-child(5) { width: 15%; } /* Cost */
    .entries-table th:nth-child(6), .entries-table tr:not(.empty-row) td:nth-child(6) { width: 15%; } /* Action */

    .empty-row td {
        width: 100% !important;
        text-align: center !important;
    }

    .btn-sm {
        padding: 0 0.4rem;
        font-size: 0.7rem;
        height: 24px;
    }

    .btn-sm i {
        font-size: 0.65rem;
        width: 0.6rem;
    }

    .user-table td:last-child {
        gap: 0.2rem;
    }
}
