/* ==========================================================================
   Tesla Fleet Telemetry - Pure Black Dark Theme (OLED / Obsidian Edition)
   Crafted with pure black #000000 background and sleek obsidian surfaces.
   ========================================================================== */

:root {
    --theme-transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

[data-theme="dark"],
[data-bs-theme="dark"] {
    --bg-pure-black: #000000;
    --bg-canvas: #050608;
    --bg-surface: #0a0c10;
    --bg-surface-elevated: #11141b;
    --bg-surface-highlight: #1a1e27;
    --border-subtle: #1f242e;
    --border-strong: #2c3340;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #8392a5;
    --tesla-red: #e82127;
    --tesla-red-glow: rgba(232, 33, 39, 0.2);

    color-scheme: dark;
}

/* Page Background & Base Text */
[data-theme="dark"] body,
[data-bs-theme="dark"] body {
    background-color: var(--bg-pure-black) !important;
    color: var(--text-primary) !important;
}

/* Generic Bootstrap Overrides */
[data-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--bg-pure-black) !important;
}

[data-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-white {
    background-color: var(--bg-surface) !important;
}

[data-theme="dark"] .text-dark,
[data-bs-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-secondary {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

/* Borders */
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-light-subtle,
[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-light-subtle {
    border-color: var(--border-subtle) !important;
}

/* Navbar */
[data-theme="dark"] .navbar-custom,
[data-bs-theme="dark"] .navbar-custom {
    background-color: var(--bg-pure-black) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8) !important;
}

[data-theme="dark"] .navbar-custom .navbar-brand,
[data-bs-theme="dark"] .navbar-custom .navbar-brand {
    color: var(--text-primary) !important;
}

/* Vehicle Cards */
[data-theme="dark"] .card-custom,
[data-bs-theme="dark"] .card-custom {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 1px rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .card-custom:hover,
[data-bs-theme="dark"] .card-custom:hover {
    border-color: var(--border-strong) !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.95), 0 0 20px var(--tesla-red-glow) !important;
}

/* KPI Summary Cards */
[data-theme="dark"] .kpi-card,
[data-bs-theme="dark"] .kpi-card {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7) !important;
}

/* Vehicle Visual Showcase (Transparent Car Backdrop) */
[data-theme="dark"] .vehicle-image-wrapper,
[data-bs-theme="dark"] .vehicle-image-wrapper {
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.07) 0%, rgba(10, 12, 16, 0.5) 65%, transparent 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .vehicle-card-img,
[data-bs-theme="dark"] .vehicle-card-img {
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.95)) !important;
}

[data-theme="dark"] .card-custom:hover .vehicle-card-img,
[data-bs-theme="dark"] .card-custom:hover .vehicle-card-img {
    filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 1)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.08)) !important;
}

/* Badges */
[data-theme="dark"] .model-badge,
[data-theme="dark"] .badge.bg-light,
[data-bs-theme="dark"] .model-badge,
[data-bs-theme="dark"] .badge.bg-light {
    background-color: var(--bg-surface-elevated) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-subtle) !important;
}

[data-theme="dark"] .badge.bg-secondary-subtle,
[data-bs-theme="dark"] .badge.bg-secondary-subtle {
    background-color: rgba(148, 163, 184, 0.12) !important;
    color: #94a3b8 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

[data-theme="dark"] .badge.bg-success-subtle,
[data-bs-theme="dark"] .badge.bg-success-subtle {
    background-color: rgba(34, 197, 94, 0.12) !important;
    color: #4ade80 !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

[data-theme="dark"] .badge.bg-warning-subtle,
[data-bs-theme="dark"] .badge.bg-warning-subtle,
[data-theme="dark"] .badge.bg-warning-subtle.text-dark,
[data-bs-theme="dark"] .badge.bg-warning-subtle.text-dark {
    background-color: rgba(234, 179, 8, 0.15) !important;
    color: #facc15 !important;
    border-color: rgba(234, 179, 8, 0.35) !important;
}

[data-theme="dark"] .badge.bg-danger-subtle,
[data-bs-theme="dark"] .badge.bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.14) !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

[data-theme="dark"] .badge.bg-primary-subtle,
[data-bs-theme="dark"] .badge.bg-primary-subtle {
    background-color: rgba(59, 130, 246, 0.12) !important;
    color: #60a5fa !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

[data-theme="dark"] .badge.bg-info-subtle,
[data-bs-theme="dark"] .badge.bg-info-subtle {
    background-color: rgba(6, 182, 212, 0.12) !important;
    color: #22d3ee !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
}

/* Battery Progress Bar */
[data-theme="dark"] .progress,
[data-bs-theme="dark"] .progress {
    background-color: var(--bg-surface-highlight) !important;
}

/* Form Controls & Dropdown */
[data-theme="dark"] .input-group-text,
[data-bs-theme="dark"] .input-group-text {
    background-color: var(--bg-surface) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-subtle) !important;
}

[data-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-select {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-subtle) !important;
}

[data-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-secondary {
    background-color: var(--bg-surface) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-subtle) !important;
}

[data-theme="dark"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--bg-surface-elevated) !important;
    color: #ffffff !important;
    border-color: var(--border-strong) !important;
}

