/* ============================================================
   NASPAY TV WEB - Main stylesheet
   ============================================================ */

:root {
    --bg:           #0E0E12;
    --card:         #17171E;
    --card-hover:   #1E1E27;
    --text:         #F2F2F7;
    --text-muted:   #9A9AA8;
    --text-light:   #6B6B78;
    --border:       #26262F;
    --chip:         #1E1E27;

    --primary:      #8B5CF6;
    --primary-h:    #7C3AED;
    --accent:       #EC4899;

    --success:      #2EA043;
    --error:        #F85149;
    --warning:      #D29922;

    --header-h:     62px;
    --footer-h:     46px;

    --radius-sm:    8px;
    --radius:       12px;
    --radius-lg:    16px;
    --radius-xl:    20px;
}

[data-theme="light"] {
    --bg:           #F5F5F7;
    --card:         #FFFFFF;
    --card-hover:   #F0F0F5;
    --text:         #1A1A2E;
    --text-muted:   #6B6B78;
    --text-light:   #8B8B94;
    --border:       #E5E5EA;
    --chip:         #F0F0F5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: auto;
    position: relative;
}

.login-bg-logo {
    position: fixed;
    left: -100px;
    bottom: -100px;
    width: 480px;
    height: 480px;
    background: url('../../favicon.png') center/contain no-repeat;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

.login-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.6s ease;
}

.login-logo img {
    height: 100px;
    width: auto;
    margin: 0 auto;
}

.login-title {
    margin-top: 0;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
}

.brand-primary { color: var(--primary); }
.brand-suffix  { color: var(--text); }

