/* vMovies */
/* Keep the HTML hidden attribute authoritative: class rules like
   .pf-menu{display:flex} otherwise override [hidden] and elements never hide. */
[hidden] { display: none !important; }

:root {
    --bg: #0b0b0f;
    --surface: #14141b;
    --surface-2: #1d1d27;
    --border: #2a2a38;
    --text: #e8e8ee;
    --text-dim: #9a9aad;
    --accent: #f5c518;
    --brand: #e0364f;
    --radius: 12px;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

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

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 14px 24px;
    background: rgba(11, 11, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--brand);
}
.logo span { color: var(--text); }

.main-nav { display: flex; gap: 4px; }
.main-nav a {
    padding: 7px 14px;
    border-radius: 8px;
    color: var(--text-dim);
    font-weight: 500;
    transition: color .15s, background .15s;
}
.main-nav a:hover { color: var(--text); }
.main-nav a.active { color: var(--text); background: var(--surface-2); }

.search-form {
    margin-left: auto;
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 6px 2px 16px;
    transition: border-color .15s;
}
.search-form:focus-within { border-color: var(--brand); }
.search-form input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    width: 200px;
    font-size: .9rem;
    padding: 7px 0;
}
.search-form input::placeholder { color: var(--text-dim); }
.search-form button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    padding: 6px;
}
.search-form button:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero {
    background-size: cover;
    background-position: center 20%;
    min-height: 420px;
    display: flex;
    align-items: flex-end;
}
.hero-content {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 60px 20px 40px;
}
.hero-tag {
    display: inline-block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--brand);
    margin-bottom: 8px;
}
.hero h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 10px;
}
.hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--text-dim);
}
.hero p {
    max-width: 560px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

/* ---------- Badges & buttons ---------- */
.badge-rating {
    background: var(--accent);
    color: #141000;
    font-weight: 700;
    font-size: .8rem;
    padding: 2px 8px;
    border-radius: 6px;
}
.badge-type {
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: .75rem;
    padding: 2px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 10px;
    font-weight: 600;
    transition: transform .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn-primary { background: var(--brand); color: #fff; }

/* ---------- Sections ---------- */
main.container { padding-top: 32px; padding-bottom: 48px; }
section { margin-bottom: 40px; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.section-head h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.clear-link { color: var(--text-dim); font-size: .9rem; }
.clear-link:hover { color: var(--text); }

.filter-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
}
.filter-tabs a {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: .875rem;
    color: var(--text-dim);
    transition: color .15s, background .15s;
}
.filter-tabs a:hover { color: var(--text); }
.filter-tabs a.active { background: var(--brand); color: #fff; }

.empty-note { color: var(--text-dim); padding: 40px 0; text-align: center; }

/* ---------- Grid & cards ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
}

.card { display: block; }
.card-poster {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
}
.card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.card:hover .card-poster img { transform: scale(1.06); }
.card-poster .badge-rating {
    position: absolute;
    top: 8px;
    left: 8px;
}
.card-hover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(11, 11, 15, 0.45);
    color: #fff;
    opacity: 0;
    transition: opacity .2s;
}
.card:hover .card-hover { opacity: 1; }
.card-body { padding: 8px 2px 0; }
.card-title {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-sub { font-size: .78rem; color: var(--text-dim); }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 32px;
}
.pagination a {
    min-width: 38px;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: .875rem;
    transition: color .15s, background .15s;
}
.pagination a:hover { color: var(--text); background: var(--surface-2); }
.pagination a.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Details page ---------- */
.detail-hero {
    background-size: cover;
    background-position: center 25%;
    background-color: var(--surface);
    padding: 56px 0 32px;
}
.detail-layout {
    display: flex;
    gap: 36px;
    align-items: flex-end;
}
.detail-poster {
    flex: 0 0 240px;
}
.detail-poster img {
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.detail-info h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.8px;
    margin-bottom: 10px;
}
.detail-info .muted { color: var(--text-dim); font-weight: 400; }
.detail-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--text-dim);
    margin-bottom: 12px;
}
.genre-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.genre-list span {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: .78rem;
    color: var(--text-dim);
}
.tagline { font-style: italic; color: var(--text-dim); margin-bottom: 10px; }
.overview { max-width: 720px; color: #c9c9d6; margin-bottom: 14px; }
.imdb-link {
    color: var(--accent);
    font-size: .875rem;
    font-weight: 600;
}
.imdb-link:hover { text-decoration: underline; }

/* ---------- Player ---------- */
.player-section {
    margin-top: 32px;
}
.player-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.player-bar h2 { font-size: 1.35rem; font-weight: 700; }
.player-controls {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
}
.player-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .875rem;
    color: var(--text-dim);
}
.player-controls select {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: .875rem;
    outline: none;
    cursor: pointer;
}
.player-controls select:focus { border-color: var(--brand); }
.player-frame {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border);
}
.player-frame iframe,
.player-frame video {
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
    display: block;
}
.player-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: .95rem;
    pointer-events: none;
}
.player-frame { position: relative; }
.player-frame:fullscreen { border-radius: 0; border: 0; }
.player-note {
    margin-top: 10px;
    font-size: .8rem;
    color: var(--text-dim);
}

