@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Anton&display=swap');

:root {
    --background-dark: #141414;
    --sidebar-bg: #1a1a1a;
    --header-bg-scrolled: #101010;
    --text-primary: #ffffff;
    --text-secondary: #a8a7ad;
    --accent-purple: #8c72ff;
    --card-gap: 15px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: var(--background-dark); color: var(--text-primary); font-family: 'Roboto', sans-serif; overflow-x: hidden; }
.main-container { display: flex; }
::-webkit-scrollbar{width:5px}::-webkit-scrollbar-track{background:#1a1a1a;border-radius:10px}::-webkit-scrollbar-thumb{background-color:#4f4f4f;border-radius:10px;border:2px solid #1a1a1a}::-webkit-scrollbar-thumb:hover{background-color:#6a6a6a}*{scrollbar-width:thin;scrollbar-color:#4f4f4f #1a1a1a}
.bi { vertical-align: -0.125em; }

/* ===== SIDEBAR (Desktop) ===== */
.sidebar { width: 150px; background-color: var(--sidebar-bg); height: 100vh; position: fixed; top: 0; left: 0; padding-top: 15px; z-index: 101; }
.logo { font-family: 'Anton', sans-serif; font-size: 32px; font-weight: 400; margin-bottom: 30px; padding: 0 30px; }
.sidebar .nav-links { list-style: none; }
.sidebar .nav-links li { margin-bottom: 5px; }
.sidebar .nav-links a { color: var(--text-secondary); text-decoration: none; font-size: 17px; padding: 15px 25px; display: block; position: relative; cursor: pointer; }
.sidebar .nav-links a.active { color: var(--text-primary); font-size: 18px; font-weight: bold; background: linear-gradient(to right, rgba(140, 114, 255, 0.2), transparent); }
.sidebar .nav-links a:hover {color: var(--accent-purple); }
.category-link { position: absolute; bottom: 0; width: 100%; border-top: 1px solid #222; padding: 20px 0; text-align: center; }
.category-link a { color: var(--text-secondary); text-decoration: none; font-size: 16px; }

/* ===== MAIN CONTENT & HEADER (Desktop) ===== */
.main-content { margin-left: 150px; width: calc(100% - 150px); height: 100vh; overflow-y: auto; }
#main-header { position: fixed; top: 0; left: 150px; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 15px 40px; z-index: 100; transition: background-color 0.3s ease; }
#main-header.scrolled { background-color: var(--header-bg-scrolled); box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.header-left, .header-right { display: flex; align-items: center; gap: 20px; }
.search-bar { position: relative; }
.search-bar i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--accent-purple); }
.search-bar input { background-color: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: var(--text-primary); padding: 10px 15px 10px 40px; border-radius: 10px; width: 300px; font-size: 15px; }
.search-bar input:focus {
    outline: none;
}
.vip-btn { background: linear-gradient(to right, #FFC371, #FF5F6D); color: white; border: none; padding: 10px 15px; border-radius: 20px; font-weight: bold; cursor: pointer; }
.header-link { color: var(--text-secondary); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.header-icon { font-size: 20px; color: var(--text-secondary); text-decoration: none; }
.header-profile { width: 32px; height: 32px; border-radius: 50%; background-color: #333; }

/* Hide mobile header on desktop by default */
#mobile-fixed-header { display: none; }

/* ===== HERO SECTION ===== */
#hero-section { height: 70vh; position: relative; display: flex; align-items: flex-end; padding: 40px 40px 20px 40px; transition: opacity 0.3s ease-in-out; }
#hero-background { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-size: cover; background-position: center 20%; transition: background-image 0.5s ease-in-out; z-index: 1; }
#hero-background::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(to bottom, rgba(20, 20, 20, 0) 0%, transparent 50%), linear-gradient(to top, var(--background-dark) 20%, transparent 70%); }
#hero-logo { position: absolute; top: 100px; left: 40px; z-index: 2; max-width: 350px; max-height: 150px; opacity: 0; transition: opacity 0.5s ease; }
#hero-logo.visible { opacity: 1; }
.hero-details { position: relative; z-index: 2; }
#hero-title { font-size: 18px; font-weight: 300; margin-bottom: 15px; max-width: 80%; }
.hero-indicators { display: flex; gap: 8px; }
.indicator-thumb { width: 75px; height: 40px; border-radius: 6px; overflow: hidden; cursor: pointer; transition: all 0.3s; position: relative; }
.indicator-thumb::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.6); transition: background-color 0.3s ease; }
.indicator-thumb.active::after { background-color: rgba(0,0,0,0); }
.indicator-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ===== MEDIA SECTIONS & CAROUSEL ===== */
#carousels-container { transition: opacity 0.3s ease-in-out; }
#carousels-container.loading { opacity: 0; pointer-events: none; }
.media-section { padding: 20px 40px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-header h2 { font-size: 22px; }
.switch-btn { color: var(--text-secondary); text-decoration: none; font-size: 14px; }
.carousel-container { position: relative; }
.media-carousel { display: flex; overflow-x: auto; gap: var(--card-gap); scrollbar-width: none; -ms-overflow-style: none; scroll-behavior: smooth; scroll-snap-type: x mandatory; transition: opacity 0.3s ease-in-out; }
.media-carousel.loading-switch { opacity: 0.3; pointer-events: none; }
.media-carousel::-webkit-scrollbar { display: none; }
.media-card { flex: 0 0 15.5%; min-width: 160px; text-decoration: none; color: var(--text-primary); scroll-snap-align: start; position: relative; }
.media-card .card-image-container { position: relative; }
.media-card img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; margin-bottom: 10px; display: block; }
.media-card p { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 22px; line-height: 22px; margin: 0; }
.media-card .card-image-container::after{content:'';position:absolute;bottom:-1px;left:0;width:100%;height:50%;background:linear-gradient(to top,rgba(0,0,0,0.85),transparent);border-radius:0 0 12px 12px;z-index:2}
.episode-overlay{position:absolute;bottom:10px;left:12px;color:#fff;padding-left:10px;font-size:13px;font-weight:500;z-index:3;background:none;border-radius:0}.episode-overlay::before{content:'';position:absolute;left:0;top:50%;transform:translateY(-50%);width:5px;height:60%;background-color:var(--accent-purple);border-radius:2px}
.carousel-arrow { position: absolute; top: 40%; transform: translateY(-50%); background-color: rgba(20, 20, 20, 0.7); border: 1px solid #333; color: white; width: 45px; height: 45px; border-radius: 50%; cursor: pointer; z-index: 20; opacity: 0; transition: opacity 0.3s, transform 0.3s; }
.carousel-container:hover .carousel-arrow { opacity: 1; }
.carousel-arrow:hover { transform: translateY(-50%) scale(1.1); background-color: rgba(20, 20, 20, 0.9); }
.left-arrow { left: -20px; }
.right-arrow { right: -20px; }
.carousel-arrow.hidden { display: none; }

/* ===== SKELETON LOADER ===== */
.media-card.loading { position: relative; background-color: #202020; border-radius: 12px; animation: pulse-bg 2s infinite ease-in-out; pointer-events: none; aspect-ratio: 2 / 3; display: flex; align-items: center; justify-content: center; }
.media-card.loading .card-image-container, .media-card.loading .skeleton-text, .media-card.loading img, .media-card.loading p { display: none; }
.media-card.loading::before { content: 'i-FLIX'; font-family: 'Anton', sans-serif; font-size: 1.2rem; color: rgba(255, 255, 255, 0.1); }
@keyframes pulse-bg { 0% { background-color: #202020; } 50% { background-color: #262626; } 100% { background-color: #202020; } }

/* ==========================================================================
   MOBILE RESPONSIVE STYLES
   ========================================================================== */
@media (max-width: 768px) {
    /* Hide desktop elements on mobile */
    .sidebar, #main-header { display: none; }
    .main-content { margin-left: 0; width: 100%; }

    /* --- MOBILE FIXED HEADER --- */
    #mobile-fixed-header {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 102;
        background: transparent;
        transition: background-color 0.3s ease;
        padding-top: 5px; 
    }
    #mobile-fixed-header.scrolled {
        background-color: var(--header-bg-scrolled);
        box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    }
    
    .mobile-header-top {
        display: flex;
        justify-content: space-between; 
        align-items: center;
        height: 50px;
        padding: 0 15px;
        gap: 15px;
    }

    .mobile-search-bar {
        position: relative;
        flex-grow: 1; 
    }
    
    .mobile-search-bar .bi-search {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        color: white; 
        font-size: 15px;
    }

    #mobile-search-input {
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: var(--text-primary);
        border-radius: 20px;
        padding: 8px 40px 8px 15px; 
        width: 100%; 
        font-size: 14px;
    }
    
    #mobile-search-input:focus {
        outline: none;
        box-shadow: none;
    }

    .mobile-action-icons {
        display: flex;
        align-items: center;
        justify-content: space-between; 
        flex-basis: 110px; 
    }

    .mobile-action-icons .header-icon {
        font-size: 20px; 
        color: var(--text-primary);
    }

    /* --- MOBILE NAVIGATION WRAPPER (This is now the top part) --- */
    .mobile-nav-wrapper {
        position: relative;
    }
    .nav-links-mobile { 
        display: flex; 
        align-items: center; 
        overflow-x: auto; 
        list-style: none;
        padding: 5px 15px 10px 15px;
        padding-right: 60px;
        -ms-overflow-style: none; 
        scrollbar-width: none; 
        width:85%;
    }
    .nav-links-mobile::-webkit-scrollbar { display: none; }
    .nav-links-mobile li { flex-shrink: 0; }
    .nav-links-mobile a { 
        display: block;
        margin-right: 15px;
        font-size: 15px; 
        color: var(--text-secondary);
        text-decoration: none;
        white-space: nowrap; 
        position: relative; 
    }
    .nav-links-mobile a.active { 
        color: var(--text-primary); 
        font-weight: bold;
    }
    .nav-links-mobile a.active::after { 
        content: ''; 
        position: absolute; 
        bottom: -5px; 
        left: 50%; 
        transform: translateX(-50%); 
        width: 25px; 
        height: 3px; 
        background-color: var(--accent-purple); 
        border-radius: 2px; 
    }
    .hamburger-menu-mobile {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        background: none;
        pointer-events: none; 
    }
     .hamburger-menu-mobile i {
        pointer-events: all; 
        cursor: pointer;
    }

    /* --- HERO & MAIN CONTENT ADJUSTMENTS --- */
    #hero-section { 
        height: 36vh; 
        padding: 0; 
        display: flex; 
        align-items: flex-end;
        padding-top: 105px; 
    }
    
    /* MODIFIED: Hide logo but show title */
    #hero-logo { display: none; }
    #hero-title {
        display: block; /* Make sure title is visible */
        font-size: 16px;
        font-weight: 500;
        margin-bottom: 0; /* Remove bottom margin */
        white-space: nowrap; /* Prevent title from wrapping */
        overflow: hidden; /* Hide overflow */
        text-overflow: ellipsis; /* Add ellipsis for long text */
        flex-grow: 1; /* Allow title to take up available space */
        min-width: 0; /* Important for flex and ellipsis to work together */
    }

    /* MODIFIED: hero-details is now a flex container */
    .hero-details { 
        width: 100%; 
        padding: 0 15px 15px 15px; 
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 15px; /* Adds space between title and dots */
    }

    .hero-indicators { 
        display: flex; 
        /* justify-content: flex-end; No longer needed here */
        gap: 5px;
        flex-shrink: 0; /* Prevent dots from shrinking */
    }
    .indicator-thumb { width: 4px; height: 4px; border-radius: 50%; background-color: rgba(255, 255, 255, 0.5); transition: width 0.3s ease; }
    .indicator-thumb img, .indicator-thumb::after { display: none; }
    .indicator-thumb.active { 
        background-color: var(--text-primary); 
        width: 8px;
        height: 4px;
        border-radius: 4px; 
    }

    /* --- OTHER MOBILE STYLES --- */
    .media-section { padding: 20px 15px; }
    .section-header h2 { font-size: 17px; }
    .media-card { flex-basis: calc(33.333% - 10px); min-width: calc(33.333% - 10px); }
    .carousel-arrow { display: none; }
    
    .media-card p {
        font-size: 13px;
        height: 18px;
        line-height: 18px;
    }
    .episode-overlay {
        font-size: 9px;
    }
}
