/* =========================================================
   SHANFI PisoWiFi — Light / Dark / System theme
   Loaded AFTER style.css. Light mode = untouched defaults.
   Everything below only applies when <html data-theme="dark">.
   ========================================================= */

/* ---------- Theme switcher (sits beside "Home") ---------- */
.theme-switch {
    display: inline-flex; align-items: center; gap: 2px; padding: 3px; margin: 0 4px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--mist);
    flex: none;
}
.theme-switch button {
    appearance: none; border: 0; background: transparent; cursor: pointer;
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    color: var(--muted); transition: background .2s, color .2s, box-shadow .2s, transform .2s;
}
.theme-switch button svg { width: 17px; height: 17px; display: block; }
.theme-switch button:hover { color: var(--blue); transform: scale(1.08); }
.theme-switch button[aria-pressed="true"] {
    background: var(--white); color: var(--blue);
    box-shadow: 0 1px 4px rgba(1,36,122,.18), 0 0 0 1px var(--line);
}
.theme-switch button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

@media (max-width: 860px) {
    .theme-switch { align-self: flex-start; margin: 6px 14px; }
}

/* Smooth colour change when the user flips the theme */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color .3s ease, color .3s ease, border-color .3s ease, box-shadow .3s ease !important;
}

/* ================= DARK THEME ================= */
html[data-theme="dark"] { color-scheme: dark; }