/* Modal Windows (Braking Incidents) */
[data-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-content {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-strong) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95) !important;
}

[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-footer,
[data-bs-theme="dark"] .modal-body,
[data-bs-theme="dark"] .modal-footer {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-subtle) !important;
}

[data-theme="dark"] #brakingEventsList .card,
[data-bs-theme="dark"] #brakingEventsList .card {
    background-color: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-subtle) !important;
}

[data-theme="dark"] #noBrakingPlaceholder,
[data-theme="dark"] #noVehiclesPlaceholder,
[data-bs-theme="dark"] #noBrakingPlaceholder,
[data-bs-theme="dark"] #noVehiclesPlaceholder {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
}

/* Alert Banner */
[data-theme="dark"] .alert-warning,
[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(234, 179, 8, 0.08) !important;
    border-color: rgba(234, 179, 8, 0.25) !important;
    color: #fef08a !important;
}

/* Footer */
[data-theme="dark"] .footer-custom,
[data-bs-theme="dark"] .footer-custom {
    background-color: var(--bg-pure-black) !important;
    border-top: 1px solid var(--border-subtle) !important;
    color: var(--text-muted) !important;
}

/* Google Maps & Navigation Links */
[data-theme="dark"] a.text-primary,
[data-bs-theme="dark"] a.text-primary {
    color: #38bdf8 !important; /* Vivid cyan blue for high readability */
}

/* Navbar Theme Toggle Button */
.theme-toggle-btn {
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    color: #334155;
    transition: all 0.2s ease-in-out;
}

.theme-toggle-btn:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

[data-theme="dark"] .theme-toggle-btn,
[data-bs-theme="dark"] .theme-toggle-btn {
    border-color: var(--border-strong) !important;
    background-color: var(--bg-surface-elevated) !important;
    color: #facc15 !important; /* Golden sun glow in dark mode */
}

[data-theme="dark"] .theme-toggle-btn:hover,
[data-bs-theme="dark"] .theme-toggle-btn:hover {
    background-color: var(--bg-surface-highlight) !important;
    border-color: #facc15 !important;
    color: #fef08a !important;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.25);
}

/* Close buttons */
[data-theme="dark"] .btn-close:not(.btn-close-white),
[data-bs-theme="dark"] .btn-close:not(.btn-close-white) {
    filter: invert(1) grayscale(100%);
}

/* Custom Sleek Dark Scrollbar */
[data-theme="dark"]::-webkit-scrollbar,
[data-bs-theme="dark"]::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="dark"]::-webkit-scrollbar-track,
[data-bs-theme="dark"]::-webkit-scrollbar-track {
    background: var(--bg-pure-black);
}

[data-theme="dark"]::-webkit-scrollbar-thumb,
[data-bs-theme="dark"]::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

[data-theme="dark"]::-webkit-scrollbar-thumb:hover,
[data-bs-theme="dark"]::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Smooth transitions */
body, .navbar-custom, .card-custom, .kpi-card, .footer-custom, .modal-content, .modal-body, .modal-footer {
    transition: var(--theme-transition);
}

/* Skeleton Loading Shimmer (OLED & Dark Mode) */
[data-theme="dark"] .skeleton,
[data-bs-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.10) 50%,
        rgba(255, 255, 255, 0.04) 100%
    ) !important;
    background-size: 200% 100% !important;
}

/* ==========================================================================
   Filter Pills & Badges (Pure OLED Dark Theme)
   High contrast, luminous colors and crystal clear visibility
   ========================================================================== */
[data-theme="dark"] .filter-pill.pill-all,
[data-bs-theme="dark"] .filter-pill.pill-all {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-strong) !important;
}
[data-theme="dark"] .filter-pill.pill-all .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-all .filter-count-badge {
    background-color: var(--bg-surface-highlight) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-subtle) !important;
}
[data-theme="dark"] .filter-pill.pill-all.active,
[data-bs-theme="dark"] .filter-pill.pill-all.active {
    background-color: #ffffff !important;
    color: #000000 !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.35) !important;
}
[data-theme="dark"] .filter-pill.pill-all.active .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-all.active .filter-count-badge {
    background-color: #000000 !important;
    color: #ffffff !important;
}

/* Online (Dark Mode) */
[data-theme="dark"] .filter-pill.pill-online,
[data-bs-theme="dark"] .filter-pill.pill-online {
    background-color: rgba(34, 197, 94, 0.12) !important;
    color: #4ade80 !important;
    border-color: rgba(74, 222, 128, 0.4) !important;
}
[data-theme="dark"] .filter-pill.pill-online i,
[data-bs-theme="dark"] .filter-pill.pill-online i {
    color: #4ade80 !important;
}
[data-theme="dark"] .filter-pill.pill-online .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-online .filter-count-badge {
    background-color: rgba(34, 197, 94, 0.25) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(74, 222, 128, 0.6) !important;
}
[data-theme="dark"] .filter-pill.pill-online.active,
[data-bs-theme="dark"] .filter-pill.pill-online.active {
    background-color: #16a34a !important;
    color: #ffffff !important;
    border-color: #22c55e !important;
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.4) !important;
}
[data-theme="dark"] .filter-pill.pill-online.active i,
[data-bs-theme="dark"] .filter-pill.pill-online.active i {
    color: #ffffff !important;
}
[data-theme="dark"] .filter-pill.pill-online.active .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-online.active .filter-count-badge {
    background-color: #ffffff !important;
    color: #15803d !important;
    border-color: transparent !important;
}

