/* AlloAnime CSS - Premium Dark Theme & Glassmorphism Design */

:root {
    --bg-main: #0a090f;
    --bg-surface: #12101a;
    --bg-elevated: #1b1828;
    --bg-glass: rgba(18, 16, 26, 0.80);

    --accent-purple: #8b3cff;
    --accent-purple-glow: rgba(139, 60, 255, 0.4);
    --accent-purple-hover: #a566ff;

    --text-primary: #ffffff;
    --text-secondary: #9c99ab;
    --text-muted: #646175;

    --color-upload: #ff1744;

    --border-color: rgba(255, 255, 255, 0.05);
    --border-glow: rgba(139, 60, 255, 0.15);

    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;

    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

/* ============================================================
   HEADER
   ============================================================ */
.main-header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4%;
    z-index: 200;
    background: var(--bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}

.logo {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent-purple);
    text-shadow: 0 0 15px var(--accent-purple-glow);
}

.nav-links {
    display: flex;
    gap: 6px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    padding: 7px 14px;
    border-radius: 8px;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.nav-links a.active {
    border-bottom: 2px solid var(--accent-purple);
    border-radius: 8px 8px 0 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 8px 16px;
    gap: 10px;
    width: 240px;
    transition: var(--transition-smooth);
}

.search-box:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
    width: 290px;
}

.search-box i { color: var(--text-secondary); }

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 100%;
    font-size: 14px;
    font-family: var(--font-primary);
}

.search-box input::placeholder { color: var(--text-muted); }

/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: rgba(139,60,255,0.15);
    border-color: var(--accent-purple);
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition-smooth);
    transform-origin: center;
}

.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   MOBILE NAV DRAWER
   ============================================================ */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 300;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mobile-nav-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0; right: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-surface);
    border-left: 1px solid rgba(255,255,255,0.08);
    z-index: 301;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -15px 0 50px rgba(0,0,0,0.6);
}

.mobile-nav-drawer.open {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.mobile-nav-logo {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-primary);
}

.mobile-nav-close {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition-smooth);
}
.mobile-nav-close:hover {
    background: var(--color-upload);
    border-color: var(--color-upload);
}

.mobile-nav-search {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.mobile-search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    gap: 10px;
    transition: var(--transition-smooth);
}

.mobile-search-box:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
}

.mobile-search-box i { color: var(--text-secondary); font-size: 14px; }

.mobile-search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 100%;
    font-size: 14px;
    font-family: var(--font-primary);
}

.mobile-search-box input::placeholder { color: var(--text-muted); }

.mobile-nav-section-label {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    padding: 4px 12px;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
}

.mobile-nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    border-radius: 12px;
    transition: var(--transition-smooth);
}

.mobile-nav-links a i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.mobile-nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.mobile-nav-links a:hover i { color: var(--accent-purple); }

.mobile-nav-links a.active {
    color: #c9a4ff;
    background: rgba(139,60,255,0.15);
    border: 1px solid rgba(139,60,255,0.2);
    font-weight: 600;
}

.mobile-nav-links a.active i { color: var(--accent-purple); }

.mobile-nav-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    flex-shrink: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
    font-family: var(--font-primary);
}

.btn-primary {
    background: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.btn-primary:hover {
    background: var(--accent-purple-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139,60,255,0.6);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero-section {
    position: relative;
    height: 70vh;
    min-height: 500px;
    width: 100%;
    margin-top: 70px;
    display: flex;
    align-items: center;
    padding: 0 6%;
    background-size: cover;
    background-position: center 20%;
    background-image: linear-gradient(to right, rgba(10,9,15,0.95) 30%, rgba(10,9,15,0.3) 100%);
    transition: var(--transition-smooth);
}

.hero-overlay {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 150px;
    background: linear-gradient(to top, var(--bg-main), transparent);
    z-index: 1;
}

.hero-content {
    max-width: 600px;
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(139,60,255,0.2);
    border: 1px solid var(--accent-purple);
    color: #c9a4ff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 64px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 15px;
    letter-spacing: -1.5px;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 25px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.hero-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   CATALOGUE & ADVANCED FILTERS
   ============================================================ */
.catalog-section {
    padding: 40px 6%;
}

.catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.catalog-result-count {
    font-size: 14px;
    color: var(--text-muted);
}

.catalog-result-count span {
    color: var(--accent-purple);
    font-weight: 700;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0;
}

/* Filter Groups */
.filter-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 28px;
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    min-width: 55px;
    flex-shrink: 0;
}

.filter-chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
    font-family: var(--font-primary);
    line-height: 1.5;
}

.filter-btn:hover {
    border-color: var(--accent-purple);
    color: var(--text-primary);
    background: rgba(139,60,255,0.1);
}

.filter-btn.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 2px 10px var(--accent-purple-glow);
}

.filter-divider {
    width: 100%;
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Sort select */
.filter-sort-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    outline: none;
    font-family: var(--font-primary);
}