html[data-theme="dark"] {
    --navy: #8fb8ff;          /* headings / outline accents become light blue */
    --navy-deep: #060d24;
    --blue: #3b97ff;
    --blue-soft: #14264a;
    --cyan: #22c8ff;
    --ink: #e7edfb;
    --muted: #94a3c4;
    --line: #22304f;
    --mist: #0e1730;
    --white: #0a1124;
    --danger: #ff6b78;
    --success: #34d399;
    --warn: #f0a63a;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] body { background: #0a1124; color: var(--ink); }

/* Surfaces that were hard-coded white */
html[data-theme="dark"] .navbar,
html[data-theme="dark"] .product-card,
html[data-theme="dark"] .step,
html[data-theme="dark"] .benefit,
html[data-theme="dark"] .faq details,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .buy-box,
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .order-card,
html[data-theme="dark"] .gallery-item,
html[data-theme="dark"] .gal-admin-item,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .notif-dropdown,
html[data-theme="dark"] .release-card,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .cat-chip,
html[data-theme="dark"] .an-range a { background: #0f1830; }

html[data-theme="dark"] .navbar { background: #0a1124; border-bottom-color: var(--line); }
html[data-theme="dark"] .section-alt { background: #0d1630; }
html[data-theme="dark"] #splash { background: #0a1124; }
html[data-theme="dark"] .splash-bar { background: #14264a; }

html[data-theme="dark"] .hero { background: radial-gradient(circle at 85% 10%, rgba(0,187,254,.14), transparent 45%), #0a1124; }

html[data-theme="dark"] .product-media,
html[data-theme="dark"] .detail-media,
html[data-theme="dark"] .pm-media { background: linear-gradient(150deg, #14264a, #0f1830); }

html[data-theme="dark"] .auth-wrap { background: linear-gradient(180deg, #0d1630, #0a1124 70%); }

/* Text that used the (now light) navy variable but sits on coloured fills */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-nav-cta,
html[data-theme="dark"] .cat-chip.active,
html[data-theme="dark"] .to-top,
html[data-theme="dark"] .step::before { color: #fff; background: linear-gradient(135deg, #0a3fb0, #0179fd); }
html[data-theme="dark"] .btn-outline { color: #bcd6ff; border-color: #4f78c4; }
html[data-theme="dark"] .btn-outline:hover { background: #1b3a78; color: #fff; }
html[data-theme="dark"] .btn-ghost { color: #8fc2ff; background: #14264a; }
html[data-theme="dark"] .btn-ghost:hover { background: #1b3366; }
html[data-theme="dark"] .btn-light { color: #01247a; background: #fff; }
html[data-theme="dark"] .toast { background: #1b3366; color: #fff; }

/* Always-dark bands keep their original deep-blue look (their text stays white) */
html[data-theme="dark"] .cta-band,
html[data-theme="dark"] .page-banner,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .signal-stage,
html[data-theme="dark"] footer { --navy: #01247a; }
html[data-theme="dark"] .cta-band h2,
html[data-theme="dark"] .page-banner h1,
html[data-theme="dark"] footer h4 { color: #fff; }
html[data-theme="dark"] .cta-band { background: linear-gradient(135deg, #060d24, #0a2a80 55%, #0b5fd1); }
html[data-theme="dark"] .page-banner { background: linear-gradient(160deg, #060d24, #0a2a80 60%, #0b4fb8); }
html[data-theme="dark"] .sidebar { background: linear-gradient(180deg, #060d24, #0b1a4a); }
html[data-theme="dark"] .side-nav a.active { background: #1b3a78; color: #fff; }
html[data-theme="dark"] .side-profile .avatar { background: #1b3a78; color: #fff; }
html[data-theme="dark"] footer { background: #060d24; }
html[data-theme="dark"] footer .logo-pill { background: #fff; }
html[data-theme="dark"] .btn-light:hover { box-shadow: 0 12px 26px rgba(0,0,0,.4); }

/* Navbar links & misc */
html[data-theme="dark"] .nav-links > a:not(.btn-nav-cta):hover,
html[data-theme="dark"] .nav-links > a.active { color: #8fc2ff; background: #14264a; }
html[data-theme="dark"] .nav-toggle { color: #cfe0ff; }
html[data-theme="dark"] .nav-toggle:hover { background: #14264a; }
html[data-theme="dark"] .nav-links { background: #0a1124; }
html[data-theme="dark"] .brand img { background: #fff; border-radius: 10px; padding: 3px 8px; height: 46px; } /* logo has a dark wordmark, keep it readable */

/* Forms */
html[data-theme="dark"] .form-control { background: #0c1530; color: var(--ink); border-color: #2a3a60; }
html[data-theme="dark"] .form-control:hover { border-color: #3d5385; }
html[data-theme="dark"] .form-control.is-invalid { background: #2a1219; }
html[data-theme="dark"] .form-control::placeholder { color: #6f7fa3; }
html[data-theme="dark"] select.form-control option { background: #0c1530; color: var(--ink); }
html[data-theme="dark"] .file-drop { background: #0d1630; border-color: #2f4a80; }
html[data-theme="dark"] input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #0c1530 inset; -webkit-text-fill-color: #e7edfb; }

/* Alerts / badges / states */
html[data-theme="dark"] .alert-success { background: #0d2a20; color: #7be3b4; border-color: #17503a; }
html[data-theme="dark"] .alert-error { background: #2d1218; color: #ff9ba5; border-color: #5a2029; }
html[data-theme="dark"] .alert-info { background: #11244a; color: #a9cdff; border-color: #234a8a; }
html[data-theme="dark"] .badge-success { background: #0f3022; color: #6fe0ae; }
html[data-theme="dark"] .badge-warn { background: #35270a; color: #f5c066; }
html[data-theme="dark"] .badge-danger { background: #3a141b; color: #ff9ba5; }
html[data-theme="dark"] .badge-muted { background: #1a2542; color: #a3b2d4; }
html[data-theme="dark"] .chip-blue { background: #14264a; color: #8fc2ff; border-color: #234a8a; }
html[data-theme="dark"] .license-state.used { color: #ff9ba5; }
html[data-theme="dark"] .license-state.free { color: #6fe0ae; }
html[data-theme="dark"] .license-box { background: #11244a; border-color: #2f5fa8; }
html[data-theme="dark"] .pm-notice { background: #11244a; border-color: #234a8a; color: #bcd6ff; }
html[data-theme="dark"] .msg-body { background: #0d1630; }
html[data-theme="dark"] .empty svg { color: #3a4f7e; }

/* Notifications, modal, hover states */
html[data-theme="dark"] .notif-item.unread,
html[data-theme="dark"] .notif-row.unread { background: #13244a; }
html[data-theme="dark"] .notif-x:hover,
html[data-theme="dark"] .notif-clear:hover { background: #3a141b; }
html[data-theme="dark"] .modal-close { background: rgba(15,24,48,.92); color: var(--ink); }
html[data-theme="dark"] .modal-close:hover { background: #1b3366; }
html[data-theme="dark"] .product-card:hover,
html[data-theme="dark"] .faq details[open] { border-color: #2f5fa8; }
html[data-theme="dark"] .pay-qr img { background: #fff; } /* QR codes must stay on white to scan */
html[data-theme="dark"] .benefit:hover .ico { background: var(--blue); color: #fff; }

/* Tables */
html[data-theme="dark"] th { color: var(--muted); border-bottom-color: var(--line); }
html[data-theme="dark"] td { border-color: var(--line); }
html[data-theme="dark"] tbody tr:hover { background: rgba(59,151,255,.06); }

/* Customer remote page (inline styles in customer/remote.php) */
html[data-theme="dark"] .rm-card,
html[data-theme="dark"] .rm-modal { background: #0f1830; border-color: var(--line); }
html[data-theme="dark"] .rm-k,
html[data-theme="dark"] .rm-sub,
html[data-theme="dark"] .rm-empty { color: var(--muted); }
html[data-theme="dark"] .rm-kv div { background: #14213f; }
html[data-theme="dark"] .rm-b { background: #14264a; color: #8fc2ff; }
html[data-theme="dark"] .rm-b.ok { background: #0f3022; color: #6fe0ae; }
html[data-theme="dark"] .rm-tabs button { background: #14213f; color: var(--ink); }
html[data-theme="dark"] .rm-tabs button.a { background: #0179fd; color: #fff; }
html[data-theme="dark"] .rm-modal td, html[data-theme="dark"] .rm-modal th { border-bottom-color: var(--line); }

/* Images & media: soften slightly so they don't glare */
html[data-theme="dark"] .gallery-item img,
html[data-theme="dark"] .product-media img { filter: brightness(.94); }

/* The logo image has a white background: show it on a soft white card in dark mode */
html[data-theme="dark"] .splash-logo { background: #fff; border-radius: 26px; padding: 10px 18px; }
html[data-theme="dark"] .splash-text { color: var(--muted); }