/* Driving (Dark Mode) */
[data-theme="dark"] .filter-pill.pill-driving,
[data-bs-theme="dark"] .filter-pill.pill-driving {
    background-color: rgba(59, 130, 246, 0.12) !important;
    color: #60a5fa !important;
    border-color: rgba(96, 165, 250, 0.4) !important;
}
[data-theme="dark"] .filter-pill.pill-driving i,
[data-bs-theme="dark"] .filter-pill.pill-driving i {
    color: #60a5fa !important;
}
[data-theme="dark"] .filter-pill.pill-driving .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-driving .filter-count-badge {
    background-color: rgba(59, 130, 246, 0.25) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(96, 165, 250, 0.6) !important;
}
[data-theme="dark"] .filter-pill.pill-driving.active,
[data-bs-theme="dark"] .filter-pill.pill-driving.active {
    background-color: #2563eb !important;
    color: #ffffff !important;
    border-color: #60a5fa !important;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.4) !important;
}
[data-theme="dark"] .filter-pill.pill-driving.active i,
[data-bs-theme="dark"] .filter-pill.pill-driving.active i {
    color: #ffffff !important;
}
[data-theme="dark"] .filter-pill.pill-driving.active .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-driving.active .filter-count-badge {
    background-color: #ffffff !important;
    color: #1d4ed8 !important;
    border-color: transparent !important;
}

/* Charging (Dark Mode) */
[data-theme="dark"] .filter-pill.pill-charging,
[data-bs-theme="dark"] .filter-pill.pill-charging {
    background-color: rgba(234, 179, 8, 0.14) !important;
    color: #facc15 !important;
    border-color: rgba(250, 204, 21, 0.45) !important;
}
[data-theme="dark"] .filter-pill.pill-charging i,
[data-bs-theme="dark"] .filter-pill.pill-charging i {
    color: #facc15 !important;
}
[data-theme="dark"] .filter-pill.pill-charging .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-charging .filter-count-badge {
    background-color: rgba(234, 179, 8, 0.25) !important;
    color: #fef08a !important;
    border: 1px solid rgba(250, 204, 21, 0.6) !important;
}
[data-theme="dark"] .filter-pill.pill-charging.active,
[data-bs-theme="dark"] .filter-pill.pill-charging.active {
    background-color: #eab308 !important;
    color: #0f172a !important;
    border-color: #fde047 !important;
    box-shadow: 0 0 16px rgba(234, 179, 8, 0.4) !important;
}
[data-theme="dark"] .filter-pill.pill-charging.active i,
[data-bs-theme="dark"] .filter-pill.pill-charging.active i {
    color: #0f172a !important;
}
[data-theme="dark"] .filter-pill.pill-charging.active .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-charging.active .filter-count-badge {
    background-color: #0f172a !important;
    color: #facc15 !important;
    border-color: transparent !important;
}

/* Asleep (Dark Mode) */
[data-theme="dark"] .filter-pill.pill-asleep,
[data-bs-theme="dark"] .filter-pill.pill-asleep {
    background-color: rgba(148, 163, 184, 0.12) !important;
    color: #cbd5e1 !important;
    border-color: rgba(203, 213, 225, 0.35) !important;
}
[data-theme="dark"] .filter-pill.pill-asleep i,
[data-bs-theme="dark"] .filter-pill.pill-asleep i {
    color: #94a3b8 !important;
}
[data-theme="dark"] .filter-pill.pill-asleep .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-asleep .filter-count-badge {
    background-color: rgba(148, 163, 184, 0.22) !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(203, 213, 225, 0.5) !important;
}
[data-theme="dark"] .filter-pill.pill-asleep.active,
[data-bs-theme="dark"] .filter-pill.pill-asleep.active {
    background-color: #64748b !important;
    color: #ffffff !important;
    border-color: #94a3b8 !important;
    box-shadow: 0 0 16px rgba(100, 116, 139, 0.4) !important;
}
[data-theme="dark"] .filter-pill.pill-asleep.active i,
[data-bs-theme="dark"] .filter-pill.pill-asleep.active i {
    color: #ffffff !important;
}
[data-theme="dark"] .filter-pill.pill-asleep.active .filter-count-badge,
[data-bs-theme="dark"] .filter-pill.pill-asleep.active .filter-count-badge {
    background-color: #ffffff !important;
    color: #1e293b !important;
    border-color: transparent !important;
}



