:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #E50914; /* Reverted to pure Netflix Red */
    --accent-hover: #f40612;
    --border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(10, 10, 10, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --font-family: 'Outfit', sans-serif;
    --border-radius: 8px;
    --border-radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

a:hover {
    color: var(--text-secondary);
}

button {
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    outline: none;
}

/* --- Header --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    transition: all 0.4s ease;
}

.header.scrolled {
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}

.header-container {
    padding: 0 4%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.8rem;
    font-weight: 900;
    color: #e50914; /* Netflix Red */
    letter-spacing: 2px;
    gap: 8px;
    text-transform: uppercase;
}

.logo-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    width: 32px;
    height: 32px;
}

.logo-icon .fa-film {
    font-size: 1.8rem;
}

.logo-icon .fa-play {
    position: absolute;
    font-size: 0.7rem;
    color: #fff;
    transform: translateX(1px);
}

.logo span {
    color: #fff;
}

.main-nav {
    display: flex;
    gap: 24px;
    margin-left: 30px;
    font-size: 0.9rem;
    align-items: center;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}

.main-nav.search-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-15px);
    pointer-events: none;
}

.main-nav a {
    color: #e5e5e5;
    transition: color 0.3s;
    white-space: nowrap;
}

.main-nav a.active {
    color: #fff;
    font-weight: 600;
    position: relative;
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #e50914; /* Red indicator */
    border-radius: 2px;
    box-shadow: 0 0 5px rgba(229, 9, 20, 0.5);
}

.main-nav a:hover {
    color: #b3b3b3;
}

/* --- Dropdown Menu --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown > a {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown > a i {
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.dropdown:hover > a i {
    transform: rotate(180deg);
}

.dropdown-content {
    visibility: hidden;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: absolute;
    background-color: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    min-width: 280px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 101;
    border: 1px solid var(--glass-border);
    border-top: 2px solid var(--accent);
    border-radius: var(--border-radius);
    padding: 15px;
    top: 100%;
    left: -50%;
    margin-top: 25px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.dropdown-content::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 8px 8px 8px;
    border-style: solid;
    border-color: transparent transparent #e5e5e5 transparent;
}

.dropdown-content a {
    color: #b3b3b3;
    padding: 6px 10px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 3px;
}

.dropdown-content a:hover {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
}

.dropdown:hover .dropdown-content {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* --- Header Actions --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    min-width: 40px;
    height: 40px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
}

.search-bar.active {
    background: rgba(0,0,0,0.85);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.search-bar input {
    background: transparent;
    border: none;
    color: #fff;
    padding: 0;
    width: 0;
    outline: none;
    font-size: 0.9rem;
    transition: width 0.3s ease, padding 0.3s;
    opacity: 0;
}

.search-bar.active input {
    width: 220px;
    padding: 6px 10px 6px 0;
    opacity: 1;
}

.search-bar button {
    background: transparent;
    color: #fff;
    font-size: 1.2rem;
    padding: 6px 10px;
    cursor: pointer;
    border: none;
    transition: color 0.3s;
}

.search-bar button:hover {
    color: var(--accent);
}

.search-bar .close-search {
    display: none;
}
.search-bar.active .close-search {
    display: block;
}

.header-notifications {
    font-size: 1.3rem;
    color: #fff;
    cursor: pointer;
    transition: color 0.3s;
}

.header-notifications:hover {
    color: #b3b3b3;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
}

.header-user i {
    font-size: 0.8rem;
    color: #fff;
    transition: transform 0.3s;
}

.header-user:hover i {
    transform: rotate(180deg);
}


/* --- Hero Section --- */
.hero-section {
    position: relative;
    height: 85vh;
    min-height: 600px;
    width: 100%;
    display: flex;
    align-items: flex-end; /* Anchor content to bottom */
    padding-bottom: 100px; /* Space from the bottom edge */
    overflow: hidden;
}

.hero-backdrop {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    /* Hide the inline background; we render it via ::before and ::after */
    background-size: 0 0 !important;
    transition: background-image 0.5s ease-in-out;
    z-index: 0;
    isolation: isolate;
}

/* Ambient blurred fill — covers the whole area behind the poster */
.hero-backdrop::before {
    content: '';
    position: absolute;
    inset: -40px;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(30px) brightness(0.35);
    z-index: -1;
}

/* Crisp poster image — right-aligned, shows full poster at natural ratio */
.hero-backdrop::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: inherit;
    background-size: auto 92%;
    background-position: right 4% bottom;
    background-repeat: no-repeat;
    z-index: 0;
}