.login-sub {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.login-form {
    width: 100%;
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.field:focus-within { border-color: var(--primary); }

.field-icon {
    padding: 0 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.field input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 15px;
    padding: 14px 12px 14px 0;
    font-family: inherit;
    min-width: 0;
}

.field-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    padding: 0 14px;
    white-space: nowrap;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary.outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-primary.outline:hover { background: rgba(139,92,246,0.1); }
.btn-primary.outline i { font-size: 16px; }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

.login-error {
    width: 100%;
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(248,81,73,0.1);
    border: 1px solid rgba(248,81,73,0.3);
    border-radius: var(--radius);
    color: var(--error);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-support {
    margin-top: 20px;
    color: var(--text);
    font-size: 13px;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.login-support a { color: var(--primary); font-weight: 600; }

.login-footer {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.lang-switch { color: var(--primary); font-weight: 600; }

.login-or {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.login-or::before,
.login-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ============================================================
   QR MODAL
   ============================================================ */
.qr-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.qr-modal-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px 28px 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.qr-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.15s;
}

.qr-modal-close:hover { background: var(--card-hover); color: var(--text); }

.qr-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.qr-sub {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.qr-box {
    width: 280px;
    height: 280px;
    margin: 0 auto 16px;
    background: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    max-width: 100%;
}

.qr-box img { display: block; width: 280px; height: 280px; max-width: 100%; }

.qr-error { color: #F85149; font-size: 13px; text-align: center; padding: 20px; }
.qr-wait { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   APP SHELL
   ============================================================ */
body.app-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    padding: 20px 24px 40px;
    animation: fadeIn 0.4s ease;
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    height: var(--header-h);
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-burger {
    display: none;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 20px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-burger:hover { background: var(--card-hover); }

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 8px;
}

.brand-text {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}

.header-nav::-webkit-scrollbar { display: none; }

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.nav-link i { font-size: 13px; }

.nav-link:hover {
    background: var(--card-hover);
    color: var(--text);
}

.nav-link.active {
    background: rgba(139,92,246,0.15);
    color: var(--primary);
}

.header-lang {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
}

.header-lang:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================================
   MOBILE DRAWER
   ============================================================ */
.header-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 900;
    pointer-events: none;
}

.header-drawer.open {
    display: block;
    pointer-events: auto;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    transition: opacity 0.40s ease;
}

.header-drawer.visible .drawer-backdrop {
    opacity: 1;
}

.drawer-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 65%;
    background: var(--bg);
    border-top-right-radius: 22px;
    border-bottom-right-radius: 22px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
    -webkit-tap-highlight-color: transparent;
}

.header-drawer.visible .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 18px 13px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.drawer-logo-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139,92,246,0.10);
    flex-shrink: 0;
}

.drawer-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.drawer-brand {
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}

.drawer-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
    flex-shrink: 0;
}

.drawer-nav {
    padding: 4px 0 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    outline: none;
    transition: none;
}

.drawer-link:hover,
.drawer-link:focus,
.drawer-link:active,
.drawer-link:visited {
    background: transparent;
    color: var(--text);
    outline: none;
}

.drawer-link.active .drawer-link-label { color: var(--primary); }
.drawer-link.active .drawer-icon-box { background: rgba(139,92,246,0.22); }

.drawer-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(139,92,246,0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drawer-icon-box i {
    color: var(--primary);
    font-size: 15px;
}

.drawer-link-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-chevron {
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.drawer-sep {
    height: 1px;
    background: var(--border);
    margin: 7px 8px;
}

.drawer-spacer { flex: 1; }

.drawer-footer {
    padding: 11px 18px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    padding: 14px 20px;
}

.footer-inner {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 600;
    transition: opacity 0.15s;
}

.footer-link:hover { opacity: 0.8; }
.footer-sep { opacity: 0.5; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
    position: relative;
    width: 100%;
    height: 480px;
    margin: 0 auto 24px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}

/* Poster — camera-style zoom + fade, image keeps real aspect ratio */
.hero-img {
    position: absolute;
    inset: 0;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    image-rendering: -webkit-optimize-contrast;
    filter: saturate(1.05) contrast(1.02);
    will-change: transform, opacity;
    transform-origin: center center;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.6s ease;
    animation: cameraZoom 22s ease-in-out infinite;
}

.hero.no-trailer .hero-img { opacity: 1; }
.hero.has-trailer .hero-img { opacity: 0; }

@keyframes cameraZoom {
    0%   { transform: scale(1.00) translate(0, 0);         opacity: 0.85; }
    15%  { transform: scale(1.05) translate(-0.5%, -0.5%); opacity: 1;    }
    35%  { transform: scale(1.10) translate(0.8%, -0.3%);  opacity: 1;    }
    50%  { transform: scale(1.06) translate(0.3%, 0.8%);   opacity: 1;    }
    70%  { transform: scale(1.12) translate(-0.5%, 0.5%);  opacity: 1;    }
    85%  { transform: scale(1.05) translate(0.5%, -0.5%);  opacity: 1;    }
    100% { transform: scale(1.00) translate(0, 0);         opacity: 0.85; }
}

.hero,
.hero * {
    -webkit-user-select: none;
    user-select: none;
}

.hero-content,
.hero-content * {
    pointer-events: auto;
    position: relative;
    z-index: 3;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0,0,0,0.10) 0%,
        rgba(0,0,0,0.35) 55%,
        rgba(0,0,0,0.92) 100%);
    z-index: 2;
    pointer-events: none;
}

.hero-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 40px;
    backdrop-filter: blur(8px);
    z-index: 3;
    pointer-events: auto;
}

.hero-bottom {
    position: absolute;
    bottom: 24px;
    left: 40px;
    right: 40px;
    text-align: center;
    color: white;
    z-index: 3;
    pointer-events: none;
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.4px;
}

.hero-title .ht-first  {
    color: var(--primary);
    text-shadow: 0 2px 18px rgba(0,0,0,0.95), 0 1px 3px rgba(0,0,0,0.7);
}

.hero-title .ht-second {
    color: #FFFFFF;
    text-shadow: 0 2px 18px rgba(0,0,0,0.95), 0 1px 3px rgba(0,0,0,0.7);
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 26px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(139,92,246,0.45);
    transition: background 0.2s, transform 0.15s;
    cursor: pointer;
    white-space: nowrap;
}

.btn-hero:hover {
    background: var(--primary-h);
    transform: translateY(-1px);
}

.btn-hero i { font-size: 18px; }

.btn-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 50%;
    color: white;
    font-size: 16px;
    backdrop-filter: blur(6px);
    transition: background 0.2s, transform 0.15s;
    cursor: pointer;
}

.btn-hero-icon:hover {
    background: rgba(0,0,0,0.78);
    transform: translateY(-1px);
}

.btn-hero-icon.fav { color: #EC4899; }

.btn-hero-icon.added {
    color: var(--primary);
    border-color: rgba(139,92,246,0.6);
    background: rgba(0,0,0,0.85);
}

.hero-unmute {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 4;
    width: 42px;
    height: 42px;
    background: rgba(0,0,0,0.60);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 50%;
    color: white;
    font-size: 15px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-unmute:hover {
    background: rgba(0,0,0,0.82);
    transform: translateY(-1px);
}

/* ============================================================
   HERO — YOUTUBE TRAILER MOUNT POINT
   ============================================================ */
.hero-trailer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
    background: #000;
}

.hero.has-trailer .hero-trailer { opacity: 1; }

.hero-trailer > div,
.hero-trailer iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    min-height: 100%;
    min-width: 177.77vh;
    transform: translate(-50%, -50%);
    border: 0;
    pointer-events: none;
    user-select: none;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section { margin-bottom: 32px; }

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.section-bar {
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: 2px;
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.section-rows {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.section-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

/* ============================================================
   POSTER TILE
   ============================================================ */
.poster {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.poster:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.poster-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.poster-img {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    background: var(--chip);
    overflow: hidden;
}

.poster-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poster-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: #EC4899;
    font-size: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    border: none;
}

.poster-info {
    padding: 10px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.poster-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.poster-sub { font-size: 11px; color: var(--text-muted); }

.poster-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
}

.poster-action {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 0.15s, color 0.15s, transform 0.15s;
}

.poster-action:hover {
    background: rgba(0,0,0,0.85);
    transform: translateY(-1px);
}

.poster-action.fav {
    color: #EC4899;
    border-color: rgba(236,72,153,0.5);
}

.poster-action.added {
    color: var(--primary);
    border-color: rgba(139,92,246,0.5);
    background: rgba(0,0,0,0.85);
}

/* ============================================================
   GRID
   ============================================================ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

/* ============================================================
   FOLDER TILE (TV folders)
   ============================================================ */
.folder {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    aspect-ratio: 1;
    justify-content: center;
}

.folder:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.folder-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.folder-name {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   DETAIL PAGE
   ============================================================ */
.detail-top {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.detail-poster {
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--chip);
}

.detail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
}

.stars {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #FFC107;
    font-size: 16px;
}

.stars .rating-num {
    margin-left: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.meta-row i { width: 14px; font-size: 12px; }

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--chip);
    color: var(--text);
    transition: all 0.15s;
}

.btn:hover { border-color: var(--primary); }

.btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn.primary:hover { background: var(--primary-h); border-color: var(--primary-h); }

.btn.fav-active {
    border-color: #EC4899;
    color: #EC4899;
    background: rgba(236,72,153,0.1);
}

.btn-danger {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.btn-danger:hover { background: #e03e36; border-color: #e03e36; }

.detail-section { margin-top: 24px; }

.detail-section-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}

.detail-section-body {
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.6;
}

/* ============================================================
   PLAYER
   ============================================================ */
.player-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: black;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    display: none;
}

.player-wrap.active { display: block; }

.player-wrap video,
.player-wrap .plyr {
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
}

.player-fallback {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    background: #000;
    overflow: hidden;
}

.player-wrap.show-fallback .player-fallback {
    display: block;
}

/* Player fallback image — same camera zoom, real aspect ratio */
.player-fallback-img {
    position: absolute;
    inset: 0;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    will-change: transform, opacity;
    transform-origin: center center;
    filter: saturate(1.05) contrast(1.02);
    animation: cameraZoom 22s ease-in-out infinite;
}

.player-fallback-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0,0,0,0.10) 0%,
        rgba(0,0,0,0.35) 55%,
        rgba(0,0,0,0.85) 100%);
    pointer-events: none;
}

