/* ===================================================================
   NFRadio — Dark Cyberpunk Theme
   =================================================================== */

:root {
    --bg-deep:    #06060c;
    --bg-base:    #0a0a14;
    --bg-card:    #10111a;
    --bg-hover:   #161825;
    --border:     rgba(99, 102, 241, 0.12);
    --primary:    #6366f1;
    --primary-l:  #818cf8;
    --accent:     #06b6d4;
    --glow:       rgba(99, 102, 241, 0.35);
    --glow-cyan:  rgba(6, 182, 212, 0.25);
    --green:      #22c55e;
    --text:       #e2e8f0;
    --text-dim:   #64748b;
    --text-muted: #475569;
    --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:  'JetBrains Mono', ui-monospace, monospace;
    --radius:     16px;
    --radius-sm:  10px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { height: 100%; }

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Background glow canvas ---- */
.bg-glow-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ---- Particles canvas ---- */
.particles-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ---- Container ---- */
.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Utility ---- */
.hidden { display: none !important; }

/* ===================================================================
   HERO
   =================================================================== */

.hero {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 8px 0;
}

/* LIVE badge */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--green);
}
.live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    50%      { opacity: .6; box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* Title */
.hero-title {
    font-size: clamp(2rem, 6vw, 3.8rem);
    font-weight: 900;
    line-height: 1;
}
.hero-title-nf {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 30px var(--glow));
}
.hero-title-radio {
    color: var(--text);
}

.hero-sub {
    font-size: 0.92rem;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

/* ===================================================================
   CIRCULAR VISUALIZER
   =================================================================== */

.visualizer-wrap {
    position: relative;
    width: clamp(140px, 25vh, 220px);
    height: clamp(140px, 25vh, 220px);
    margin: 0 auto;
    flex-shrink: 0;
    overflow: visible;
}

#visualizer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
}

.play-btn {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80px; height: 80px;
    border-radius: 50%;
    border: none;
    background: rgba(99, 102, 241, 0.15);
    backdrop-filter: blur(12px);
    color: var(--primary-l);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.play-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 40px var(--glow);
    transform: translate(-50%, -50%) scale(1.08);
}
.play-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}
.play-btn svg {
    margin-left: 4px; /* optical center for play triangle */
}
.play-btn .hidden + svg { margin-left: 0; }

/* ---- Track info ---- */
.track-info {
    margin-bottom: 0;
}
.track-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 3px;
}
.track-prompt {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-style: italic;
    max-width: 500px;
    margin: 0 auto;
}

/* ---- Progress bar ---- */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
}
.time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 36px;
}
.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.progress-bar:hover { height: 6px; }
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.15s linear;
}

/* ---- Controls ---- */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ctrl-btn {
    width: 44px; height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
}
.ctrl-btn:hover {
    background: rgba(255,255,255,0.12);
    color: var(--primary-l);
}
.ctrl-btn--primary {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
}
.ctrl-btn--primary:hover {
    box-shadow: 0 0 24px var(--glow);
    transform: scale(1.08);
    background: linear-gradient(135deg, var(--primary-l), #8b5cf6);
    color: #fff;
}

/* Volume */
.volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}
.volume-icon { color: var(--text-dim); }

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 90px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--primary-l);
    border: none;
    cursor: pointer;
    box-shadow: 0 0 8px var(--glow);
}
.volume-slider::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--primary-l);
    border: none;
    cursor: pointer;
}

/* ---- Spectrum Analyzer ---- */
.spectrum-section {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}
.spectrum-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding: 0 2px;
}
.spectrum-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.spectrum-range {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.6;
}
.spectrum-canvas {
    width: 100%;
    height: 70px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(99, 102, 241, 0.08);
}

/* ===================================================================
   SECTIONS
   =================================================================== */

.section {
    margin-bottom: 20px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.badge {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
    background: rgba(255,255,255,0.04);
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
}

/* ---- Search ---- */
.search-wrap {
    position: relative;
    margin-bottom: 16px;
}
.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.25s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--primary); }

/* ---- Playlist ---- */
.playlist {
    max-height: 480px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}
.playlist::-webkit-scrollbar { width: 6px; }
.playlist::-webkit-scrollbar-track { background: transparent; }
.playlist::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }

.playlist-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.playlist-empty code {
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.pl-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.pl-item:hover {
    background: var(--bg-hover);
}
.pl-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.25);
}

.pl-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 28px;
    text-align: right;
}
.pl-item.active .pl-num { color: var(--primary-l); }

.pl-body { flex: 1; min-width: 0; }

.pl-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pl-desc {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pl-dur {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---- Cards (About) ---- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.06);
}
.card-icon {
    color: var(--primary-l);
    margin-bottom: 8px;
}
.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.card-text {
    font-size: 0.88rem;
    color: var(--text-dim);
    line-height: 1.5;
}

/* ---- Stats ---- */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.stat {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.stat-val {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}
.stat-label {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ---- Collapsible How It Works ---- */
.how-section {
    border-top: 1px solid var(--border);
    margin-top: 4px;
}
.how-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    gap: 8px;
    transition: color 0.2s;
}
.how-summary::-webkit-details-marker { display: none; }
.how-summary:hover { color: var(--text); }
.how-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.25s;
}
details[open] .how-arrow { transform: rotate(180deg); }
.how-content {
    padding-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.how-content .cards { margin: 0; }
.how-content .stats { margin: 0; }

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 16px 0 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ---- Toast notifications ---- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    max-width: 400px;
    text-align: center;
}
.toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast--error { border-color: rgba(239, 68, 68, 0.3); }
.toast--info  { border-color: rgba(99, 102, 241, 0.3); }

/* ---- Focus styles for keyboard navigation ---- */
.pl-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.ctrl-btn:focus-visible,
.play-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 640px) {
    .hero { padding: 20px 0 12px; }
    .hero-title { font-size: 2.2rem; }
    .hero-sub { font-size: 0.88rem; margin-bottom: 12px; }
    .visualizer-wrap { width: 190px; height: 190px; }
    .play-btn { width: 64px; height: 64px; }
    .play-btn svg { width: 36px; height: 36px; }
    .controls { gap: 8px; }
    .volume-wrap { width: 100%; justify-content: center; margin-left: 0; margin-top: 4px; }
    .volume-slider { width: 120px; }
    .spectrum-canvas { height: 50px; }
    .stats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .stat { padding: 12px 8px; }
    .stat-val { font-size: 1.5rem; }
    .cards { grid-template-columns: 1fr; }
}