.hero-vignette {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    /* Strong left overlay for text area, soft bottom fade */
    background:
        linear-gradient(to right, var(--bg-dark) 18%, rgba(10,10,10,0.75) 38%, rgba(10,10,10,0.1) 62%, transparent 80%),
        linear-gradient(to top,   var(--bg-dark) 0%,  transparent 35%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 650px;
    padding-left: 4%;
    padding-right: 20px;
}

.hero-content.animating {
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.2rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-transform: none; 
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.hero-meta span.match {
    color: #46d369;
}

.hero-meta span.rating {
    border: 1px solid rgba(255,255,255,0.4);
    padding: 0 0.4rem;
}

.hero-desc {
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: 1.2rem;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 90%;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.btn-play, .btn-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0.6rem 1.4rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-play {
    background-color: var(--accent);
    color: #fff;
    /* Removed AI glow */
}

.btn-play:hover {
    background-color: var(--accent-hover);
    transform: scale(0.98); /* Tactile press feedback */
}

.btn-more {
    background-color: rgba(109, 109, 110, 0.7);
    color: white;
}

.btn-more:hover {
    background-color: rgba(109, 109, 110, 0.5);
    transform: scale(1.05);
}

/* --- Hero Controls (Slider, Mute, Age Rating) --- */
.hero-slider-controls {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 2%;
    transform: translateY(-50%);
    z-index: 5;
    pointer-events: none;
}

.slider-btn {
    pointer-events: auto;
    background: rgba(0,0,0,0.4);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0;
}

.hero-section:hover .slider-btn {
    opacity: 1;
}

.slider-btn:hover {
    background: rgba(0,0,0,0.8);
    border-color: #fff;
    transform: scale(1.1);
}

.hero-indicators {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 5;
}

.hero-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s;
}

.hero-dot:hover {
    background: rgba(255,255,255,0.7);
}

.hero-dot.active {
    background: var(--accent);
    transform: scale(1.3);
}

.hero-right-controls {
    position: absolute;
    right: 0;
    bottom: 25%;
    display: flex;
    align-items: center;
    z-index: 5;
}

.mute-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 15px;
    transition: all 0.2s;
}

.mute-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: #fff;
}

