/* Janatha Garage — shared light/dark theme */

:root,
[data-theme="light"] {
    --jg-bg: #FFFFFF;
    --jg-bg-soft: #F9FAFB;
    --jg-bg-muted: #F3F4F6;
    --jg-surface: #FFFFFF;
    --jg-surface-2: #F8F9FA;
    --jg-text: #111827;
    --jg-text-strong: #081B4B;
    --jg-text-muted: #6B7280;
    --jg-text-body: #4B5563;
    --jg-border: #E5E7EB;
    --jg-border-strong: #D1D5DB;
    --jg-link: #9A6207;
    --jg-link-hover: #C2740A;
    --jg-header-bg: rgba(255, 255, 255, 0.96);
    --jg-header-bg-solid: #FFFFFF;
    --jg-input-bg: #FFFFFF;
    --jg-shadow: 0 1px 2px rgba(8, 27, 75, 0.05), 0 8px 20px -12px rgba(8, 27, 75, 0.22);
    --jg-toggle-bg: #FFFFFF;
    --jg-toggle-color: #081B4B;
    --jg-toggle-border: #E5E7EB;
    --jg-toggle-hover: #F3F4F6;
    color-scheme: light;
}

[data-theme="dark"] {
    --jg-bg: #0B1220;
    --jg-bg-soft: #0F172A;
    --jg-bg-muted: #1E293B;
    --jg-surface: #151D2E;
    --jg-surface-2: #1A2336;
    --jg-text: #E5E7EB;
    --jg-text-strong: #F8FAFC;
    --jg-text-muted: #94A3B8;
    --jg-text-body: #CBD5E1;
    --jg-border: #2A3548;
    --jg-border-strong: #3B4A63;
    --jg-link: #FBBF24;
    --jg-link-hover: #FCD34D;
    --jg-header-bg: rgba(15, 23, 42, 0.94);
    --jg-header-bg-solid: #0F172A;
    --jg-input-bg: #1A2336;
    --jg-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 28px -14px rgba(0, 0, 0, 0.55);
    --jg-toggle-bg: #1A2336;
    --jg-toggle-color: #F8FAFC;
    --jg-toggle-border: #2A3548;
    --jg-toggle-hover: #243044;
    color-scheme: dark;
}

html {
    color-scheme: light dark;
}

html,
body {
    transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

/* ── Theme toggle button ── */
.jg-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--jg-toggle-border);
    background: var(--jg-toggle-bg);
    color: var(--jg-toggle-color);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
    box-shadow: 0 1px 2px rgba(8, 27, 75, 0.04);
}

.jg-theme-toggle:hover {
    background: var(--jg-toggle-hover);
    border-color: var(--jg-border-strong);
}

.jg-theme-toggle:active {
    transform: scale(0.96);
}

.jg-theme-toggle:focus-visible {
    outline: 2px solid #9A6207;
    outline-offset: 2px;
}

.jg-theme-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}

.jg-theme-toggle [data-jg-icon][hidden],
.jg-theme-toggle [data-jg-icon][aria-hidden="true"] {
    display: none !important;
}

/* Explicit icon visibility by theme (beats late DOM re-renders) */
[data-theme="light"] .jg-theme-toggle [data-jg-icon="sun"],
[data-theme="dark"] .jg-theme-toggle [data-jg-icon="moon"] {
    display: none !important;
}

[data-theme="light"] .jg-theme-toggle [data-jg-icon="moon"],
[data-theme="dark"] .jg-theme-toggle [data-jg-icon="sun"] {
    display: block !important;
}

.admin-header .jg-theme-toggle,
.admin-login-panel .jg-theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.jg-header-nav .jg-theme-toggle {
    margin-left: 4px;
}

@media (max-width: 420px) {
    .jg-theme-toggle {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }
}

/* ── Dark mode: global page chrome ── */
[data-theme="dark"] body {
    background: var(--jg-bg) !important;
    color: var(--jg-text) !important;
}

[data-theme="dark"] a {
    color: var(--jg-link);
}

[data-theme="dark"] a:hover {
    color: var(--jg-link-hover);
}

[data-theme="dark"] ::selection {
    background: rgba(245, 158, 11, 0.35);
    color: #FFF7ED;
}

/* Sticky headers across public pages */
[data-theme="dark"] header,
[data-theme="dark"] .jg-site-header {
    background: var(--jg-header-bg) !important;
    background-color: var(--jg-header-bg-solid) !important;
    border-bottom-color: var(--jg-border) !important;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.25) !important;
}

[data-theme="dark"] #top {
    background: var(--jg-bg) !important;
}

