/*
Theme Name: FilmStream
Theme URI: http://localhost:8888/web_film
Author: ABCVIP
Description: Theme WordPress xem phim dùng dữ liệu FilmGateway.
Version: 2.2.0
Text Domain: filmstream
*/
:root {
    --bg: #181818;
    --shell: #101010;
    --panel: #161616;
    --panel-soft: #1d1d1d;
    --line: #303030;
    --line-soft: #252525;
    --text: #e7e7e7;
    --muted: #a5a5a5;
    --red: #d62828;
    --red-dark: #8f1515;
    --yellow: #ffd34d;
    --shell-width: 1350px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 1.35;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: #fff;
}

img {
    display: block;
    max-width: 100%;
}

.site-shell {
    width: min(var(--shell-width), 100%);
    margin: 0 auto;
    background: var(--shell);
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
}

.main-shell {
    min-height: 520px;
    padding: 0 8px 16px;
}

.site-header {
    background: #121212;
}

.top-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    min-height: 50px;
    border-bottom: 1px solid #2b2b2b;
    background: linear-gradient(#222, #111);
}

.top-nav-auth {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
    padding: 0 8px;
}

.top-nav-auth__btn {
    height: 32px;
    border: 1px solid #444;
    border-radius: 3px;
    background: linear-gradient(#2a2a2a, #181818);
    color: #f2f2f2;
    padding: 0 14px;
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.top-nav-auth__btn:hover {
    border-color: #666;
    background: linear-gradient(#353535, #222);
    color: #fff;
}

.top-nav-auth__btn--register {
    border-color: #8f1515;
    background: linear-gradient(var(--red), var(--red-dark));
    color: #fff;
}

.top-nav-auth__btn--register:hover {
    border-color: #ff4d4d;
    background: linear-gradient(#e03535, #b01818);
    color: #fff;
}

.top-nav-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    width: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.top-nav-list > li {
    margin: 0;
    padding: 0;
}

.top-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-right: 1px solid #333;
    background: transparent;
    cursor: pointer;
}

.top-nav-toggle__bar {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 1px;
    background: #d6d6d6;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.top-nav.is-menu-open .top-nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.top-nav.is-menu-open .top-nav-toggle__bar:nth-child(2) {
    opacity: 0;
}

.top-nav.is-menu-open .top-nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.top-nav-backdrop {
    display: none;
}

body.is-nav-open {
    overflow: hidden;
}

.top-nav-drawer {
    display: contents;
}

.top-nav-drawer__close {
    display: none;
}

.top-nav a {
    display: block;
    padding: 12px 14px;
    border-right: 1px solid #333;
    color: #d6d6d6;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.top-nav .current-menu-item > a,
.top-nav .current_page_item > a,
.top-nav a.active,
.top-nav a:hover {
    background: linear-gradient(var(--red), var(--red-dark));
    color: #fff;
}

.header-search-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-row .custom-logo-link {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.brand-row .custom-logo {
    display: block;
    height: 36px;
    width: auto;
    max-width: 200px;
}

.brand-note {
    color: var(--muted);
    font-size: 11px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 260px;
}

.search-form input[type="search"] {
    width: 100%;
    height: 23px;
    border: 1px solid #383838;
    background: #0a0a0a;
    color: #ddd;
    padding: 0 7px;
    font-size: 11px;
    outline: none;
}

.search-form button {
    height: 23px;
    border: 0;
    background: linear-gradient(#ee3a32, #a81515);
    color: #fff;
    padding: 0 9px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.quick-tags,
.footer-tags,
.keyword-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.quick-tags {
    padding: 5px 8px;
    border-bottom: 1px solid var(--line);
}

.quick-tags a,
.footer-tags a,
.keyword-cloud a,
.tag-list a {
    display: inline-block;
    border: 1px solid #333;
    background: #191919;
    color: #cfcfcf;
    padding: 3px 7px;
    font-size: 11px;
}

.quick-tags a:hover,
.footer-tags a:hover,
.keyword-cloud a:hover,
.tag-list a:hover {
    border-color: var(--red);
    background: #2a0f0f;
    color: #fff;
}

.home-intro {
    padding-top: 6px;
}

.ad-stack {
    width: min(560px, 100%);
    margin: 0 auto 8px;
    border: 1px solid #3c2c12;
    background: #080808;
}

.ad-line {
    border-bottom: 1px solid rgba(255, 255, 255, .18);
    line-height: 0;
}

.ad-line a {
    display: block;
}

.ad-line img {
    display: block;
    width: 100%;
    height: auto;
}

.ad-line:last-child {
    border-bottom: 0;
}

.section-title {
    position: relative;
    margin: 8px 0 6px;
    border-top: 1px solid #393939;
    border-bottom: 1px solid #242424;
    background: linear-gradient(#202020, #111);
    line-height: 22px;
}

.section-title span {
    display: inline-block;
    padding: 0 8px;
    border-left: 3px solid var(--red);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.keyword-cloud {
    padding: 2px 0 7px;
}

.intro-text {
    margin: 4px 0 8px;
    color: #c9c9c9;
    font-size: 11px;
}

.movie-section {
    clear: both;
}

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

/* Tablet / laptop nhỏ: giữ 5 cột để 25 phim = 5 hàng đầy (25 chỉ chia hết cho 5). */
@media (max-width: 900px) {
    .film-grid {
        gap: 8px 6px;
    }

    .poster {
        height: 92px;
    }
}

.film-card {
    position: relative;
    min-width: 0;
}

.film-card a {
    display: block;
}

.poster {
    position: relative;
    height: 108px;
    background: #050505;
    border: 1px solid #2f2f2f;
    overflow: hidden;
}

.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poster--vlxx img,
img.poster--vlxx {
    transform: scale(1.14);
    transform-origin: center 76%;
}

.poster:after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 62%, rgba(0,0,0,.34));
    pointer-events: none;
    z-index: 2;
}

.poster-preview {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: #000;
    transition: opacity .12s ease, visibility .12s ease;
}

.film-card__hit,
.film-card__meta {
    display: block;
    color: inherit;
    text-decoration: none;
}

.poster .film-card__hit {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: pointer;
}

.film-card.is-previewing .film-card__hit,
.film-card.is-preview-loading .film-card__hit,
.film-card.is-preview-playing .film-card__hit {
    z-index: 5;
}

.poster-preview iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
    background: #000;
}

.poster-preview video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    pointer-events: none;
}

.film-card.is-previewing .poster-preview,
.film-card.is-preview-loading .poster-preview {
    opacity: 1;
    visibility: visible;
    z-index: 4;
}

.film-card.is-previewing:not(.is-preview-playing) .film-card__hit img {
    opacity: 0.15;
}

.film-card.is-preview-playing .poster-preview {
    opacity: 1;
    visibility: visible;
    z-index: 4;
}

.film-card.is-preview-playing .film-card__hit img {
    opacity: 0;
    visibility: hidden;
}

.film-card.is-preview-playing .poster:after {
    opacity: 0;
}

.film-card.is-preview-loading .poster-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background: rgba(0, 0, 0, .35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 50 50'%3E%3Ccircle cx='25' cy='25' r='20' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-dasharray='31.4 31.4'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center / 28px no-repeat;
}

.badge {
    position: absolute;
    z-index: 3;
    top: 3px;
    padding: 1px 4px;
    border-radius: 1px;
    color: #fff;
    font-size: 9px;
    line-height: 12px;
    text-transform: capitalize;
}

.badge-source {
    left: 3px;
    padding: 2px 3px;
    line-height: 0;
}

.badge-source img {
    display: block;
    height: 12px;
    width: auto;
}

.badge-quality {
    right: 3px;
    background: rgba(210, 36, 36, .86);
}

.film-title {
    min-height: 30px;
    margin: 3px 0 0;
    color: #f1f1f1;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.25;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.film-card:hover .film-title {
    color: #ffdfdf;
}

.film-duration {
    display: none;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 12px 0 4px;
}

.pagination .page-numbers {
    min-width: 22px;
    height: 22px;
    padding: 4px 7px;
    border: 1px solid #555;
    border-radius: 50%;
    color: #e5e5e5;
    background: #111;
    text-align: center;
    line-height: 12px;
}

.pagination .current,
.pagination a:hover {
    border-color: #54789f;
    background: #426b94;
    color: #fff;
}

.watch-page {
    padding-top: 5px;
}

.watch-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 25px;
    border-bottom: 1px solid #333;
}

.watch-title-row h1 {
    margin: 0;
    color: #fff;
    font-size: 13px;
    font-weight: 400;
}

.watch-title-row .search-form {
    min-width: 230px;
}

.player-shell {
    margin-top: 5px;
    border: 1px solid #2c2c2c;
    background: #000;
}

.fgw-player-wrap {
    background: #000;
}

.watch-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.fgw-server-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
    padding: 0;
    background: transparent;
    border: 0;
}

.fgw-server-switch__btn {
    appearance: none;
    border: 0;
    border-radius: 4px;
    background: #000;
    color: #fff;
    font: 700 12px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    min-width: 28px;
    min-height: 24px;
    padding: 4px 8px;
    cursor: pointer;
}

.fgw-server-switch__btn:hover {
    color: #fff;
    opacity: 0.9;
}

.fgw-server-switch__btn.is-active {
    background: #d32f2f;
    color: #fff;
}

.fgw-player {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
}

.fgw-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.fgw-player iframe.fgw-player-iframe:not(.is-active) {
    visibility: hidden;
    pointer-events: none;
    z-index: 0;
}

.fgw-player iframe.fgw-player-iframe.is-active {
    visibility: visible;
    z-index: 1;
}

.fgw-player-empty {
    display: grid;
    place-items: center;
    min-height: 320px;
    color: var(--muted);
}

.watch-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 5px 0;
    color: #bdbdbd;
    font-size: 11px;
}

.watch-meta b {
    color: #fff;
}

.watch-description {
    margin: 8px 0;
    color: #d8d8d8;
    font-size: 11px;
}

.watch-description p {
    margin: 0 0 7px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0;
}

.related-section {
    margin-top: 8px;
}

.empty-box {
    padding: 16px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    text-align: center;
}

.site-footer {
    background: var(--bg);
}

.site-footer .site-shell {
    padding: 4px 8px 12px;
}

.footer-tags {
    padding: 3px 0 7px;
}

.footer-copy {
    margin: 4px 0 0;
    color: #aaa;
    font-size: 11px;
}

@media (max-width: 760px) {
    .site-shell {
        width: 100%;
        border-left: 0;
        border-right: 0;
    }

    .top-nav {
        flex-wrap: nowrap;
        align-items: center;
    }

    .top-nav-toggle {
        display: flex;
    }

    .top-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 998;
        border: 0;
        margin: 0;
        padding: 0;
        background: rgba(0, 0, 0, 0.55);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .top-nav.is-menu-open .top-nav-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .top-nav-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 999;
        width: min(280px, 85vw);
        margin: 0;
        overflow: hidden;
        background: linear-gradient(180deg, #1e1e1e 0%, #111 100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
        transform: translateX(-100%);
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
        will-change: transform;
    }

    .top-nav.is-menu-open .top-nav-drawer {
        transform: translateX(0);
    }

    .top-nav-drawer__close {
        display: none;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 2px;
        right: 0;
        z-index: 1000;
        width: 48px;
        height: 48px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .top-nav.is-menu-open .top-nav-drawer__close {
        display: flex;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .top-nav-drawer__close-line {
        position: absolute;
        display: block;
        width: 22px;
        height: 2px;
        border-radius: 1px;
        background: #f2f2f2;
    }

    .top-nav-drawer__close-line:nth-child(1) {
        transform: rotate(45deg);
    }

    .top-nav-drawer__close-line:nth-child(2) {
        transform: rotate(-45deg);
    }

    .top-nav-list {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin: 0;
        padding: 0 0 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .top-nav-list > li {
        width: 100%;
    }

    .top-nav-list a {
        border-right: 0;
        border-bottom: 1px solid #333;
        padding: 14px 18px;
        font-size: 14px;
    }

    .top-nav-list > li:last-child a {
        border-bottom: 0;
    }

    .top-nav-auth {
        margin-left: auto;
        padding: 6px 8px;
        align-self: center;
    }

    .header-search-row,
    .watch-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form,
    .watch-title-row .search-form {
        width: 100%;
        min-width: 0;
    }

    .ad-line strong {
        min-width: 64px;
        font-size: 18px;
    }

    .ad-line span {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .film-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .poster {
        height: 82px;
    }
}