.age-rating {
    background: rgba(51, 51, 51, 0.8);
    border-left: 3px solid #dcdcdc;
    padding: 8px 30px 8px 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* --- Main Content & Grid --- */
.main-content {
    margin-top: -100px; /* Overlap hero a bit */
    position: relative;
    z-index: 4;
}

.main-content.no-hero {
    margin-top: 100px;
}

.movies-section {
    padding: 0 4% 6rem;
}

.section-title {
    font-size: 1.4vw;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5em;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.movie-card {
    position: relative;
    cursor: pointer;
    background: transparent;
    min-width: 0;
    border-radius: var(--border-radius);
    transition: transform 0.2s ease;
}

.movie-card:hover {
    z-index: 10;
}

.movie-poster-container {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--bg-secondary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.movie-card:hover .movie-poster-container,
.movie-card:focus .movie-poster-container {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.8), 0 0 0 3px var(--accent);
    z-index: 20;
}
.movie-card:focus { outline: none; }

.movie-poster {
    width: 100%;
    aspect-ratio: 2/3; /* Changed to proper cinematic 2:3 ratio */
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.movie-card:hover .movie-poster {
    transform: scale(1.05); /* Smooth inner zoom */
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.play-overlay::after {
    /* Elegant modern play button ring */
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.movie-card:hover .play-overlay::after {
    transform: scale(1);
}

.play-overlay i {
    font-size: 2.5rem;
    color: #fff;
    /* Removed neon text-shadow */
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

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

.movie-card:hover .play-overlay i {
    transform: scale(1);
}

.movie-info {
    padding: 12px 4px 0 4px;
    display: block;
}

.movie-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    transition: color 0.3s ease;
    display: block;
    width: 100%;
}

.movie-card:hover .movie-title {
    color: var(--accent);
}

.movie-meta {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.movie-rating {
    color: #46d369;
    font-weight: bold;
}

.badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--accent);
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 2;
}

.episode-badge {
    left: auto;
    right: 5px;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.history-badge {
    top: auto;
    bottom: 5px;
    left: 5px;
    background: rgba(255, 152, 0, 0.9); /* Orange color */
    color: #fff;
    border: none;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination button {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    transition: all 0.2s;
    border: none;
    font-weight: 500;
}

.pagination button.active {
    background: var(--accent);
    color: #fff;
    cursor: default;
}

.pagination button:not(:disabled):not(.active):hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination .dots {
    color: var(--text-secondary);
}

/* --- Modal (Chi Tiết Phim) --- */
.movie-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.movie-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.movie-modal.active .modal-content {
    animation: modalSpring 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalSpring {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-content {
    background: rgba(15, 15, 15, 0.7); /* Deep dark glass */
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 60px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.2);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: 2px solid transparent;
}

.close-modal:hover {
    border-color: #fff;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
    padding-bottom: 2rem;
}

.modal-backdrop {
    width: 100%;
    height: 450px;
    background-size: cover;
    background-position: center 20%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.modal-backdrop-content {
    padding: 0 3rem 2rem 3rem;
    position: relative;
    z-index: 2;
    width: 100%;
}

.modal-backdrop::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(15, 15, 15, 1) 0%, rgba(15, 15, 15, 0.8) 20%, rgba(15,15,15,0) 100%);
    z-index: 1;
}

/* Modal Skeleton */
.modal-skeleton-backdrop {
    width: 100%;
    height: 450px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.modal-skeleton-backdrop-content {
    padding: 0 3rem 2rem 3rem;
    position: relative;
    z-index: 2;
}
.modal-skeleton-content {
    padding: 0 3rem;
    position: relative;
    z-index: 2;
}
.modal-skeleton-title {
    width: 60%;
    height: 45px;
    margin-bottom: 16px;
    border-radius: 4px;
}
.modal-skeleton-meta {
    width: 40%;
    height: 20px;
    margin-bottom: 24px;
    border-radius: 4px;
}
.modal-skeleton-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 32px;
}
.skeleton-btn {
    width: 130px;
    height: 48px;
    border-radius: 6px;
}
.modal-skeleton-desc {
    width: 100%;
    height: 16px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.modal-info-container {
    padding: 0 3rem 2rem 3rem;
    position: relative;
    z-index: 2;
}

.modal-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    min-height: 96px;
    display: flex;
    align-items: flex-end;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    font-weight: 500;
}

.meta-rating { color: #46d369; font-weight: 600; }
.meta-item { color: var(--text-muted); }
.meta-quality { border: 1px solid var(--text-muted); padding: 0 4px; border-radius: 3px; font-size: 0.8rem; }

.modal-two-cols {
    display: flex;
    gap: 2rem;
}

.modal-desc-col {
    flex: 2;
}

.modal-desc {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.modal-details-col {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.modal-details-col span {
    color: var(--text-muted);
}

.modal-details-col p {
    margin-bottom: 0.5rem;
}

.play-btn {
    background: white;
    color: black;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.8rem 2rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 2rem;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.play-btn:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: scale(0.98); /* Tactile feedback */
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.modal-fav-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 0 1.2rem;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-fav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.modal-fav-btn.active {
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Video View --- */
.video-view {
    width: 100%;
    min-height: 100vh;
    background: var(--bg-primary);
    z-index: 10;
    display: none;
    padding-top: 100px; /* space for header + extra gap */
}

.video-view.active {
    display: block;
}

/* --- Video Header --- */
.video-header {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 25px 0 15px 0;
    color: white;
}

.video-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.video-episode-badge {
    background: var(--accent);
    color: white;
    font-size: 0.95rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iframe-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    border-radius: 8px;
    overflow: hidden;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-bottom {
    background: var(--bg-primary);
    min-height: 50vh;
    padding: 2rem 4% 6rem 4%;
    max-width: 960px;
    margin: 0 auto;
}

.episode-nav-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    gap: 8px;
}

.nav-control-btn {
    background: #3a3a3a;
    color: #e0e0e0;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 120px;
}

.nav-control-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px); /* Keep slight lift for secondary nav buttons */
}

.nav-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}


.episodes-container {
    margin-bottom: 2rem;
    background: transparent;
    padding: 0;
    border-radius: 8px;
}

.episodes-container h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.episodes-list {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.episode-btn {
    background: #1a1a1a;
    color: #a0a0a0;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #2a2a2a;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.9rem;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.episode-btn:hover {
    background: #2a2a2a;
    color: #fff;
    border-color: #444;
}

.episode-btn.active {
    background: rgba(225, 29, 72, 0.1); /* Based on new --accent #e11d48 */
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: none;
    font-weight: 600;
}

.episode-btn.watched {
    color: #777;
    background: #151515;
    border-color: #222;
}

.episode-btn.active.watched {
    color: white;
    background: var(--accent);
    border-color: var(--accent);
}

/* --- Video Movie Details --- */
.video-movie-details {
    margin-bottom: 3rem;
}

.video-info-wrapper {
    display: flex;
    gap: 2rem;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
}

.video-info-content {
    flex: 1;
}

.video-title {
    font-size: 2rem;
    margin-bottom: 0.2rem;
}

.video-year {
    color: var(--text-secondary);
    font-weight: 400;
}

.video-origin-name {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1rem;
}

.video-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.video-meta span {
    background: rgba(255,255,255,0.1);
    padding: 4px 10px;
    border-radius: 4px;
}

.video-tags p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.video-tags strong {
    color: var(--text-primary);
}

.video-description {
    margin-top: 1.5rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.video-description h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.related-movies-container {
    margin-top: 3rem;
}

.related-movies-container .movies-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.related-movies-container h3 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

/* Utilities */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

/* Skeleton Loading */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}
.skeleton {
    background: #333;
    background-image: linear-gradient(to right, #333 0%, #444 20%, #333 40%, #333 100%);
    background-repeat: no-repeat;
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear forwards;
}
.skeleton-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.skeleton-poster {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 8px;
}
.skeleton-title {
    height: 16px;
    width: 80%;
    border-radius: 4px;
    margin-top: 5px;
}
.skeleton-meta {
    height: 12px;
    width: 50%;
    border-radius: 4px;
}

/* Favorite Button */
.fav-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    top: auto;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}
.fav-btn:hover {
    background: rgba(229, 9, 20, 0.8);
    transform: scale(1.1);
}
.fav-btn.active {
    color: #e50914;
}

/* --- Home Sections (Horizontal Rows) --- */
.home-sections {
    padding: 0 4% 6rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.movie-row-container {
    position: relative;
    width: 100%;
}

.movie-row-container:hover .row-slider-btn {
    opacity: 1;
}

.row-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, background 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Make it perfectly round */
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

.row-slider-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.05); /* Slight scale on hover, not too aggressive */
}

.row-slider-btn.prev-btn {
    left: 5px; /* Moved slightly inside so it doesn't clip screen edge */
}

.row-slider-btn.next-btn {
    right: 5px; /* Moved slightly inside so it doesn't clip screen edge */
}

@media (max-width: 768px) {
    .row-slider-btn {
        display: none; /* Hide on mobile since touch swipe works fine */
    }
}

.movie-row-title {
    font-size: 1.4vw;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.movie-row-title i {
    font-size: 0.8em;
    color: var(--accent);
}

.movie-row {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    
    padding: 40px 25px 40px 25px;
    margin: -40px -25px -40px -25px;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.movie-row::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.movie-row {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Make cards inside row have fixed width to avoid shrinking */
.movie-row .movie-card {
    flex: 0 0 auto;
    width: calc(100% / 7 - 13px);
    min-width: 160px;
}

@media (max-width: 1200px) {
    .movie-row .movie-card { width: calc(100% / 5 - 12px); }
    .movie-row-title { font-size: 1.2rem; }
}

@media (max-width: 768px) {
    .movie-row .movie-card { width: calc(100% / 3 - 10px); min-width: 130px; }
    .movie-row-title { font-size: 1.1rem; }
}

@media (max-width: 480px) {
    .movie-row .movie-card { width: calc(100% / 2 - 8px); min-width: 120px; }
    .home-sections { padding: 0 15px 5rem; }
}

/* --- Responsive --- */
.mobile-menu-btn {
    display: none;
    background: transparent;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 98;
    display: none;
}
.menu-overlay.active {
    display: block;
}

@media (max-width: 900px) {
    .main-nav { margin-left: 10px; gap: 10px; }
    .hero-title { font-size: 2.8rem; }
    .hero-content { width: 70%; }
}

@media (max-width: 1250px) {
    .header-container { padding: 0 15px; height: 60px; position: relative; }
    
    .mobile-menu-btn { display: block; }
    
    .main-nav { 
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--bg-primary);
        padding: 80px 20px 80px; /* Thêm padding dưới để không bị cấn */
        transition: left 0.3s ease;
        z-index: 99;
        margin-left: 0;
        align-items: flex-start;
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
        overflow-y: auto;
    }
    
    .main-nav.active { left: 0; }
    
    .main-nav > a, .main-nav > .dropdown {
        font-size: 1.1rem;
        padding: 12px 0;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .dropdown { width: 100%; }
    
    .dropdown > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .dropdown-content {
        position: static;
        visibility: visible;
        opacity: 1;
        transform: none;
        box-shadow: none;
        background: transparent;
        border: none;
        padding-left: 20px;
        display: none;
        min-width: 100%;
        margin-top: 10px;
    }
    
    .dropdown.active .dropdown-content { 
        display: grid; 
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .dropdown-content::before { display: none; }
    .dropdown-content a { 
        padding: 8px 10px; 
        font-size: 0.95rem; 
        background: rgba(255,255,255,0.05);
        border-radius: 4px;
        text-align: center;
    }

    /* Hero Section Mobile */
    .hero-section { height: 65vh; min-height: 500px; padding-bottom: 60px; }
    /* On mobile override the right-aligned poster to a full-cover background */
    .hero-backdrop::before { filter: blur(0px) brightness(0.55); }  /* clear blur — full image as bg */
    .hero-backdrop::after  { background-size: cover; background-position: center 20%; } /* cover full screen */
    .hero-vignette {
        background: linear-gradient(to top, var(--bg-dark) 20%, rgba(10,10,10,0.75) 55%, transparent 100%);
    }
    .hero-content { width: 100%; margin-top: 0; padding-top: 0; padding-right: 15px; padding-left: 15px; }
    .hero-title { font-size: clamp(1.6rem, 5vw, 2.2rem); margin-bottom: 0.4rem; }
    .hero-meta { font-size: 0.85rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
    .hero-desc { font-size: 0.9rem; -webkit-line-clamp: 3; margin-bottom: 1rem; text-shadow: 1px 1px 3px #000; }
    .hero-buttons { flex-direction: row; gap: 10px; width: 100%; }
    .btn-play, .btn-more { padding: 0.5rem 1rem; font-size: 0.9rem; flex: 1; justify-content: center; }
    
    /* Grid */
    .section-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 15px; }
    .movies-section { padding: 0 15px 5rem; }
    .movies-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .related-movies-container .movies-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
    
    .movie-info { padding: 8px 4px 0; }
    .movie-title { font-size: 0.85rem; }
    .movie-meta { font-size: 0.75rem; gap: 5px; }
    
    /* Search Bar Mobile - Dropdown */
    .header-actions { position: static; }
    
    .search-bar.active { 
        position: fixed;
        top: 0; /* Đè lên toàn bộ header để bàn phím không đẩy khung tìm kiếm */
        left: 0;
        width: 100vw;
        height: 60px; /* Bằng với chiều cao của header */
        background: #0a0a0a;
        border-bottom: 1px solid #222;
        z-index: 2000;
        border: none;
        border-radius: 0;
        padding: 0 15px;
        display: flex;
        align-items: center;
        box-shadow: 0 4px 10px rgba(0,0,0,0.5); /* Thêm bóng đổ cho đẹp */
        transform: none; /* Quan trọng: Xóa transform từ desktop để không bị đẩy lên 50% */
        animation: none;
    }
    
    .search-bar.active input {
        position: relative;
        flex: 1;
        width: 100%;
        height: 40px;
        background: #1a1a1a;
        border: 1px solid #333;
        border-radius: 8px;
        padding: 0 45px;
        margin: 0;
        font-size: 1rem;
        color: #fff;
        box-shadow: none;
        opacity: 1;
        transition: border-color 0.3s, background 0.3s;
    }
    
    .search-bar.active input:focus {
        border-color: var(--accent);
        background: #222;
    }
    
    .search-bar.active #searchBtn {
        position: absolute;
        left: 20px;
        color: #fff;
        font-size: 1.2rem;
        padding: 10px;
        margin: 0;
        z-index: 2;
    }
    
    .search-bar .close-search {
        background: transparent;
        color: #fff;
        font-size: 1.4rem;
        padding: 8px;
        cursor: pointer;
        border: none;
    }

    .search-bar.active .close-search {
        position: absolute;
        right: 20px;
        z-index: 2;
    }
    
    .search-bar.active .search-suggestions {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        max-height: calc(100vh - 60px);
        background: #0a0a0a;
        border: none;
        box-shadow: 0 10px 20px rgba(0,0,0,0.8);
        border-radius: 0;
        padding: 10px 15px 20px;
        overflow-y: auto;
    }

    .search-bar.active .search-suggestion-item {
        background: #1a1a1a;
        border: 1px solid #222;
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 10px;
    }

    .search-bar.active .search-suggestion-item:hover {
        background: #2a2a2a;
    }
    
    .search-bar.active .search-suggestion-poster {
        width: 45px;
        height: 65px;
        border-radius: 4px;
    }
    
    .search-bar.active .search-suggestion-info h4 {
        font-size: 1rem;
    }
    
    /* Fullscreen Modal Mobile */
    .modal-content { 
        max-height: 100vh;
        height: 100vh; 
        margin: 0; 
        border-radius: 0;
        width: 100vw;
    }
    .modal-backdrop { height: 35vh; min-height: 200px; }
    .modal-info-container { padding: 0 15px; margin-top: -40px; }
    .modal-title { font-size: 1.6rem; }
    .modal-two-cols { flex-direction: column; gap: 1rem; }
    .modal-desc { font-size: 0.95rem; margin-bottom: 1rem; }
    .play-btn { width: 100%; justify-content: center; margin-bottom: 1.5rem; }
    
    /* Video View Mobile */
    .video-view { padding-top: 80px; }
    .video-bottom { padding: 1.5rem 15px; }
    .episodes-list { justify-content: center; }
    .episode-btn { padding: 6px 12px; font-size: 0.85rem; }
    
    .video-info-wrapper {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    .video-title {
        font-size: 1.5rem;
        text-align: center;
    }
    .video-origin-name, .video-meta {
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .movies-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .related-movies-container .movies-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .logo { font-size: 1.4rem; }
    .logo-icon { width: 28px; height: 28px; }
    .logo-icon .fa-film { font-size: 1.5rem; }
    
    .header-actions { gap: 12px; }
    .header-notifications { display: none; }
    .user-avatar { width: 28px; height: 28px; }
    
    .mobile-menu-btn { display: block; }
    .hero-title { font-size: 1.8rem; }
    
    .video-header { padding: 15px 15px 10px 15px; }
    .video-header h2 { font-size: 1.2rem; flex-wrap: wrap; gap: 8px; }
    
    .next-episode-toast { 
        bottom: 20px; 
        right: 15px; 
        font-size: 0.95rem; 
        padding: 10px 15px; 
        max-width: calc(100vw - 30px); 
    }
}

/* Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Ripple Effect */
.ripple-btn {
    position: relative;
    overflow: hidden;
}
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}
@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 320px;
    max-width: calc(100vw - 30px);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}
.search-suggestions::-webkit-scrollbar {
    width: 6px;
}
.search-suggestions::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
.search-suggestion-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
    color: white;
}
.search-suggestion-item:last-child {
    border-bottom: none;
}
.search-suggestion-item:hover {
    background: rgba(255, 255, 255, 0.1);
}
.search-suggestion-poster {
    width: 45px;
    height: 65px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.search-suggestion-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}
.search-suggestion-info h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-suggestion-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Auto-play Toast */
.next-episode-toast {
    position: absolute;
    bottom: 80px;
    right: 30px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 1.1rem;
    z-index: 100;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--accent);
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Plyr Customizations */
:root {
    --plyr-color-main: #E50914;
    --plyr-video-background: #000;
}
.plyr--video {
    height: 100%;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}


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

/* Professional Mobile Video Controls - Neat Bottom Bar */
@media (max-width: 768px) {
    /* Allow the control bar to wrap */
    .plyr__controls {
        flex-wrap: wrap !important;
        padding: 8px 10px 5px 10px !important;
    }

    /* 1. Row 1: Full-width Progress Bar */
    .plyr__controls > .plyr__progress {
        flex: 1 1 100% !important; /* Take full width */
        order: -1 !important; /* Force to top row */
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 8px !important; /* Spacing between progress and buttons */
    }

    /* 2. Row 2: Buttons - Remove absolute positioning */
    .plyr__controls [data-plyr="rewind"],
    .plyr__controls [data-plyr="fast-forward"],
    .plyr__controls > [data-plyr="play"] {
        position: static !important;
        transform: none !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        border: none !important;
        border-radius: 4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 7px !important;
        margin: 0 2px !important;
        z-index: 1 !important;
    }

    /* Reset icon sizes to native Plyr proportions */
    .plyr__controls [data-plyr="rewind"] svg,
    .plyr__controls [data-plyr="fast-forward"] svg,
    .plyr__controls > [data-plyr="play"] svg {
        width: 18px !important;
        height: 18px !important;
        position: static !important;
        fill: currentColor !important; /* Matches Plyr theme */
    }

    /* Hide the huge overlaid play button */
    .plyr__control--overlaid {
        display: none !important;
    }

    /* 3. Row 2 Layout: Push time and other controls to the right */
    .plyr__controls > .plyr__time--current {
        margin-left: auto !important; /* Pushes everything after it to the right */
        font-size: 13px !important;
        font-weight: 500 !important;
        padding-right: 5px !important;
    }

    /* Hide redundant elements to save space */
    .plyr__controls .plyr__time--duration {
        display: none !important;
    }
    
    /* Expand volume slider on hover */
    .plyr__controls .plyr__volume {
        width: auto !important;
        min-width: 0 !important;
        max-width: 40px !important; 
        transition: max-width 0.3s ease !important;
        overflow: hidden !important;
    }
    .plyr__controls .plyr__volume:hover {
        max-width: 140px !important; 
    }
    .plyr__controls .plyr__volume input[data-plyr="volume"] {
        display: block !important;
    }
    .plyr__controls {
        padding-bottom: 5px;
    }
}

/* ========================================= */
/* SUBTITLE OVERLAY STYLING                  */
/* ========================================= */
#customSubtitleOverlay {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: yellow;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black, -1px -1px 2px black, 1px -1px 2px black, -1px 1px 2px black;
    z-index: 1000;
    width: 90%;
    pointer-events: none;
    line-height: 1.4;
}

@media (max-width: 768px) {
    #customSubtitleOverlay {
        font-size: 14px; /* Rất nhỏ cho mobile để bằng với sub gốc */
    }
}
.search-suggestions::-webkit-scrollbar {
    width: 6px;
}
.search-suggestions::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
.search-suggestion-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
    color: white;
}
.search-suggestion-item:last-child {
    border-bottom: none;
}
.search-suggestion-item:hover {
    background: rgba(255, 255, 255, 0.1);
}
.search-suggestion-poster {
    width: 45px;
    height: 65px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.search-suggestion-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}
.search-suggestion-info h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-suggestion-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Auto-play Toast */
.next-episode-toast {
    position: absolute;
    bottom: 80px;
    right: 30px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 1.1rem;
    z-index: 100;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--accent);
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Plyr Customizations */
:root {
    --plyr-color-main: #E50914;
    --plyr-video-background: #000;
}
.plyr--video {
    height: 100%;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}


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

/* Professional Mobile Video Controls - Neat Bottom Bar */
@media (max-width: 768px) {
    /* Allow the control bar to wrap */
    .plyr__controls {
        flex-wrap: wrap !important;
        padding: 8px 10px 5px 10px !important;
    }

    /* 1. Row 1: Full-width Progress Bar */
    .plyr__controls > .plyr__progress {
        flex: 1 1 100% !important; /* Take full width */
        order: -1 !important; /* Force to top row */
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 8px !important; /* Spacing between progress and buttons */
    }

    /* 2. Row 2: Buttons - Remove absolute positioning */
    .plyr__controls [data-plyr="rewind"],
    .plyr__controls [data-plyr="fast-forward"],
    .plyr__controls > [data-plyr="play"] {
        position: static !important;
        transform: none !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        border: none !important;
        border-radius: 4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 7px !important;
        margin: 0 2px !important;
        z-index: 1 !important;
    }

    /* Reset icon sizes to native Plyr proportions */
    .plyr__controls [data-plyr="rewind"] svg,
    .plyr__controls [data-plyr="fast-forward"] svg,
    .plyr__controls > [data-plyr="play"] svg {
        width: 18px !important;
        height: 18px !important;
        position: static !important;
        fill: currentColor !important; /* Matches Plyr theme */
    }

    /* Hide the huge overlaid play button */
    .plyr__control--overlaid {
        display: none !important;
    }

    /* 3. Row 2 Layout: Push time and other controls to the right */
    .plyr__controls > .plyr__time--current {
        margin-left: auto !important; /* Pushes everything after it to the right */
        font-size: 13px !important;
        font-weight: 500 !important;
        padding-right: 5px !important;
    }

    /* Hide redundant elements to save space */
    .plyr__controls .plyr__time--duration {
        display: none !important;
    }
    
    /* Expand volume slider on hover */
    .plyr__controls .plyr__volume {
        width: auto !important;
        min-width: 0 !important;
        max-width: 40px !important; 
        transition: max-width 0.3s ease !important;
        overflow: hidden !important;
    }
    .plyr__controls .plyr__volume:hover {
        max-width: 140px !important; 
    }
    .plyr__controls .plyr__volume input[data-plyr="volume"] {
        display: block !important;
    }
    .plyr__controls {
        padding-bottom: 5px;
    }
}

/* ========================================= */
/* SUBTITLE OVERLAY STYLING                  */
/* ========================================= */
#customSubtitleOverlay {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: yellow;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black, -1px -1px 2px black, 1px -1px 2px black, -1px 1px 2px black;
    z-index: 1000;
    width: 90%;
    pointer-events: none;
    line-height: 1.4;
}

@media (max-width: 768px) {
    #customSubtitleOverlay {
        font-size: 14px; /* Rất nhỏ cho mobile để bằng với sub gốc */
        bottom: 40px;
    }
}
@media (max-width: 480px) {
    #customSubtitleOverlay {
        font-size: 11px; /* Cực nhỏ cho điện thoại màn hình bé */
        bottom: 35px;
    }
}

.plyr__captions { display: block !important; z-index: 999999 !important; }
.plyr__caption { background: rgba(0,0,0,0.8) !important; color: yellow !important; font-size: 24px !important; }

/* ========================================= */
/* TV INTERFACE OPTIMIZATIONS                */
/* ========================================= */
@media (min-width: 1400px) {
    .movies-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 30px; }
    .hero-title { font-size: 5rem; height: auto; min-height: 150px; }
    .hero-desc { font-size: 1.2rem; height: auto; min-height: 90px; }
    .movie-title { font-size: 1.1rem; }
    .header-container { height: 90px; }
    .main-nav { font-size: 1.1rem; }
    .dropdown-content a { font-size: 1.05rem; }
}

@media (min-width: 1920px) {
    .movies-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 40px; }
    .hero-title { font-size: 6rem; height: auto; min-height: 200px; }
    .hero-desc { font-size: 1.4rem; height: auto; min-height: 100px; }
    .movie-title { font-size: 1.3rem; }
    .section-title { font-size: 2rem; }
    .header-container { height: 100px; padding: 0 5%; }
    .main-nav { font-size: 1.25rem; gap: 40px; }
    .logo { font-size: 2.5rem; }
    .dropdown-content { min-width: 320px; }
    .dropdown-content a { font-size: 1.15rem; padding: 10px 15px; }
}


/* ========================================= */
/* TOP RATED SECTION (PREMIUM DESIGN)        */
/* ========================================= */
.top-rated-section {
    position: relative;
    margin: 50px 4% 50px;
    background: linear-gradient(145deg, #161618 0%, #0a0a0a 100%);
    border-radius: 16px;
    border: 1px solid rgba(245, 197, 24, 0.15);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 1;
}
@keyframes topRatedPulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.02); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.5; }
}
.top-rated-glow {
    position: absolute;
    top: -50%; left: -50%; right: -50%; bottom: -50%;
    background: radial-gradient(circle, rgba(245,197,24,0.06) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
    animation: topRatedPulse 4s ease-in-out infinite;
}
.top-rated-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.top-rated-title { font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; gap: 10px; margin: 0; }
.top-rated-title .gradient-text { background: linear-gradient(90deg, #f5c518, #f59e0b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.imdb-badge { font-size: 0.7rem; font-weight: 800; background: #f5c518; color: #000; padding: 3px 8px; border-radius: 6px; box-shadow: 0 2px 10px rgba(245,197,24,0.3); }
.top-rated-view-all { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #ccc; padding: 8px 18px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: 0.3s; }
.top-rated-view-all:hover { background: #f5c518; color: #000; border-color: #f5c518; }
.top-rated-body { display: grid; grid-template-columns: 280px 1fr; }
.top-rated-featured { position: relative; cursor: pointer; border-right: 1px solid rgba(255,255,255,0.05); overflow: hidden; min-height: 420px; border-bottom-left-radius: 16px; transition: 0.3s; }
.top-rated-featured img { width: 100%; height: 100%; object-fit: cover; transition: 0.7s ease; filter: brightness(0.85); }
.top-rated-featured:hover img { transform: scale(1.08); filter: brightness(1); }
.top-rated-featured-overlay { position: absolute; inset: 0; padding: 25px; background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.5) 50%, transparent 100%); display: flex; flex-direction: column; justify-content: flex-end; }
.top-rated-watching-badge { align-self: flex-start; display: flex; align-items: center; gap: 5px; background: rgba(229,9,20,0.9); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: 6px; margin-bottom: 12px; border: 1px solid rgba(255,255,255,0.2); }
.top-rated-featured-title { font-size: 1.25rem; font-weight: 800; color: #fff; margin-bottom: 8px; line-height: 1.3; }
.top-rated-featured-meta { display: flex; gap: 10px; font-size: 0.8rem; color: #bbb; margin-bottom: 15px; align-items: center; }
.top-rated-featured-score { color: #f5c518; font-weight: 700; font-size: 1rem; }
.top-rated-featured-action .btn-watch-now { background: #f5c518; color: #000; border: none; padding: 10px 20px; border-radius: 25px; font-weight: 700; font-size: 0.9rem; cursor: pointer; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.3s; }
.top-rated-featured:hover .btn-watch-now { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(245,197,24,0.4); }
.top-rated-rank-badge-crown { position: absolute; top: 15px; left: 15px; background: linear-gradient(45deg, #f5c518, #f59e0b); color: #000; font-size: 1rem; font-weight: 900; padding: 5px 12px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.top-rated-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; }
.top-rated-list-item { position: relative; display: flex; align-items: center; gap: 15px; padding: 15px 20px; cursor: pointer; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); border-right: 1px solid rgba(255,255,255,0.03); border-bottom: 1px solid rgba(255,255,255,0.03); overflow: hidden; }
.top-rated-list-item:nth-child(3n) { border-right: none; }
.top-rated-list-item:nth-last-child(-n+3) { border-bottom: none; }
.top-rated-list-item:hover { background: rgba(255,255,255,0.08); border-radius: 8px; z-index: 2; border-color: transparent; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }
.top-rated-rank-watermark { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 5rem; font-weight: 900; color: rgba(255,255,255,0.03); font-style: italic; pointer-events: none; transition: 0.3s; font-family: 'Arial Black', sans-serif; }
.top-rated-list-item:hover .top-rated-rank-watermark { color: rgba(245,197,24,0.1); transform: translateY(-50%) scale(1.1); }
.top-rated-thumb { position: relative; flex-shrink: 0; width: 75px; height: 105px; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.top-rated-thumb img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.top-rated-list-item:hover .top-rated-thumb img { transform: scale(1.1); }
.top-rated-play { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; opacity: 0; transition: 0.3s; color: #fff; font-size: 1.2rem; }
.top-rated-list-item:hover .top-rated-play { opacity: 1; }
.top-rated-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; z-index: 1; }
.top-rated-name { font-size: 0.95rem; font-weight: 700; color: #eee; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: 0.3s; }
.top-rated-list-item:hover .top-rated-name { color: #f5c518; }
.top-rated-meta { display: flex; gap: 8px; font-size: 0.75rem; color: #888; flex-wrap: wrap; align-items: center; }
.top-rated-meta span:not(:last-child)::after { content: '·'; margin-left: 8px; }
.top-rated-meta .top-rated-score { font-weight: 700; color: #f5c518; }
.top-rated-meta .top-rated-score::after { content: none; }
@media (max-width: 1150px) {
    .top-rated-body { grid-template-columns: 1fr; }
    .top-rated-featured { min-height: 300px; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.05); border-bottom-left-radius: 0; }
    .top-rated-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .top-rated-list-item:nth-child(3n) { border-right: 1px solid rgba(255,255,255,0.03); }
    .top-rated-list-item:nth-child(2n) { border-right: none; }
    .top-rated-list-item:nth-last-child(-n+3) { border-bottom: 1px solid rgba(255,255,255,0.03); }
    .top-rated-list-item:last-child { border-bottom: none; }
}
@media (max-width: 768px) {
    .top-rated-section { margin: 30px 2% 30px; }
    .top-rated-header { padding: 12px 15px; gap: 10px; }
    .top-rated-title { font-size: 0.9rem; gap: 5px; }
    .top-rated-view-all { padding: 5px 12px; font-size: 0.75rem; }
    .top-rated-featured { min-height: 150px; border-bottom-left-radius: 0; }
    .top-rated-featured-overlay { padding: 12px; }
    .top-rated-featured-title { font-size: 1rem; margin-bottom: 3px; }
    .top-rated-featured-meta { margin-bottom: 8px; font-size: 0.7rem; gap: 6px; }
    .top-rated-featured-score { font-size: 0.85rem; }
    .top-rated-featured-action .btn-watch-now { padding: 6px 12px; font-size: 0.75rem; border-radius: 15px; }
    .top-rated-rank-badge-crown { font-size: 0.8rem; padding: 3px 8px; top: 10px; left: 10px; }
    .top-rated-list { grid-template-columns: 1fr; }
    .top-rated-list-item:nth-child(2n) { border-right: 1px solid rgba(255,255,255,0.03); }
    .top-rated-list-item:nth-child(n) { border-right: none; }
    .top-rated-list-item:nth-last-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,0.03); }
    .top-rated-list-item:last-child { border-bottom: none; }
}

/* Top 50 Filters */
.top-filter-btn {
    background: rgba(255,255,255,0.05);
    color: #ccc;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 6px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
}
.top-filter-btn:hover, .top-filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
/* Custom Dropdown Filter */
.top-filter-dropdown {
    position: relative;
    user-select: none;
}
.top-filter-dropdown .top-filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
}
.top-filter-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    min-width: 160px;
    padding: 8px 0;
}
.top-filter-dropdown:hover .dropdown-menu,
.top-filter-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.top-filter-dropdown .dropdown-item {
    padding: 10px 20px;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
.top-filter-dropdown .dropdown-item:hover,
.top-filter-dropdown .dropdown-item.active {
    background: rgba(255,255,255,0.05);
    color: var(--accent);
}
