/* --- Dark Theme System --- */
body.dark-theme {
    --primary: #FFD700;
    --primary-dark: #FFC107;
    --secondary: #1a1a1a; /* Keep secondary dark for labels/buttons to logic */
    --text: #f5f5f5;
    --text-muted: #94a3b8; /* Slate 400 for better secondary contrast */
    --light-bg: #0f172a;
    --white: #1e293b;
    --gold-text: #FFD700;
    --glass: rgba(15, 23, 42, 0.9);
    --glass-dark: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7);
    --dark-accent: #334155;
    --hover-bg: #1e293b;
    background: var(--light-bg) !important;
    color: var(--text) !important;
}

/* --- Global Accessibility Overrides --- */
body.dark-theme p, 
body.dark-theme span:not(.btn):not(.status-badge):not(.nav-logo span), 
body.dark-theme .testimonial-card p,
body.dark-theme .step-card p,
body.dark-theme .feature-card p,
body.dark-theme .stat-item {
    color: var(--text-muted) !important;
}

body.dark-theme h1, 
body.dark-theme h2, 
body.dark-theme h3, 
body.dark-theme h4,
body.dark-theme .nav-logo span,
body.dark-theme .user-info strong {
    color: var(--text) !important;
}

body.dark-theme label {
    color: var(--text) !important;
    opacity: 0.9;
}

/* --- Button Contrast Fix --- */
/* Accent (Yellow) buttons always dark text */
.btn-accent, .btn-secondary:hover {
    color: #1a1a1a !important;
}

/* Primary (Dark) buttons always light text */
.btn-primary, .button {
    color: #ffffff !important;
}

