/* ===== LOCAL FONTS - Performance Optimized ===== */
@font-face {
    font-family: 'Outfit';
    src: url('/static/fonts/Outfit-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Outfit';
    src: url('/static/fonts/Outfit-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Outfit';
    src: url('/static/fonts/Outfit-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* Global Essentials */
:root {
    --bg-color: #0d0e12;
    /* Very dark almost black */
    --surface-color: #1a1b21;
    /* Slightly lighter for cards */
    --primary-color: #e50914;
    /* Netflix/Streaming Red */
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --glass-bg: rgba(20, 20, 25, 0.85);
    /* More opaque */
    --glass-border: rgba(255, 255, 255, 0.08);
    --radius-md: 12px;
    --radius-lg: 20px;
    --sidebar-width: 68px;
    /* Reduced specific width */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    display: flex;
}

/* Sidebar Navigation (Glassmorphism) */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid var(--glass-border);
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    /* Prevents text overflow when collapsed */
}

.sidebar:hover {
    width: 200px;
}

/* Expand on hover for desktop */

/* When expanded, show text better */
.sidebar:hover .nav-item {
    align-items: flex-start;
    padding-left: 20px;
}

.sidebar:hover .nav-item i {
    margin-right: 15px;
    margin-bottom: 0;
    font-size: 1.4rem;
}

.sidebar:hover .nav-item span {
    opacity: 1;
    height: auto;
    font-size: 0.95rem;
    margin-top: 0;
}

/* When collapsed (default) */
.nav-item span {
    font-size: 0.75rem;
    text-align: center;
    margin-top: 5px;
    white-space: nowrap;
    opacity: 0;
    /* Hide text by default for ultra-clean look like app */
    transition: opacity 0.2s;
    height: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    /* Icon on top of text */
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 60px;
    /* Fixed height for touch target */
    padding: 0;
    /* Remove padding */
    color: var(--text-secondary);
    text-decoration: none;
    transition: 0.3s;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    margin-bottom: 5px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item i {
    font-size: 1.4rem;
    transition: 0.3s;
}

/* Active Indicator */
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 24px;
    /* More precise, pill shaped indicator */
    width: 3px;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Spacer logic */
.sidebar .spacer {
    flex-grow: 1;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 0;
    min-height: 100vh;
    padding-bottom: 80px;
    /* Space for mobile nav */
}

/* Hero Section */
.hero {
    position: relative;
    height: 70vh;
    /* Taller hero */
    width: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 40px;
}

.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(13, 14, 18, 0) 0%, rgba(13, 14, 18, 0.4) 50%, var(--bg-color) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    margin-bottom: 30px;
}

.hero-badge {
    background: #FFD700;
    color: #000;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 15px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: 4rem;
    /* Bigger title */
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.hero-desc {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    max-width: 500px;
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
}

.btn-play {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.btn-play:hover {
    background: var(--primary-color);
    transform: scale(1.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--primary-color);
}

/* Pagination Dots */
.dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.dot.active {
    width: 20px;
    background: white;
    border-radius: 4px;
}

/* Section & Grid */
.section-title {
    padding: 20px 40px;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
}

.nav-arrow:hover {
    box-shadow: 0 0 15px var(--primary-color);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* Responsive columns */
    gap: 20px;
    padding: 0 40px 60px 40px;
}

.media-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 2 / 3;
    background-color: #222;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: block;
    text-decoration: none;
    color: inherit;
}

a.media-card,
a.media-card:visited,
a.media-card:hover,
a.media-card:active {
    color: var(--text-primary);
    text-decoration: none;
}

.media-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
    z-index: 10;
}

.media-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.media-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 50%;
    opacity: 1;
    /* Always visible */
    transition: 0.3s;
}

.media-card:hover .media-overlay {
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 70%, rgba(0, 0, 0, 0.4) 100%);
}

/* Always show title on mobile though? Maybe better to keep titles visible */
.media-overlay.always-visible {
    opacity: 1;
    height: auto;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.media-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    border-left: 3px solid var(--primary-color);
    padding-left: 10px;
    text-shadow: 2px 2px 4px black;
}

.fav-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    backdrop-filter: blur(5px);
    transition: 0.2s;
    opacity: 0;
    transform: translateY(-10px);
    z-index: 100;
}

.media-card:hover .fav-icon {
    opacity: 1;
    transform: translateY(0);
}

.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
    color: #444;
    background: #111;
}

/* ================= MOBILE OPTIMIZATION ================= */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    /* Bottom Navigation Bar for Mobile */
    .sidebar {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        flex-direction: row;
        padding-top: 0;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        justify-content: space-around;
        background: rgba(13, 14, 18, 0.95);
        /* More solid on mobile to cover content */
    }

    .sidebar:hover {
        width: 100%;
    }

    /* Disable expansion */
    .sidebar:hover .nav-item {
        padding-left: 0;
        align-items: center;
    }

    /* Reset hover styles */
    .sidebar:hover .nav-item i {
        margin-right: 0;
    }

    .sidebar .spacer {
        display: none;
    }

    .nav-item {
        padding: 0;
        height: 100%;
        flex: 1;
    }

    .nav-item i {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }

    .nav-item span {
        font-size: 0.65rem;
    }

    .nav-item.active::before {
        left: 50%;
        top: 0;
        transform: translateX(-50%);
        height: 3px;
        width: 40%;
        border-radius: 0 0 4px 4px;
    }

    .main-content {
        margin-left: 0;
        margin-bottom: 70px;
        /* Space for bottom nav */
        width: 100%;
    }

    .hero {
        height: 50vh;
        padding: 20px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .media-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on mobile */
        padding: 0 20px 40px 20px;
        gap: 15px;
    }

    .section-title {
        padding: 20px;
    }

    .media-overlay {
        opacity: 1;
    }

    /* Always show info on mobile */
    .fav-icon {
        opacity: 1;
        transform: none;
    }
}

/* Hero Favorite Button Fix */
.hero-fav-btn {
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 9999;
    pointer-events: auto;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-fav-btn:hover,
.hero-fav-btn.active {
    background: white;
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Player Styles - Added dynamically */
.player-wrapper {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.player-container {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
}

.player-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
}

.player-header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-primary);
}

.player-area {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    background: #000;
}

.player-area iframe,
.player-area #initialMessage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#initialMessage {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 1.2rem;
    background: #0d0e12;
}

.video-nav {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapter-info {
    font-weight: 600;
    color: var(--primary-color);
}

.report-button {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.report-button:hover {
    color: var(--primary-color);
}

/* Server & Episode Selection */
.server-section {
    margin-top: 40px;
    padding-bottom: 60px;
}

.server-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.server-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.server-tab {
    padding: 10px 25px;
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

.server-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

.server-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(229, 9, 20, 0.3);
}

.server-episodes {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    list-style: none;
}

.server-episodes.active {
    display: grid;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.episode-button {
    width: 100%;
    padding: 12px 5px;
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    text-align: center;
    font-family: 'Outfit', sans-serif;
}

.episode-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

.episode-button.active {
    background: #333;
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}