/* ==========================================================================
   BoxFox Radio — Design System & Styles
   Modern Dark Glassmorphism, Micro-Animations & Fluid Typography
   Theme Tokens defined in theme.css
   ========================================================================== */

@import url('theme.css');

:root {
    --accent-primary: #f97316;
    --accent-primary-hover: #ea580c;
    --accent-primary-active: #c2410c;
    --accent-primary-glow: rgba(249, 115, 22, 0.4);
    --accent-primary-subtle: rgba(249, 115, 22, 0.12);
    --accent-primary-border: rgba(249, 115, 22, 0.35);

    --accent-secondary: #fb923c;
    --accent-secondary-glow: rgba(251, 146, 60, 0.35);
    --accent-secondary-subtle: rgba(251, 146, 60, 0.1);

    --color-live: #f97316;
    --color-live-glow: rgba(249, 115, 22, 0.6);
    --color-offline: #64748b;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;

    --accent-emerald: var(--accent-primary);
    --accent-emerald-glow: var(--accent-primary-glow);
    --accent-cyan: var(--accent-secondary);
    --accent-cyan-glow: var(--accent-secondary-glow);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.35);
    --accent-rose: #ef4444;

    --bg-base: #0f1115;
    --bg-surface: rgba(22, 26, 33, 0.88);
    --bg-surface-solid: #161a21;
    --bg-surface-elevated: #1e232d;
    --bg-surface-hover: #262c37;
    --bg-surface-active: #2e3543;

    --bg-card-border: rgba(255, 255, 255, 0.08);
    --bg-card-border-glow: var(--accent-primary-border);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: #2a313d;
    --border-focus: var(--accent-primary);

    --glow-color-1: rgba(249, 115, 22, 0.22);
    --glow-color-2: rgba(234, 88, 12, 0.18);
    --glow-color-3: rgba(217, 119, 6, 0.14);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-on-accent: #ffffff;

    --radius-lg: 8px;
    --radius-md: 6px;
    --radius-sm: 4px;
    --radius-xs: 2px;
    --radius-full: 6px;
    --radius-circle: 50%;

    --shadow-card: 0 20px 45px -10px rgba(0, 0, 0, 0.65), 0 0 35px rgba(249, 115, 22, 0.06);
    --shadow-btn: 0 8px 20px -4px rgba(249, 115, 22, 0.45);
    --shadow-glow: 0 0 25px var(--accent-primary-glow);

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Ambient Background Glow Spheres (Warm Ember / Orange)
   -------------------------------------------------------------------------- */
.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    animation: floatGlow 18s ease-in-out infinite alternate;
}

.glow-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--glow-color-1) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--glow-color-2) 0%, transparent 70%);
    bottom: -120px;
    right: -120px;
    animation-delay: -9s;
}

.glow-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--glow-color-3) 0%, transparent 70%);
    top: 40%;
    left: 60%;
    animation-delay: -5s;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 30px) scale(1.15); }
}

/* --------------------------------------------------------------------------
   Station Card Layout
   -------------------------------------------------------------------------- */
.station-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
}

.player-card {
    background: var(--bg-surface);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 30px 26px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.player-card.is-live {
    border-color: var(--bg-card-border-glow);
    box-shadow: var(--shadow-card), 0 0 30px rgba(249, 115, 22, 0.15);
}

/* --------------------------------------------------------------------------
   Header: Brand & Status Badge
   -------------------------------------------------------------------------- */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary-subtle), var(--accent-secondary-subtle));
    border: 1px solid var(--accent-primary-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.brand-icon svg {
    width: 22px;
    height: 22px;
}

.station-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 40%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.station-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* Status Pill */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.status-badge .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Live State */
.status-badge.live {
    background: var(--accent-primary-subtle);
    border: 1px solid var(--accent-primary-border);
    color: var(--accent-primary);
}

.status-badge.live .status-dot {
    background-color: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
    animation: pulseDot 1.5s infinite;
}

/* Offline State */
.status-badge.offline {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
}

.status-badge.offline .status-dot {
    background-color: var(--text-muted);
}

@keyframes pulseDot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 var(--color-live-glow); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 var(--color-live-glow); }
}

/* --------------------------------------------------------------------------
   Visualizer Canvas & Sound Wave Bars
   -------------------------------------------------------------------------- */