[data-theme="dark"] .jg-mobile-menu {
    background: var(--jg-surface) !important;
    border-top-color: var(--jg-border) !important;
}

[data-theme="dark"] .jg-dd-menu {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
    box-shadow: var(--jg-shadow) !important;
}

[data-theme="dark"] .jg-burger {
    background: var(--jg-toggle-bg) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text-strong) !important;
}

/* Soft / white page backgrounds (home sections + about/services/news) */
[data-theme="dark"] body > div[style*="min-height"],
[data-theme="dark"] div[style*="min-height:100vh"],
[data-theme="dark"] div[style*="min-height: 100vh"],
[data-theme="dark"] #top,
[data-theme="dark"] #how,
[data-theme="dark"] #everything-auto,
[data-theme="dark"] #partners,
[data-theme="dark"] #main,
[data-theme="dark"] .jg-sec,
[data-theme="dark"] section[style*="background:#FFFFFF"],
[data-theme="dark"] section[style*="background: #FFFFFF"],
[data-theme="dark"] section[style*="background:#fff"],
[data-theme="dark"] section[style*="background: #fff"],
[data-theme="dark"] section[style*="background:#F9FAFB"],
[data-theme="dark"] section[style*="background: #F9FAFB"],
[data-theme="dark"] div[style*="background: #F9FAFB"],
[data-theme="dark"] div[style*="background:#F9FAFB"],
[data-theme="dark"] div[style*="background: #F8F9FA"],
[data-theme="dark"] div[style*="background:#F8F9FA"],
[data-theme="dark"] div[style*="background:#FFFFFF"],
[data-theme="dark"] div[style*="background: #FFFFFF"] {
    background: var(--jg-bg-soft) !important;
}

/* Home booking form card + fields (beat inline white styles) */
[data-theme="dark"] #everything-auto {
    background: var(--jg-bg) !important;
}

[data-theme="dark"] #everything-auto > .jg-container > [data-reveal],
[data-theme="dark"] #everything-auto [data-reveal] {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
}

[data-theme="dark"] #everything-auto .jg-pad[style*="radial-gradient"],
[data-theme="dark"] #everything-auto .jg-split[style*="radial-gradient"] {
    background: radial-gradient(120% 200% at 0% 0%, #12296B 0%, #081B4B 58%) !important;
    border-color: transparent !important;
}

[data-theme="dark"] #everything-auto .jg-form-grid > div > button[data-jg-dropdown],
[data-theme="dark"] #everything-auto .jg-form-grid input,
[data-theme="dark"] #everything-auto .jg-phone-row,
[data-theme="dark"] #everything-auto .jg-otp-band input {
    background: var(--jg-input-bg) !important;
    border-color: var(--jg-border-strong) !important;
    color: var(--jg-text) !important;
}

[data-theme="dark"] #everything-auto .jg-form-grid > div > button[data-jg-dropdown] span,
[data-theme="dark"] #everything-auto .jg-phone-row input,
[data-theme="dark"] #everything-auto .jg-phone-row span {
    color: var(--jg-text) !important;
}

[data-theme="dark"] #everything-auto .jg-form-grid label,
[data-theme="dark"] #everything-auto .jg-progress-title,
[data-theme="dark"] #everything-auto .jg-progress-count {
    color: var(--jg-text-muted) !important;
}

[data-theme="dark"] #everything-auto [data-jg-dropdown] {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text) !important;
}

[data-theme="dark"] #everything-auto [data-jg-dropdown] button {
    color: var(--jg-text) !important;
}

[data-theme="dark"] #everything-auto [data-jg-dropdown] button:hover {
    background: var(--jg-bg-muted) !important;
}

[data-theme="dark"] #everything-auto .jg-why {
    background: var(--jg-bg-muted) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text-body) !important;
}

[data-theme="dark"] #everything-auto .jg-submit-row button[style*="background:#E5E7EB"],
[data-theme="dark"] #everything-auto .jg-submit-row button[style*="background: #E5E7EB"] {
    background: #334155 !important;
    color: #CBD5E1 !important;
    box-shadow: inset 0 0 0 1px #475569 !important;
}

[data-theme="dark"] #everything-auto .jg-phone-action[style*="background:#E5E7EB"],
[data-theme="dark"] #everything-auto .jg-phone-action[style*="background: #E5E7EB"],
[data-theme="dark"] #everything-auto button[style*="background:#fff"],
[data-theme="dark"] #everything-auto button[style*="background: #fff"],
[data-theme="dark"] #everything-auto button[style*="background:#FFFFFF"],
[data-theme="dark"] #everything-auto button[style*="background: #FFFFFF"] {
    background: var(--jg-input-bg) !important;
    color: var(--jg-text) !important;
    border-color: var(--jg-border-strong) !important;
}

