/* ==========================================
   ANIMEFLIX - PREMIUM ANIME THEME (CLEAN VERSION)
   ========================================== */

/* --- RESET & BASE --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12111a;
    --bg-card: #1a1925;
    --bg-card-hover: #232136;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-dark: #6d28d9;
    --accent-glow: rgba(139, 92, 246, 0.4);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #2d2b3d;
    --sub-color: #3b82f6;
    --dub-color: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
img { display: block; max-width: 100%; }
select { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* --- PRELOADER --- */
#preloader {
    position: fixed; inset: 0; z-index: 99999;
    background: var(--bg-primary);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: opacity 0.5s;
}
#preloader.hide { opacity: 0; pointer-events: none; }
#preloader p { margin-top: 20px; color: var(--text-muted); font-size: 14px; }
.loader-ring { width: 50px; height: 50px; position: relative; }
.loader-ring div {
    position: absolute; width: 100%; height: 100%;
    border: 3px solid transparent; border-top-color: var(--accent);
    border-radius: 50%; animation: spin 1.2s linear infinite;
}
.loader-ring div:nth-child(2) { animation-delay: -0.3s; border-top-color: var(--accent-light); }
.loader-ring div:nth-child(3) { animation-delay: -0.6s; border-top-color: var(--sub-color); }
.loader-ring div:nth-child(4) { animation-delay: -0.9s; border-top-color: var(--dub-color); }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- NAVBAR --- */
#navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    width: 100%;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    transition: var(--transition);
}
#navbar.scrolled { background: rgba(10, 10, 15, 0.95); border-bottom-color: var(--border); }
.nav-inner {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 30px;
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
    box-sizing: border-box;
}
.nav-logo { font-size: 22px; font-weight: 800; color: #fff; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.nav-logo span { background: linear-gradient(135deg, var(--accent), var(--sub-color)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-link {
    padding: 8px 14px; border-radius: 6px; font-size: 14px; font-weight: 500;
    color: var(--text-secondary); transition: var(--transition);
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(139, 92, 246, 0.15); }
.nav-dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px 0; min-width: 180px;
    box-shadow: var(--shadow); max-height: 400px; overflow-y: auto;
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a {
    display: block; padding: 8px 16px; font-size: 13px;
    color: var(--text-secondary); transition: var(--transition);
}
.dropdown-menu a:hover { color: #fff; background: rgba(139, 92, 246, 0.1); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-search {
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); transition: var(--transition);
}
.nav-search:hover { color: #fff; background: rgba(139, 92, 246, 0.2); }
.nav-hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 5px; }
.nav-hamburger span { width: 22px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: var(--transition); }

@media (min-width: 769px) { .nav-inner { max-width: 100%; padding: 0 40px; } }
@media (max-width: 1024px) and (min-width: 769px) { .nav-inner { padding: 0 20px; } .nav-link { padding: 8px 10px; font-size: 13px; } }
@media (max-width: 768px) { .nav-inner { padding: 0 15px; } .nav-links { display: none; } .nav-hamburger { display: flex; } }

