/* ============================
   ACCESSIBILITY UTILITIES
   ============================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================
   ROOT VARIABLES & RESET
   ============================ */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-card-hover: #1e1e2a;
    --accent: #e50914;
    --accent-light: #ff2d3b;
    --accent-glow: rgba(229, 9, 20, 0.3);
    --gold: #f5c518;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #60607a;
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.15);
    --gradient-card: linear-gradient(0deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.7);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    display: block;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

ul {
    list-style: none;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================
   SCROLLBAR
   ============================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ============================
   HEADER
   ============================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0;
    transition: var(--transition);
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.98) 0%, transparent 100%);
    backdrop-filter: blur(0px);
}

.header.scrolled {
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

/* Dropdown */
.nav-dropdown {
    position: relative;
}

.dropdown-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.dropdown-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #1a1a25;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px;
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    z-index: 100;
    flex-wrap: wrap;
    gap: 4px;
    column-gap: 0;
}

/* Invisible bridge fills the 8px gap so hover isn't lost moving mouse down */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

.nav-dropdown:hover .dropdown-menu {
    display: flex;
}

.dropdown-menu a {
    display: block;
    width: 50%;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.dropdown-menu a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 8px 16px;
    padding-right: 42px;
    color: #fff;
    font-size: 14px;
    width: 220px;
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    width: 280px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    position: absolute;
    right: 12px;
    color: var(--text-secondary);
    display: flex;
    transition: var(--transition);
}

.search-btn:hover {
    color: #fff;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1a1a25;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    z-index: 999;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.search-result-img {
    width: 44px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-card);
}

.search-result-info h5 {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: var(--transition);
}

/* ============================
   PAGE LOADER
   ============================ */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s, visibility 0.4s;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(229, 9, 20, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================
   SECTION LOADER (inline)
   ============================ */
.section-loader {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}

.section-loader .loader-ring {
    width: 40px;
    height: 40px;
}

/* ============================
   HOME PAGE - HERO / BANNER
   ============================ */
.hero {
    position: relative;
    background-color: var(--bg-primary);
    height: clamp(400px, 56vh, 640px);
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

/* Mobile / nhỏ: cover fill bình thường */
.hero-backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    transition: opacity 0.8s ease;
}

/* Desktop ≥ 1024px: poster portrait hiện tự nhiên bên phải,
   không bị zoom to vì không dùng cover trải full-width */
@media (min-width: 1024px) {
    .hero-backdrop {
        background-size: auto 115%;
        background-position: right -20px center;
    }
}

/* Desktop rộng hơn thì kéo poster xa hơn sang phải 1 chút */
@media (min-width: 1440px) {
    .hero-backdrop {
        background-size: auto 110%;
        background-position: right 5% center;
    }
}

/* Backdrop ngang từ TMDB: cover toàn bộ hero, gradient nhẹ hơn cho text */
@media (min-width: 1024px) {
    .hero-landscape .hero-backdrop {
        background-size: cover;
        background-position: center center;
    }

    .hero-landscape .hero-backdrop::after {
        background:
            linear-gradient(to right,
                rgba(10, 10, 15, 0.88) 0%,
                rgba(10, 10, 15, 0.55) 40%,
                rgba(10, 10, 15, 0.15) 70%,
                transparent            100%),
            linear-gradient(to top,
                rgba(10, 10, 15, 1)    0%,
                rgba(10, 10, 15, 0.5)  20%,
                transparent            50%);
    }
}

.hero-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    /* Gradient dày hơn ở desktop để che vùng trống bên trái */
    background: linear-gradient(to right,
            rgba(10, 10, 15, 1)    0%,
            rgba(10, 10, 15, 0.92) 30%,
            rgba(10, 10, 15, 0.55) 55%,
            rgba(10, 10, 15, 0.15) 80%,
            transparent            100%),
        linear-gradient(to top,
            rgba(10, 10, 15, 1)  0%,
            rgba(10, 10, 15, 0.5) 25%,
            transparent           55%);
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 0 0 clamp(40px, 5vh, 72px);
    width: 100%;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid rgba(229, 9, 20, 0.3);
    border-radius: 100px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #ff6b6b;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -1px;
    margin-bottom: 16px;
    max-width: 600px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hero-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.hero-meta-item .quality-badge {
    background: var(--gold);
    color: #000;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
}

.hero-desc {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.7;
    margin-bottom: 28px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 700;
    transition: var(--transition);
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 40px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid var(--border-hover);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

/* Hero Indicators */
.hero-indicators {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 8px;
    z-index: 3;
}

.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: var(--transition);
}

.hero-dot.active {
    width: 24px;
    background: var(--accent);
}

/* ============================
   SECTIONS
   ============================ */
.section {
    padding: 48px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background: var(--accent);
    border-radius: 2px;
}

.section-more {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    transition: var(--transition);
}

.section-more:hover {
    color: var(--accent-light);
}

/* ============================
   MOVIE GRID
   ============================ */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.movies-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* ============================
   MOVIE CARD
   ============================ */
.movie-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.movie-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-hover);
    z-index: 5;
}