[data-theme="dark"] #everything-auto button[style*="background:#081B4B"],
[data-theme="dark"] #everything-auto button[style*="background: #081B4B"] {
    background: #081B4B !important;
    color: #fff !important;
}

[data-theme="dark"] #everything-auto button[style*="linear-gradient"] {
    background: linear-gradient(180deg, #FBBF24, #F59E0B) !important;
    color: #081B4B !important;
}

[data-theme="dark"] #jg-fleet[data-loaded] {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
}

@media (max-width: 768px) {
    [data-theme="dark"] header {
        background: rgba(15, 23, 42, 0.96) !important;
        border-bottom-color: var(--jg-border) !important;
    }
}

/* White cards / pads */
[data-theme="dark"] .jg-pad,
[data-theme="dark"] .jg-card-box,
[data-theme="dark"] .jg-hero-sec {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
}

[data-theme="dark"] .jg-hero-sec {
    background: var(--jg-bg) !important;
}

[data-theme="dark"] .jg-pad[style*="background:#fff"],
[data-theme="dark"] .jg-pad[style*="background: #fff"],
[data-theme="dark"] .jg-pad[style*="background:#FFFFFF"],
[data-theme="dark"] .jg-pad[style*="background: #FFFFFF"],
[data-theme="dark"] div[style*="background:#fff"][style*="border-radius"],
[data-theme="dark"] div[style*="background: #fff"][style*="border-radius"],
[data-theme="dark"] div[style*="background:#FFFFFF"][style*="border-radius"],
[data-theme="dark"] div[style*="background: #FFFFFF"][style*="border-radius"],
[data-theme="dark"] div[style*="background:white"][style*="border-radius"],
[data-theme="dark"] div[style*="background: white"][style*="border-radius"],
[data-theme="dark"] a[style*="background: white"],
[data-theme="dark"] a[style*="background:white"] {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
    color: inherit;
}

/* Text strong navy → light */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] .jg-finder-title,
[data-theme="dark"] .jg-header-brand-title {
    color: var(--jg-text-strong);
}

[data-theme="dark"] .jg-sec h2,
[data-theme="dark"] .jg-pad h2 {
    color: var(--jg-text-strong) !important;
}

[data-theme="dark"] .jg-pad p,
[data-theme="dark"] .jg-finder-subtitle {
    color: var(--jg-text-body) !important;
}

/* Nav link text on light headers */
[data-theme="dark"] .jg-nav-links a,
[data-theme="dark"] .jg-header-link,
[data-theme="dark"] .mobile-menu-link {
    color: var(--jg-text-body) !important;
}

[data-theme="dark"] .jg-nav a[style*="color:#081B4B"],
[data-theme="dark"] .jg-nav a[style*="color: #081B4B"],
[data-theme="dark"] header a[style*="color:#081B4B"],
[data-theme="dark"] header a[style*="color: #081B4B"],
[data-theme="dark"] header a[style*="color:#374151"],
[data-theme="dark"] header a[style*="color: #374151"] {
    color: var(--jg-text-strong) !important;
    border-color: var(--jg-border) !important;
    background: var(--jg-bg-muted) !important;
}

[data-theme="dark"] header a[style*="background:#F9FAFB"],
[data-theme="dark"] header a[style*="background: #F9FAFB"] {
    background: var(--jg-bg-muted) !important;
}

/* Forms / inputs */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .jg-input,
[data-theme="dark"] .admin-input,
[data-theme="dark"] .admin-select,
[data-theme="dark"] .admin-textarea {
    background: var(--jg-input-bg) !important;
    color: var(--jg-text) !important;
    border-color: var(--jg-border-strong) !important;
}

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

/* Tables */
[data-theme="dark"] .jg-table-header,
[data-theme="dark"] .jg-pump-row:hover {
    background: var(--jg-bg-muted) !important;
}

[data-theme="dark"] .jg-pump-row {
    border-bottom-color: var(--jg-border) !important;
}

[data-theme="dark"] .jg-chip {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text) !important;
}

[data-theme="dark"] .jg-chip.active {
    background: rgba(245, 158, 11, 0.16) !important;
    border-color: #F59E0B !important;
    color: #FBBF24 !important;
}

[data-theme="dark"] .jg-btn-secondary {
    background: var(--jg-bg-muted) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text-strong) !important;
}

[data-theme="dark"] .map-my-location-btn {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text-strong) !important;
}

[data-theme="dark"] #google-map-container {
    border-color: var(--jg-border) !important;
    background: var(--jg-bg-muted) !important;
}

