/* ==========================================================================
   US Citizen Identity - light / dark theme
   One switch in the navbar of every page. The chosen theme lives on
   <html data-theme="light|dark"> (set before first paint by the inline head
   script, saved in localStorage "uci_theme"). Each page keeps its own look
   until a visitor picks one: the home page starts light, the policy pages
   start dark (data-default-theme on <html>).
   ========================================================================== */

/* ---------- Navbar actions wrapper ---------- */
.uci-nav-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* ---------- The switch - an exact copy of TCPA Lookup's header switch ----------
   Phones / tablets (<= 860px): a round 38px button showing one icon (sun in
   light mode, moon in dark mode), brand-blue outline on a soft blue fill.
   Desktop (>= 861px): the pill - moon left, sun right, gradient knob under the
   ACTIVE mode's icon. Values copied from tcpalookup.us's computed styles. */
.theme-switch {
    position: relative; flex: none; padding: 0; cursor: pointer;
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #e7f3ff; border: 1px solid #1877f2; color: #1877f2;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    -webkit-tap-highlight-color: transparent;
}
/* TCPA's hover tint is rgba(24,119,242,.16) over its white header = #dae9fd. A see-through
   tint would let UCI's navy header show through (dark circle after a tap), so use the solid colour. */
.theme-switch:hover, .theme-switch:active, .theme-switch:focus, .theme-switch:focus-visible { background: #dae9fd; border-color: #1877f2; color: #1877f2; }
.theme-switch:active { transform: scale(0.96); }
.theme-switch:focus-visible { outline: 2px solid #1877f2; outline-offset: 2px; }
.theme-switch svg {
    width: 20px; height: 20px; display: block; pointer-events: none;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.theme-switch .ts-moon { display: none; }
html[data-theme="dark"] .theme-switch { background: rgba(77, 163, 255, 0.14); color: #4da3ff; border-color: #4da3ff; }
html[data-theme="dark"] .theme-switch:hover,
html[data-theme="dark"] .theme-switch:active { background: rgba(77, 163, 255, 0.22); border-color: #4da3ff; color: #4da3ff; }
html[data-theme="dark"] .theme-switch .ts-sun { display: none; }
html[data-theme="dark"] .theme-switch .ts-moon { display: block; }

@media (min-width: 861px) {
    .theme-switch,
    .theme-switch:hover, .theme-switch:active, .theme-switch:focus, .theme-switch:focus-visible {
        width: 76px; height: 42px; border-radius: 999px; transform: none;   /* room for the 20px icons */
        background: #ffffff;
        border: 1px solid rgba(101, 103, 107, 0.35);
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
        color: #65676b;
        transition: border-color .2s ease, background .2s ease;
    }
    .theme-switch:hover, .theme-switch:focus-visible { border-color: #1877f2; }
    .theme-switch svg,
    html[data-theme="dark"] .theme-switch svg {
        display: block; position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
        width: 20px; height: 20px; color: #8a8d91; transition: color .3s ease;   /* a touch larger than TCPA's 18px */
    }
    .theme-switch .ts-moon, .theme-switch .ts-sun,
    html[data-theme="dark"] .theme-switch .ts-moon,
    html[data-theme="dark"] .theme-switch .ts-sun { display: block; }   /* desktop shows both icons */
    .theme-switch .ts-moon { left: 10px; right: auto; }   /* centred under the knob (knob centre 20px from each end) */
    .theme-switch .ts-sun  { right: 10px; left: auto; color: #ffffff; }
    .theme-switch::after {
        content: ""; position: absolute; top: 3px; left: 37px; width: 34px; height: 34px; border-radius: 50%;
        background: linear-gradient(135deg, #4da3ff, #1263d6);
        box-shadow: 0 2px 6px rgba(24, 119, 242, 0.35);
        transition: left .3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    html[data-theme="dark"] .theme-switch,
    html[data-theme="dark"] .theme-switch:hover,
    html[data-theme="dark"] .theme-switch:active,
    html[data-theme="dark"] .theme-switch:focus-visible {
        width: 76px; height: 42px;   /* same size as light mode - no jump when switching */
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.18);
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
        color: #b0b3b8;
    }
    html[data-theme="dark"] .theme-switch:hover,
    html[data-theme="dark"] .theme-switch:focus-visible { border-color: #1877f2; }
    html[data-theme="dark"] .theme-switch::after { left: 3px; }
    html[data-theme="dark"] .theme-switch .ts-moon { color: #ffffff; }
    html[data-theme="dark"] .theme-switch .ts-sun  { color: #8a8d91; }
}
@media (prefers-reduced-motion: reduce) {
    .theme-switch, .theme-switch::after, .theme-switch svg { transition: none; }
}

/* ==========================================================================
   HOME PAGE - dark theme (the page itself is light by default)
   ========================================================================== */
html[data-theme="dark"] body.uci-home { background-color: #0b1622; color-scheme: dark; }
html[data-theme="dark"] .uci-home {
    --gray-bg: #0b1622; --gray-card: #132131; --gray-bdr: #233648;
    --gray-text: #cbd5e1; --gray-sub: #94a3b8;
}

/* search box in the hero - matches TCPA Lookup's Single Search bar in dark mode:
   charcoal field, translucent brand-blue border (solid on focus), the phone
   icon on its near-white panel, light text, grey placeholder. */
html[data-theme="dark"] .uci-home .search-box {
    background: #242526; border: 2px solid rgba(24, 119, 242, 0.38);
    box-shadow: 0 6px 22px rgba(13, 33, 55, 0.10);
    transition: border-color .2s ease, box-shadow .2s ease;
}
html[data-theme="dark"] .uci-home .search-box:hover { border-color: rgba(24, 119, 242, 0.6); }
html[data-theme="dark"] .uci-home .search-box:focus-within { border-color: #1877f2; box-shadow: 0 8px 28px rgba(13, 33, 55, 0.16); }
html[data-theme="dark"] .uci-home .search-icon-wrap { background: #f8faff; border-right-color: #dce3ea; color: #1565c0; }
html[data-theme="dark"] .uci-home .search-box input { color: #e4e6eb; }
html[data-theme="dark"] .uci-home .search-box input::placeholder { color: #8a8d91; }

/* cards */
html[data-theme="dark"] .uci-home .result-header,
html[data-theme="dark"] .uci-home .section-card {
    background: #132131; border-color: #233648; box-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .uci-home .result-person-name,
html[data-theme="dark"] .uci-home .info-value { color: #e8eef5; }
html[data-theme="dark"] .uci-home .info-value.not-found { color: #7c8a9c; }
html[data-theme="dark"] .uci-home .info-label { color: #94a3b8; }
html[data-theme="dark"] .uci-home .info-label i { color: #64b5f6; }
html[data-theme="dark"] .uci-home .phone-number-badge {
    background: rgba(66, 165, 245, 0.12); color: #90caf9;
    border-color: rgba(144, 202, 249, 0.4); box-shadow: none;
}

/* status chips */
html[data-theme="dark"] .uci-home .status-clean           { background: rgba(67, 160, 71, 0.16);  color: #81c784; border-color: rgba(129, 199, 132, 0.4); }
html[data-theme="dark"] .uci-home .status-blacklisted     { background: rgba(229, 57, 53, 0.16);  color: #ef9a9a; border-color: rgba(239, 154, 154, 0.4); }
html[data-theme="dark"] .uci-home .status-federal-dnc     { background: rgba(245, 124, 0, 0.16);  color: #ffb74d; border-color: rgba(255, 183, 77, 0.4); }
html[data-theme="dark"] .uci-home .status-state-dnc       { background: rgba(216, 27, 96, 0.16);  color: #f48fb1; border-color: rgba(244, 143, 177, 0.4); }
html[data-theme="dark"] .uci-home .status-state-federal-dnc { background: rgba(229, 57, 53, 0.16); color: #ef9a9a; border-color: rgba(239, 154, 154, 0.4); }
html[data-theme="dark"] .uci-home .status-unknown         { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.35); }

/* inline-styled bits inside the sample / result cards */
html[data-theme="dark"] .uci-home #results [style*="background:#e3f2fd"] {
    background: rgba(66, 165, 245, 0.14) !important; color: #90caf9 !important; border-color: rgba(144, 202, 249, 0.35) !important;
}
html[data-theme="dark"] .uci-home #results [style*="color:#1565c0"] { color: #64b5f6 !important; }
html[data-theme="dark"] .uci-home #results [style*="color:#718096"] { color: #94a3b8 !important; }
html[data-theme="dark"] .uci-home #results [style*="color:#1a202c"],
html[data-theme="dark"] .uci-home #results [style*="color: #1a202c"] { color: #e8eef5 !important; }
html[data-theme="dark"] .uci-home #results [style*="color:#4a5568"] { color: #cbd5e1 !important; }
html[data-theme="dark"] .uci-home #results [style*="background:#f"],
html[data-theme="dark"] .uci-home #results [style*="background: #f"],
html[data-theme="dark"] .uci-home #results [style*="background:white"],
html[data-theme="dark"] .uci-home #results [style*="background: white"] { background: #0f1c2a !important; }

/* loader */
html[data-theme="dark"] .uci-home .loader-wrap { background: #132131; border-color: #233648; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45); }
html[data-theme="dark"] .uci-home .loader-step { color: #7c8a9c; border-bottom-color: #1c2d3e; }
html[data-theme="dark"] .uci-home .loader-step.active { color: #90caf9; background: rgba(66, 165, 245, 0.1); }
html[data-theme="dark"] .uci-home .loader-step.done { color: #81c784; }
html[data-theme="dark"] .uci-home .loader-step-icon { background: #0f1c2a; border-color: #2a3e52; color: #7c8a9c; }
html[data-theme="dark"] .uci-home .loader-step.active .loader-step-icon { background: rgba(66, 165, 245, 0.16); border-color: #42a5f5; color: #90caf9; }
html[data-theme="dark"] .uci-home .loader-step.done .loader-step-icon { background: rgba(67, 160, 71, 0.16); border-color: rgba(129, 199, 132, 0.5); color: #81c784; }

/* empty / plain error states */
html[data-theme="dark"] .uci-home .empty-state h3 { color: #cbd5e1; }
html[data-theme="dark"] .uci-home .empty-state i { color: #3b4d61; }
html[data-theme="dark"] .uci-home .error-banner { background: rgba(229, 57, 53, 0.12); border-color: rgba(239, 154, 154, 0.35); color: #ef9a9a; }

/* error panels (js/error-panel.js) */
html[data-theme="dark"] .uci-home .err-panel { background: #132131; border-color: #233648; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
html[data-theme="dark"] .uci-home .err-bad  { --err-c: #f87171; --err-soft: rgba(248, 113, 113, 0.12); --err-ring: rgba(248, 113, 113, 0.35); }
html[data-theme="dark"] .uci-home .err-warn { --err-c: #fbbf24; --err-soft: rgba(251, 191, 36, 0.12); --err-ring: rgba(251, 191, 36, 0.35); }
html[data-theme="dark"] .uci-home .err-info { --err-c: #60a5fa; --err-soft: rgba(96, 165, 250, 0.12); --err-ring: rgba(96, 165, 250, 0.35); }
html[data-theme="dark"] .uci-home .err-badge { border-color: #132131; }
html[data-theme="dark"] .uci-home .err-txt b,
html[data-theme="dark"] .uci-home .reg-txt b,
html[data-theme="dark"] .uci-home .err-ip code { color: #e8eef5; }
html[data-theme="dark"] .uci-home .err-reason { color: #cbd5e1; }
html[data-theme="dark"] .uci-home .err-hint,
html[data-theme="dark"] .uci-home .err-ip-l,
html[data-theme="dark"] .uci-home .reg-txt span { color: #94a3b8; }
html[data-theme="dark"] .uci-home .err-ip { background: #0f1c2a; border-color: #233648; }
html[data-theme="dark"] .uci-home .err-copy,
html[data-theme="dark"] .uci-home .err-contact { background: #0f1c2a; border-color: #2f4459; color: #cfe0f2; }
html[data-theme="dark"] .uci-home .err-copy:hover,
html[data-theme="dark"] .uci-home .err-contact:hover { border-color: #42a5f5; color: #90caf9; }
html[data-theme="dark"] .uci-home .err-reg { background: linear-gradient(100deg, rgba(30, 136, 229, 0.14) 0%, #132131 45%); border-color: #233648; }
html[data-theme="dark"] .uci-home .reg-lock { background: #132131; color: #90caf9; }
html[data-theme="dark"] .uci-home .reg-ip { background: #0f1c2a; border-color: rgba(144, 202, 249, 0.45); box-shadow: none; }
html[data-theme="dark"] .uci-home .reg-ip small { color: #94a3b8; }
html[data-theme="dark"] .uci-home .reg-ip code { color: #90caf9; }
html[data-theme="dark"] .uci-home .reg-copy { color: #90caf9; border-color: rgba(144, 202, 249, 0.45); }
html[data-theme="dark"] .uci-home .reg-copy.copied { color: #81c784; border-color: rgba(129, 199, 132, 0.5); background: rgba(67, 160, 71, 0.14); }

/* invalid-number card (js/invalid-number.js) */
html[data-theme="dark"] .uci-home .inv-sub { color: #f87171 !important; }
html[data-theme="dark"] .uci-home .inv-badge { color: #fca5a5 !important; background: rgba(239, 68, 68, 0.14) !important; border-color: rgba(248, 113, 113, 0.4) !important; }
html[data-theme="dark"] .uci-home .inv-badge i { color: #f87171; }
html[data-theme="dark"] .uci-home .inv-detail { background: rgba(239, 68, 68, 0.08); border-color: rgba(248, 113, 113, 0.3); }
html[data-theme="dark"] .uci-home .inv-seg b { color: #e8eef5; background: #0f1c2a; border-color: #2f4459; }
html[data-theme="dark"] .uci-home .inv-seg.bad b { color: #fca5a5; border-color: #f87171; }
html[data-theme="dark"] .uci-home .inv-seg small { color: #94a3b8; }
html[data-theme="dark"] .uci-home .inv-seg.bad small { color: #f87171; }
html[data-theme="dark"] .uci-home .inv-dash { color: #64748b; }
html[data-theme="dark"] .uci-home .inv-reason { color: #fecaca; }
html[data-theme="dark"] .uci-home .inv-reason b { color: #fca5a5; }
html[data-theme="dark"] .uci-home .inv-reason span { color: #fdba74; }
html[data-theme="dark"] .uci-home .inv-panel-txt b,
html[data-theme="dark"] .uci-home .inv-empty b { color: #e2e8f0; }
html[data-theme="dark"] .uci-home .inv-panel-txt span,
html[data-theme="dark"] .uci-home .inv-empty span { color: #94a3b8; }
html[data-theme="dark"] .uci-home .inv-empty-ico { background: #0f1c2a; color: #64748b; }

/* Blacklist maintenance card (js/blacklist.js) */
html[data-theme="dark"] .uci-home .uci-maint-ico { color: #fdba74; background: rgba(234, 88, 12, 0.14); border-color: rgba(251, 146, 60, 0.35); }
html[data-theme="dark"] .uci-home .uci-maint-pill { color: #fcd34d; background: rgba(245, 158, 11, 0.12); border-color: rgba(252, 211, 77, 0.35); }
html[data-theme="dark"] .uci-home .uci-maint h3 { color: #e8eef5; }
html[data-theme="dark"] .uci-home .uci-maint p { color: #94a3b8; }
html[data-theme="dark"] .uci-home .uci-maint-live { color: #81c784; background: rgba(67, 160, 71, 0.14); border-color: rgba(129, 199, 132, 0.4); }

/* ==========================================================================
   POLICY PAGES - light theme (the pages themselves are dark by default)
   ========================================================================== */
html[data-theme="light"] body.uci-doc { background: #f0f4f8; color: #334155; color-scheme: light; }
html[data-theme="light"] .uci-doc .page-header { border-bottom-color: rgba(13, 33, 55, 0.12); }
html[data-theme="light"] .uci-doc .page-header h1,
html[data-theme="light"] .uci-doc h2 { color: #0d2137; }
html[data-theme="light"] .uci-doc h2 i { color: #1565c0; }
html[data-theme="light"] .uci-doc .page-header p { color: #64748b; }
html[data-theme="light"] .uci-doc .page-wrap p,
html[data-theme="light"] .uci-doc .page-wrap ul li { color: #475569; }
html[data-theme="light"] .uci-doc .page-wrap a { color: #1565c0; }
html[data-theme="light"] .uci-doc .highlight-box { background: #e8f2fd; border-color: #c7defa; }
html[data-theme="light"] .uci-doc .highlight-box p { color: #1a3a57; }
html[data-theme="light"] .uci-doc .warning-box { background: #fef2f2; border-color: #fecaca; }
html[data-theme="light"] .uci-doc .warning-box p { color: #b91c1c; }
html[data-theme="light"] .uci-doc .cookie-table th { background: #e3eefb; color: #0d2137; border-bottom-color: #c7defa; }
html[data-theme="light"] .uci-doc .cookie-table td { color: #475569; border-bottom-color: #e2e8f0; }
html[data-theme="light"] .uci-doc .cookie-table { background: #ffffff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .uci-doc .badge-essential { background: #e3f2fd; color: #1565c0; border-color: #90caf9; }
html[data-theme="light"] .uci-doc .badge-no { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
html[data-theme="light"] .uci-doc .page-footer { margin-top: 60px; }

/* ---------- Narrow phones: make room for the switch in the one-row navbar ----------
   "Live Database" -> "Live" and "Back to Home" -> "Home" (full labels on larger
   screens); the brand comes down a touch on the very smallest phones. */
.lbl-short { display: none; }
@media (max-width: 440px) {
    .uci-nav-actions .lbl-full { display: none; }
    .uci-nav-actions .lbl-short { display: inline; }
    .uci-home .navbar-brand img { height: 46px; width: 46px; }
}
@media (max-width: 360px) {
    .uci-doc .navbar-inner { padding: 0 10px !important; }
}
@media (max-width: 340px) {
    .uci-home .navbar-brand img { height: 34px !important; width: 34px !important; }
    .uci-home .brand-text { font-size: 16px !important; }
}
