/* ==========================================================================
   1. GLOBAL RESET & BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Font stack that supports Unicode characters (Tamil, Telugu, etc.) clearly */
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    /* Smooth scrolling for the whole UI */
    scroll-behavior: smooth;
}

body {
    background-color: #141414;
    color: #fff;
    /* Default: Allow vertical scroll (for Home Page), hide horizontal */
    overflow-x: hidden;
    overflow-y: auto; 
}

/* ==========================================================================
   2. HOME PAGE SPECIFIC STYLES
   ========================================================================== */

/* Navbar (Fixed at top) */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 50px;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    transition: background-color 0.3s;
}

.navbar.scrolled {
    background: linear-gradient(to bottom, #000000 0%, #000000 50%, rgba(0,0,0,0) 100%);
}

.logo {
    color: #e50914;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: default; 
    outline: none;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-right: 20px;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s;
    padding: 5px 10px;
    border-radius: 4px;
    outline: none;
    border: 2px solid transparent;
}

nav ul li a:hover, nav ul li a.active {
    color: #b3b3b3;
}

nav ul li a:focus {
    background-color: rgba(255,255,255,0.1);
    border: 2px solid white;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
}

.user-menu i, .user-menu .avatar {
    margin-left: 20px;
    font-size: 1.2rem;
    cursor: pointer;
    outline: none;
    border: 2px solid transparent;
}

.user-menu i:focus, .user-menu .avatar:focus {
    border: 2px solid white;
    border-radius: 50%;
    padding: 2px;
}

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

/* Hero Section (Home Page Banner) */
.hero {
    height: 80vh;
    background: linear-gradient(to top, #141414 0%, transparent 100%), 
                url('https://image.tmdb.org/t/p/original/xDMIl84Qo5Tsu62c9DGWhmPI67A.jpg') no-repeat center center/cover;
    background-blend-mode: color-burn;
    display: flex;
    align-items: flex-end;
    padding: 0 50px 100px;
    outline: none; 
}

.hero-content {
    max-width: 600px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    line-height: 1.5;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-buttons {
    display: flex;
}

.hero-buttons button {
    padding: 10px 25px;
    margin-right: 10px;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    outline: none;
    border: 2px solid transparent;
}

.hero-buttons button:focus {
    border: 2px solid white;
    transform: scale(1.05);
}

.play-btn { background-color: #fff; color: #000; }
.info-btn { background-color: rgba(109, 109, 110, 0.7); color: #fff; }
.hero-buttons i { margin-right: 10px; }

/* OTT Apps Section (Home Page) */
.ott-section {
    display: flex;
    gap: 45px;
    padding: 10px 5px 30px 5px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 50px; /* Aligns with padding */
}
.ott-section::-webkit-scrollbar { display: none; }

.ott-item {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: #333;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    border: 8px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 20px 0 0;
}

.ott-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ott-item:focus {
    border: 8px solid white;
    transform: scale(1.15);
    outline: none;
}

/* ==========================================================================
   3. LIVE TV PAGE LAYOUT (DASHBOARD STYLE)
   ========================================================================== */

/* IMPORTANT: This class locks the layout for Live TV only */
body.livetv-page {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Disables window scroll for this page */
}

/* 3.1 Top Section (Static - Does not scroll) */
.header-action-row {
    padding: 20px 50px 10px 50px;
    flex-shrink: 0;
}

.back-home-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid transparent;
    padding: 10px 20px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    outline: none;
}

.back-home-btn:focus {
    background-color: #fff;
    color: #000;
    border-color: #fff;
    transform: scale(1.05);
}

.top-feature-container {
    display: flex;
    gap: 20px;
    padding: 0 50px;
    width: 100%;
    height: 35vh; /* Fixed height for top section */
    flex-shrink: 0; 
    margin-bottom: 10px;
}

.banner-section {
    flex: 1;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: #222;
}

.banner-bg { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; }

.banner-content {
    position: absolute; bottom: 20px; left: 30px; z-index: 2; max-width: 80%;
}

.banner-content h2 { font-size: 2.2rem; margin-bottom: 8px; font-weight: 800; text-shadow: 2px 2px 4px rgba(0,0,0,0.8); }
.banner-content p { font-size: 1.1rem; margin-bottom: 15px; color: #e5e5e5; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); }

.banner-btn {
    padding: 10px 20px; background-color: #e50914; color: white; border: none; 
    border-radius: 4px; font-weight: bold; font-size: 0.9rem; outline: none; border: 2px solid transparent; cursor: pointer;
}
.banner-btn:focus { background-color: white; color: black; border-color: white; transform: scale(1.05); }

.player-section {
    height: 100%; aspect-ratio: 16 / 9; flex-shrink: 0;
    position: relative; border-radius: 8px; overflow: hidden; background-color: #000;
}
.player-bg { width: 100%; height: 100%; object-fit: cover; }
.player-placeholder { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; color: white; z-index: 2; }
.player-placeholder i { font-size: 3rem; margin-bottom: 10px; opacity: 0.9; }
.live-badge { position: absolute; top: 15px; right: 15px; background-color: #e50914; color: white; padding: 4px 8px; font-size: 0.8rem; font-weight: bold; border-radius: 4px; z-index: 5; }

/* ==========================================================================
   4. CONTENT AREA (Layout Logic)
   ========================================================================== */

/* Main Container that holds Filters + Scrolling Channels */
.content-container {
    padding: 0 50px;
    flex-grow: 1; /* Fills remaining height */
    display: flex; 
    flex-direction: column;
    overflow: hidden; /* Prevents page scroll */
}

/* 4.1 Filter Section (Fixed, Sticky) */
.filter-title {
    margin: 10px 0;
    font-size: 1.2rem;
    color: #b3b3b3;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0; /* Ensures title doesn't shrink */
}

.filter-row {
    display: flex;
    gap: 15px;
    padding: 5px 0 15px 0;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0; /* Ensures row doesn't shrink */
    
    /* Horizontal Scroll Fixes */
    margin: 0 -50px; /* Extend to edges */
    padding-left: 50px; /* Push content back */
    padding-right: 50px;
}
.filter-row::-webkit-scrollbar { display: none; }

/* Filter Card Styles */
.filter-item-large {
    min-width: 140px;
    height: 100px;
    background-color: #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 4px solid transparent; 
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}

.filter-item-large:focus {
    border-color: #e50914;
    background-color: #444;
    transform: scale(1.1);
    outline: none;
    z-index: 10;
    box-shadow: 0 0 15px rgba(0,0,0,0.8);
}

.lang-text { font-size: 3.5rem; font-weight: 700; line-height: 1; color: #fff; margin-bottom: 5px; }
.lang-sub { font-size: 0.9rem; color: #ccc; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }


/* 4.2 Channel Scrolling Area (The only part that scrolls vertically) */
#channel-rows-placeholder {
    flex: 1; /* Takes all remaining vertical space */
    overflow-y: auto; /* Enables vertical scrolling */
    overflow-x: hidden;
    
    /* Scroll padding keeps focus away from edges */
    scroll-padding-top: 20px;
    scroll-padding-bottom: 20px;
    
    padding-bottom: 50px;
    padding-top: 10px;
    
    /* Extend scrollbar to edge of screen */
    margin: 0 -50px;
    padding-left: 50px;
    padding-right: 50px;
}
#channel-rows-placeholder::-webkit-scrollbar { display: none; }

.row-title {
    margin: 25px 0 10px 0;
    font-size: 1.4rem;
    color: #e5e5e5;
    font-weight: bold;
}

/* 4.3 Horizontal Channel Rows */
.content-row {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 20px;
    
    /* FIX: "20% gone" issue - Padding adds space inside scroll container */
    padding: 15px 50px 35px 50px; 
    
    /* Pull container to edges */
    margin-left: -50px;
    margin-right: -50px;
    
    /* Snap alignment */
    scroll-padding-inline: 50px; 
}
.content-row::-webkit-scrollbar { display: none; }

.channel-item {
    width: 220px;  
    height: 125px; 
    background-color: #fff; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    border: 4px solid transparent; 
    transition: transform 0.2s ease-in-out;
}

.channel-item img {
    width: auto;
    height: auto;
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.channel-item:focus {
    outline: none;
    border-color: #e50914;
    transform: scale(1.15);
    z-index: 20;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
}

.content-info {
    padding: 5px;
    background-color: #e5e5e5;
    display: none;
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 30;
    border-radius: 0 0 4px 4px;
}

.channel-item:focus .content-info { display: block; }

.content-info h3 {
    margin: 0;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #141414;
    text-align: center;
    font-weight: bold;
}

/* Movie Card (Home Page) */
.content-item {
    max-width: 175px;
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    border: 4px solid transparent;
    transition: transform 0.3s;
}
.content-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #333;
    min-height: 87px;
}
.content-item:focus {
    outline: none;
    border-color: white;
    transform: scale(1.1);
    z-index: 20;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   5. MEDIA QUERIES
   ========================================================================== */
@media screen and (min-width: 1280px) {
    .banner-content h2 { font-size: 2.5rem; }
}

@media (max-width: 768px) {
    /* Restore scrolling for mobile */
    body.livetv-page { height: auto; overflow-y: auto; }
    
    .top-feature-container { flex-direction: column; height: auto; }
    .content-container { overflow: visible; height: auto; }
    #channel-rows-placeholder { overflow-y: visible; }
    
    .banner-section { height: 250px; margin-bottom: 20px; }
    .player-section { width: 100%; aspect-ratio: 16/9; }
}