.movie-card-img-wrap {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.movie-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    background: var(--bg-card);
}

.movie-card:hover .movie-card-img {
    transform: scale(1.08);
}

.movie-card-overlay {
    position: absolute;
    inset: 0;
    background: var(--gradient-card);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.movie-card:hover .movie-card-overlay {
    opacity: 1;
}

.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 3;
    width: 44px;
    height: 44px;
    background: rgba(229, 9, 20, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.movie-card:hover .play-btn {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.play-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
    margin-left: 3px;
}

.movie-card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-quality {
    background: var(--gold);
    color: #000;
}

.badge-sub {
    background: var(--accent);
    color: #fff;
}

.badge-new {
    background: #22c55e;
    color: #fff;
}

.badge-ep {
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

.movie-card-info {
    padding: 10px;
}

.movie-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.movie-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.movie-card-year {
    font-size: 12px;
    color: var(--text-muted);
}

.movie-card-ep {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}

/* ============================
   HORIZONTAL SCROLL (slider)
   ============================ */
.slider-wrap {
    position: relative;
}

.movies-slider {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.movies-slider::-webkit-scrollbar {
    display: none;
}

.movies-slider .movie-card {
    flex: 0 0 240px;
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid var(--border-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 5;
    font-size: 18px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.slider-arrow:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.slider-arrow.left {
    left: -16px;
}

.slider-arrow.right {
    right: -16px;
}

/* ============================
   MOVIE DETAIL PAGE
   ============================ */
.detail-page {
    padding-top: 64px;
}

.detail-hero {
    position: relative;
    min-height: 500px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.detail-hero-backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.detail-hero-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right,
            rgba(10, 10, 15, 0.98) 0%,
            rgba(10, 10, 15, 0.8) 50%,
            rgba(10, 10, 15, 0.4) 100%),
        linear-gradient(to top,
            rgba(10, 10, 15, 1) 0%,
            rgba(10, 10, 15, 0.4) 40%,
            transparent 100%);
}

.detail-hero-inner {
    position: relative;
    z-index: 2;
    padding: 60px 0 40px;
    display: flex;
    gap: 40px;
    align-items: flex-end;
}

.detail-poster {
    flex-shrink: 0;
    width: 320px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.detail-poster img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--bg-card);
}

.detail-info {
    flex: 1;
    max-width: 700px;
}

.detail-info h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    letter-spacing: -1px;
    line-height: 1.1;
    margin-bottom: 8px;
}

.detail-origin-name {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-style: italic;
}

.detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.detail-tag {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.detail-tag.accent {
    background: rgba(229, 9, 20, 0.15);
    border-color: rgba(229, 9, 20, 0.3);
    color: #ff6b6b;
}

.detail-desc {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 28px;
    max-width: 600px;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.detail-meta-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    border: 1px solid var(--border);
}

.detail-meta-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-meta-value {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

/* Episodes */
.detail-body {
    padding: 40px 0 80px;
}

.server-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.server-tab {
    padding: 8px 18px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.server-tab.active,
.server-tab:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.episodes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 8px;
}

.ep-btn {
    min-width: 56px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.ep-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.ep-btn.playing {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* PLAYER */
.player-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.player-section {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border);
    position: relative;
    padding-top: 56.25%; /* Fallback 16:9 cho browser không hỗ trợ aspect-ratio */
}

.player-section iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

/* ============================
   LIST PAGE
   ============================ */
.list-page {
    padding: 100px 0 80px;
}

.list-page-header {
    margin-bottom: 32px;
}

.list-page-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.list-page-count {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================
   PAGINATION
   ============================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover,
.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================
   MODAL
   ============================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transform: scale(0.95);
    transition: transform 0.3s;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--accent);
}

.modal-content {
    padding: 24px;
}

/* ============================
   EMPTY STATE
   ============================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ============================
   ADVERTISEMENTS
   ============================ */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 16px 20px;
    margin: 20px 0;
}

.ad-banner {
    width: 100%;
    max-width: 728px;
    height: 90px;
    background: var(--bg-card);
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.02) 10px, rgba(255, 255, 255, 0.02) 20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.ad-banner:hover {
    border-color: rgba(229, 9, 20, 0.5);
    color: var(--text-secondary);
}

.ad-banner::before {
    content: 'Quảng Cáo';
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
}

.ad-banner-square {
    max-width: 300px;
    height: 250px;
}

/* ============================
   FOOTER
   ============================ */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    margin-top: 80px;
}

.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    padding: 60px 0 48px;
}

.footer-brand p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 16px;
    max-width: 280px;
    line-height: 1.7;
}

.footer-links h4 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.footer-links a {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    padding: 5px 0;
    transition: var(--transition);
}

.footer-links a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================
   ANIMATIONS
   ============================ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-in {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.animate-fade {
    animation: fadeIn 0.4s ease both;
}

/* Staggered cards */
.movies-grid .movie-card:nth-child(1) {
    animation-delay: 0.05s;
}

.movies-grid .movie-card:nth-child(2) {
    animation-delay: 0.1s;
}

.movies-grid .movie-card:nth-child(3) {
    animation-delay: 0.15s;
}

.movies-grid .movie-card:nth-child(4) {
    animation-delay: 0.2s;
}

.movies-grid .movie-card:nth-child(5) {
    animation-delay: 0.25s;
}

.movies-grid .movie-card:nth-child(6) {
    animation-delay: 0.3s;
}

.movies-grid .movie-card:nth-child(7) {
    animation-delay: 0.35s;
}

.movies-grid .movie-card:nth-child(8) {
    animation-delay: 0.4s;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 1024px) {
    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .detail-hero-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
    }

    .detail-poster {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 15, 0.98);
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 8px;
        border-bottom: 1px solid var(--border);
        backdrop-filter: blur(20px);
    }

    .nav.open {
        display: flex;
    }

    .menu-toggle {
        display: flex;
    }

    .search-input {
        width: 160px;
        font-size: 16px; /* Prevents iOS/Android auto-zoom on focus */
    }

    .search-input:focus {
        width: 200px;
    }

    .hero {
        max-height: 650px;
    }

    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 12px;
    }

    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    .footer-brand {
        grid-column: 1/-1;
    }

    .detail-meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .slider-arrow {
        display: none;
    }

    .section {
        padding: 32px 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 14px;
    }

    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .footer-top {
        grid-template-columns: 1fr;
    }

    .header-inner {
        gap: 12px;
    }

    .search-input {
        width: 120px;
        font-size: 16px; /* Prevents iOS/Android auto-zoom on focus */
    }

    .search-input:focus {
        width: 150px;
    }


    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* ============================
   CATFISH FLOATING BANNER
   ============================ */

