:root {
    --bg-main: #141414;
    --bg-card: #1f1f1f;
    --bg-nav: rgba(20, 20, 20, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --brand-color: #e50914; /* Netflix red */
    --hover-overlay: rgba(255, 255, 255, 0.1);
    --transition: 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- NAVBAR --- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    background-color: var(--bg-nav);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4%;
    z-index: 1000;
    transition: background-color 0.4s ease;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    cursor: pointer;
}

.desktop-tabs {
    display: flex;
    gap: 20px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.tab-btn.active {
    color: var(--text-primary);
    font-weight: 700;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 6px 12px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--text-primary);
    background: rgba(0,0,0,0.8);
}

.search-box .material-icons-round {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-right: 8px;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 200px;
    font-family: inherit;
    font-size: 0.9rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
}

/* --- PLAYER SECTION --- */
.player-wrapper {
    margin-top: 70px;
    background: #000;
    position: relative;
    width: 100%;
}

.video-aspect-ratio {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    aspect-ratio: 16/9;
}

#video-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Metadata under player */
.player-metadata {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 4%;
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(to bottom, #000 0%, var(--bg-main) 100%);
}

.player-metadata img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--bg-card);
    padding: 4px;
}

.meta-info h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

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

.live-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--brand-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.live-tag .dot {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.category-tag {
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* --- CONTENT ROWS (NETFLIX STYLE) --- */
.content-section {
    padding: 20px 0 100px 0; /* extra padding bottom for mobile nav */
}

.category-row {
    margin-bottom: 3vw;
}

.category-row-title {
    font-size: 1.4vw;
    font-weight: 700;
    margin: 0 4% 0.5em 4%;
    color: #e5e5e5;
}

.row-cards {
    display: flex;
    gap: 8px;
    padding: 0 4% 20px 4%;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    cursor: grab;
}

.row-cards:active {
    cursor: grabbing;
}

.row-cards::-webkit-scrollbar {
    display: none;
}

/* Scroll Buttons (Desktop) */
.scroll-btn {
    position: absolute;
    top: 0;
    bottom: 20px;
    width: 4%;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    cursor: pointer;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scroll-btn:hover {
    background: rgba(0,0,0,0.8);
}

.scroll-btn .material-icons-round {
    font-size: 2.5vw;
}

.scroll-btn.left { left: 0; border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.scroll-btn.right { right: 0; border-top-left-radius: 4px; border-bottom-left-radius: 4px; }

.row-container:hover .scroll-btn {
    opacity: 1;
}

.channel-card {
    flex: 0 0 18%; /* Desktop: 5+ cards per row */
    min-width: 200px;
    aspect-ratio: 16/9;
    background: var(--bg-card);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.channel-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.2);
    transition: var(--transition);
}

.channel-card:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
}

.channel-card:hover::after {
    background: transparent;
}

.channel-card.playing {
    border: 2px solid var(--text-primary);
}

.channel-logo {
    width: 50%;
    height: 50%;
    object-fit: contain;
    z-index: 2;
}

.channel-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    z-index: 2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    padding: 50px;
    display: none;
}
.loading.active {
    display: flex;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--brand-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mobile Bottom Nav (Hidden on Desktop) */
.mobile-bottom-nav {
    display: none;
}

/* --- RESPONSIVE DESIGN (MOBILE) --- */
@media screen and (max-width: 768px) {
    .navbar {
        height: 60px;
        padding: 0 15px;
    }
    
    .desktop-tabs {
        display: none;
    }
    
    .search-box {
        background: transparent;
        border: none;
        padding: 0;
    }
    .search-box input {
        display: none; /* Can implement a toggle for mobile search later */
    }
    
    .avatar {
        width: 28px;
        height: 28px;
    }

    /* Sticky Player on Mobile */
    .player-wrapper {
        margin-top: 60px;
        position: sticky;
        top: 60px;
        z-index: 999;
        box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    }
    
    .player-metadata {
        padding: 10px 15px;
        background: var(--bg-main);
    }
    .meta-info h1 {
        font-size: 1.2rem;
    }
    .player-metadata img {
        width: 45px;
        height: 45px;
    }
    
    /* Rows */
    .category-row-title {
        font-size: 1.1rem;
        margin: 0 15px 10px 15px;
    }
    .row-cards {
        padding: 0 15px 15px 15px;
        gap: 12px;
    }
    
    /* Hide scroll buttons on mobile */
    .scroll-btn {
        display: none !important;
    }
    .channel-card {
        flex: 0 0 40%;
        min-width: 140px;
    }
    .channel-card:hover {
        transform: none; /* Disable hover scale on mobile */
    }

    /* Mobile Bottom Nav */
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: rgba(20, 20, 20, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255,255,255,0.1);
        z-index: 1000;
    }
    .nav-item {
        background: none;
        border: none;
        color: var(--text-secondary);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-size: 0.7rem;
        cursor: pointer;
    }
    .nav-item.active {
        color: var(--text-primary);
    }
    .nav-item .material-icons-round {
        font-size: 1.5rem;
    }
}
