/* Custom Styles for Sri Lankan Cab Service System */

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
}

.font-mono, [class*="font-mono"] {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-variant-numeric: tabular-nums lining-nums;
}

/* Hide annoying browser default number spinners for a sleek financial UI */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Native Dark Theme Date Picker with bright visible calendar icon */
input[type="date"] {
    color-scheme: dark;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8) sepia(100%) saturate(600%) hue-rotate(345deg); /* bright amber calendar icon */
    cursor: pointer;
    opacity: 0.95;
    padding: 3px;
    border-radius: 4px;
    transition: transform 0.15s ease, filter 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(1) brightness(1.2);
    transform: scale(1.15);
}

.date-picker-wrapper {
    cursor: pointer;
}

.date-picker-wrapper input[type="date"] {
    cursor: pointer;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #0f172a;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Smooth theme transitions */
body, aside, header, main, div, input, select, textarea, table, thead, tbody, tr, th, td {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   LIGHT MODE PROFESSIONAL THEME SYSTEM - SENIOR UI/UX ARCHITECTURE
   High-Contrast Executive Slate, Amber & Semantic Financial Palette
   WCAG AAA Compliant & Clean Aesthetic across all devices
   ========================================================================== */
html.light {
    color-scheme: light;
}

/* Canvas & Global Typography */
html.light body {
    background-color: #f8fafc !important; /* Soft Slate 50 */
    color: #0f172a !important; /* Slate 900 */
}

/* Typography Hierarchy with High-Contrast Ratios */
html.light .text-white {
    color: #0f172a !important; /* Bold Slate 900 */
}
html.light .text-slate-100 {
    color: #0f172a !important;
}
html.light .text-slate-200 {
    color: #1e293b !important; /* Slate 800 */
}
html.light .text-slate-300 {
    color: #334155 !important; /* Slate 700 */
}
html.light .text-slate-400 {
    color: #475569 !important; /* Slate 600 - High contrast secondary text */
}
html.light .text-slate-500 {
    color: #64748b !important; /* Slate 500 - Clear tertiary captions */
}
html.light .text-slate-600 {
    color: #475569 !important;
}

/* Main Cards, Containers, and Glass Panes */
html.light .bg-slate-900,
html.light .bg-slate-900\/50,
html.light .bg-slate-900\/60,
html.light .bg-slate-900\/70,
html.light .bg-slate-900\/80,
html.light .bg-slate-900\/90 {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 4px 16px -2px rgba(0, 0, 0, 0.03);
}

/* Inner Panels, Sub-cards, and Wells */
html.light .bg-slate-950,
html.light .bg-slate-950\/40,
html.light .bg-slate-950\/50,
html.light .bg-slate-950\/60,
html.light .bg-slate-950\/70,
html.light .bg-slate-950\/80,
html.light .bg-slate-950\/90 {
    background-color: #f8fafc !important; /* Slate 50 */
    border-color: #e2e8f0 !important;
}

/* Eliminate Dark Gradients in Light Mode */
html.light [class*="from-emerald-950"],
html.light [class*="to-slate-900"],
html.light [class*="from-slate-950"] {
    --tw-gradient-from: #ffffff !important;
    --tw-gradient-to: #ffffff !important;
    background-image: none !important;
    background-color: #ffffff !important;
}

/* Borders & Dividers */
html.light [class*="border-slate-800"],
html.light [class*="border-slate-700"],
html.light .border-slate-800,
html.light .border-slate-700 {
    border-color: #e2e8f0 !important; /* Slate 200 */
}

html.light [class*="divide-slate-800"],
html.light [class*="divide-slate-700"],
html.light .divide-slate-800 {
    border-color: #f1f5f9 !important; /* Slate 100 */
}

/* Desktop Header Bar & Mobile Top Bar */
html.light header.sticky {
    background-color: rgba(255, 255, 255, 0.94) !important;
    border-bottom-color: #e2e8f0 !important;
    backdrop-filter: blur(12px) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}

html.light .md\:hidden {
    background-color: #ffffff !important;
    border-bottom-color: #e2e8f0 !important;
}

/* Sidebar Navigation */
html.light #sidebar {
    background-color: #ffffff !important;
    border-right-color: #e2e8f0 !important;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.03) !important;
}

html.light #sidebar .border-b,
html.light #sidebar .border-t {
    border-color: #e2e8f0 !important;
}

html.light #sidebar .p-6.border-b {
    background-color: #ffffff !important;
}