/* Outer wrapper — sticks to bottom of viewport */
.catfish-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    /* let clicks pass through wrapper */
}

/* ── Entrance animation ── */
@keyframes catfish-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ── Main inner banner ── */
.catfish-inner {
    pointer-events: auto;
    position: relative;
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: stretch;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    animation: catfish-slide-up 0.5s cubic-bezier(0.34, 1.26, 0.64, 1) both;
    animation-delay: 1.2s;
    /* appear after page loads */
    transform: translateY(100%);
    /* start hidden before animation */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
}

/* Collapsed state — slide down out of view */
.catfish-bar.collapsed .catfish-inner {
    animation: none;
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* ── Ad clickable area ── */
.catfish-ad-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.25s;
    position: relative;
    overflow: hidden;
}

.catfish-ad-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(229, 9, 20, 0.04), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.catfish-ad-wrap:hover::before {
    transform: translateX(100%);
}

.catfish-ad-wrap:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* AD badge */
.catfish-ad-badge {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid rgba(229, 9, 20, 0.4);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #ff6b6b;
    text-transform: uppercase;
}

/* Pulsing red dot */
.catfish-ad-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    animation: catfish-pulse 1.8s ease-in-out infinite;
}

@keyframes catfish-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(229, 9, 20, 0.5);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.2);
        box-shadow: 0 0 0 5px rgba(229, 9, 20, 0);
    }
}

/* Ad text body */
.catfish-ad-body {
    flex: 1;
    min-width: 0;
}