/* News */
[data-theme="dark"] .jg-pagination a {
    background: var(--jg-bg-muted) !important;
    color: var(--jg-text) !important;
}

[data-theme="dark"] .jg-pagination a:hover {
    background: var(--jg-border) !important;
}

[data-theme="dark"] .jg-pagination .active {
    background: #081B4B !important;
    color: #fff !important;
}

/* Soft inner panels */
[data-theme="dark"] div[style*="background:#F9FAFB"][style*="border-radius"],
[data-theme="dark"] div[style*="background: #F9FAFB"][style*="border-radius"],
[data-theme="dark"] div[style*="background:#F3F4F6"][style*="border-radius"],
[data-theme="dark"] div[style*="background: #F3F4F6"][style*="border-radius"] {
    background: var(--jg-bg-muted) !important;
    border-color: var(--jg-border) !important;
}

[data-theme="dark"] div[style*="border:1px solid #E5E7EB"],
[data-theme="dark"] div[style*="border: 1px solid #E5E7EB"],
[data-theme="dark"] div[style*="border:1px solid #F3F4F6"],
[data-theme="dark"] div[style*="border: 1px solid #F3F4F6"] {
    border-color: var(--jg-border) !important;
}

[data-theme="dark"] h1[style*="color: #081B4B"],
[data-theme="dark"] h1[style*="color:#081B4B"],
[data-theme="dark"] h2[style*="color: #081B4B"],
[data-theme="dark"] h2[style*="color:#081B4B"],
[data-theme="dark"] h2[style*="color: #111827"],
[data-theme="dark"] h2[style*="color:#111827"],
[data-theme="dark"] div[style*="color: #081B4B"],
[data-theme="dark"] span[style*="color: #081B4B"] {
    color: var(--jg-text-strong) !important;
}

[data-theme="dark"] p[style*="color: #4B5563"],
[data-theme="dark"] p[style*="color:#4B5563"],
[data-theme="dark"] p[style*="color: #6B7280"],
[data-theme="dark"] p[style*="color:#6B7280"],
[data-theme="dark"] div[style*="color: #6B7280"],
[data-theme="dark"] div[style*="color:#6B7280"],
[data-theme="dark"] div[style*="color: #4B5563"],
[data-theme="dark"] div[style*="color:#4B5563"] {
    color: var(--jg-text-muted) !important;
}

/* Preserve brand navy / amber sections (do not flatten) */
[data-theme="dark"] .jg-hero-card,
[data-theme="dark"] .jg-head,
[data-theme="dark"] .jg-petrol-hero,
[data-theme="dark"] footer[style*="background:#081B4B"],
[data-theme="dark"] footer[style*="background: #081B4B"] {
    /* intentional brand surfaces */
}

/* ── Station finder ── */
[data-theme="dark"] .jg-site-header {
    background: rgba(15, 23, 42, 0.98) !important;
    border-bottom-color: var(--jg-border) !important;
}

[data-theme="dark"] .jg-header-divider {
    background: var(--jg-border-strong) !important;
}

[data-theme="dark"] .jg-header-link {
    color: var(--jg-text-body) !important;
}

[data-theme="dark"] .jg-header-link:hover {
    background: var(--jg-bg-muted) !important;
    color: var(--jg-text-strong) !important;
}

[data-theme="dark"] .jg-station-finder-container,
[data-theme="dark"] .jg-finder-sidebar,
[data-theme="dark"] .jg-finder-results-panel {
    background: var(--jg-bg-soft) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text);
}

[data-theme="dark"] .jg-finder-header,
[data-theme="dark"] .jg-finder-results-header,
[data-theme="dark"] .jg-finder-results-panel,
[data-theme="dark"] .jg-finder-list {
    background: var(--jg-bg-soft) !important;
    border-color: var(--jg-border) !important;
}

[data-theme="dark"] .jg-finder-sidebar::-webkit-scrollbar-track {
    background: var(--jg-bg-soft) !important;
}

[data-theme="dark"] .jg-finder-sidebar::-webkit-scrollbar-thumb {
    background: var(--jg-border-strong) !important;
}

[data-theme="dark"] .jg-switch-service,
[data-theme="dark"] .jg-active-location-card,
[data-theme="dark"] .jg-station-card,
[data-theme="dark"] .jg-suggestions,
[data-theme="dark"] .jg-search-input-wrapper,
[data-theme="dark"] .jg-initial-state {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text) !important;
}

[data-theme="dark"] .jg-station-card {
    border-bottom-color: var(--jg-border) !important;
}

[data-theme="dark"] .jg-station-card:hover {
    background: var(--jg-bg-muted) !important;
}