html.light #sidebar nav a:not(.bg-amber-500) {
    color: #475569 !important;
}

html.light #sidebar nav a:not(.bg-amber-500):hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

html.light #sidebar .p-4.border-t {
    background-color: #f8fafc !important;
}

html.light #sidebarOverlay {
    background-color: rgba(15, 23, 42, 0.45) !important;
}

/* Form Inputs, Selects, & Textareas in Light Mode */
html.light input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
html.light select,
html.light textarea {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.light input:focus,
html.light select:focus,
html.light textarea:focus {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}

html.light input[readonly],
html.light input:disabled {
    background-color: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
}

html.light input::placeholder,
html.light textarea::placeholder {
    color: #94a3b8 !important;
}

html.light select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

/* Date Picker in Light Mode */
html.light input[type="date"] {
    color-scheme: light !important;
    color: #0f172a !important;
}

html.light input[type="date"]::-webkit-calendar-picker-indicator {
    filter: sepia(100%) saturate(400%) hue-rotate(345deg) brightness(0.7) !important;
    opacity: 0.85;
}

html.light input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.1);
}

html.light .date-picker-wrapper {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.light .date-picker-wrapper:hover {
    border-color: #f59e0b !important;
}

html.light .date-picker-wrapper input[type="date"] {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Tables in Light Mode - Crisp Executive Styling */
html.light table {
    border-collapse: separate;
    border-spacing: 0;
}

html.light thead,
html.light thead tr,
html.light thead th {
    background-color: #f8fafc !important; /* Clean Slate 50 */
    color: #475569 !important; /* Slate 600 */
    border-bottom: 2px solid #e2e8f0 !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

html.light tbody tr {
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

html.light tbody tr:hover {
    background-color: #f8fafc !important; /* Subtle slate tint on hover */
}

html.light tbody td {
    border-color: #f1f5f9 !important;
    color: #1e293b !important;
}

/* ==========================================================================
   SEMANTIC EXECUTIVE ACCENT COLORS (High-Contrast for Light Canvas)
   ========================================================================== */

/* 1. Amber / Gold (Primary Brand & Warnings) */
html.light .text-amber-400,
html.light .text-amber-500 {
    color: #b45309 !important; /* Deep Rich Amber-700 (Contrast > 5.5:1) */
}
html.light .text-amber-300,
html.light .text-amber-200,
html.light .text-amber-300\/70 {
    color: #92400e !important; /* Amber-800 */
}
html.light .bg-amber-500\/10,
html.light .bg-amber-500\/20 {
    background-color: #fffbeb !important; /* Amber-50 */
    border-color: #fde68a !important; /* Amber-200 */
    color: #b45309 !important;
}

/* 2. Emerald / Green (Net Profit & Positive Margins) */
html.light .text-emerald-400,
html.light .text-emerald-500 {
    color: #047857 !important; /* Deep Forest Emerald-700 (Contrast > 5.6:1) */
}
html.light .text-emerald-300,
html.light .text-emerald-200,
html.light .text-emerald-300\/80 {
    color: #065f46 !important; /* Emerald-800 */
}
html.light .bg-emerald-500\/10,
html.light .bg-emerald-500\/20 {
    background-color: #ecfdf5 !important; /* Emerald-50 */
    border-color: #a7f3d0 !important; /* Emerald-200 */
    color: #047857 !important;
}
html.light .bg-emerald-500\/10 strong,
html.light .bg-emerald-500\/20 strong {
    color: #064e3b !important;
}

/* 3. Rose / Crimson (Expenses & Deductions) */
html.light .text-rose-400,
html.light .text-rose-500 {
    color: #be123c !important; /* Authoritative Crimson Rose-700 (Contrast > 6.0:1) */
}
html.light .text-rose-300,
html.light .text-rose-200 {
    color: #9f1239 !important; /* Rose-800 */
}
html.light .bg-rose-500\/10,
html.light .bg-rose-500\/20 {
    background-color: #fff1f2 !important; /* Rose-50 */
    border-color: #fecdd3 !important; /* Rose-200 */
    color: #be123c !important;
}
html.light .bg-rose-500\/10 strong,
html.light .bg-rose-500\/20 strong {
    color: #881337 !important;
}

/* 4. Sky / Royal Blue (Driver Payouts & Information) */
html.light .text-sky-400,
html.light .text-sky-500 {
    color: #0369a1 !important; /* Deep Royal Sky-700 (Contrast > 5.8:1) */
}
html.light .text-sky-300,
html.light .text-sky-200 {
    color: #075985 !important; /* Sky-800 */
}
html.light .bg-sky-500\/10,
html.light .bg-sky-500\/20 {
    background-color: #f0f9ff !important; /* Sky-50 */
    border-color: #bae6fd !important; /* Sky-200 */
    color: #0369a1 !important;
}

/* ==========================================================================
   NEUTRAL SLATE BADGES, BUTTONS & ROSTER CARDS IN LIGHT MODE
   ========================================================================== */

/* 1. Universal Slate Surface & Opacity Catchers for Non-Interactive Elements */
html.light [class*="bg-slate-800"]:not(button):not(a):not(input):not(select),
html.light [class*="bg-slate-950"]:not(button):not(a):not(input):not(select) {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #334155 !important;
}

/* 2. Driver Roster Status Badges */
html.light span[class*="bg-slate-800"],
html.light .badge-pending {
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #64748b !important;
    font-weight: 600 !important;
}

html.light span[class*="bg-emerald-500"],
html.light .badge-issued {
    background-color: #ecfdf5 !important;
    border: 1px solid #a7f3d0 !important;
    color: #047857 !important;
    font-weight: 700 !important;
}

/* 3. Driver Code Badges & Technical Pills */
html.light span.font-mono[class*="bg-slate-800"],
html.light span.driver-code-pill {
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
    font-weight: 700 !important;
}

/* Selected driver code pill */
html.light #driverCardsContainer a.border-amber-500 span.font-mono {
    background-color: #fef3c7 !important;
    border: 1px solid #fde68a !important;
    color: #92400e !important;
}

/* 4. Secondary Action Buttons & Links in Light Mode (Clean White/Slate Cards, NEVER Pitch Black!) */
html.light button[class*="bg-slate-800"],
html.light a[class*="bg-slate-800"],
html.light button[class*="bg-slate-950"],
html.light a[class*="bg-slate-950"],
html.light .secondary-btn {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.light button[class*="bg-slate-800"]:hover,
html.light a[class*="bg-slate-800"]:hover,
html.light button[class*="bg-slate-950"]:hover,
html.light a[class*="bg-slate-950"]:hover,
html.light .secondary-btn:hover {
    background-color: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* 5. Quick Date Range Preset Buttons (In Dashboard, Profit, Salary, Hires) */
html.light [onclick*="setReportPreset"],
html.light [onclick*="setDashboardPreset"],
html.light [onclick*="setHireDatePreset"],
html.light .preset-btn {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.light [onclick*="setReportPreset"]:hover,
html.light [onclick*="setDashboardPreset"]:hover,
html.light [onclick*="setHireDatePreset"]:hover,
html.light .preset-btn:hover {
    background-color: #fffbeb !important;
    border-color: #f59e0b !important;
    color: #b45309 !important;
}

/* Active Preset Button (e.g. This Month) */
html.light a[class*="bg-amber-500\/20"],
html.light button[class*="bg-amber-500\/20"] {
    background-color: #fffbeb !important;
    border: 1px solid #f59e0b !important;
    color: #b45309 !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.15) !important;
}

/* 6. Overlap Notice "View Slip" Button in Light Mode */
html.light .bg-rose-500\/10 a[class*="bg-slate-800"],
html.light .bg-rose-500\/10 a {
    background-color: #ffffff !important;
    border: 1px solid #fecdd3 !important;
    color: #be123c !important;
    font-weight: 700 !important;
}
html.light .bg-rose-500\/10 a[class*="bg-slate-800"]:hover,
html.light .bg-rose-500\/10 a:hover {
    background-color: #fff1f2 !important;
    border-color: #fda4af !important;
    color: #9f1239 !important;
}

/* 7. Header Bar Theme Toggle & Date Badge in Light Mode */
html.light header .theme-toggle-btn,
html.light header [class*="bg-slate-800"],
html.light .md\:hidden .theme-toggle-btn {
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

html.light header .theme-toggle-btn:hover,
html.light .md\:hidden .theme-toggle-btn:hover {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

html.light header .theme-toggle-btn .theme-toggle-icon,
html.light header span i.fa-calendar,
html.light .md\:hidden .theme-toggle-btn .theme-toggle-icon {
    color: #d97706 !important;
}

/* 8. Executive KPI Metric Numbers (Consistent Bold Slate 900 across Cards) */
html.light .kpi-number,
html.light .kpi-value,
html.light .grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 h3.font-mono,
html.light .grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 h4.font-mono {
    color: #0f172a !important;
    font-weight: 900 !important;
}

/* 9. Driver Performance Leaderboard in Light Mode */
html.light .driver-lead-gross {
    color: #0f172a !important;
    font-weight: 800 !important;
}
html.light .driver-rank-badge:not(.bg-amber-500) {
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
}

/* 10. Driver Selection Cards in Salary Grid */
html.light #driverCardsContainer a:not(.border-amber-500) {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.light #driverCardsContainer a:not(.border-amber-500):hover {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px);
}

html.light #driverCardsContainer a.border-amber-500 {
    background-color: #fffbeb !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.15) !important;
}

html.light #driverCardsContainer a:not(.border-amber-500) div[class*="bg-slate-800"] {
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
}

/* Instant Search Inputs in Data Tables */
html.light #tableInstantSearch,
html.light #driverSearchInput {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.light #tableInstantSearch:focus,
html.light #driverSearchInput:focus {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}

/* Filtered Count Badges */
html.light #filteredCount {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
}

/* Secondary Action Buttons in Light Mode */
html.light a.bg-slate-950,
html.light button.bg-slate-950 {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

html.light a.bg-slate-950:hover,
html.light button.bg-slate-950:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

/* Modals & Dialogs in Light Mode */
html.light .fixed.inset-0.bg-slate-950\/80,
html.light .fixed.inset-0.bg-slate-950\/90 {
    background-color: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(6px) !important;
}

html.light .fixed.inset-0 .bg-slate-900 {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

/* Scrollbars in Light Mode */
html.light ::-webkit-scrollbar-track {
    background: #f1f5f9;
}
html.light ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}
html.light ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   RESPONSIVENESS & MOBILE SCREEN OPTIMIZATIONS (iOS & Android Native Feel)
   Ensures seamless viewing from 320px smartphones to 4K displays
   ========================================================================== */
:root {
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
}

html, body {
    min-height: 100dvh;
    min-height: -webkit-fill-available;
}

.overflow-x-auto,
.overflow-y-auto {
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Mobile top bar safe area handling for notch & dynamic island */
.mobile-top-bar {
    padding-top: max(0.75rem, env(safe-area-inset-top)) !important;
    padding-left: max(1rem, env(safe-area-inset-left)) !important;
    padding-right: max(1rem, env(safe-area-inset-right)) !important;
}

#sidebar {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Modals fit neatly on phones & tablets with full scrolling support */
.fixed.inset-0 {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.fixed.inset-0 > div {
    max-height: calc(100dvh - 2.5rem) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Bill Drop Zone in Light Mode */
html.light #billDropZone {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
}
html.light #billDropZone:hover {
    background-color: #fffbeb !important;
    border-color: #f59e0b !important;
}

/* Touch & Mobile Screen Rules (iPhone, iPad, Android Phones & Tablets) */
@media (max-width: 768px) {
    /* Critical iOS Safari Fix: Prevent auto-zoom when tapping inputs */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Fast touch response */
    button, a, input, select, textarea {
        touch-action: manipulation;
    }

    /* Table minimum width on mobile to prevent columns from colliding */
    #hiresTable,
    #advancesTable,
    #driversTable,
    #vehiclesTable,
    #salaryHistoryTable,
    #expensesTable,
    .recent-hires-table,
    .overflow-x-auto > table {
        min-width: 640px;
    }

    /* Modals fit neatly on phones */
    .fixed.inset-0 > div {
        max-width: 95vw !important;
        margin: auto !important;
        padding: 1.15rem !important;
        border-radius: 1.25rem !important;
    }

    /* Action buttons comfortable touch targets */
    .table-action-btn,
    table tbody td button,
    table tbody td a.inline-flex {
        min-width: 34px;
        min-height: 34px;
    }

    /* Padding adjustments for mobile viewports */
    main > div.p-6 {
        padding: 0.875rem !important;
    }

    header.px-6 {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
    }
}

/* Print Styles for Export PDF / Print */
@media print {
    body {
        background-color: white !important;
        color: black !important;
    }
    aside, header, #sidebar, #mobileMenuBtn, .no-print {
        display: none !important;
    }
    main {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    .print-sheet {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        background: white !important;
        color: black !important;
    }
}

/* Micro-feedback animation when invalid text is typed into a numeric field */
@keyframes input-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.input-invalid-shake {
    animation: input-shake 0.28s ease-in-out !important;
    border-color: #f43f5e !important; /* Rose-500 */
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.35) !important;
}