.player-fallback-msg {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 24px;
    text-align: center;
    color: #fff;
    font-size: 13px;
    padding: 0 20px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.9);
    opacity: 0.9;
}

/* ============================================================
   SEASONS / EPISODES
   ============================================================ */
.season {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}

.season-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.season-head:hover { background: var(--card-hover); }

.season-head i {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.season.open .season-head i { transform: rotate(180deg); }

.season-body { display: none; border-top: 1px solid var(--border); }
.season.open .season-body { display: block; }

.episode {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text);
    font-size: 13px;
}

.episode:last-child { border-bottom: none; }
.episode:hover { background: var(--card-hover); }
.episode i { color: var(--primary); font-size: 18px; flex-shrink: 0; }

/* ============================================================
   STATE
   ============================================================ */
.state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.state i { font-size: 48px; color: var(--text-light); }
.state-title { font-size: 15px; }

.loader {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-page {
    max-width: 640px;
    margin: 0 auto;
}

.settings-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}

.settings-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.settings-row:last-child { border-bottom: none; }
.settings-row .k { color: var(--text-muted); }
.settings-row .v { color: var(--text); font-weight: 500; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.status-pill.active { background: rgba(46,160,67,0.15); color: var(--success); }
.status-pill.expired { background: rgba(248,81,73,0.15); color: var(--error); }

.status-pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   GLOBAL SAFETY NET
   ============================================================ */
html, body { overflow-x: hidden; }
.app-content { overflow-x: hidden; }

/* ============================================================
   RESPONSIVE — TABLET (<= 900px)
   ============================================================ */
@media (max-width: 900px) {
    .header-burger { display: inline-flex; }
    .header-nav { display: none; }
    .header-lang { display: none; }

    .header-inner {
        justify-content: space-between;
        padding: 0 12px;
        gap: 10px;
        position: relative;
    }

    .brand-logo { display: none; }

    .header-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        flex: initial;
        justify-content: center;
    }

    .brand-text { font-size: 17px; }

    .hero { height: 320px; }
    .hero-title { font-size: 22px; }
    .hero-bottom { bottom: 16px; left: 20px; right: 20px; }
    .hero-center { gap: 10px; padding: 12px 14px; }

    .detail-top { grid-template-columns: 150px 1fr; gap: 16px; }
    .detail-title { font-size: 20px; }

    .app-content { padding: 16px; }

    .section-scroll {
        display: flex;
        flex-direction: row;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 6px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .section-scroll::-webkit-scrollbar { display: none; }

    .poster-scroll {
        flex: 0 0 auto;
        width: 120px;
        scroll-snap-align: start;
    }

    .poster-scroll .poster-img { aspect-ratio: 2 / 3; }
    .poster-scroll .poster-name { font-size: 12px; }
}

/* ============================================================
   RESPONSIVE — PHONE (<= 600px)
   ============================================================ */
@media (max-width: 600px) {
    .header-inner { padding: 0 10px; }

    .detail-top { grid-template-columns: 1fr; }
    .detail-poster { max-width: 180px; margin: 0 auto; }

    .grid,
    .section-rows {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .hero {
        height: 260px;
        border-radius: var(--radius);
    }

    .hero-title { font-size: 16px; }
    .hero-bottom { bottom: 12px; left: 12px; right: 12px; }

    .hero-center {
        gap: 6px;
        padding: 8px 10px;
        border-radius: 30px;
    }

    .btn-hero {
        padding: 9px 14px;
        font-size: 12px;
        gap: 5px;
        border-radius: 20px;
        white-space: nowrap;
    }
    .btn-hero i { font-size: 13px; }

    .btn-hero-icon {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .app-content { padding: 12px; }

    .settings-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .live-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .live-grid .folder {
        min-width: 0;
        padding: 8px 4px;
        gap: 6px;
        aspect-ratio: auto;
    }

    .live-grid .folder-img {
        width: 40px;
        height: 40px;
    }

    .live-grid .folder-name {
        font-size: 10px;
        line-height: 1.2;
        -webkit-line-clamp: 2;
    }

    .live-grid .poster-sub { font-size: 9px; }
}

@media (max-width: 400px) {
    .poster-scroll { width: 110px; }
}

/* ============================================================
   LIST HEADER + SEARCH BAR + PAGER
   ============================================================ */
.list-header { margin-bottom: 8px; }

.list-count {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    margin-left: 8px;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 8px 0 12px;
    margin-bottom: 16px;
    height: 42px;
    transition: border-color 0.15s;
}

.search-bar:focus-within { border-color: var(--primary); }

.search-icon {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 0 10px;
    min-width: 0;
}

.search-input::placeholder { color: var(--text-light); }

.search-clear {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.search-clear:hover { color: var(--text); }

.movies-grid,
.series-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(8, 1fr);
}

.live-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(6, 1fr);
}

.pager { margin-top: 24px; display: flex; justify-content: center; }
.pager-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.pager-btn,
.pager-num {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pager-btn:hover:not(:disabled),
.pager-num:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pager-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pager-num.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pager-dots {
    color: var(--text-muted);
    padding: 0 4px;
    font-weight: 600;
}

@media (max-width: 600px) {
    .movies-grid,
    .series-grid,
    .live-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .search-bar { height: 40px; margin-bottom: 12px; }
    .search-input { font-size: 13.5px; }

    .pager-btn,
    .pager-num { min-width: 32px; height: 32px; font-size: 12px; padding: 0 8px; }
}

/* ============================================================
   TRAILER MODAL
   ============================================================ */
.trailer-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.trailer-modal-card {
    position: relative;
    width: 100%;
    max-width: 900px;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.trailer-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.trailer-modal-close:hover { background: rgba(0,0,0,0.9); }

.trailer-modal-body {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
}

.trailer-modal-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.trailer-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    color: var(--text-muted);
    font-size: 14px;
}

.trailer-unavailable i {
    font-size: 40px;
    color: var(--warning);
}

/* ============================================================
   PLAYLISTS PAGE
   ============================================================ */
.playlists-page {
    max-width: 1100px;
    margin: 0 auto;
}

.playlists-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.playlists-header .section-header { margin-bottom: 0; }

.playlists-new-btn {
    padding: 10px 18px;
    font-size: 13.5px;
    white-space: nowrap;
}

.playlists-empty {
    min-height: 60vh;
    justify-content: center;
}

.playlists-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

.playlist-folder {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
}

.playlist-folder:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.playlist-folder-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 10px;
    color: inherit;
    text-decoration: none;
    text-align: center;
}

.playlist-folder-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    flex-shrink: 0;
}

.playlist-folder-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
    word-break: break-word;
}