.watch-heading { font-size: 1.35rem; font-weight: 700; margin-bottom: 14px; }

/* ---------- In-player top buttons ---------- */
.pf-top {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity .2s;
}
.player-frame:hover .pf-top,
.player-frame:fullscreen .pf-top { opacity: 1; }
/* Touch devices have no hover — keep the buttons visible so the menu is reachable. */
@media (hover: none) { .pf-top { opacity: 1; } }
.pf-btn {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    backdrop-filter: blur(4px);
}
.pf-btn:hover { background: rgba(0, 0, 0, 0.85); }

/* ---------- In-player settings menu ---------- */
.pf-menu {
    position: absolute;
    top: 56px;
    right: 10px;
    z-index: 8;
    width: 300px;
    max-width: calc(100% - 20px);
    max-height: calc(100% - 80px);
    overflow-y: auto;
    background: rgba(15, 15, 22, 0.97);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .6);
}
.pf-sec { display: flex; flex-direction: column; gap: 6px; }
.pf-sec > label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
}
.pf-sec select {
    width: 100%;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: .875rem;
    cursor: pointer;
    outline: none;
}
.pf-sec select:focus { border-color: var(--brand); }
.pf-sec-row { flex-direction: row; gap: 10px; }
.pf-sec-row > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pf-sec-row label { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); }
.pf-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    color: var(--text-dim);
}
.pf-line span { width: 58px; }
.pf-line b { color: var(--text); min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.pf-line input[type=range] { flex: 1; accent-color: var(--brand); }
.pf-hint { font-size: .78rem; color: var(--text-dim); line-height: 1.4; margin: 2px 0 0; }
.pf-hint b { color: var(--text); }
.pf-line button {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.pf-line button:hover { border-color: var(--brand); }
.pf-line button.link {
    width: auto;
    border: none;
    background: none;
    color: var(--text-dim);
    text-decoration: underline;
    font-size: .76rem;
    padding: 0 4px;
}

/* ---------- Custom subtitle overlay ---------- */
.sub-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8%;
    text-align: center;
    padding: 0 5%;
    z-index: 5;
    pointer-events: none;
    display: none;
    --sub-size: 1.2;
}
.sub-overlay div {
    display: inline-block;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.66);
    color: #fff;
    padding: 0.08em 0.4em;
    border-radius: 4px;
    font-size: calc(1rem * var(--sub-size));
    line-height: 1.35;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    white-space: normal;
}
.player-frame:fullscreen .sub-overlay div { font-size: calc(1.6rem * var(--sub-size)); }

/* ---------- Cast ---------- */
.cast-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.cast-card { flex: 0 0 110px; }
.cast-card img {
    width: 110px;
    height: 140px;
    object-fit: cover;
    border-radius: 10px;
    background: var(--surface-2);
    margin-bottom: 6px;
}
.cast-name {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cast-role {
    display: block;
    font-size: .72rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: .85rem;
}
.site-footer a { color: var(--text); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .site-header { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
    .search-form { order: 3; width: 100%; margin-left: 0; }
    .search-form input { width: 100%; flex: 1; }
    .hero { min-height: 320px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
    .detail-layout { flex-direction: column; align-items: flex-start; }
    .detail-poster { flex: 0 0 auto; width: 180px; }

    /* No reliable hover on phones — keep the ⚙/⛶ buttons visible. */
    .pf-top { opacity: 1; }

    /* The player frame is short on phones and clips its overflow, so float the
       settings menu as a centered panel over the page instead of inside it. */
    .pf-menu {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        width: min(340px, 92vw);
        max-width: 92vw;
        max-height: 82vh;
    }
    .watch-heading { font-size: 1.2rem; }
}
