:root {
    --bg-dark: #0a1128;
    --card-bg: #141e3c;
    --accent-orange: #ff6b00;
    --text-light: #ffffff;
    --text-muted: #8892b0;
    --red-live: #ff3333;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-dark); color: var(--text-light); padding-bottom: 100px; }

/* Top Bar */
.top-bar { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background: var(--bg-dark); position: sticky; top: 0; z-index: 100; }
.logo-area { display: flex; align-items: center; gap: 10px; }
.live-pill { background: var(--red-live); color: white; font-size: 10px; font-weight: bold; padding: 3px 8px; border-radius: 4px; }
.brand-name { font-size: 18px; font-weight: 600; }
.header-icons { display: flex; gap: 20px; font-size: 24px; cursor: pointer; }

/* Main Content */
.main-content { padding: 0; /* Removed side padding for full-width hero */ }

/* Hero Player - Edge to Edge */
.hero-player { 
    width: 100%; 
    aspect-ratio: 16/9; 
    background: #000; 
    overflow: hidden; 
    position: relative; 
    margin-bottom: 20px;
}
.hero-player video, .hero-player iframe { width: 100%; height: 100%; object-fit: cover; border: none; }
.hero-offline { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; background: var(--card-bg); color: var(--text-muted); }
.hero-offline i { font-size: 40px; margin-bottom: 10px; color: var(--red-live); }

/* Sections (Add padding back to sections, not the hero) */
.section-header { display: flex; justify-content: space-between; align-items: center; margin: 25px 20px 15px 20px; }
.section-header h2 { font-size: 18px; font-weight: 600; }
.section-header a { color: var(--accent-orange); font-size: 12px; text-decoration: none; font-weight: bold; }

/* Categories */
.categories { display: flex; gap: 10px; overflow-x: auto; padding: 5px 20px 15px 20px; scrollbar-width: none; }
.categories::-webkit-scrollbar { display: none; }
.cat-btn { background: var(--card-bg); color: var(--text-light); border: none; padding: 10px 20px; border-radius: 20px; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: 0.3s; }
.cat-btn.active { background: var(--accent-orange); color: white; }

/* --- HORIZONTAL SCROLL AND CARDS (THE FIX) --- */
.horizontal-scroll { 
    display: flex !important; 
    flex-direction: row !important; 
    gap: 12px !important; 
    overflow-x: auto !important; 
    padding: 0 20px 15px 20px !important; 
    scrollbar-width: none;
}
.horizontal-scroll::-webkit-scrollbar { display: none; }

.square-card { 
    display: flex !important;
    flex-direction: column !important;
    min-width: 31% !important; /* Exactly 3 fit per screen */
    max-width: 31% !important;
    width: 31% !important;
    flex-shrink: 0 !important;
    text-decoration: none; 
    color: white; 
}

/* Logo Box - Horizontal shape */
.station-logo, .card-image { 
    width: 100% !important; 
    height: 22vw !important; /* Makes the box a wide rectangle */
    object-fit: contain !important; 
    background-color: #ffffff !important; 
    border-radius: 8px !important; 
    padding: 6px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.square-card h3 { 
    font-size: 12px !important; 
    font-weight: 500 !important; 
    line-height: 1.2 !important; 
    margin-top: 8px !important; 
    text-overflow: ellipsis !important; 
    white-space: nowrap !important; 
    overflow: hidden !important; 
    text-align: left !important;
}

/* Bottom Navigation */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: #060b19; display: flex; justify-content: space-around; padding: 12px 0 25px 0; border-top: 1px solid rgba(255,255,255,0.05); z-index: 100; }
.nav-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text-muted); font-size: 13px; font-weight: 500; gap: 6px; }
.nav-item i { font-size: 24px; }
.nav-item.active { color: var(--accent-orange); }

/* Desktop Overrides */
@media (min-width: 768px) {
    body { padding-left: 240px; padding-bottom: 0; }
    .main-content { padding: 20px 40px; }
    .hero-player { width: 100%; max-height: 500px; border-radius: 16px; margin-bottom: 30px; }
    .section-header { margin-left: 0; margin-right: 0; }
    .categories { padding-left: 0; padding-right: 0; }
    .horizontal-scroll { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; padding: 0 !important; gap: 20px !important; overflow: visible !important; }
    .square-card { min-width: 0 !important; max-width: none !important; width: 100% !important; }
    .station-logo, .card-image { width: 100% !important; height: 180px !important; }
    .bottom-nav { display: none; }
    .desktop-sidebar { display: flex !important; }
}

/* =========================================
   MOBILE OVERRIDE (Strict Flexbox)
   ========================================= */
@media (max-width: 767px) {
    .horizontal-scroll {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: scroll !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        gap: 12px !important;
        padding: 0 20px 15px 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .square-card {
        display: flex !important;
        flex-direction: column !important;
        flex: 0 0 31% !important;
        width: 31% !important;
        min-width: 31% !important;
        max-width: 31% !important;
        margin: 0 !important;
        text-decoration: none;
    }

    .station-logo {
        width: 100% !important;
        height: 22vw !important;
        object-fit: contain !important; 
        background-color: #ffffff !important;
        border-radius: 8px !important;
        padding: 4px !important;
        display: block !important;
    }

    .square-card h3 {
        font-size: 11px !important;
        line-height: 1.2 !important;
        margin-top: 6px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: left !important;
    }
}

/* =========================================
   DESKTOP OVERRIDES (Fix Header & Layout)
   ========================================= */
@media (min-width: 768px) {
    .header-icons .fa-bars {
        display: none !important;
    }
    .top-bar {
        padding: 10px 40px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .desktop-sidebar {
        display: none !important;
    }
    body {
        padding-left: 0 !important;
    }
    .main-content {
        padding: 20px 40px !important;
        max-width: 1400px;
        margin: 0 auto;
    }
    .hero-player {
        width: 100% !important;
        max-height: 600px;
        border-radius: 16px !important;
        margin-bottom: 30px;
    }
    .horizontal-scroll {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
        overflow: visible !important;
        padding: 0 0 20px 0 !important;
    }
    .square-card {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        flex: none !important;
    }
    .station-logo {
        width: 100% !important;
        height: 180px !important;
    }
    .bottom-nav {
        display: none !important;
    }
}

/* Desktop nav links in header */
.desktop-nav {
    display: none; /* hidden on mobile */
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
        gap: 30px;
        align-items: center;
        margin: 0 auto;
        padding: 0 20px;
    }
    .desktop-nav a {
        color: var(--text-muted);
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
        transition: color 0.2s;
    }
    .desktop-nav a:hover {
        color: var(--accent-orange);
    }
    /* Hide mobile hamburger */
    .header-icons .fa-bars {
        display: none;
    }
    /* Push logo left, icons right */
    .top-bar {
        justify-content: space-between;
    }
    .logo-area {
        flex: 0 0 auto;
    }
    .header-icons {
        flex: 0 0 auto;
    }
}
