/* ==========================================================================
   Swiss Radio Live — Stylesheet (styles.css)
   Clean, modern Swiss-inspired dark theme with responsive UI
   ========================================================================== */

:root {
    --bg-main: #0c0d0f;
    --bg-surface: #14161b;
    --bg-card: #1b1e26;
    --bg-card-hover: #232733;
    --bg-card-active: #2b1f22;
    --card-border: #2a2e3b;
    --card-border-active: #d52b1e;
    
    --swiss-red: #d52b1e;
    --swiss-red-hover: #ef3324;
    --swiss-red-glow: rgba(213, 43, 30, 0.35);
    
    --text-primary: #f4f5f7;
    --text-secondary: #c0c4ce;
    --text-muted: #838a9b;
    
    --badge-bg: #222632;
    --chip-bg: #1c202a;
    --chip-border: #2b3040;
    --chip-active-bg: #d52b1e;
    --chip-active-text: #ffffff;
    
    --live-green: #10b981;
    --gold: #f59e0b;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 20px rgba(213, 43, 30, 0.4);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --player-height: 84px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: calc(var(--player-height) + 24px);
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #2a2f3d;
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: #3e4558;
}

/* Layout Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 20px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

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

.nav-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}
.nav-back-btn:hover {
    background: var(--bg-card-hover);
    transform: translateX(-2px);
    border-color: var(--swiss-red);
}

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

.swiss-cross-badge {
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(213, 43, 30, 0.4));
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand .subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

.stats-pill {
    padding: 6px 12px;
    background: var(--badge-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}
.stats-pill span {
    color: var(--swiss-red-hover);
    font-weight: 800;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.header-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--swiss-red);
}

/* Controls Bar (Search + View Tabs) */
.controls-bar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.05rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 48px;
    padding: 0 46px 0 48px;
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}
.search-box input:focus {
    border-color: var(--swiss-red);
    box-shadow: 0 0 0 3px var(--swiss-red-glow);
    background: var(--bg-card);
}
.search-box input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
}
.clear-btn:hover {
    color: var(--text-primary);
}

/* View Tabs */
.view-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.view-tab {
    padding: 9px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.view-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}
.view-tab.active {
    background: var(--swiss-red);
    border-color: var(--swiss-red);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

/* Filter Chips (Language & Genre) */
.filters-container {
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    min-width: 65px;
}

.chips-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.chip {
    padding: 5px 12px;
    background: var(--chip-bg);
    border: 1px solid var(--chip-border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.chip:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: #3f475a;
}
.chip.active {
    background: #2e1c20;
    border-color: var(--swiss-red);
    color: #ff857a;
    font-weight: 700;
}

/* Main Content & Station Grid */
.main-content {
    min-height: 400px;
}

.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Station Card */
.station-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.station-card:hover {
    background: var(--bg-card-hover);
    border-color: #3f4657;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.station-card.active-playing {
    border-color: var(--card-border-active);
    background: var(--bg-card-active);
    box-shadow: var(--shadow-glow);
}

.card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.station-logo {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: #111317;
    border: 1px solid #282d3b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    overflow: hidden;
}

.station-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.station-info {
    flex: 1;
    min-width: 0;
}

.station-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.station-genre {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.card-fav-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    transition: transform 0.15s ease;
}
.card-fav-btn:hover {
    transform: scale(1.2);
}
.card-fav-btn.is-fav {
    color: var(--gold);
}

/* Card Bottom Badges */
.card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 10px;
}

.badges-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-badge {
    padding: 2px 7px;
    background: var(--badge-bg);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.canton-badge {
    padding: 2px 6px;
    background: #251b1e;
    color: #ff9187;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.7rem;
}

.bitrate-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Card Play Status / Wave Animation */
.card-play-action {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mini-play-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--swiss-red);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mini-play-btn:hover {
    background: var(--swiss-red-hover);
    transform: scale(1.1);
}

/* Mini Wave Bars */
.mini-wave {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}
.station-card.active-playing .mini-wave {
    display: flex;
}
.mini-wave span {
    width: 3px;
    background: var(--swiss-red);
    border-radius: 1px;
    animation: waveBounce 1s ease-in-out infinite alternate;
}
.mini-wave span:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.mini-wave span:nth-child(2) { height: 14px; animation-delay: 0.3s; }
.mini-wave span:nth-child(3) { height: 9px; animation-delay: 0.2s; }
.mini-wave span:nth-child(4) { height: 12px; animation-delay: 0.4s; }

@keyframes waveBounce {
    0% { height: 4px; }
    100% { height: 14px; }
}

/* Sticky Bottom Player Bar */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--player-height);
    background: rgba(18, 20, 26, 0.94);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
}

.player-left {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 300px;
    min-width: 220px;
}

.now-playing-cover {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: #141720;
    border: 1px solid #2d3342;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    flex-shrink: 0;
    overflow: hidden;
}

.now-playing-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.now-playing-meta {
    flex: 1;
    min-width: 0;
}

.now-playing-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.now-playing-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stream-live-pill {
    padding: 2px 6px;
    background: var(--live-green);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
    animation: livePulse 2s infinite ease-in-out;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.now-playing-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.player-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.player-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}
.player-action-btn.is-fav {
    color: var(--gold);
}

/* Center Controls */
.player-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

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

.control-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    transition: all 0.15s ease;
}
.control-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.play-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--swiss-red);
    color: #fff;
    border: none;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--swiss-red-glow);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.play-btn:hover {
    background: var(--swiss-red-hover);
    transform: scale(1.08);
}
.play-btn:active {
    transform: scale(0.96);
}

/* Visualizer Wrapper */
.visualizer-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
}

#visualizerCanvas {
    display: block;
    width: 180px;
    height: 20px;
}

/* Right Controls (Volume & Sleep Timer) */
.player-right {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 260px;
    justify-content: flex-end;
}

.timer-badge {
    padding: 2px 6px;
    background: var(--swiss-red);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: var(--radius-full);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}
.volume-btn:hover {
    color: var(--text-primary);
}

#volumeSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 90px;
    height: 5px;
    background: #2a2f3e;
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
}
#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.15s ease;
}
#volumeSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--swiss-red-hover);
}

.vol-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

/* Loading & Empty States */
.loading-state,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    margin: 20px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #282d3b;
    border-top-color: var(--swiss-red);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1.15rem;
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}
.btn-primary {
    background: var(--swiss-red);
    color: #fff;
}
.btn-primary:hover {
    background: var(--swiss-red-hover);
}

/* Sleep Timer Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #171a22;
    border-bottom: 1px solid var(--card-border);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}
.close-modal-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.timer-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.timer-option-btn {
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.timer-option-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--swiss-red);
}
.timer-option-btn.active {
    background: var(--swiss-red);
    border-color: var(--swiss-red);
    color: #fff;
}

.active-timer-box {
    margin-top: 16px;
    padding: 10px;
    background: #251619;
    border: 1px solid var(--swiss-red);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.88rem;
    color: #ff9187;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: #1e222d;
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-size: 0.86rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Media Queries */
@media (max-width: 900px) {
    .player-left {
        width: auto;
        max-width: 180px;
    }
    .player-right {
        width: auto;
    }
    #volumeSlider,
    .vol-label {
        display: none;
    }
    .visualizer-wrapper {
        display: none;
    }
}

@media (max-width: 640px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    .stations-grid {
        grid-template-columns: 1fr;
    }
    .player-bar {
        padding: 0 14px;
    }
    .now-playing-sub {
        display: none;
    }
}

