/* assets/css/style.css */
/* Premium Design System & Responsive Rules for MMS Hub */

:root {
    --mms-navy: #042a4f;
    --mms-navy-light: #0a3a6b;
    --mms-cyan: #269ad6;
    --mms-cyan-light: #e0f4ff;
    --mms-indigo: #1b7bb1;
    --mms-indigo-light: #d1ecf9;
    --mms-violet: #8b5cf6;
    --mms-bg: #f8fafc;
    --mms-card-bg: #ffffff;
    --mms-text-main: #334155;
    --mms-text-muted: #64748b;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #042a4f 0%, #0a3a6b 100%);
    --gradient-accent: linear-gradient(135deg, #269ad6 0%, #042a4f 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    
    /* Shadows & Transitions */
    --card-shadow: 0 10px 30px -5px rgba(4, 42, 79, 0.04), 0 8px 15px -6px rgba(4, 42, 79, 0.03);
    --hover-shadow: 0 20px 40px -5px rgba(38, 154, 214, 0.15), 0 12px 20px -6px rgba(38, 154, 214, 0.1);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --border-radius-xl: 18px;
    --border-radius-lg: 12px;
}

/* Base Body Styles */
body {
    background-color: var(--mms-bg);
    color: var(--mms-text-main);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding-bottom: 80px;
    letter-spacing: -0.15px;
    overflow-x: hidden;
}

.text-navy {
    color: var(--mms-navy) !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Fade-In Entrance Animation */
.main-card, .form-container, .stat-card, .login-card {
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* ===================================================
   MODERN GLASSMORPHIC NAVBAR
   =================================================== */
.mms-navbar {
    background: rgba(15, 23, 42, 0.92) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1.5px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    transition: var(--transition-smooth);
}

.mms-navbar .navbar-brand {
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.mms-navbar .nav-link {
    color: rgba(241, 245, 249, 0.8) !important;
    font-weight: 600;
    transition: var(--transition-smooth);
    border-radius: var(--border-radius-lg);
}

.mms-navbar .nav-link:hover, 
.mms-navbar .nav-link.active,
.mms-navbar .show > .nav-link {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.06);
}

.mms-navbar .dropdown-menu {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--border-radius-xl);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
    padding: 10px;
}

.mms-navbar .dropdown-item {
    font-weight: 600;
    padding: 10px 16px;
    border-radius: var(--border-radius-lg);
    transition: var(--transition-smooth);
    color: var(--mms-navy-light);
}

.mms-navbar .dropdown-item:hover {
    background: var(--mms-indigo-light);
    color: var(--mms-indigo);
}

/* ===================================================
   PREMIUM LAYOUT ELEMENTS
   =================================================== */
.page-header {
    background: var(--gradient-primary);
    padding: 3rem 0 5.5rem 0;
    color: white;
    border-bottom: 3.5px solid var(--mms-cyan);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.main-card {
    border: 1px solid rgba(241, 245, 249, 0.9);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--card-shadow);
    background: var(--mms-card-bg);
    margin-top: -4rem;
    padding: 2.2rem;
    transition: var(--transition-smooth);
}

.section-header {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--mms-text-muted);
    border-left: 4.5px solid var(--mms-indigo);
    padding-left: 14px;
    margin-bottom: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

/* Statistics Dashboard Cards */
.stat-card {
    border: 1px solid rgba(241, 245, 249, 0.8);
    border-radius: 20px;
    background: white;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    padding: 1.8rem !important;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--hover-shadow);
    border-color: rgba(99, 102, 241, 0.15);
}

/* Interactive Navigation Cards */
.nav-card {
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 16px;
    background: white;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    padding: 1.4rem;
    margin-bottom: 1.2rem;
}

.nav-card:hover {
    transform: translateY(-4px) scale(1.008);
    box-shadow: var(--hover-shadow);
    border-color: #6366f1 !important;
}

.nav-card .icon-box {
    transition: var(--transition-smooth);
}

.nav-card:hover .icon-box {
    transform: scale(1.1) rotate(2deg);
}

/* Premium Form Elements */
.form-control, .form-select {
    border: 1.8px solid #e2e8f0;
    border-radius: var(--border-radius-lg);
    padding: 10px 14px;
    color: var(--mms-text-main);
    font-weight: 500;
    transition: var(--transition-smooth);
}

.form-control:focus, .form-select:focus {
    border-color: var(--mms-indigo);
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.15);
    color: var(--mms-navy);
}