.catfish-ad-text {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catfish-ad-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* CTA button-like text */
.catfish-ad-cta {
    flex-shrink: 0;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 100px;
    white-space: nowrap;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 0 20px rgba(229, 9, 20, 0.35);
}

.catfish-ad-wrap:hover .catfish-ad-cta {
    background: var(--accent-light);
    transform: scale(1.04);
}

/* ── X close button (top-right, inside overflow boundary) ── */
.catfish-close-btn {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.75);
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s, color 0.2s;
    pointer-events: auto;
}

.catfish-close-btn:hover {
    background: rgba(229, 9, 20, 0.8);
    border-color: transparent;
    color: #fff;
}

/* ── Restore floating tab ── */
.catfish-restore-tab {
    pointer-events: auto;
    position: fixed;
    bottom: 0;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #1a1a2e, #12121c);
    border: 1px solid rgba(229, 9, 20, 0.4);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    padding: 8px 16px;
    color: #ff6b6b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 -4px 20px rgba(229, 9, 20, 0.2);
    transition: background 0.2s, transform 0.2s;

    /* Hidden by default — shown only when .catfish-bar.collapsed */
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
}

.catfish-bar.collapsed .catfish-restore-tab {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.3s 0.15s, transform 0.3s 0.15s;
}

.catfish-restore-tab:hover {
    background: linear-gradient(135deg, #22223a, #1a1a2e);
    transform: translateY(-2px);
}

.catfish-tab-icon {
    font-size: 14px;
}

.catfish-tab-label {
    letter-spacing: 1px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .catfish-inner {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .catfish-ad-cta {
        display: none;
    }

    .catfish-ad-sub {
        display: none;
    }

    .catfish-ad-wrap {
        padding: 12px 14px;
        gap: 10px;
    }

    .catfish-restore-tab {
        right: 12px;
    }
}

/* ============================
   BANNER AD ZONES (frontend)
   ============================ */

/* Base zone — reset để không bị ảnh hưởng bởi .ad-container cũ */
.phimhay-ad-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
    position: relative;
    /* Quan trọng: không có padding ở đây */
    padding: 0;
    box-sizing: border-box;
}

/* Ẩn hoàn toàn khi không có nội dung */
.phimhay-ad-zone:empty {
    display: none;
}

.phimhay-ad-zone a {
    display: block;
    line-height: 0;
    /* bỏ khoảng trắng dưới img */
}

.phimhay-ad-zone img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: opacity 0.3s, transform 0.3s;
}

.phimhay-ad-zone a:hover img {
    opacity: 0.9;
    transform: scale(1.01);
}

/* Đè lên .ad-container cũ nếu bị apply cùng lúc */
.ad-container.phimhay-ad-zone {
    padding: 0;
    margin: 0;
    background: none;
}



/* ============================
   TỪ́ng Slot cụ thể
   ============================ */

/* Wrapper full-width cho home_billboard */
.billboard-wrap {
    width: 100%;
    overflow: hidden;
    margin-top: 80px;
    /* Tránh Header đè ở đầu khi chưa load #hero-area */
    margin-bottom: -10px;
}

.billboard-wrap:empty {
    display: none;
    margin-top: 0;
}

/* Billboard 970×250 — full-width nằm ngoài .container */
.phimhay-ad-home_billboard {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 0;
}

.phimhay-ad-home_billboard a {
    display: flex;
    justify-content: center;
    max-width: 970px;
    margin: 0 auto;
}