.playlist-folder-sub {
    font-size: 10px;
    color: var(--text-muted);
}

.playlist-folder-menu {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.playlist-folder-menu:hover {
    background: var(--card-hover);
    color: var(--text);
}

.playlist-menu {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    min-width: 160px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: fadeIn 0.15s ease;
}

.playlist-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
}

.playlist-menu-item:hover { background: var(--card-hover); }
.playlist-menu-item i { width: 14px; font-size: 12px; color: var(--text-muted); }

.playlist-menu-item.danger { color: var(--error); }
.playlist-menu-item.danger i { color: var(--error); }
.playlist-menu-item.danger:hover { background: rgba(248,81,73,0.10); }

@media (max-width: 600px) {
    .playlists-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .playlist-folder { border-radius: 10px; }
    .playlist-folder-link { padding: 10px 6px; gap: 8px; }

    .playlist-folder-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        font-size: 16px;
    }

    .playlist-folder-name { font-size: 11px; }
    .playlist-folder-sub { font-size: 9px; }

    .playlist-folder-menu {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    .playlists-new-btn {
        padding: 8px 14px;
        font-size: 12.5px;
    }

    .playlists-new-btn span { display: none; }
    .playlists-new-btn i { font-size: 14px; }
}

/* ============================================================
   PLAYLIST NAME / CONFIRM MODAL
   ============================================================ */
