/* Easy VoiceTrack — theme system (ported from RadioHost Studio; --dash-* tokens verbatim, accent amber) */

/* ===== Theme Variables ===== */
:root {
    --dash-bg: #0a0a0a;
    --dash-sidebar: #080808;
    --dash-surface: #141414;
    --dash-surface-light: #1a1a1a;
    --dash-border: #2a2a2a;
    --dash-text: #f5f5f5;
    --dash-text-secondary: #a1a1aa;
    --dash-text-muted: #8f8f99;   /* 6:1 on the dark ground (was #71717a, 4.1:1) */
    --dash-input-bg: #141414;
    --dash-input-border: #2a2a2a;
    --dash-input-placeholder: #666;
    --dash-hover: rgba(255,255,255,0.04);
    --dash-hover-strong: rgba(255,255,255,0.06);
    --dash-scrollbar-track: #0a0a0a;
    --dash-scrollbar-thumb: #333;
    --dash-toggle-bg: #333;
    --dash-stat-shadow: rgba(0,0,0,0.3);
    --dash-card-shadow: 0 1px 3px rgba(0,0,0,0.4);
    --dash-ring-dot: #080808;
    --dash-table-hover: rgba(245, 158, 11, 0.05);
    --dash-badge-neutral-bg: rgba(255,255,255,0.08);
    --dash-badge-neutral-text: #a1a1aa;
    --dash-spinner-track: rgba(255,255,255,0.2);
    --dash-code-bg: rgba(255,255,255,0.06);
    --dash-overlay: rgba(0,0,0,0.6);
}

[data-theme="light"] {
    --dash-bg: #f1f5f9;
    --dash-sidebar: #ffffff;
    --dash-surface: #ffffff;
    --dash-surface-light: #f8fafc;
    --dash-border: #e2e8f0;
    --dash-text: #1e293b;
    --dash-text-secondary: #475569;
    --dash-text-muted: #5b6678;   /* 5.7:1 on white (was #94a3b8, 2.6:1) */
    --dash-input-bg: #f8fafc;
    --dash-input-border: #cbd5e1;
    --dash-input-placeholder: #94a3b8;
    --dash-hover: rgba(0,0,0,0.04);
    --dash-hover-strong: rgba(0,0,0,0.07);
    --dash-scrollbar-track: #f1f5f9;
    --dash-scrollbar-thumb: #cbd5e1;
    --dash-toggle-bg: #cbd5e1;
    --dash-stat-shadow: rgba(0,0,0,0.06);
    --dash-card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --dash-ring-dot: #ffffff;
    --dash-table-hover: rgba(245, 158, 11, 0.04);
    --dash-badge-neutral-bg: rgba(0,0,0,0.06);
    --dash-badge-neutral-text: #64748b;
    --dash-spinner-track: rgba(0,0,0,0.1);
    --dash-code-bg: rgba(0,0,0,0.05);
    --dash-overlay: rgba(0,0,0,0.4);
}

/* ===== Section Title Override banner heading ===== */
.section-override-title { color: #fef3c7; } /* amber-100 — readable on dark backgrounds */
[data-theme="light"] .section-override-title { color: #78350f; } /* amber-900 — readable on light backgrounds */
.section-override-subtitle { color: rgba(253,230,138,0.7); } /* amber-200/70 — readable on dark */
[data-theme="light"] .section-override-subtitle { color: #92400e; } /* amber-800 — readable on light */

/* ===== Base ===== */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--dash-bg);
    color: var(--dash-text);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', system-ui, sans-serif;
}

/* ===== Smooth transitions ===== */
*, *::before, *::after {
    transition-property: color, background-color, border-color, opacity, box-shadow, transform;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--dash-scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--dash-scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #f59e0b; }

/* ===== Selection ===== */
::selection { background: #f59e0b; color: white; }

/* ===== Dashboard sidebar scrollbar ===== */
#dashboard-sidebar::-webkit-scrollbar { width: 4px; }
#dashboard-sidebar::-webkit-scrollbar-track { background: transparent; }
#dashboard-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 2px; }
[data-theme="light"] #dashboard-sidebar::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); }

/* ===== Form inputs ===== */
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="tel"], input[type="search"], input[type="date"],
input[type="time"], input[type="datetime-local"], textarea, select {
    background-color: var(--dash-input-bg) !important;
    color: var(--dash-text) !important;
    border-color: var(--dash-input-border) !important;
}
input::placeholder, textarea::placeholder { color: var(--dash-input-placeholder) !important; }

/* ===== Form focus — red glow ===== */
input:focus, select:focus, textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4);
    border-color: #f59e0b !important;
}