.visualizer-container {
    position: relative;
    width: 100%;
    height: 120px;
    background: rgba(14, 17, 22, 0.7);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#visualizer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* --------------------------------------------------------------------------
   Metadata Section
   -------------------------------------------------------------------------- */
.metadata-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.track-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--accent-primary);
    text-transform: uppercase;
}

.track-title-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.track-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
    text-overflow: ellipsis;
    overflow: hidden;
}

.stream-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.stat-pill {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.uptime-pill.active {
    color: var(--accent-primary);
    border-color: var(--accent-primary-border);
    background: var(--accent-primary-subtle);
}

/* --------------------------------------------------------------------------
   Playback Controls & Volume
   -------------------------------------------------------------------------- */
.controls-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 8px 0;
}

.btn-play {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: var(--radius-circle);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-btn);
}

.btn-play:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #334155;
    box-shadow: none;
}

.btn-play:not(:disabled):hover {
    transform: scale(1.06);
    box-shadow: 0 12px 30px var(--accent-primary-glow);
}

.btn-play:not(:disabled):active {
    transform: scale(0.96);
}

.btn-play svg {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 2;
}

.btn-play .icon-play {
    margin-left: 4px; /* Optical center alignment */
}

/* Spinner for buffering */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Volume Slider */
.volume-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px;
    background: rgba(14, 17, 22, 0.6);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-mute {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s ease;
}

.btn-mute:hover {
    color: var(--text-primary);
}

.btn-mute svg {
    width: 20px;
    height: 20px;
}

.slider-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    outline: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

#volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-percent {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 38px;
    text-align: right;
}

/* --------------------------------------------------------------------------
   Offline Notice Card
   -------------------------------------------------------------------------- */
.offline-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: opacity 0.3s ease;
}

.notice-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.notice-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-amber);
    margin-bottom: 2px;
}

.notice-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Card Footer: Action Links
   -------------------------------------------------------------------------- */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.footer-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.footer-btn svg {
    width: 16px;
    height: 16px;
}

/* --------------------------------------------------------------------------
   Toast Notification
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   Toast Notification
   -------------------------------------------------------------------------- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-surface-elevated);
    backdrop-filter: blur(16px);
    border: 1px solid var(--accent-primary);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    z-index: 100;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Top Player Navigation
   -------------------------------------------------------------------------- */
.top-player-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: wrap;
}

.player-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.player-nav-btn.active {
    color: var(--accent-primary);
    border-color: var(--accent-primary-border);
    background: var(--accent-primary-subtle);
}

/* --------------------------------------------------------------------------
   Visualizer Toolbar & Controls
   -------------------------------------------------------------------------- */
.visualizer-container {
    position: relative;
}

.visualizer-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 5;
}

.vis-btn {
    background: rgba(14, 17, 22, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-family: var(--font-mono);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.vis-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-primary);
}

.vis-btn svg {
    width: 12px;
    height: 12px;
}

/* Fullscreen Visualizer */
.visualizer-container.is-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
    background: var(--bg-base);
}

.visualizer-container.is-fullscreen #visualizer-canvas {
    width: 100%;
    height: 100%;
}

/* --------------------------------------------------------------------------
   Quick Links Row in Card
   -------------------------------------------------------------------------- */
.quick-links-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: -6px;
}

.quick-link-pill {
    flex: 1;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-link-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* --------------------------------------------------------------------------
   In-App Slide-over Drawer / Modal
   -------------------------------------------------------------------------- */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 500;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    width: 100%;
    max-width: 580px;
    height: 100vh;
    background: var(--bg-surface-solid);
    border-left: 1px solid var(--border-default);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.drawer-overlay.open .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(14, 17, 22, 0.6);
    flex-shrink: 0;
}

.drawer-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drawer-header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-open-fullpage {
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--accent-primary-subtle);
    border: 1px solid var(--accent-primary-border);
    transition: all 0.2s ease;
}

.btn-open-fullpage:hover {
    background: var(--accent-primary);
    color: #ffffff;
}

.btn-close-drawer {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-close-drawer:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --------------------------------------------------------------------------
   Responsive Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .player-card {
        padding: 24px 18px;
        gap: 20px;
    }

    .station-title {
        font-size: 1.1rem;
    }

    .visualizer-container {
        height: 100px;
    }

    .btn-play {
        width: 68px;
        height: 68px;
    }
}
