/*
================================
--- Foundation: Colors & Fonts ---
================================
*/
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Poppins:wght@600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Monoton&display=swap');

:root {
    --color-background: #101418;
    --color-surface: #191E24;
    --color-primary: #e50914;
    --color-primary-hover: #f40612;
    --color-text-primary: #f0f0f0;
    --color-text-secondary: #a9a9a9;
    --color-border: #2a313a;

    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/*
================================
--- General Body & Layout Styles ---
================================
*/
body {
    font-family: var(--font-body);
    margin: 0;
    background-color: var(--color-background);
    color: var(--color-text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/*
================================
--- Header & Navigation ---
================================
*/
header {
    background-color: var(--color-surface);
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Monoton', cursive;
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: 1px;
    color: var(--color-primary);
    text-decoration: none;
    text-shadow: 0 0 20px rgba(229, 9, 20, 0.6);
    text-transform: none;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

nav a {
    color: var(--color-text-secondary);
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 1rem;
    transition: color 0.3s;
    display: block;
}

nav a:hover {
    color: var(--color-text-primary);
}

.category-link.active {
    color: var(--color-primary);
    font-weight: 700;
}

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--color-surface);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 1;
    border-radius: 5px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.dropdown-content a:hover {
    background-color: var(--color-primary);
    color: white !important;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.search-container input {
    padding: 0.6rem 0.8rem;
    border-radius: 5px;
    border: 1px solid var(--color-border);
    background-color: #222;
    color: var(--color-text-primary);
    width: 250px;
    transition: all 0.3s ease;
}
.search-container input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.2);
}


/*
================================
--- Main Content, Grids & Rows ---
================================
*/
main {
    padding: 2.5rem 1rem;
}

.category-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.category-row-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 0;
    border-left: 4px solid var(--color-primary);
    padding-left: 1rem;
}

.see-all-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.see-all-link:hover {
    color: var(--color-primary);
}

.category-row {
    margin-bottom: 3rem;
}

/* --- UPDATED: Horizontal Scrolling for Homepage Rows --- */
#homepage-content .video-grid {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 1rem;
    padding-bottom: 1rem;
    scroll-snap-type: x mandatory;
}

/* --- Custom Scrollbar Styles --- */
#homepage-content .video-grid::-webkit-scrollbar { height: 8px; }
#homepage-content .video-grid::-webkit-scrollbar-track { background: var(--color-surface); border-radius: 10px; }
#homepage-content .video-grid::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }
#homepage-content .video-grid::-webkit-scrollbar-thumb:hover { background: #555; }

/* --- FIX: Make "See all" / Search View a Wrapping Grid --- */
#single-category-content .video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.video-item {
    background-color: var(--color-surface);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    flex: 0 0 calc((100% - 5rem) / 6); /* Fixed width for 6 items per row */
    scroll-snap-align: start;
}

/* --- FIX: Hover effect ONLY on homepage --- */
#homepage-content .video-item:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(229, 9, 20, 0.3);
    border-color: var(--color-primary);
}

.poster-container {
    position: relative;
}

.video-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.video-item h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--color-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/*
================================
--- Details & Player Pages ---
================================
*/
.details-header {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    background: var(--color-surface);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.details-thumbnail {
    max-width: 250px;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 5px 25px rgba(0,0,0,0.4);
}

.details-info { flex: 1; min-width: 300px; }
.details-info h1 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    margin-top: 0;
}
.details-info hr {
    border: none;
    height: 1px;
    background-color: var(--color-border);
    margin: 1.5rem 0;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background-color: #000;
    border-radius: 8px;
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* --- Upgraded Stylish Buttons --- */
.watch-now-button, .download-button, .ep-nav-button {
    background: linear-gradient(45deg, var(--color-primary), #a7060e);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    display: inline-block;
}
.watch-now-button:hover, .download-button:hover, .ep-nav-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    background: linear-gradient(45deg, #f40612, var(--color-primary));
}

.season-title {
    font-family: var(--font-heading);
    margin-top: 2.5rem;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.5rem;
}
.episodes-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.episodes-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.3s;
}
.episodes-table tr:hover td { background-color: #20262d; }
.episodes-table td a { color: var(--color-primary); text-decoration: none; font-weight: bold; }
.episodes-table tr.active td {
    background-color: #381b1d;
    color: var(--color-text-primary);
}
.episodes-table tr.active td a {
    color: #fff;
    font-weight: bold;
}

.episode-nav-buttons {
    display: flex;
    justify-content: space-between;
    margin: 1.5rem 0;
}

/*
================================
--- Loader & Footer ---
================================
*/
#loader {
    border: 8px solid var(--color-border);
    border-top: 8px solid var(--color-primary);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 4rem auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

/*
================================
--- Responsive Styles (Mobile) ---
================================
*/
@media (max-width: 820px) {

    .header-content { flex-wrap: wrap; }
    
    .mobile-icons { display: flex; align-items: center; gap: 1rem; }
    nav, .search-container { display: none; }

    nav { order: 3; width: 100%; margin-top: 1rem; }
    nav.active { display: block; }
    nav ul { flex-direction: column; width: 100%; }
    nav ul li { width: 100%; }
    nav ul li a { text-align: center; border-bottom: 1px solid var(--color-border); }
    .dropdown-content { position: static; display: block; box-shadow: none; border: none; background-color: #20262d; }
    .dropdown-content a { text-align: center; padding-left: 2rem; font-weight: normal; color: var(--color-text-secondary); }
    
    .search-container.active { display: block; order: 4; width: 100%; margin-top: 1rem; }
    
    .nav-toggle, .search-toggle-btn { display: block; background: transparent; border: 0; cursor: pointer; padding: 0; color: var(--color-text-primary); }
    .search-toggle-btn { font-size: 1.2rem; }
    .nav-toggle { width: 30px; height: 30px; position: relative; }

    .hamburger { display: block; position: relative; background-color: var(--color-text-primary); width: 100%; height: 3px; border-radius: 2px; transition: transform 0.3s ease-out; }
    .hamburger::before, .hamburger::after { content: ''; position: absolute; left: 0; background-color: var(--color-text-primary); width: 100%; height: 3px; border-radius: 2px; transition: all 0.3s ease-out; }
    .hamburger::before { top: -8px; }
    .hamburger::after { top: 8px; }
    .nav-toggle.active .hamburger { background-color: transparent; }
    .nav-toggle.active .hamburger::before { transform: rotate(45deg) translate(5px, 6px); }
    .nav-toggle.active .hamburger::after { transform: rotate(-45deg) translate(5px, -6px); }

    /* --- Mobile Grid Adjustments --- */
    #single-category-content .video-grid { 
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
        gap: 1rem; 
    }
    .video-item {
        flex-basis: 150px; /* Adjust item width for mobile scrolling */
    }
    
    #category-title, .category-row-title { font-size: 1.5rem; }
    .details-info h1 { font-size: 2rem; }
    .details-header { flex-direction: column; align-items: center; text-align: center; }
    .details-info { margin-top: 1.5rem; }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 821px) {
    .mobile-icons {
        display: none;
    }
}