/* Custom Table Polish */
.table-responsive {
    border-radius: var(--border-radius-lg);
    overflow-x: auto;
    border: 1px solid rgba(241, 245, 249, 0.9);
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8fafc !important;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.8px;
    color: var(--mms-text-muted);
    font-weight: 800;
    border-bottom: 2px solid #e2e8f0;
    padding: 16px 12px;
}

.table tbody td {
    padding: 16px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 500;
}

.table tbody tr {
    transition: var(--transition-smooth);
}

.table tbody tr:hover {
    background-color: rgba(248, 250, 252, 0.8) !important;
}

/* Primary/Secondary Buttons Upgrades */
.btn-success {
    background: var(--gradient-success) !important;
    border: none !important;
}
.btn-danger {
    background: var(--gradient-danger) !important;
    border: none !important;
}
.btn-warning {
    background: var(--gradient-warning) !important;
    border: none !important;
    color: white !important;
}

.btn-success:hover, .btn-danger:hover, .btn-warning:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Vehicle row in PSS Hub */
.v-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 8px;
}

/* ===================================================
   RESPONSIVE BREAKPOINTS
   =================================================== */

/* --- TABLET BREAKPOINT (991px & Down) --- */
@media (max-width: 991px) {
    .main-card {
        margin-top: -2.5rem;
        padding: 1.5rem;
    }
    
    .page-header {
        padding: 2.5rem 0 4rem 0;
    }
    
    .mms-navbar .container-fluid {
        padding: 0 1rem !important;
    }
    
    /* Stack stats cards slightly tighter */
    .stat-card {
        padding: 1.3rem !important;
    }

    /* Navbar collapse menu styling on mobile */
    .mms-navbar .navbar-collapse {
        background: rgba(15, 23, 42, 0.97);
        border-radius: var(--border-radius-xl);
        margin-top: 8px;
        padding: 12px;
        border: 1px solid rgba(99, 102, 241, 0.2);
    }

    .mms-navbar .dropdown-menu {
        background: rgba(30, 41, 59, 0.95);
        border: none;
        box-shadow: none;
        padding: 4px 0 4px 12px;
    }

    .mms-navbar .dropdown-item {
        color: rgba(241, 245, 249, 0.75) !important;
    }

    .mms-navbar .dropdown-item:hover {
        background: rgba(255,255,255,0.07);
        color: #fff !important;
    }

    /* Language buttons shrink on tablet */
    #lang-btn-en, #lang-btn-ms {
        font-size: 0.7rem !important;
        padding: 2px 7px !important;
    }
}