/* --- SEARCH OVERLAY --- */
.search-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    display: none; flex-direction: column; align-items: center;
    padding-top: 100px;
}
.search-overlay.active { display: flex; }
.search-box { width: 90%; max-width: 600px; position: relative; }
.search-box input {
    width: 100%; padding: 16px 50px 16px 24px;
    background: var(--bg-card); border: 2px solid var(--border);
    border-radius: 50px; color: #fff; font-size: 16px; outline: none;
    transition: var(--transition);
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 30px var(--accent-glow); }
.search-close {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 20px;
}
.search-results { width: 90%; max-width: 600px; margin-top: 20px; max-height: 50vh; overflow-y: auto; }
.search-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: var(--radius);
    cursor: pointer; transition: var(--transition);
}
.search-item:hover { background: var(--bg-card); }
.search-item img { width: 45px; height: 65px; object-fit: cover; border-radius: 4px; }
.search-item-info h4 { font-size: 14px; color: #fff; }
.search-item-info p { font-size: 12px; color: var(--text-muted); }
.search-tags { width: 90%; max-width: 600px; margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-tags span { color: var(--text-muted); font-size: 13px; }
.search-tags button {
    padding: 6px 14px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 20px; font-size: 12px; color: var(--text-secondary);
    transition: var(--transition);
}
.search-tags button:hover { border-color: var(--accent); color: #fff; }

/* --- HERO SLIDER --- */
.hero-section { position: relative; height: 520px; margin-top: 64px; overflow: hidden; }
.hero-slider { position: relative; width: 100%; height: 100%; }
.hero-slide {
    position: absolute; inset: 0; opacity: 0;
    transition: opacity 0.8s ease;
    display: flex; align-items: flex-end;
    overflow: hidden;
}
.hero-slide.active { opacity: 1; }
.hero-bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center top;
    filter: brightness(0.45);
    transform: scale(1);
    transition: transform 6s ease-in-out;
    will-change: transform;
}
.hero-slide.active .hero-bg { transform: scale(1.1); }
.hero-content {
    position: relative; z-index: 4;
    padding: 0 40px 60px;
    max-width: 600px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.6s ease 0.3s;
    pointer-events: none;
}
.hero-content * { pointer-events: auto; }
.hero-slide.active .hero-content { transform: translateY(0); opacity: 1; }
.hero-gradient {
    position: absolute; inset: 0;
    background: linear-gradient(to right, rgba(10,10,15,0.97) 0%, rgba(10,10,15,0.7) 40%, rgba(10,10,15,0.3) 70%, transparent 100%),
        linear-gradient(to top, rgba(10,10,15,1) 0%, rgba(10,10,15,0.6) 15%, transparent 40%),
        linear-gradient(to bottom, rgba(10,10,15,0.8) 0%, transparent 20%);
}
.hero-bottom-fade {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 150px;
    background: linear-gradient(to top, var(--bg-primary) 0%, transparent 100%);
    z-index: 2; pointer-events: none;
}
.hero-tag {
    display: inline-block; padding: 4px 12px;
    background: var(--accent); color: #fff;
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    border-radius: 4px; margin-bottom: 12px;
}
.hero-title {
    font-size: 42px; font-weight: 800; line-height: 1.1;
    margin-bottom: 16px; text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.hero-desc {
    font-size: 15px; color: var(--text-secondary);
    margin-bottom: 24px; line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-btns { display: flex; gap: 12px; }
.btn-hero {
    padding: 12px 28px; border-radius: 6px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    transition: var(--transition);
}
.btn-play-hero { background: var(--accent); color: #fff; }
.btn-play-hero:hover { background: var(--accent-light); transform: translateY(-2px); }
.btn-info-hero { background: rgba(255,255,255,0.1); color: #fff; backdrop-filter: blur(10px); }
.btn-info-hero:hover { background: rgba(255,255,255,0.2); }
.hero-dots {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px; z-index: 5;
}
.hero-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: rgba(255,255,255,0.3); cursor: pointer;
    transition: var(--transition);
}
.hero-dot.active { background: var(--accent); transform: scale(1.2); }
.hero-counter {
    position: absolute; top: 20px; right: 20px;
    background: rgba(0,0,0,0.5); padding: 6px 12px;
    border-radius: 20px; font-size: 13px; font-weight: 600;
    color: #fff; z-index: 5; backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

/* --- SECTIONS & SLIDERS --- */
.section { padding: 20px 0 40px 0; position: relative; }
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; padding: 0 20px;
}
.section-header h2 { font-size: 20px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.see-all { font-size: 12px; color: var(--text-secondary); font-weight: 600; transition: var(--transition); cursor: pointer; }
.see-all:hover { color: var(--accent); }

.slider-container { position: relative; width: 100%; overflow: hidden; padding: 10px 0; }
.slider-track {
    display: flex; gap: 12px; overflow-x: auto; scroll-behavior: smooth;
    padding: 10px 20px; scrollbar-width: none; -ms-overflow-style: none;
    width: calc(100% - 40px); margin: 0 auto;
}
.slider-track::-webkit-scrollbar { display: none; }

.anime-card {
    flex: 0 0 auto; width: 160px; border-radius: var(--radius-lg);
    overflow: hidden; cursor: pointer; background: var(--bg-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative; flex-shrink: 0;
}
.anime-card:hover { transform: scale(1.05); box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 10; }
.card-poster { position: relative; width: 100%; aspect-ratio: 2/3; overflow: hidden; }
.card-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.anime-card:hover .card-poster img { transform: scale(1.1); }
.card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 60%);
    opacity: 0; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.anime-card:hover .card-overlay { opacity: 1; }
.card-play-icon {
    width: 40px; height: 40px; background: var(--accent);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px; box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(0.8); transition: var(--transition);
}
.anime-card:hover .card-play-icon { transform: scale(1); }
.card-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; z-index: 2; }
.card-badge { padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; color: #fff; }
.badge-sub { background: var(--sub-color); }
.badge-dub { background: var(--dub-color); }
.badge-ongoing { background: var(--success); }
.card-rating {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,0.7); padding: 2px 6px;
    border-radius: 4px; font-size: 11px; color: var(--warning); font-weight: 700;
}
.card-eps {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.7); padding: 2px 8px;
    border-radius: 4px; font-size: 11px; color: #fff;
}
.card-info { padding: 10px; }
.card-title { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.card-meta { font-size: 11px; color: var(--text-muted); display: flex; justify-content: space-between; }

.slider-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; background: rgba(0,0,0,0.5);
    border: none; border-radius: 50%; color: #fff; font-size: 20px;
    cursor: pointer; z-index: 20; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); opacity: 0; pointer-events: none;
}
.slider-container:hover .slider-arrow { opacity: 1; pointer-events: auto; }
.slider-arrow.left { left: 10px; }
.slider-arrow.right { right: 10px; }
.slider-arrow:hover { background: var(--accent); }

/* --- SCHEDULE --- */
.schedule-tabs { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; }
.sched-tab {
    padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-secondary); font-size: 13px;
    transition: var(--transition);
}
.sched-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
    width: 100%;
}
.schedule-item {
    display: flex; align-items: center; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 16px; transition: var(--transition); cursor: pointer; width: 100%;
}
.schedule-item:hover { background: var(--bg-card-hover); border-color: var(--accent); transform: translateX(5px); }
.schedule-time-box {
    flex-shrink: 0; width: 80px; text-align: center;
    padding-right: 15px; border-right: 1px solid var(--border);
    margin-right: 15px; display: flex; flex-direction: column; justify-content: center;
}
.schedule-time-box .time { font-size: 16px; font-weight: 700; color: var(--accent); line-height: 1.2; }
.schedule-time-box .date { font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-top: 4px; font-weight: 600; }
.schedule-info { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.schedule-img { width: 50px; height: 70px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.schedule-details { flex: 1; min-width: 0; }
.schedule-title { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.schedule-ep-badge { background: var(--sub-color); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; margin-left: auto; display: inline-block; }

/* --- BROWSE FILTERS --- */
.browse-filters-wrapper { width: 100%; }
.browse-filters {
    display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px;
    background: var(--bg-card); padding: 16px; border-radius: var(--radius);
}
.browse-filters select {
    flex: 1; min-width: 140px; padding: 10px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 6px; color: #fff; font-size: 13px;
}
.filter-toggle-btn { display: none; }

/* --- MODAL (DETAIL) --- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(10px);
    display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content {
    width: 90%; max-width: 1100px; max-height: 90vh;
    background: var(--bg-secondary); border-radius: var(--radius-lg);
    overflow-y: auto; position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-close {
    position: absolute; top: 16px; right: 16px; z-index: 10;
    width: 36px; height: 36px; background: rgba(0,0,0,0.6);
    border-radius: 50%; color: #fff; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger); }
.modal-banner { height: 350px; background-size: cover; background-position: center; position: relative; }
.modal-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg-secondary) 0%, transparent 100%); }
.modal-body { display: flex; gap: 30px; padding: 0 30px 30px; margin-top: -100px; position: relative; z-index: 2; }
.modal-left { flex-shrink: 0; }
.modal-poster { width: 220px; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.modal-right { flex: 1; }
.modal-title { font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 12px; }
.modal-meta { display: flex; gap: 16px; color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.modal-badges { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.modal-badges span { padding: 4px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; font-size: 12px; color: var(--text-secondary); }
.modal-synopsis { font-size: 15px; color: var(--text-primary); line-height: 1.7; margin-bottom: 24px; max-height: 150px; overflow-y: auto; }
.modal-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.info-item h4 { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.info-item p { font-size: 14px; color: #fff; font-weight: 600; }
.modal-actions { display: flex; gap: 12px; }
.btn-play { flex: 1; padding: 14px; background: var(--accent); color: #fff; border-radius: 6px; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: var(--transition); }
.btn-play:hover { background: var(--accent-light); transform: translateY(-2px); }
.btn-add { padding: 14px 24px; background: var(--bg-card); border: 1px solid var(--border); color: #fff; border-radius: 6px; font-weight: 600; transition: var(--transition); }
.btn-add:hover { border-color: var(--accent); color: var(--accent); }

/* --- EPISODES GRID --- */
.modal-episodes { border-top: 1px solid var(--border); padding: 24px 30px; }
.ep-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.ep-header h3 { font-size: 18px; color: #fff; margin: 0; }
.ep-range { font-size: 13px; color: var(--text-muted); }
.ep-select {
    padding: 6px 12px; background: #1a1a2e; border: 1px solid #2d2b3d;
    border-radius: 6px; color: #fff; font-size: 13px; font-weight: 600;
    cursor: pointer; outline: none; transition: all 0.2s; min-width: 140px;
}
.ep-select:hover { border-color: #8b5cf6; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; }
.ep-btn {
    padding: 10px 0; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-secondary); font-size: 13px; font-weight: 600;
    text-align: center; cursor: pointer; transition: all 0.2s;
}
.ep-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.ep-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ep-btn.watched { background: rgba(139, 92, 246, 0.2); color: var(--accent); }

/* --- VIDEO MODAL --- */
.video-overlay {
    position: fixed; inset: 0; z-index: 4000;
    background: #000; display: none; align-items: center; justify-content: center;
}
.video-overlay.active { display: flex; }
.video-container {
    width: 100%; height: 100%; position: relative;
    display: flex; flex-direction: column; background: #000;
}
.video-close {
    position: absolute; top: 15px; right: 15px; z-index: 9999;
    width: 40px; height: 40px; background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 50%;
    color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.video-close:hover { background: var(--danger); border-color: var(--danger); transform: scale(1.1); }

.video-frame { flex: 1; width: 100%; background: #000; display: flex; align-items: center; justify-content: center; }
.video-frame iframe { width: 100%; height: 100%; border: none; }

.video-info {
    padding: 15px 20px; background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}
.video-main-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.video-left { flex: 1; min-width: 0; }
.video-left h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 0 0 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-left span { display: block; font-size: 12px; color: var(--text-muted); }
.video-controls-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.server-buttons { display: flex; gap: 4px; background: var(--bg-card); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.server-btn { padding: 6px 14px; font-size: 12px; font-weight: 700; color: var(--text-muted); transition: all 0.2s; cursor: pointer; border: none; background: none; }
.server-btn.active { background: var(--accent); color: #fff; }
.server-btn:hover:not(.active) { color: #fff; background: rgba(139, 92, 246, 0.2); }

.video-lang-toggle { display: flex; background: var(--bg-card); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.vlang-btn { padding: 6px 14px; font-size: 12px; font-weight: 700; color: var(--text-muted); transition: all 0.2s; cursor: pointer; border: none; background: none; }
.vlang-btn.active { background: var(--accent); color: #fff; }
.vlang-btn:hover:not(.active) { color: #fff; background: rgba(139, 92, 246, 0.2); }

.video-nav { display: flex; gap: 8px; }
.ep-nav-btn {
    padding: 6px 14px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: #fff; font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.ep-nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.ep-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* --- ANIME GRID --- */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px;
    width: 100%;
}
.anime-grid .anime-card { width: 100%; flex: none; flex-shrink: 1; transform: none !important; }
.anime-grid .anime-card:hover { transform: translateY(-8px) !important; }

/* --- PAGINATION --- */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 6px; margin-top: 30px; padding: 10px 0; flex-wrap: wrap;
}
.page-btn {
    min-width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-secondary); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.page-btn:hover:not(:disabled):not(.active) { border-color: var(--accent); color: #fff; background: rgba(139, 92, 246, 0.15); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-btn.nav-btn { padding: 0 14px; font-size: 13px; }
.page-dots { color: var(--text-muted); font-size: 14px; padding: 0 4px; }

/* --- MAIN CONTENT LAYOUT --- */
.main-content { width: 100%; max-width: 100%; margin: 0; padding: 0; box-sizing: border-box; float: none; }
.main-content .container { width: 100%; max-width: 100%; padding: 0 20px; box-sizing: border-box; }

body.home .main-content { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
body.browse .main-content,
body.movies .main-content,
body.schedule .main-content,
body.myList .main-content {
    max-width: 1280px !important; margin: 0 auto !important;
    padding: 80px 20px 20px 20px !important;
}
body.browse .main-content .container,
body.movies .main-content .container,
body.schedule .main-content .container,
body.myList .main-content .container {
    max-width: 1280px !important; width: 100% !important; padding: 0 !important;
}

/* --- FAB BUTTON --- */
.fab-button {
    position: fixed; bottom: 30px; right: 30px;
    width: 60px; height: 60px; background: var(--accent); color: #fff;
    border: none; border-radius: 50%;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
    cursor: pointer; z-index: 9998;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
    animation: pulse 2s infinite;
}
.fab-button:hover { transform: scale(1.1); box-shadow: 0 6px 25px rgba(139, 92, 246, 0.7); }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(139, 92, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

/* --- TOP 10 MODAL --- */
.top10-modal-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px); z-index: 9999;
    display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
}
.top10-modal-overlay.active { display: flex; opacity: 1; }
.top10-modal-content {
    background: var(--bg-secondary); width: 90%; max-width: 400px;
    max-height: 85vh; border-radius: 16px; border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); overflow: hidden;
    display: flex; flex-direction: column;
    transform: scale(0.9); transition: transform 0.3s ease;
}
.top10-modal-overlay.active .top10-modal-content { transform: scale(1); }
.top10-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-card); flex-shrink: 0;
}
.top10-modal-header h3 { margin: 0; font-size: 18px; color: #fff; }
.top10-close-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 24px; cursor: pointer; line-height: 1; padding: 0;
    width: 30px; height: 30px; display: flex; align-items: center;
    justify-content: center; border-radius: 50%; transition: var(--transition);
}
.top10-close-btn:hover { background: var(--danger); color: #fff; }
.top10-modal-content .top10-tabs {
    display: flex; gap: 4px; margin: 15px 0 0 0;
    background: var(--bg-card); border-radius: 6px; padding: 4px;
    width: calc(100% - 40px); margin-left: 20px; margin-right: 20px; flex-shrink: 0;
}
.top10-modal-content .top10-tab {
    flex: 1; padding: 6px 0; border-radius: 4px; font-size: 12px;
    font-weight: 600; color: var(--text-muted); transition: var(--transition);
    cursor: pointer; text-align: center; background: transparent; border: none;
}
.top10-modal-content .top10-tab.active { background: var(--accent); color: #fff; }
.top10-modal-content .top10-tab:hover:not(.active) { color: #fff; background: rgba(139, 92, 246, 0.15); }
.top10-modal-content .top10-list {
    padding: 0 20px 20px; overflow-y: auto; flex: 1;
    display: flex; flex-direction: column; gap: 10px;
}
.top10-modal-content .top10-item {
    display: flex; align-items: center; gap: 10px; padding: 8px;
    border-radius: 6px; transition: var(--transition); cursor: pointer;
    width: 100%; box-sizing: border-box;
}
.top10-modal-content .top10-item:hover { background: var(--bg-card-hover); }
.top10-modal-content .top10-rank { font-size: 18px; font-weight: 800; min-width: 24px; text-align: center; }
.top10-modal-content .top10-rank.gold { color: #fbbf24; }
.top10-modal-content .top10-rank.silver { color: #94a3b8; }
.top10-modal-content .top10-rank.bronze { color: #d97706; }
.top10-modal-content .top10-rank.normal { color: var(--text-muted); }
.top10-modal-content .top10-img { width: 45px; height: 65px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.top10-modal-content .top10-info { flex: 1; min-width: 0; }
.top10-modal-content .top10-title { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top10-modal-content .top10-views { font-size: 11px; color: var(--accent); font-weight: 600; }

/* --- FOOTER --- */
.site-footer {
    background: var(--bg-secondary); border-top: 1px solid var(--border);
    padding: 60px 0 20px; margin-top: 60px;
}
.footer-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px; margin-bottom: 40px;
}
.footer-col h3 { font-size: 20px; color: #fff; margin-bottom: 16px; }
.footer-col h4 { font-size: 16px; color: #fff; margin-bottom: 16px; }
.footer-col p { color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.footer-col a {
    display: block; color: var(--text-secondary); font-size: 14px;
    margin-bottom: 10px; transition: var(--transition);
}
.footer-col a:hover { color: var(--accent); padding-left: 5px; }
.footer-bottom {
    text-align: center; padding-top: 20px; border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: 13px;
}

/* --- MOBILE HAMBURGER MENU --- */
@media (max-width: 768px) {
    .nav-links.active {
        display: flex !important; flex-direction: column;
        position: absolute; top: 64px; left: 0; right: 0;
        background: rgba(10, 10, 15, 0.98); backdrop-filter: blur(20px);
        padding: 15px 20px; border-bottom: 1px solid var(--border);
        gap: 4px; z-index: 999;
    }
    .nav-links.active .nav-link { padding: 12px 16px; font-size: 15px; border-radius: 8px; }
    .nav-links.active .nav-dropdown .dropdown-menu {
        position: static; display: none; box-shadow: none; border: none;
        background: rgba(255, 255, 255, 0.05); margin: 4px 0 4px 16px;
        max-height: 200px; overflow-y: auto; border-radius: 8px;
    }
    .nav-links.active .nav-dropdown.open .dropdown-menu { display: block !important; }
    .nav-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .nav-hamburger.active span:nth-child(2) { opacity: 0; }
    .nav-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
}

/* --- MOBILE: FILTER TOGGLE --- */
@media (max-width: 768px) {
    .filter-toggle-btn {
        display: block !important; width: 100%; padding: 12px;
        background: var(--bg-card); border: 1px solid var(--border);
        border-radius: var(--radius); color: var(--text-primary);
        font-weight: 600; margin-bottom: 15px; cursor: pointer;
        text-align: center; font-size: 14px;
    }
    .browse-filters { display: none; flex-direction: column; gap: 10px; }
    .browse-filters.active { display: flex; }
    .browse-filters select { width: 100%; }
}

/* --- MOBILE: VIDEO PLAYER (X BUTTON OUTSIDE) --- */
@media (max-width: 768px) {
    /* 1. Push video down and reduce height to make room for X button */
    .video-container { 
        height: 65vh !important; 
        max-height: 450px !important;
        margin-top: 50px !important; /* Space for the X button */
    }

    /* 2. Move X button to FIXED position (Top-Right of Screen) */
    .video-close { 
        position: fixed !important; /* Detach from video container */
        top: 15px !important;       /* Near top of screen */
        right: 15px !important;     /* Near right of screen */
        left: auto !important;      /* Override previous 'left' */
        width: 40px !important;
        height: 40px !important;
        font-size: 22px !important;
        z-index: 99999 !important;  /* Ensure it's above everything */
        background: rgba(0, 0, 0, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.6) !important;
    }

    /* 3. Keep your existing controls layout */
    .video-info { 
        position: relative; 
        width: 100%; 
        background: var(--bg-secondary); 
        border-top: 1px solid var(--border); 
        padding: 10px 15px; 
        z-index: 100; 
    }
    .video-main-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .video-left { width: 100%; }
    .video-controls-group { width: 100%; flex-direction: column; align-items: stretch; gap: 8px; }
    .server-buttons { width: 100%; justify-content: space-between; }
    .server-btn { flex: 1; text-align: center; padding: 8px; font-size: 13px; }
    .video-lang-toggle { width: 100%; justify-content: space-between; }
    .vlang-btn { flex: 1; text-align: center; padding: 8px; font-size: 13px; }
    .video-nav { width: 100%; display: flex; justify-content: space-between; }
    .ep-nav-btn { flex: 1; text-align: center; padding: 10px; font-size: 13px; }
}

/* --- MOBILE: GRID & SLIDER --- */
@media (max-width: 768px) {
    .slider-arrow { display: none !important; }
    
    /* Reduce hero height slightly */
    .hero-section { height: 350px !important; }
    
    .hero-title { font-size: 28px; }
    
    /* Move Hero Dots Down */
    .hero-dots {
        bottom: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 10 !important;
    }

    .hero-content {
        padding: 0 20px 30px !important;
    }

    .modal-body { flex-direction: column; padding: 0 20px 20px; margin-top: -80px; }
    .modal-poster { width: 160px; }
    .modal-episodes { padding: 20px; }
    .ep-grid { grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); }
    .ep-header { flex-direction: column; align-items: flex-start; }
    .ep-select { width: 100%; min-width: unset; }
    .ep-grid { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; max-height: 250px; }
    .ep-btn { font-size: 12px; padding: 8px 0; }

    /* Home Sliders: 3 Columns */
    .slider-track {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important; overflow-x: visible !important;
        width: 100% !important; padding: 0 !important; margin: 0 !important;
    }

    /* Browse/Movies Pages: 2 Columns */
    body.browse .anime-grid,
    body.movies .anime-grid,
    body.schedule .anime-grid,
    body.myList .anime-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Card Sizes */
    .slider-track .anime-card,
    .anime-grid .anime-card {
        width: 100% !important; flex: none !important; margin: 0 !important;
    }
    .card-title { font-size: 10px !important; }
    .card-meta { font-size: 9px !important; }
    .card-eps, .card-rating { font-size: 8px !important; }

    /* Schedule Mobile */
    .schedule-item { flex-direction: column; align-items: flex-start; gap: 10px; padding: 15px; }
    .schedule-time-box {
        width: 100%; border-right: none;
        border-bottom: 1px solid var(--border);
        padding-right: 0; padding-bottom: 10px; margin-right: 0;
        flex-direction: row; justify-content: space-between; align-items: center;
    }
    .schedule-time-box .time { font-size: 18px; }
    .schedule-time-box .date { font-size: 12px; margin-top: 0; }
    .schedule-img { width: 55px; height: 75px; }
.schedule-title {
    font-size: 14px;
    white-space: normal !important;     /* Allow wrapping */
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;   /* Max 2 lines */
    -webkit-box-orient: vertical !important;
    line-height: 1.3;
    word-break: break-word;
}
    .schedule-ep-badge { margin-left: 0; margin-top: 4px; }
    .schedule-list h3 { font-size: 14px !important; }

    /* FAB & Top 10 Mobile */
    .fab-button { bottom: 20px; right: 20px; width: 50px; height: 50px; }
    .top10-modal-content { width: 95%; max-height: 90vh; }
    .top10-modal-content .top10-tabs { width: 100%; margin: 15px 0 0 0; }
}

/* --- VERY SMALL SCREENS --- */
@media (max-width: 480px) {
    .main-content .container { padding: 0 15px; }
    body.browse .anime-grid,
    body.movies .anime-grid,
    body.schedule .anime-grid,
    body.myList .anime-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .ep-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; }
    .ep-btn { font-size: 11px; padding: 6px 0; }
}
/* --- DESKTOP VIDEO LAYOUT: TWO-COLUMN WITH EMPTY RIGHT --- */
@media (min-width: 769px) {
    .video-main-row {
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: flex-start !important; /* KEY FIX: Don't push to edges */
        gap: 30px;
        width: 100%;
    }

    /* LEFT COLUMN: Title & Info */
    .video-left {
        flex: 0 1 auto; /* Only takes space it needs */
        min-width: 0;
        max-width: 50%; /* Don't let title stretch too far */
        text-align: left;
    }

    .video-left h3 {
        font-size: 18px;
        font-weight: 700;
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .video-left span {
        font-size: 13px;
        color: var(--text-muted);
    }

    /* RIGHT COLUMN: Controls */
    .video-controls-group {
        flex-direction: column !important;
        align-items: flex-start !important; /* Align controls to the left of their column */
        gap: 8px;
        flex-shrink: 0;
    }

    .server-buttons,
    .video-lang-toggle,
    .video-nav {
        width: auto;
    }
}
/* Style for the date line in video info */
#videoEpInfo span {
    display: block;
    font-size: 11px !important;
    color: var(--text-muted) !important;
    margin-top: 2px;
    font-weight: 400;
}
/* --- RELATED ANIME SECTION --- */
.modal-related {
    border-top: 1px solid var(--border);
    padding: 24px 30px;
}

.modal-related h3 {
    font-size: 18px;
    color: #fff;
    margin-bottom: 16px;
}

.related-scroll {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 10px 0;
}

.related-scroll .slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 10px 0;
}

.related-scroll .slider-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: calc(100% - 40px);
    margin: 0 auto;
}

.related-scroll .slider-track::-webkit-scrollbar {
    display: none;
}

.related-scroll .anime-card {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 130px !important;
    transform: none !important;
}

.related-scroll .anime-card:hover {
    transform: scale(1.05) !important;
}

/* Arrows inside modal */
.related-scroll .slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0;
    pointer-events: none;
}

.related-scroll .slider-container:hover .slider-arrow {
    opacity: 1;
    pointer-events: auto;
}

.related-scroll .slider-arrow.left { left: 5px; }
.related-scroll .slider-arrow.right { right: 5px; }
.related-scroll .slider-arrow:hover { background: var(--accent); }

/* Mobile: Hide arrows, show scroll */
@media (max-width: 768px) {
    .modal-related {
        padding: 15px 20px;
    }

    .modal-related h3 {
        font-size: 15px;
        margin-bottom: 12px;
    }

    .related-scroll .slider-arrow {
        display: none !important;
    }

    .related-scroll .slider-track {
        overflow-x: auto !important;
        width: 100% !important;
        padding: 10px 0 !important;
        margin: 0 !important;
    }

    .related-scroll .anime-card {
        width: 110px !important;
    }

    .related-scroll .card-title {
        font-size: 11px;
    }

    .related-scroll .card-meta {
        font-size: 9px;
    }
}