/* ===== Toggle switch ===== */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--dash-toggle-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-switch.active { background: #f59e0b; }
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.toggle-switch.active::after { transform: translateX(20px); }

/* ===== Color picker ===== */
input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 48px;
    height: 48px;
    border: 2px solid var(--dash-input-border);
    border-radius: 12px;
    cursor: pointer;
    padding: 2px;
    background: var(--dash-surface-light);
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 8px; }

/* ===== Stat card hover ===== */
.stat-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    box-shadow: var(--dash-card-shadow);
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: #f59e0b;
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.15);
}

/* ===== Table ===== */
.table-row:hover { background: var(--dash-table-hover); }

/* ===== Wizard step animation ===== */
.wizard-step {
    animation: slideIn 0.3s ease forwards;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== Loading spinner ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--dash-spinner-track);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Badge styles ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.badge-warning { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }   /* was #d97706: 3.9:1 on dark */
.badge-error { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-info { background: rgba(0, 229, 255, 0.15); color: #00b8d4; }
.badge-neutral { background: var(--dash-badge-neutral-bg); color: var(--dash-badge-neutral-text); }

[data-theme="light"] .badge-success { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
[data-theme="light"] .badge-warning { background: rgba(251, 191, 36, 0.12); color: #b45309; }
[data-theme="light"] .badge-error { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
[data-theme="light"] .badge-info { background: rgba(0, 229, 255, 0.12); color: #0891b2; }

/* ===== Trial banner =====
   Was inline rgba plus amber-400 / red-400 headings, which are tuned for the
   dark theme and were never corrected for the light one: #fbbf24 on its own 8%
   wash over #f1f5f9 is about 1.9:1, and #f87171 about 2.5:1. This is the banner
   every trial account sees on every page, and in light mode its headline was
   the least readable text on the screen. Same fix .badge-warning already uses. */
.trial-banner { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.35); }
.trial-banner-title { color: #fbbf24; }
.trial-banner.is-ended { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.35); }
.trial-banner.is-ended .trial-banner-title,
.trial-banner .trial-banner-urgent { color: #f87171; }

[data-theme="light"] .trial-banner { background: rgba(245, 158, 11, 0.12); border-color: rgba(217, 119, 6, 0.4); }
[data-theme="light"] .trial-banner-title { color: #92400e; }
[data-theme="light"] .trial-banner.is-ended { background: rgba(239, 68, 68, 0.1); border-color: rgba(220, 38, 38, 0.4); }
[data-theme="light"] .trial-banner.is-ended .trial-banner-title,
[data-theme="light"] .trial-banner .trial-banner-urgent { color: #b91c1c; }

/* ===== Setup hint strip (ui.next_step) =====
   Cyan, not amber, and deliberately: the trial banner directly above it is
   amber because it is a WARNING, and a suggestion stacked underneath in the
   same colour reads as a second thing wrong rather than as help. Cyan is the
   accent the design system already uses for informational badges.

   Both icon values are theme-specific for contrast: cyan-400 is 9.8:1 on the
   dark wash but only ~2:1 on the light one, so light gets cyan-800 (5.97:1). */
.next-step {
    background: rgba(6, 182, 212, 0.10);
    border-color: rgba(6, 182, 212, 0.35);
}
.next-step-icon { color: #22d3ee; }
/* Not --dash-text-muted: #94a3b8 over the light wash is about 2.4:1, and this
   is a link. --dash-text-secondary is 6.9 / 6.2. */
.next-step-link { color: var(--dash-text-secondary); }
.next-step-link:hover { color: var(--dash-text); }

[data-theme="light"] .next-step {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(14, 116, 144, 0.35);
}
[data-theme="light"] .next-step-icon { color: #155e75; }

/* ===== Equalizer animation bars ===== */
.eq-bar {
    display: inline-block;
    width: 3px;
    background: #f59e0b;
    border-radius: 2px;
    animation: eq-pulse 0.8s ease-in-out infinite;
}
.eq-bar:nth-child(1) { animation-delay: 0s; height: 12px; }
.eq-bar:nth-child(2) { animation-delay: 0.15s; height: 20px; }
.eq-bar:nth-child(3) { animation-delay: 0.3s; height: 16px; }
.eq-bar:nth-child(4) { animation-delay: 0.45s; height: 24px; }
.eq-bar:nth-child(5) { animation-delay: 0.1s; height: 18px; }
@keyframes eq-pulse {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

/* ===== Noise texture overlay ===== */
.noise-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* ===== Glow effects ===== */
.glow-red { text-shadow: 0 0 20px rgba(239, 68, 68, 0.5); }
.glow-cyan { text-shadow: 0 0 20px rgba(0, 229, 255, 0.5); }

/* ===== Card hover glow ===== */
.card-glow:hover {
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.1), 0 8px 30px var(--dash-stat-shadow);
}

/* ===== Form inputs (themed) ===== */
.form-input {
    background: var(--dash-input-bg);
    border: 1px solid var(--dash-input-border);
    color: var(--dash-text);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    width: 100%;
}
.form-input::placeholder { color: var(--dash-input-placeholder); }

/* ===== Dashboard theme-aware text utilities ===== */
.dt { color: var(--dash-text); }
.dt-secondary { color: var(--dash-text-secondary); }
.dt-muted { color: var(--dash-text-muted); }
.db { background-color: var(--dash-bg); }
.ds { background-color: var(--dash-surface); }
.ds-light { background-color: var(--dash-surface-light); }
.db-border { border-color: var(--dash-border); }
.db-hover:hover { background-color: var(--dash-hover); }
.db-hover-strong:hover { background-color: var(--dash-hover-strong); }

/* ===== Site preview modal ===== */
.preview-modal {
    backdrop-filter: blur(8px);
    background: var(--dash-overlay);
}
.preview-frame {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}

/* ===== Theme toggle button ===== */
.theme-toggle {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--dash-border);
    background: var(--dash-surface);
    color: var(--dash-text-secondary);
    transition: all 0.2s;
}
.theme-toggle:hover {
    border-color: #f59e0b;
    color: #f59e0b;
    background: var(--dash-hover-strong);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { position: absolute; transition: opacity 0.2s, transform 0.3s; }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

/* Tables inside generated article HTML (help_loader._render_blocks emits
   .table-scroll). The rules are duplicated from resources.css because the Help
   Center loads only tailwind.css and platform.css — resources.css is for the
   /learn and /radio-for pages — so without this every table in the docs renders
   as unspaced rows. Scoped to .table-scroll, which nothing else uses. */
.table-scroll { overflow-x: auto; margin: 0 0 1.6rem; border: 1px solid var(--dash-border); border-radius: 12px; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table-scroll th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .07em;
    font-weight: 700; color: var(--dash-text-muted); padding: 11px 14px; background: var(--dash-surface);
    border-bottom: 1px solid var(--dash-border); white-space: nowrap; }
.table-scroll td { padding: 11px 14px; border-bottom: 1px solid var(--dash-border);
    color: var(--dash-text-secondary); vertical-align: top; line-height: 1.55; }
.table-scroll tr:last-child td { border-bottom: 0; }
.table-scroll td:first-child { color: var(--dash-text); }

/* ===== Easy VoiceTrack additions ===== */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    background: #f59e0b; color: #0a0a0a; font-weight: 600; font-size: 14px;
    padding: 10px 18px; border-radius: 12px; transition: background .15s, opacity .15s;
}
.btn-primary:hover { background: #fbbf24; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    background: var(--dash-hover-strong); color: var(--dash-text-secondary); font-weight: 500;
    font-size: 14px; padding: 10px 16px; border-radius: 12px; transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--dash-border); color: var(--dash-text); }
.btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    background: #dc2626; color: #fff; font-weight: 600; font-size: 14px;
    padding: 10px 18px; border-radius: 12px; transition: background .15s;
}
.btn-danger:hover { background: #b91c1c; }
/* This file loads after tailwind.css, so the display above would beat
   Tailwind's .hidden at equal specificity (the modal's upgrade link showed
   as an empty orange button). */
.btn-primary.hidden, .btn-ghost.hidden, .btn-danger.hidden { display: none; }
.card { background: var(--dash-surface); border: 1px solid var(--dash-border); border-radius: 16px; }
.form-input.is-invalid { border-color: #f87171 !important; box-shadow: 0 0 0 2px rgba(248,113,113,.25); }
.field-error { color: #f87171; font-size: 12px; margin-top: 6px; }
[data-theme="light"] .field-error { color: #dc2626; }
.form-label { font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--dash-text-secondary); }
.meter { height: 6px; border-radius: 999px; background: var(--dash-hover-strong); overflow: hidden; }
.meter > span { display: block; height: 100%; background: #f59e0b; border-radius: 999px; }
.meter.is-warning > span { background: #f87171; }
.nav-link { color: var(--dash-text-secondary); font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 10px; }
.nav-link:hover { color: var(--dash-text); background: var(--dash-hover-strong); }
.nav-link.is-active { color: var(--dash-text); background: var(--dash-hover-strong); }
.form-label:not(.flex) { display: block; }
/* Tailwind's divide-y defaults to a light grey that glares on the dark theme. */
.divide-y > :not([hidden]) ~ :not([hidden]) { border-color: var(--dash-border); }
input[type="range"] { accent-color: #f59e0b; }

/* ===== Accessibility ===== */
/* A visible focus ring for keyboard users on everything interactive. */
:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }
/* Radio cards and the file drop zone hide their real input: ring the label. */
label:has(input.sr-only:focus-visible) { outline: 2px solid #f59e0b; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