.pl-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.pl-modal.visible { opacity: 1; }

.pl-modal-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px 22px 18px;
    transform: scale(0.94) translateY(6px);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.22s ease;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.pl-modal.visible .pl-modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.pl-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
}

.pl-modal-text {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
    word-break: break-word;
    margin-bottom: 4px;
}

.pl-modal-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.pl-modal-input:focus { border-color: var(--primary); }
.pl-modal-input::placeholder { color: var(--text-light); }

.pl-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

.pl-modal-actions .btn {
    padding: 9px 18px;
    font-size: 13.5px;
}

/* ============================================================
   ADD / REMOVE PLAYLIST MODAL
   ============================================================ */
.atp-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    margin-top: 4px;
}

.atp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
}

.atp-item:hover {
    border-color: var(--primary);
    background: var(--card-hover);
}

.atp-item i {
    color: var(--primary);
    font-size: 13px;
    width: 14px;
    flex-shrink: 0;
}

.atp-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atp-count {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

.atp-empty {
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.atp-item-remove { justify-content: space-between; }

.atp-remove-icon {
    color: var(--error) !important;
    font-size: 12px !important;
    margin-left: 6px;
}

/* ============================================================
   PLAYLIST DETAIL PAGE
   ============================================================ */
.playlist-detail-page {
    max-width: 1100px;
    margin: 0 auto;
}

.playlist-detail-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.playlist-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    width: fit-content;
    transition: color 0.15s;
}

.playlist-back-link:hover { color: var(--primary); }

.pld-empty {
    min-height: 60vh;
    justify-content: center;
}

.playlist-items-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 14px;
}

@media (max-width: 600px) {
    .playlist-items-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}