[data-theme="dark"] .jg-station-card.selected {
    background: rgba(37, 99, 235, 0.16) !important;
    border-left-color: #60A5FA !important;
}

[data-theme="dark"] .jg-card-title {
    color: var(--jg-text-strong) !important;
}

[data-theme="dark"] .jg-card-address,
[data-theme="dark"] .jg-card-meta-bar {
    color: var(--jg-text-muted) !important;
}

[data-theme="dark"] .jg-theme-petrol .jg-initial-icon,
[data-theme="dark"] .jg-theme-petrol .jg-active-loc-icon {
    background: rgba(245, 158, 11, 0.14) !important;
    color: #FBBF24 !important;
    border-color: rgba(251, 191, 36, 0.35) !important;
}

[data-theme="dark"] .jg-theme-ev .jg-initial-icon,
[data-theme="dark"] .jg-theme-ev .jg-active-loc-icon {
    background: rgba(5, 150, 105, 0.16) !important;
    color: #34D399 !important;
    border-color: rgba(52, 211, 153, 0.35) !important;
}

[data-theme="dark"] .jg-suggestions {
    box-shadow: var(--jg-shadow) !important;
}

[data-theme="dark"] .jg-suggestion-item:hover,
[data-theme="dark"] .jg-suggestion-item.active {
    background: var(--jg-bg-muted) !important;
}

[data-theme="dark"] .jg-divider span,
[data-theme="dark"] .jg-filter-label,
[data-theme="dark"] .jg-initial-desc,
[data-theme="dark"] .jg-active-loc-sub,
[data-theme="dark"] .jg-loading-text {
    color: var(--jg-text-muted) !important;
}

[data-theme="dark"] .jg-initial-title,
[data-theme="dark"] .jg-active-loc-label,
[data-theme="dark"] #result-count-heading {
    color: var(--jg-text-strong) !important;
}

[data-theme="dark"] .jg-search-input-icon {
    stroke: var(--jg-text-muted) !important;
}

[data-theme="dark"] .jg-error-notice {
    background: rgba(220, 38, 38, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.35) !important;
    color: #FCA5A5 !important;
}

[data-theme="dark"] .jg-btn-action.report {
    background: rgba(248, 113, 113, 0.12) !important;
    color: #FCA5A5 !important;
    border-color: rgba(248, 113, 113, 0.35) !important;
}

[data-theme="dark"] .jg-btn-action.report:hover {
    background: rgba(248, 113, 113, 0.2) !important;
    color: #FECACA !important;
}

[data-theme="dark"] .jg-report-modal__panel {
    background: var(--jg-surface) !important;
    border-color: var(--jg-border) !important;
    color: var(--jg-text) !important;
}

[data-theme="dark"] .jg-report-modal__header h3 {
    color: var(--jg-text-strong) !important;
}

[data-theme="dark"] .jg-report-modal__header p,
[data-theme="dark"] .jg-report-field label span {
    color: var(--jg-text-muted) !important;
}

[data-theme="dark"] .jg-report-field label {
    color: var(--jg-text) !important;
}

[data-theme="dark"] .jg-report-field input,
[data-theme="dark"] .jg-report-field select,
[data-theme="dark"] .jg-report-field textarea,
[data-theme="dark"] .jg-report-modal__close {
    background: var(--jg-input-bg, var(--jg-bg-muted)) !important;
    color: var(--jg-text) !important;
    border-color: var(--jg-border-strong) !important;
}

[data-theme="dark"] .leaflet-popup-content-wrapper {
    background: var(--jg-surface) !important;
    color: var(--jg-text) !important;
}

[data-theme="dark"] .leaflet-popup-tip {
    background: var(--jg-surface) !important;
}

[data-theme="dark"] .leaflet-container {
    background: #0B1220 !important;
}

[data-theme="dark"] .leaflet-control-attribution,
[data-theme="dark"] .leaflet-bar a {
    background: var(--jg-surface) !important;
    color: var(--jg-text-muted) !important;
    border-color: var(--jg-border) !important;
}

/* Tom Select (admin shared via theme.css for completeness) */
[data-theme="dark"] .ts-wrapper .ts-control,
[data-theme="dark"] .ts-dropdown {
    background: var(--jg-input-bg) !important;
    color: var(--jg-text) !important;
    border-color: var(--jg-border-strong) !important;
}

[data-theme="dark"] .ts-dropdown .option.active {
    background: var(--jg-bg-muted) !important;
}

/* Login page toggle placement helper */
.jg-theme-toggle-float {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 5;
}

.admin-login-panel {
    position: relative;
}