/* --- MOBILE BREAKPOINT (767px & Down) --- */
@media (max-width: 767px) {
    html, body {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    body {
        padding-bottom: 90px;
    }
    
    .page-header {
        padding: 1.8rem 0 3rem 0;
        text-align: center !important;
    }
    
    .page-header .d-flex {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px;
    }

    .page-header h1 {
        font-size: 1.3rem !important;
    }

    .page-header p {
        font-size: 0.82rem !important;
    }
    
    .main-card {
        margin-top: -1.5rem;
        padding: 1.1rem;
        border-radius: 12px;
    }
    
    .section-header {
        font-size: 0.78rem;
        margin-bottom: 1.2rem;
    }

    /* Stat cards - 2 per row on mobile */
    .stat-card {
        padding: 1rem !important;
    }

    .stat-card .fs-1 { font-size: 1.8rem !important; }
    
    /* Make tables fully horizontal scrollable */
    .table-responsive {
        border: 1px solid #e2e8f0;
        margin-bottom: 1rem;
    }
    
    .table thead th, .table tbody td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }
    
    /* Form inputs adjustments */
    .form-control, .form-select {
        padding: 8px 12px;
        font-size: 0.88rem;
    }
    
    /* Buttons in mobile stack vertically */
    .d-grid-mobile {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    /* Fix Select2 mobile widths */
    .select2-container {
        width: 100% !important;
    }
    
    /* QR code scan box size optimizer */
    #reader {
        width: 100% !important;
        max-width: 320px;
        margin: 0 auto;
    }
    
    /* Pallet Tally sidebar moves dynamically in grid */
    .summary-card.sticky-top {
        position: relative !important;
        top: 0 !important;
        margin-top: 1.5rem;
        border-radius: var(--border-radius-lg);
        overflow: hidden;
        box-shadow: var(--card-shadow);
    }

    /* Vehicle rows in PSS Hub */
    .v-row {
        flex-wrap: wrap;
    }
    .v-row .v-name { min-width: 0; flex: 1 1 120px; }
    .v-row .v-cap  { width: 80px !important; }

    /* Modal dialog full-width on mobile */
    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-content {
        border-radius: 16px;
    }

    /* PSS/Hub screen trip loading layout */
    #activeVehicleChecklist {
        flex-direction: column !important;
    }
    #activeVehicleChecklist label {
        width: 100%;
        justify-content: flex-start !important;
    }

    /* Fix overflow in reconcile summary cards */
    .d-inline-block {
        max-width: 100%;
    }

    /* Receiving multi-item table — keep horizontal scroll */
    .table-scroll-x {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
    }

    /* stock_transfer bulk reason input */
    input[style*="width:200px"] {
        width: 100% !important;
    }

    /* Action btn groups stack on mobile */
    .btn-group.gap-2 {
        flex-wrap: wrap !important;
    }

    /* Responsive Table to Cards conversion */
    .responsive-table-cards:not(.table-scroll-x) table, 
    .responsive-table-cards:not(.table-scroll-x) thead, 
    .responsive-table-cards:not(.table-scroll-x) tbody, 
    .responsive-table-cards:not(.table-scroll-x) th, 
    .responsive-table-cards:not(.table-scroll-x) td, 
    .responsive-table-cards:not(.table-scroll-x) tr { 
        display: block !important; 
    }
    
    .responsive-table-cards:not(.table-scroll-x) table {
        min-width: 100% !important;
    }
    
    .responsive-table-cards:not(.table-scroll-x) thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .responsive-table-cards:not(.table-scroll-x) tr {
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: var(--border-radius-lg);
        margin-bottom: 1.2rem;
        padding: 1.2rem;
        background: #ffffff;
        box-shadow: 0 4px 10px rgba(0,0,0,0.02);
        position: relative;
    }
    
    .responsive-table-cards:not(.table-scroll-x) td { 
        border: none !important;
        border-bottom: 1px dashed #e2e8f0 !important; 
        position: relative;
        padding: 10px 0 !important;
        text-align: left !important;
        word-break: break-word;
        white-space: normal !important;
    }
    
    .responsive-table-cards:not(.table-scroll-x) td:last-child {
        border-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .responsive-table-cards:not(.table-scroll-x) td:before { 
        display: block;
        margin-bottom: 6px;
        font-weight: 800;
        content: attr(data-label);
        font-size: 0.72rem;
        color: var(--mms-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Fix Select2 inside stacked table cards */
    .responsive-table-cards:not(.table-scroll-x) .select2-container {
        width: 100% !important;
    }

    /* Dashboard navigation cards — 2 columns on mobile */
    .row-cols-xl-5 > *, .row-cols-lg-4 > *, .row-cols-md-3 > * {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* --- EXTRA SMALL MOBILE (400px & Down) --- */
@media (max-width: 400px) {
    .page-header h1 {
        font-size: 1.1rem !important;
    }

    /* Single column nav cards on very small screens */
    .row-cols-xl-5 > *, .row-cols-lg-4 > *, .row-cols-md-3 > *, .row-cols-2 > * {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .main-card {
        padding: 0.9rem;
    }

    .btn { font-size: 0.8rem; }
}

/* ===================================================
   CATEGORY BADGE STYLING
   =================================================== */
.badge-cat, .badge.badge-cat {
    background-color: var(--mms-indigo-light) !important;
    color: var(--mms-indigo) !important;
    padding: 0.4rem 0.8rem !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: inline-block !important;
    line-height: 1 !important;
    text-align: center !important;
}

/* ===================================================
   DARK THEME SYSTEM & COMPONENT OVERRIDES
   =================================================== */
html[data-theme="dark"],
html[data-bs-theme="dark"] {
    --mms-navy: #f8fafc !important;
    --mms-bg: #0b1329;
    --mms-card-bg: #162032;
    --mms-text-main: #f8fafc;
    --mms-text-muted: #cbd5e1;
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4), 0 8px 15px -6px rgba(0, 0, 0, 0.3);
    --hover-shadow: 0 20px 40px -5px rgba(38, 154, 214, 0.25);
    
    --bs-body-bg: #0b1329 !important;
    --bs-body-color: #f8fafc !important;
    --bs-card-bg: #162032 !important;
    --bs-card-color: #f8fafc !important;
    --bs-table-bg: #162032 !important;
    --bs-table-color: #f8fafc !important;
    --bs-table-hover-bg: #1e293b !important;
    --bs-table-hover-color: #ffffff !important;
    
    color-scheme: dark;
}

html[data-theme="dark"] body,
html[data-bs-theme="dark"] body {
    background-color: var(--mms-bg) !important;
    color: var(--mms-text-main) !important;
}

/* Scrollbars in dark mode */
html[data-theme="dark"] ::-webkit-scrollbar-thumb,
html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #334155;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Cards & Containers in dark mode */
html[data-theme="dark"] .main-card,
html[data-bs-theme="dark"] .main-card,
html[data-theme="dark"] .stat-card,
html[data-bs-theme="dark"] .stat-card,
html[data-theme="dark"] .nav-card,
html[data-bs-theme="dark"] .nav-card,
html[data-theme="dark"] .form-container,
html[data-bs-theme="dark"] .form-container,
html[data-theme="dark"] .card,
html[data-bs-theme="dark"] .card,
html[data-theme="dark"] .custom-card,
html[data-bs-theme="dark"] .custom-card {
    background-color: #1e293b !important;
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .section-title,
html[data-bs-theme="dark"] .section-title {
    color: #38bdf8 !important;
    border-left-color: #38bdf8 !important;
}

html[data-theme="dark"] .nav-card .title,
html[data-bs-theme="dark"] .nav-card .title {
    color: #f8fafc !important;
}

html[data-theme="dark"] .nav-card .desc,
html[data-bs-theme="dark"] .nav-card .desc {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .card-header.bg-white,
html[data-bs-theme="dark"] .card-header.bg-white,
html[data-theme="dark"] .card-header.bg-light,
html[data-bs-theme="dark"] .card-header.bg-light {
    background-color: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .card-body,
html[data-bs-theme="dark"] .card-body {
    background-color: #162032 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .section-header,
html[data-bs-theme="dark"] .section-header {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-bs-theme="dark"] .bg-light {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

/* Text utility overrides in dark mode */
html[data-theme="dark"] .text-dark,
html[data-bs-theme="dark"] .text-dark,
html[data-theme="dark"] .fw-bold.text-dark,
html[data-bs-theme="dark"] .fw-bold.text-dark {
    color: #f8fafc !important;
}

html[data-theme="dark"] .text-navy,
html[data-bs-theme="dark"] .text-navy {
    color: #38bdf8 !important;
}

html[data-theme="dark"] .text-muted,
html[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .text-secondary,
html[data-bs-theme="dark"] .text-secondary {
    color: #cbd5e1 !important;
}

/* Tables & DataTables in dark mode */
html[data-theme="dark"] .table-responsive,
html[data-bs-theme="dark"] .table-responsive {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .table,
html[data-bs-theme="dark"] .table {
    color: #f1f5f9 !important;
    border-color: #334155 !important;
    background-color: #162032 !important;
}

html[data-theme="dark"] .table > :not(caption) > * > *,
html[data-bs-theme="dark"] .table > :not(caption) > * > * {
    background-color: #162032 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .table thead,
html[data-bs-theme="dark"] .table thead,
html[data-theme="dark"] .table thead th,
html[data-bs-theme="dark"] .table thead th,
html[data-theme="dark"] .table thead.table-light,
html[data-bs-theme="dark"] .table thead.table-light,
html[data-theme="dark"] .table thead.table-light th,
html[data-bs-theme="dark"] .table thead.table-light th {
    background-color: #0f172a !important;
    color: #94a3b8 !important;
    border-bottom: 2px solid #334155 !important;
}

html[data-theme="dark"] .table tbody tr,
html[data-bs-theme="dark"] .table tbody tr {
    background-color: #162032 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > *,
html[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #1a263c !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .table-hover > tbody > tr:hover > *,
html[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: #24324a !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .table td, 
html[data-theme="dark"] .table th,
html[data-bs-theme="dark"] .table td, 
html[data-bs-theme="dark"] .table th {
    border-color: #334155 !important;
    color: inherit !important;
}

/* Badges in dark mode */
html[data-theme="dark"] .badge.bg-light,
html[data-bs-theme="dark"] .badge.bg-light,
html[data-theme="dark"] .badge.bg-white,
html[data-bs-theme="dark"] .badge.bg-white {
    background-color: #334155 !important;
    color: #f8fafc !important;
    border: 1px solid #475569 !important;
}

html[data-theme="dark"] .badge.bg-secondary,
html[data-bs-theme="dark"] .badge.bg-secondary {
    background-color: #475569 !important;
    color: #f8fafc !important;
}

/* DataTables elements */
html[data-theme="dark"] .dataTables_wrapper,
html[data-bs-theme="dark"] .dataTables_wrapper {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .dataTables_length select,
html[data-bs-theme="dark"] .dataTables_length select,
html[data-theme="dark"] .dataTables_filter input,
html[data-bs-theme="dark"] .dataTables_filter input {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}

html[data-theme="dark"] .page-link,
html[data-bs-theme="dark"] .page-link {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #38bdf8 !important;
}

html[data-theme="dark"] .page-item.disabled .page-link,
html[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #64748b !important;
}

html[data-theme="dark"] .page-item.active .page-link,
html[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: var(--mms-indigo) !important;
    border-color: var(--mms-indigo) !important;
    color: #ffffff !important;
}

/* Form inputs & controls in dark mode */
html[data-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-bs-theme="dark"] .form-select,
html[data-theme="dark"] .input-group-text,
html[data-bs-theme="dark"] .input-group-text {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-bs-theme="dark"] .form-control::placeholder {
    color: #64748b !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-bs-theme="dark"] .form-select:focus {
    background-color: #1e293b !important;
    border-color: var(--mms-cyan) !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3.5px rgba(38, 154, 214, 0.25) !important;
}

html[data-theme="dark"] .form-control:disabled,
html[data-bs-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-select:disabled,
html[data-bs-theme="dark"] .form-select:disabled,
html[data-theme="dark"] .form-control[readonly],
html[data-bs-theme="dark"] .form-control[readonly],
html[data-theme="dark"] .readonly-disabled-field,
html[data-bs-theme="dark"] .readonly-disabled-field {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
    color: #94a3b8 !important;
}

/* Dropdowns in dark mode */
html[data-theme="dark"] .dropdown-menu,
html[data-bs-theme="dark"] .dropdown-menu {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .dropdown-item,
html[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus,
html[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .dropdown-divider,
html[data-bs-theme="dark"] .dropdown-divider {
    border-top-color: #334155 !important;
}

/* Modals in dark mode */
html[data-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .modal-header,
html[data-bs-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-bs-theme="dark"] .modal-footer {
    border-color: #334155 !important;
}

/* Select2 in dark mode */
html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f8fafc !important;
}

html[data-theme="dark"] .select2-dropdown,
html[data-bs-theme="dark"] .select2-dropdown {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected],
html[data-bs-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--mms-indigo) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected=true],
html[data-bs-theme="dark"] .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #0f172a !important;
}

html[data-theme="dark"] .select2-search__field,
html[data-bs-theme="dark"] .select2-search__field {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

/* Flatpickr in dark mode */
html[data-theme="dark"] .flatpickr-calendar,
html[data-bs-theme="dark"] .flatpickr-calendar {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .flatpickr-day,
html[data-bs-theme="dark"] .flatpickr-day,
html[data-theme="dark"] .flatpickr-month,
html[data-bs-theme="dark"] .flatpickr-month,
html[data-theme="dark"] .flatpickr-weekday,
html[data-bs-theme="dark"] .flatpickr-weekday {
    color: #f8fafc !important;
}

html[data-theme="dark"] .flatpickr-day:hover,
html[data-bs-theme="dark"] .flatpickr-day:hover {
    background-color: #334155 !important;
}

html[data-theme="dark"] .flatpickr-day.selected,
html[data-bs-theme="dark"] .flatpickr-day.selected {
    background-color: var(--mms-indigo) !important;
    border-color: var(--mms-indigo) !important;
}

/* SweetAlert2 in dark mode */
html[data-theme="dark"] .swal2-popup,
html[data-bs-theme="dark"] .swal2-popup {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .swal2-title,
html[data-bs-theme="dark"] .swal2-title,
html[data-theme="dark"] .swal2-html-container,
html[data-bs-theme="dark"] .swal2-html-container {
    color: #f8fafc !important;
}

/* Theme switch button animation & styling */
.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: scale(1.03);
}

/* Responsive table cards in dark mode */
@media (max-width: 991.98px) {
    html[data-theme="dark"] .responsive-table-cards:not(.table-scroll-x) tr,
    html[data-bs-theme="dark"] .responsive-table-cards:not(.table-scroll-x) tr {
        background: #162032 !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }
    html[data-theme="dark"] .responsive-table-cards:not(.table-scroll-x) td,
    html[data-bs-theme="dark"] .responsive-table-cards:not(.table-scroll-x) td {
        border-bottom-color: #334155 !important;
    }
}

/* Overrides for inline white background elements in dark mode */
html[data-theme="dark"] [style*="background: white"],
html[data-bs-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-bs-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-bs-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-bs-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-bs-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background-color: white"],
html[data-bs-theme="dark"] [style*="background-color: white"],
html[data-theme="dark"] [style*="background-color: #fff"],
html[data-bs-theme="dark"] [style*="background-color: #fff"],
html[data-theme="dark"] [style*="background-color: #ffffff"],
html[data-bs-theme="dark"] [style*="background-color: #ffffff"] {
    background-color: #162032 !important;
    color: #f1f5f9 !important;
}

/* Overrides for inline dark text in dark mode */
html[data-theme="dark"] [style*="color: #333"],
html[data-bs-theme="dark"] [style*="color: #333"],
html[data-theme="dark"] [style*="color: #000"],
html[data-bs-theme="dark"] [style*="color: #000"],
html[data-theme="dark"] [style*="color: black"],
html[data-bs-theme="dark"] [style*="color: black"],
html[data-theme="dark"] [style*="color:#333"],
html[data-bs-theme="dark"] [style*="color:#333"],
html[data-theme="dark"] [style*="color:#000"],
html[data-bs-theme="dark"] [style*="color:#000"] {
    color: #f1f5f9 !important;
}

/* Custom page boxes, stat cards & filter containers in dark mode */
html[data-theme="dark"] .stat-box,
html[data-bs-theme="dark"] .stat-box,
html[data-theme="dark"] .filter-card,
html[data-bs-theme="dark"] .filter-card,
html[data-theme="dark"] .inv-table-wrap,
html[data-bs-theme="dark"] .inv-table-wrap,
html[data-theme="dark"] .stat-card-pss,
html[data-bs-theme="dark"] .stat-card-pss,
html[data-theme="dark"] .day-section,
html[data-bs-theme="dark"] .day-section,
html[data-theme="dark"] .info-card,
html[data-bs-theme="dark"] .info-card,
html[data-theme="dark"] .summary-card,
html[data-bs-theme="dark"] .summary-card,
html[data-theme="dark"] .report-card,
html[data-bs-theme="dark"] .report-card {
    background-color: #162032 !important;
    background: #162032 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .inv-table-wrap .table-header,
html[data-bs-theme="dark"] .inv-table-wrap .table-header {
    background-color: #0f172a !important;
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .stat-num,
html[data-bs-theme="dark"] .stat-num,
html[data-theme="dark"] .school-name-main,
html[data-bs-theme="dark"] .school-name-main {
    color: #f8fafc !important;
}

html[data-theme="dark"] .stat-label,
html[data-bs-theme="dark"] .stat-label,
html[data-theme="dark"] .stat-lbl,
html[data-bs-theme="dark"] .stat-lbl,
html[data-theme="dark"] .filter-card .filter-title,
html[data-bs-theme="dark"] .filter-card .filter-title,
html[data-theme="dark"] .filter-label,
html[data-bs-theme="dark"] .filter-label {
    color: #94a3b8 !important;
}

/* Category pill badges in inventory report */
html[data-theme="dark"] .cat-UHT,
html[data-bs-theme="dark"] .cat-UHT { background: #1e3a8a !important; color: #93c5fd !important; border-color: #2563eb !important; }

html[data-theme="dark"] .cat-PSS,
html[data-bs-theme="dark"] .cat-PSS { background: #14532d !important; color: #86efac !important; border-color: #16a34a !important; }

html[data-theme="dark"] .cat-PST,
html[data-bs-theme="dark"] .cat-PST { background: #7c2d12 !important; color: #fdba74 !important; border-color: #ea580c !important; }

html[data-theme="dark"] .cat-Other,
html[data-bs-theme="dark"] .cat-Other { background: #334155 !important; color: #cbd5e1 !important; border-color: #475569 !important; }