body.dark-theme .btn-secondary {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

/* --- Component Specific Overrides --- */
body.dark-theme .navbar { 
    background: var(--glass) !important; 
    border-bottom: 1px solid rgba(255,255,255,0.1) !important; 
}
body.dark-theme .nav-links a:not(.btn) { color: var(--text) !important; }
body.dark-theme .nav-links a:hover:not(.btn) { color: var(--primary) !important; }

body.dark-theme .glass-card, 
body.dark-theme .testimonial-card,
body.dark-theme .step-card,
body.dark-theme .feature-card,
body.dark-theme .dashboard-card { 
    background: var(--white) !important; 
    border: 1px solid rgba(255,255,255,0.1) !important; 
}

body.dark-theme .admin-sidebar .admin-nav-item { color: #cbd5e1 !important; transition: all 0.2s; }
body.dark-theme .admin-sidebar .admin-nav-item:hover { background: rgba(255,255,255,0.05) !important; color: #FFD700 !important; }
body.dark-theme .admin-sidebar .admin-nav-item.active { background: #FFD700 !important; color: #1a1a1a !important; font-weight: 700; }
body.dark-theme .admin-sidebar .admin-nav-item.active i { color: #1a1a1a !important; }
body.dark-theme .admin-content { background: #0f172a !important; }

body.dark-theme td, body.dark-theme th { 
    color: var(--text-muted) !important; 
    border-bottom: 1px solid #334155 !important; 
    transition: background 0.2s;
}
body.dark-theme th { color: var(--text) !important; background: rgba(255,255,255,0.05); }
body.dark-theme tr:hover td { background: #2d3748 !important; color: #ffffff !important; }
body.dark-theme .glass-card:hover { background: #2d3748 !important; }

/* Input / Form Contrast */
body.dark-theme input:not([type='checkbox']), 
body.dark-theme select, 
body.dark-theme textarea { 
    background: #1e293b !important; 
    color: #ffffff !important; 
    border: 1px solid #334155 !important; 
}

body.dark-theme input::placeholder { color: #64748b !important; }

/* Dashboard Specifics */
body.dark-theme #status-text { color: var(--text-muted) !important; }
body.dark-theme .dashboard-header { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important; }
body.dark-theme hr { border-top: 1px solid rgba(255,255,255,0.1) !important; }

/* --- Modal & Profile Overrides --- */
/* Target the light-grey background blocks in "My Account" modal */
body.dark-theme div[style*="background: #f9f9f9"],
body.dark-theme div[style*="background:#f9f9f9"] {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
}

/* Target hardcoded #666 labels in modal profile blocks */
body.dark-theme p[style*="color: #666"],
body.dark-theme p[style*="color:#666"] {
    color: var(--text-muted) !important;
}

body.dark-theme .modal-content h2,
body.dark-theme #driver-modal h2,
body.dark-theme #account-settings-modal h2 {
    color: var(--primary) !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
}

body.dark-theme .modal-content button[style*="background: none"],
body.dark-theme #driver-modal button[onclick*="closeModal"],
body.dark-theme #close-account-btn {
    color: var(--text) !important;
}

body.dark-theme #driver-modal .glass-card {
    background: #1e293b !important;
}

/* --- Theme Toggle Switch (Isolated & Enhanced Icons) --- */
.theme-toggle-container {
    display: flex;
    align-items: center;
    padding: 0 15px;
}

.ui-switch {
  --switch-bg: #cbd5e1;
  --switch-width: 48px;
  --switch-height: 22px;
  --circle-diameter: 28px;
  --circle-bg: #ffffff;
  --circle-inset: calc((var(--circle-diameter) - var(--switch-height)) / 2);
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
}

.ui-switch input { display: none; }

.ui-switch .theme-slider {
  width: var(--switch-width);
  height: var(--switch-height);
  background: var(--switch-bg);
  border-radius: 999px;
  position: relative;
  transition: 0.3s;
}

.ui-switch .theme-slider .theme-circle {
  top: calc(var(--circle-inset) * -1);
  left: 0;
  width: var(--circle-diameter);
  height: var(--circle-diameter);
  position: absolute;
  background: var(--circle-bg);
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  /* Sun Icon in Light Mode (Orange) */
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTgiIHdpZHRoPSIxOCIgdmlld0JveD0iMCAwIDIwIDIwIj4KICAgIDxwYXRoIGZpbGw9IiNmNTllMGIiCiAgICAgICAgZD0iTTkuMzA1IDEuNjY3VjMuNzVoMS4zODlWMS42NjdoLTEuMzl6bS00LjcwNyAxLjk1bC0uOTgyLjk4Mkw1LjA5IDYuMDcybC45ODItLjk4Mi0xLjQ3My0xLjQ3M3ptMTAuODAyIDBMMTMuOTI3IDUuMDlsLjk4Mi45ODIgMS40NzMtMS40NzMtLjk4Mi0uOTgyek0xMCA1LjEzOWE0Ljg3MiA0Ljg3MiAwIDAwLTQuODYyIDQuODZBNC44NzIgNC44NzIgMCAwMDEwIDE0Ljg2MiA0Ljg3MiA0Ljg3MiAwIDAwMTQuODYgMTAgNC44NzIgNC44NzIgMCAwMDEwIDUuMTM5em0wIDEuMzg5QTMuNDYyIDMuNDYyIDAgMDExMy40NzEgMTBhMy40NjIgMy40NjIgMCAwMS0zLjQ3MyAzLjQ3MkEzLjQ2MiAzLjQ2MiAwIDAxNi41MjcgMTAgMy40NjIgMy40NjIgMCAwMTEwIDYuNTI4ek0xLjY2NSA5LjMwNXYxLjM5aDIuMDgzdi0xLjM5SDEuNjY2em0xNC41ODMgMHYxLjM5aDIuMDg0di0xLjM5aC0yLjA4NHpNNS4wOSAxMy45MjhMMy42MTYgMTUuNGwuOTgyLjk4MiAxLjQ3My0xLjQ3My0uOTgyLS45ODJ6bTkuODIgMGwtLjk4Mi45ODIgMS40NzMtMS40NzMuOTgyLS45ODItMS40NzMtMS40NzN6TTkuMzA1IDE2LjI1djIuMDgzaDEuMzg5VjE2LjI1aC0xLjM5eiIgLz4KPC9zdmc+");
  background-repeat: no-repeat;
  background-position: center;
}

.ui-switch input:checked + .theme-slider { background: var(--primary); }
.ui-switch input:checked + .theme-slider .theme-circle {
  left: calc(100% - var(--circle-diameter));
  /* Moon Icon in Dark Mode (White/Silver) */
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTgiIHdpZHRoPSIxOCIgdmlld0JveD0iMCAwIDIwIDIwIj4KICAgIDxwYXRoIGZpbGw9IiNmZmZiZmEiCiAgICAgICAgZD0iTTQuMiAyLjVsLS43IDEuOC0xLjguNyAxLjguNy43IDEuOC42LTEuOEw2LjcgNWwtMS45LS43LS42LTEuOHptMTUgOC4zYTYuNyA2LjcgMCAxMS02LjYtNi42IDUuOCA1LjggMCAwMDYuNiA2LjZ6IiAvPgo8L3N2Zz4=");
}

/* ── Dark Theme: Footer Overrides ─────────────────────────────────────────── */
body.dark-theme .footer {
    background: #060a13;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .footer-brand h2 {
    color: var(--primary) !important;
}

body.dark-theme .footer-brand p {
    color: var(--text-muted) !important;
}

body.dark-theme .footer-col h4 {
    color: var(--text) !important;
}

body.dark-theme .footer-col a {
    color: #64748b !important;
}

body.dark-theme .footer-col a:hover {
    color: var(--primary) !important;
}

body.dark-theme .footer-divider {
    background: linear-gradient(90deg, transparent, #1e293b, transparent);
}

body.dark-theme .footer-left p {
    color: #475569 !important;
}

body.dark-theme .footer-center a {
    color: #64748b !important;
}

body.dark-theme .footer-center a:hover {
    color: var(--primary) !important;
}

body.dark-theme .footer-right a {
    color: #64748b !important;
}

body.dark-theme .footer-right a:hover {
    color: var(--primary) !important;
}