.filter-sort-select:hover, .filter-sort-select:focus {
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.filter-sort-select option {
    background: var(--bg-surface);
}

/* Active filter summary bar */
.active-filters-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: rgba(139,60,255,0.08);
    border: 1px solid rgba(139,60,255,0.2);
    border-radius: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.active-filters-bar.visible { display: flex; }

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(139,60,255,0.18);
    border: 1px solid rgba(139,60,255,0.3);
    color: #c9a4ff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.clear-filters-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    transition: var(--transition-smooth);
    font-family: var(--font-primary);
}

.clear-filters-btn:hover {
    color: var(--color-upload);
    background: rgba(255,23,68,0.1);
}

/* ============================================================
   ANIME GRID & CARDS
   ============================================================ */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    min-height: 250px;
}

.grid-loader {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 16px;
}

.grid-loader i {
    font-size: 30px;
    color: var(--accent-purple);
}

.anime-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.anime-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-purple);
    box-shadow: 0 12px 30px rgba(139,60,255,0.25);
}

.card-poster-wrapper {
    position: relative;
    width: 100%;
    padding-top: 140%;
    overflow: hidden;
    background-color: var(--bg-elevated);
}

.card-poster {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.anime-card:hover .card-poster { transform: scale(1.05); }

.card-play-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10,9,15,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: var(--transition-smooth);
}

.anime-card:hover .card-play-overlay { opacity: 1; }

.card-play-btn {
    width: 55px;
    height: 55px;
    background: var(--accent-purple);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 0 20px var(--accent-purple-glow);
    transform: scale(0.8);
    transition: var(--transition-smooth);
}

.anime-card:hover .card-play-btn { transform: scale(1); }

.card-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-category {
    font-size: 11px;
    color: var(--accent-purple);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: auto;
}

/* ============================================================
   PLAYER MODAL
   ============================================================ */
.player-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(5,4,8,0.95);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.player-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.player-modal-content {
    position: relative;
    width: 100%; height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.close-player-btn {
    position: absolute;
    top: 15px; right: 25px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    z-index: 1010;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    font-family: var(--font-primary);
}

.close-player-btn:hover {
    background: var(--color-upload);
    border-color: var(--color-upload);
}

.player-main-layout {
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    height: calc(100% - 60px);
    margin-top: 50px;
    gap: 20px;
}

/* Episode Selector Panel & Sub-components */
.episode-selector-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    flex: 1;
    min-width: 320px;
    max-width: 360px;
}

.episode-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.episode-panel-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.episode-nav-arrows {
    display: flex;
    gap: 6px;
}

.ep-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition-smooth);
}

.ep-nav-btn:hover:not(.disabled) {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
}

.ep-nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-manual-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition-smooth);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-manual-toggle:hover {
    color: var(--accent-purple);
}

.manual-input-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.manual-inputs {
    display: flex;
    gap: 10px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.input-field label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 14px;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
}

.input-field input:focus {
    border-color: var(--accent-purple);
}

.btn-manual-play {
    background: var(--accent-purple);
    color: var(--text-primary);
    border: none;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-manual-play:hover {
    background: var(--accent-purple-hover);
}

.season-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: none;
    flex-shrink: 0;
}

.season-tabs::-webkit-scrollbar {
    display: none;
}

.season-tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}

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

.season-tab-btn.active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent-purple);
}

.episode-list-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.episode-list-container::-webkit-scrollbar {
    width: 6px;
}
.episode-list-container::-webkit-scrollbar-track {
    background: transparent;
}
.episode-list-container::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}
.episode-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

.episode-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.episode-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    aspect-ratio: 1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    justify-content: center;
    align-items: center;
}

.episode-btn:hover {
    background: rgba(139, 60, 255, 0.1);
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.episode-btn.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 0 12px var(--accent-purple-glow);
}

/* Episode toggle button — hidden on desktop, shown on mobile */
.episode-toggle-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.episode-toggle-mobile i {
    transition: transform 0.3s ease;
}

.episode-toggle-mobile.open i {
    transform: rotate(180deg);
}

.episode-toggle-mobile:hover {
    background: rgba(139,60,255,0.15);
    border-color: var(--accent-purple);
}

@media (max-width: 1024px) {
    .player-main-layout {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        overflow-y: auto;
        padding-bottom: 40px;
    }
    
    .video-container {
        flex: none;
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }
    
    .episode-selector-panel {
        max-width: none;
        height: 320px;
        margin-left: 0;
        margin-top: 15px;
    }
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 50px rgba(0,0,0,0.8);
    flex: 3;
    width: 0;
    min-width: 0;
    height: 100%;
}

.video-container video,
.video-container iframe,
#iframe-player {
    width: 100%; height: 100%;
    max-height: 80vh;
    object-fit: contain;
    border: none;
}

.video-loader {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10,9,15,0.92);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    gap: 15px;
    padding: 20px;
    text-align: center;
}

.loader-spinner {
    width: 60px; height: 60px;
    border: 4px solid rgba(139,60,255,0.1);
    border-top: 4px solid var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px var(--accent-purple-glow);
}