.phimhay-ad-home_billboard img {
    border-radius: 8px;
    max-height: 250px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* Below Player 728×90 */
.phimhay-ad-below_player {
    max-width: 728px;
    margin: 12px auto 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.phimhay-ad-below_player img {
    border-radius: var(--radius-md);
    max-height: 90px;
    object-fit: cover;
}

/* Sidebar Square 300×250 */
.phimhay-ad-sidebar_square {
    max-width: 300px;
    margin: 0 auto 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.phimhay-ad-sidebar_square img {
    border-radius: var(--radius-md);
    max-height: 250px;
    object-fit: cover;
}

/* Sidebar Half-Page 300×600 */
.phimhay-ad-sidebar_halfpage {
    max-width: 300px;
    margin: 0 auto 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.phimhay-ad-sidebar_halfpage img {
    border-radius: var(--radius-md);
    max-height: 600px;
    object-fit: cover;
}

/* In-Content 468×60 */
.phimhay-ad-in_content {
    max-width: 468px;
    width: 100%;
    margin: 20px auto;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.phimhay-ad-in_content img {
    border-radius: var(--radius-sm);
    max-height: 60px;
    object-fit: cover;
}

/* Catfish — dùng PHP render, CSS chỉ style wrapper ảnh */
.phimhay-ad-catfish {
    width: 100%;
    max-width: 728px;
    margin: 0 auto;
}

.phimhay-ad-catfish img {
    border-radius: 0;
    max-height: 90px;
    object-fit: cover;
}

/* Popup / Interstitial */
.phimhay-ad-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    border-radius: var(--radius-xl);
    padding: 8px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8);
    max-width: 620px;
    width: calc(100vw - 40px);
}

.phimhay-ad-popup img {
    max-height: 400px;
    border-radius: calc(var(--radius-xl) - 4px);
}

/* Ad label badge */
.phimhay-ad-zone::before {
    content: 'QC';
    position: absolute;
    top: 4px;
    right: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255, 255, 255, 0.5);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 5px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}

/* Shimmer placeholder while loading */
.phimhay-ad-zone.loading {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    min-height: 90px;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

@media (max-width: 768px) {

    .phimhay-ad-header_leaderboard,
    .phimhay-ad-home_billboard,
    .phimhay-ad-below_player,
    .phimhay-ad-sidebar_square,
    .phimhay-ad-sidebar_halfpage,
    .phimhay-ad-in_content {
        max-width: 100%;
    }

    /* header_leaderboard img: fix width: auto bị overflow */
    .phimhay-ad-header_leaderboard img {
        width: 100%;
        max-width: 100%;
        max-height: 60px;
    }

    .phimhay-ad-home_billboard img {
        max-height: 120px;
    }

    /* below_player: không crop banner khi full-width */
    .phimhay-ad-below_player img {
        max-height: none;
        height: auto;
        object-fit: contain;
    }

    /* sidebar_halfpage: 600px quá cao trên mobile, giảm xuống */
    .phimhay-ad-sidebar_halfpage img {
        max-height: 280px;
    }

    /* in_content: không crop banner khi full-width */
    .phimhay-ad-in_content img {
        max-height: none;
        height: auto;
        object-fit: contain;
    }
}

@media (max-width: 480px) {
    /* sidebar_halfpage quá cao trên phone nhỏ, ẩn đi */
    .phimhay-ad-sidebar_halfpage {
        display: none;
    }

    /* header leaderboard càng nhỏ hơn nữa */
    .phimhay-ad-header_leaderboard img {
        max-height: 50px;
    }
}

/* ============================
   HEADER LEADERBOARD SLOT
   ============================ */
.phimhay-ad-header_leaderboard {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin-top: 80px;
    /* Đẩy xuống để không bị menu đè! */
    margin-bottom: 0;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* <a> cần có width để img width:100% tính đúng trong flex container */
.phimhay-ad-header_leaderboard a {
    display: block;
    width: 100%;
    max-width: 728px;
    line-height: 0;
}

.phimhay-ad-header_leaderboard img {
    display: block;
    width: 100%;
    max-width: 728px;
    height: auto;
    max-height: 90px;
    object-fit: contain;
    border-radius: 0;
}

/* ============================
   CATFISH IMAGE / CUSTOM WRAP
   ============================ */
.catfish-img-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0;
    text-decoration: none;
    min-height: 90px;
}

.catfish-custom-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    padding: 0;
    overflow: hidden;
}

/* ============================
   POPUP / INTERSTITIAL OVERLAY
   ============================ */
.ad-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease both;
}

.ad-popup-box {
    position: relative;
    background: #111;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
    padding: 8px;
    max-width: 620px;
    width: calc(100vw - 40px);
    animation: fadeInUp 0.35s cubic-bezier(0.34, 1.26, 0.64, 1) both;
}

.ad-popup-box img {
    display: block;
    max-width: 100%;
    max-height: 400px;
    width: auto;
    margin: 0 auto;
    border-radius: 10px;
    object-fit: contain;
}

.ad-popup-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(229, 9, 20, 0.5);
    transition: background 0.2s, transform 0.2s;
    z-index: 1;
}

.ad-popup-close:hover {
    background: #b91c1c;
    transform: scale(1.1);
}

@media (max-width: 480px) {
    .ad-popup-box {
        max-width: calc(100vw - 24px);
    }
}