/* Radio Site Maker Platform — Theme System */

/* ===== 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: #71717a;
    --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(239, 68, 68, 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: #94a3b8;
    --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(239, 68, 68, 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);
}

/* ===== 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: #ef4444; }

/* ===== Selection ===== */
::selection { background: #ef4444; 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(239, 68, 68, 0.4);
    border-color: #ef4444 !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: #ef4444; }
.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: #ef4444;
    box-shadow: 0 8px 30px rgba(239, 68, 68, 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: #ef4444;
    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: #d97706; }
.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; }

/* ===== Equalizer animation bars ===== */
.eq-bar {
    display: inline-block;
    width: 3px;
    background: #ef4444;
    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(239, 68, 68, 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: #ef4444;
    color: #ef4444;
    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); }
