:root {
    --primary: #10B981; /* Emerald 500 */
    --primary-hover: #059669; /* Emerald 600 */
    --bg-color: #0f172a; /* Slate 900 */
    --surface: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
    --surface-hover: rgba(30, 41, 59, 0.9);
    --border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #eab308;
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

.app-container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* Glassmorphism Utilities */
.glass-nav, .glass-card {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Navigation */
.glass-nav {
    margin: 1rem 0 2rem;
    padding: 1rem;
    position: sticky;
    top: 1rem;
    z-index: 50;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-area h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.hamburger-btn {
    display: none; /* Hidden on desktop by default */
}

.icon {
    width: 28px;
    height: 28px;
}

.icon-sm {
    width: 20px;
    height: 20px;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    transition: transform 0.2s;
}

.nav-btn:hover .nav-icon {
    transform: scale(1.1);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-btn.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-color: rgba(16, 185, 129, 0.2);
}

.nav-btn.admin-btn {
    margin-left: 0.5rem;
    border-color: var(--border);
}

/* Desktop Left Sidebar Navigation */
@media (min-width: 992px) {
    .app-container {
        display: flex;
        gap: 2rem;
        align-items: flex-start;
        padding: 2rem 1rem;
        max-width: 1440px;
    }

    .glass-nav {
        width: 260px;
        min-width: 260px;
        position: sticky;
        top: 2rem;
        height: calc(100vh - 4rem);
        margin: 0;
        padding: 2.5rem 1.5rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
    }

    .nav-content {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        height: 100%;
        gap: 2.5rem;
    }

    .logo-area {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid var(--border);
        width: 100%;
    }

    .logo-area h1 {
        font-size: 1.25rem;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        flex-grow: 1;
        overflow: visible;
        padding-bottom: 0;
    }

    .nav-btn {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        border-radius: 0.75rem;
        gap: 0.75rem;
        transition: all 0.2s ease-in-out;
    }

    .nav-btn.admin-btn {
        margin-left: 0;
        margin-top: auto; /* Push admin login button to the bottom! */
    }

    .main-content {
        flex: 1;
        min-width: 0;
        width: 100%;
    }
}

/* Cards & Layout */
.glass-card {
    padding: 2rem;
}

.card-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.text-center { text-align: center; }

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.875rem;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Fix select text color for options in some browsers */
select option {
    background: var(--bg-color);
    color: var(--text-main);
}

.select-with-refresh {
    display: flex;
    gap: 0.5rem;
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 0.5rem;
    padding: 0 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.1);
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    position: relative;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Admin Sub Navigation */
.admin-sub-nav button.active {
    background: rgba(16, 185, 129, 0.15) !important;
    color: var(--primary) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

/* Auth Form */
.auth-form {
    max-width: 300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Dashboard Stats */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-header h2 {
    font-size: 1.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

#statFuel { color: var(--warning); }
#statTotal { color: var(--primary); }

/* Table */
.table-container {
    padding: 1.5rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-header h3 {
    font-size: 1.125rem;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
}

.data-table tr:hover {
    background: rgba(255,255,255,0.02);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-pending { background: rgba(234, 179, 8, 0.2); color: var(--warning); }
.badge-active { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-done { background: rgba(34, 197, 94, 0.2); color: var(--success); }

/* Utility Classes */
.hidden { display: none !important; }

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loader */
.loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    position: absolute;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.loading .btn-text { opacity: 0; }
.btn.loading .loader { display: block; }

/* Alert */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--primary);
    border-left: 4px solid var(--primary);
}

.alert.error {
    border-color: var(--danger);
}

.alert.success {
    border-color: var(--success);
}

.alert.info {
    border-color: #3b82f6;
    border-left: 4px solid #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.close-alert {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

.close-alert:hover { color: var(--text-main); }

/* Responsive adjustments */
/* Responsive adjustments (Mobile & Tablet Viewport) */
@media (max-width: 991px) {
    body {
        padding-bottom: 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .glass-card {
        padding: 1.5rem;
    }

    /* Mobile Header & Hamburger Menu */
    .hamburger-btn {
        display: flex;
        background: transparent;
        border: none;
        color: var(--text-main);
        cursor: pointer;
        padding: 0.5rem;
        align-items: center;
        justify-content: center;
        border-radius: 0.5rem;
        transition: background 0.2s;
    }

    .hamburger-btn:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .hamburger-btn svg {
        width: 24px;
        height: 24px;
        color: var(--text-main);
        transition: transform 0.2s ease-in-out;
    }

    .glass-nav {
        position: sticky;
        top: 1rem;
        margin: 0.5rem 0.5rem 1.5rem;
        padding: 0.75rem 1.25rem;
        z-index: 1000;
        border-radius: 1rem;
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
        border: 1px solid var(--border);
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
        max-height: 62px; /* Collapsed state */
        overflow: hidden;
    }

    .glass-nav.mobile-menu-open {
        max-height: 350px; /* Expanded state */
        padding-bottom: 1.5rem;
    }

    .mobile-menu-open .icon-menu {
        display: none !important;
    }

    .mobile-menu-open .icon-close {
        display: block !important;
    }

    .nav-content {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 1.5rem;
    }

    .logo-area {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        height: 40px;
    }

    .logo-brand {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: var(--primary);
    }

    .logo-area h1 {
        font-size: 1.15rem;
        margin: 0;
        background: transparent;
        -webkit-text-fill-color: var(--text-main);
    }

    .logo-area .icon {
        width: 24px;
        height: 24px;
        color: var(--primary);
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        gap: 0.50rem;
        width: 100%;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
        padding-bottom: 0;
        overflow-x: visible;
    }

    .glass-nav.mobile-menu-open .nav-links {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-btn {
        display: flex;
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        align-items: center;
        border-radius: 0.75rem;
        gap: 0.75rem;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.05);
        color: var(--text-muted);
    }

    .nav-btn.active {
        background: rgba(16, 185, 129, 0.1);
        color: var(--primary);
        border-color: rgba(16, 185, 129, 0.2);
    }

    .nav-btn.admin-btn {
        margin-left: 0;
        border-color: rgba(255, 255, 255, 0.05);
    }

    .nav-icon {
        width: 20px;
        height: 20px;
        margin-right: 0 !important;
    }
}

/* Sidebar and Admin Layout Styling */
.admin-layout {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
    margin-top: 1rem;
}

.admin-sidebar {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    justify-content: space-between;
    min-height: 550px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar-top-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-logo-area {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.admin-logo-area h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.admin-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav .btn {
    text-align: left;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.sidebar-nav .btn.active {
    background: var(--primary) !important;
    color: var(--background) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.sidebar-nav .btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 991px) {
    .admin-layout {
        flex-direction: column;
        gap: 1rem;
    }
    
    .admin-sidebar {
        position: sticky;
        top: 1rem;
        margin-bottom: 1rem;
        padding: 0.75rem 1.25rem;
        z-index: 999;
        border-radius: 1rem;
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
        border: 1px solid var(--border);
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
        max-height: 62px; /* Collapsed state */
        overflow: hidden;
        width: 100%;
        flex: none;
        min-height: auto !important;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
    }

    .admin-sidebar.mobile-menu-open {
        max-height: 480px; /* Expanded state to show subnav and footer */
        padding-bottom: 1.5rem;
    }

    .admin-sidebar.mobile-menu-open .icon-menu {
        display: none !important;
    }

    .admin-sidebar.mobile-menu-open .icon-close {
        display: block !important;
    }

    .admin-sidebar-top-wrapper {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 1.5rem;
    }

    .admin-logo-area {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        height: 40px;
        padding-bottom: 0;
        border-bottom: none;
    }

    .admin-logo-area .hamburger-btn {
        display: flex;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    }

    .admin-sidebar.mobile-menu-open .sidebar-nav {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .sidebar-nav .btn {
        width: 100%;
        text-align: left;
        white-space: normal;
    }

    .admin-sidebar-footer {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
        width: 100%;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 1rem;
    }

    .admin-sidebar.mobile-menu-open .admin-sidebar-footer {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* ========================================== */
/* CUSTOM MODALS & UI COMPONENTS */
/* ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.modal-box {
    width: 100%;
    max-width: 480px;
    background: rgba(30, 41, 59, 0.85) !important;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4) !important;
    border-radius: 1.5rem !important;
    padding: 2rem !important;
}

.edit-trip-box {
    max-width: 720px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.modal-message {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.edit-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .edit-form-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================== */
/* CUSTOM DROP-DOWN SELECT STYLING */
/* ========================================== */

.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select {
    display: flex;
    flex-direction: column;
    position: relative;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.custom-select-trigger:after {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-muted);
    transition: transform 0.2s ease;
}

.custom-select-wrapper.open .custom-select-trigger:after {
    transform: rotate(180deg);
    border-top-color: var(--primary);
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 999;
    max-height: 200px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-option:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
}

.custom-option.selected {
    background: rgba(16, 185, 129, 0.2);
    color: var(--primary);
    font-weight: 600;
}

/* Icons styling */
.icon-sm {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
}