.video-loader p { font-size: 18px; font-weight: 600; }

.loader-substatus {
    color: var(--text-secondary);
    font-size: 14px !important;
    font-weight: 400 !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    padding: 30px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-surface);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    user-select: none;
    font-family: var(--font-primary);
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: var(--accent-purple);
    color: var(--text-primary);
    background: rgba(139,60,255,0.05);
}

.page-btn.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-btn.ellipsis {
    cursor: default;
    border-color: transparent;
    background: transparent;
}

/* ============================================================
   VIEW ROUTING
   ============================================================ */
.view-container { transition: opacity 0.3s ease; }
.view-container.hidden { display: none; opacity: 0; }

/* ============================================================
   HORIZONTAL CAROUSELS
   ============================================================ */
.scroll-section { padding: 30px 6%; }
.scroll-section:last-of-type { padding-bottom: 60px; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

.scroll-arrows { display: flex; gap: 8px; }

.scroll-arrow {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    font-size: 14px;
}

.scroll-arrow:hover {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.horizontal-scroll-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 5px 20px 5px;
    margin: 0 -5px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.horizontal-scroll-container::-webkit-scrollbar { display: none; }

.horizontal-scroll-container .anime-card { flex: 0 0 200px; }

/* ============================================================
   RESPONSIVE — TABLET (≤992px)
   ============================================================ */
@media (max-width: 992px) {
    .player-main-layout { height: auto; }
    .video-container video { max-height: 55vh; }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤768px)
   ============================================================ */
@media (max-width: 768px) {
    .main-header { padding: 0 16px; height: 60px; }

    .nav-links { display: none; }
    .hamburger-btn { display: flex; }
    .search-box { display: none; }
    .mobile-nav-overlay { display: block; }

    .hero-section {
        height: 55vh;
        min-height: 360px;
        margin-top: 60px;
        padding: 0 5%;
    }

    .hero-title { font-size: 36px; letter-spacing: -1px; }
    .hero-desc { font-size: 14px; -webkit-line-clamp: 2; }
    .hero-meta { gap: 12px; font-size: 13px; }

    .catalog-section { padding: 20px 4%; }

    .filter-groups { padding: 14px; gap: 8px; }
    .filter-group-label { min-width: 48px; font-size: 11px; }
    .filter-btn { padding: 4px 11px; font-size: 12px; }

    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }

    .horizontal-scroll-container .anime-card { flex: 0 0 155px; }
    .scroll-arrows { display: none; }
    .scroll-section { padding: 18px 4%; }

    .section-title { font-size: 20px; }

    .page-btn { min-width: 38px; height: 38px; font-size: 13px; }

    /* ====== MOBILE PLAYER MODAL ====== */
    .player-modal-content {
        height: 100%;
        display: flex;
        flex-direction: column;
        padding: 10px;
        overflow: hidden;
    }

    .close-player-btn {
        position: relative;
        top: 0;
        right: 0;
        align-self: flex-end;
        padding: 6px 12px;
        font-size: 13px;
        margin-bottom: 8px;
    }

    .player-main-layout {
        display: flex;
        flex-direction: column;
        height: calc(100% - 45px);
        margin-top: 0;
        gap: 10px;
        padding-bottom: 10px;
        overflow: hidden;
    }

    .video-container {
        position: relative;
        border-radius: 10px;
        flex-shrink: 0;
        width: 100%;
        height: 0;
        padding-top: 56.25%;
        overflow: hidden;
        background: #000;
    }

    .video-container video, 
    .video-container iframe,
    #iframe-player {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        object-fit: contain;
        border: none;
    }

    /* Show the episode toggle button on mobile */
    .episode-toggle-mobile {
        display: flex;
        flex-shrink: 0;
    }

    /* Episode panel: hidden by default on mobile, toggle reveals it */
    .episode-selector-panel {
        display: none;
        max-width: none;
        min-width: 0;
        height: 0;
        max-height: 0;
        overflow: hidden;
        margin-top: 0;
        margin-left: 0;
        border: none;
        padding: 0;
        opacity: 0;
        background: var(--bg-surface);
        border-radius: 12px;
        transition: opacity 0.3s ease;
    }

    .episode-selector-panel.mobile-open {
        display: flex !important;
        height: auto !important;
        flex: 1;
        min-height: 0;
        max-height: none;
        opacity: 1;
        padding: 15px;
        margin-top: 5px;
        border: 1px solid var(--border-color);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .episode-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .episode-btn {
        font-size: 12px;
        border-radius: 6px;
    }

    .season-tab-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .episode-panel-header h3 {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .hero-title { font-size: 26px; }
    .anime-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .horizontal-scroll-container .anime-card { flex: 0 0 138px; }
    .btn { padding: 10px 20px; font-size: 14px; }
    .catalog-section { padding: 16px 3%; }

    /* Even smaller player adjustments */
    .player-main-layout {
        margin-top: 35px;
    }

    .episode-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .close-player-btn {
        top: 6px;
        right: 6px;
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 20px;
    }
}
