/* ==========================================================================
   SineAI Android TV UI/UX V3 — Complete Ground-Up Design System
   Target: Xiaomi Mi Box / 10-foot Living Room Interface (720p, 1080p, 4K)
   ========================================================================== */

:root {
    --sineai-tv-contract: 4;
}

/* 1. DESIGN TOKENS & BASE RESET */
.tv-featured,
.tv-search-intro {
    display: none;
}

body.tv-nav-ready {
    --tv-bg: #07080b;
    --tv-surface: #111318;
    --tv-surface-hover: #191c23;
    --tv-surface-raised: #212530;
    --tv-purple: #7c3aed;
    --tv-purple-light: #9b72ff;
    --tv-accent: #06b6d4;
    --tv-text: #f7f7f8;
    --tv-text-secondary: rgba(255, 255, 255, 0.68);
    --tv-text-dim: rgba(255, 255, 255, 0.42);
    --tv-border: rgba(255, 255, 255, 0.12);

    --tv-radius-sm: 8px;
    --tv-radius-md: 12px;
    --tv-radius-lg: 16px;

    /* Overscan Safe Area scaling */
    --tv-safe-x: clamp(42px, 4vw, 90px);
    --tv-safe-y: clamp(26px, 3vh, 58px);

    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overscroll-behavior: none;
    background: var(--tv-bg);
    color: var(--tv-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: auto !important;
    scroll-padding-top: calc(clamp(72px, 8vh, 88px) + 20px);
}

html.tv-nav-ready,
body.tv-nav-ready {
    scrollbar-width: none;
}

html.tv-nav-ready::-webkit-scrollbar,
body.tv-nav-ready::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

body.tv-nav-ready .container {
    width: 100%;
    max-width: none;
    padding-inline: var(--tv-safe-x);
}

/* Hide web clutter in TV mode */
body.tv-nav-ready .hero-glow,
body.tv-nav-ready .logo-area,
body.tv-nav-ready .tagline,
body.tv-nav-ready .see-all,
body.tv-nav-ready .app-footer,
body.tv-nav-ready .search-sparkle-icon {
    display: none !important;
}

/* Performance Budget: NO backdrop-filter or heavy blur */
body.tv-nav-ready .modal,
body.tv-nav-ready .saas-search-box,
body.tv-nav-ready .saas-results-toolbar,
body.tv-nav-ready .card-type-badge,
body.tv-nav-ready .card-score-badge,
body.tv-nav-ready .brand-badge,
body.tv-nav-ready .btn-nav-auth,
body.tv-nav-ready .btn-nav-profile {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Profile is a full-page TV view; keep its controls below the fixed header. */
body.tv-nav-ready #profileSection {
    min-height: 100vh;
    /* WebView may perform a late focus scroll of roughly one control row.
       Reserve a full header + control-row gutter so overscan never clips it. */
    padding-top: calc(clamp(72px, 8vh, 88px) + clamp(64px, 7vh, 84px)) !important;
    padding-right: var(--tv-safe-x) !important;
    padding-bottom: max(56px, var(--tv-safe-y)) !important;
    padding-left: var(--tv-safe-x) !important;
}

body.tv-nav-ready #profileSection .profile-page-header {
    position: relative;
    z-index: 2;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center !important;
    min-height: 54px;
    gap: clamp(16px, 2vw, 36px);
}

body.tv-nav-ready #profileSection .profile-page-header h2 {
    min-width: 0;
    text-align: center;
    font-size: clamp(18px, 1.6vw, 30px) !important;
    line-height: 1.15;
}

/* The TV shell always owns navigation, even on low-resolution WebViews. */
body.tv-nav-ready #mobileTopBar,
body.tv-nav-ready #mobileBottomNav {
    display: none !important;
}

/* Dialogs must always sit above the fixed TV navigation. */
body.tv-nav-ready #detailModal,
body.tv-nav-ready #trailerModal,
body.tv-nav-ready #authModal,
body.tv-nav-ready #advSearchModal {
    z-index: 2000 !important;
}

/* 2. MINIMAL TOP NAV BAR */
body.tv-nav-ready .tv-fixed-header,
body.tv-nav-ready .top-nav-bar,
body.tv-nav-ready #topNav {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: clamp(72px, 8vh, 88px) !important;
    padding: 0 var(--tv-safe-x) !important;
    background: linear-gradient(180deg, rgba(7, 8, 11, 0.99) 0%, rgba(7, 8, 11, 0.96) 72%, rgba(7, 8, 11, 0.9) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35) !important;
    pointer-events: auto;
}

body.tv-nav-ready .brand-badge {
    display: none !important;
}

body.tv-nav-ready .tv-nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.tv-nav-ready .tv-nav-link {
    min-height: 44px;
    padding: 6px 18px;
    border: 1px solid transparent;
    border-radius: var(--tv-radius-sm);
    background: transparent;
    color: var(--tv-text-secondary);
    font-size: clamp(14px, 0.95vw, 18px);
    font-weight: 700;
    cursor: pointer;
}

body.tv-nav-ready .tv-nav-link.active {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.tv-nav-ready .auth-nav-area {
    display: flex;
    gap: 12px;
}

body.tv-nav-ready .btn-nav-auth,
body.tv-nav-ready .btn-nav-profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 22px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(6, 182, 212, 0.2));
    color: #ffffff;
    font-size: clamp(14px, 0.95vw, 18px);
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
}


/* 3. CINEMATIC HERO SECTION */
body.tv-nav-ready .tv-featured {
    position: relative;
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 76vh;
    min-height: 500px;
    max-height: 780px;
    margin: 0;
    padding: 0 0 clamp(30px, 4vh, 60px);
    overflow: hidden;
    background: var(--tv-bg);
    isolation: isolate;
}

body.tv-nav-ready .tv-featured-backdrop,
body.tv-nav-ready .tv-featured-shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

body.tv-nav-ready .tv-featured-backdrop {
    z-index: -3;
    background-position: center 20%;
    background-size: cover;
}

body.tv-nav-ready .tv-featured-shade {
    z-index: -2;
    background:
        linear-gradient(90deg, #07080b 0%, rgba(7, 8, 11, 0.92) 36%, rgba(7, 8, 11, 0.35) 64%, transparent 100%),
        linear-gradient(0deg, #07080b 0%, rgba(7, 8, 11, 0.45) 35%, transparent 100%),
        linear-gradient(180deg, rgba(7, 8, 11, 0.6) 0%, transparent 22%);
}

body.tv-nav-ready .tv-featured-content {
    width: min(680px, 44vw);
    padding-left: var(--tv-safe-x);
}

body.tv-nav-ready .tv-featured-kicker,
body.tv-nav-ready .tv-eyebrow {
    margin-bottom: 8px;
    color: var(--tv-purple-light);
    font-size: clamp(12px, 0.85vw, 16px);
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

body.tv-nav-ready .tv-featured h2 {
    margin: 0 0 10px;
    color: #fff;
    font-size: clamp(36px, 3.8vw, 68px);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: -0.04em;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

body.tv-nav-ready .tv-featured-meta {
    margin-bottom: 10px;
    color: #e2e8f0;
    font-size: clamp(14px, 0.98vw, 19px);
    font-weight: 750;
}

body.tv-nav-ready .tv-featured p {
    display: -webkit-box;
    max-width: 620px;
    margin: 0 0 20px;
    overflow: hidden;
    color: var(--tv-text-secondary);
    font-size: clamp(15px, 1.05vw, 20px);
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

body.tv-nav-ready .tv-featured-button {
    min-width: 180px;
    min-height: 50px;
    padding: 10px 24px;
    border: 0;
    border-radius: var(--tv-radius-sm);
    background: #fff;
    color: #07080b;
    font-size: clamp(15px, 1.02vw, 20px);
    font-weight: 850;
}

/* 4. DISCOVERY CARDS SECTION BELOW HERO */
body.tv-nav-ready .tv-discovery-section {
    padding-top: clamp(20px, 3vh, 40px) !important;
}

body.tv-nav-ready .tv-discovery-cards {
    display: flex;
    gap: clamp(14px, 1.2vw, 22px);
    padding: 10px var(--tv-safe-x) 20px;
    overflow-x: auto;
    scrollbar-width: none;
}

body.tv-nav-ready .tv-card-action {
    flex: 0 0 clamp(200px, 16vw, 280px);
    min-height: 90px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 1px solid var(--tv-border);
    border-radius: var(--tv-radius-md);
    background: var(--tv-surface);
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: transform 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out !important;
}

body.tv-nav-ready .tv-card-icon {
    font-size: clamp(28px, 2.2vw, 38px);
}

body.tv-nav-ready .tv-card-text {
    display: flex;
    flex-direction: column;
}

body.tv-nav-ready .tv-card-text strong {
    font-size: clamp(15px, 1.05vw, 20px);
    font-weight: 850;
}

body.tv-nav-ready .tv-card-text span {
    color: var(--tv-text-secondary);
    font-size: clamp(12px, 0.8vw, 15px);
}

/* 5. AI PROMPT EXPERIENCE (TEXT ENTRY MODE GATEWAY) */
body.tv-nav-ready #discoverSection > .app-header {
    position: relative;
    display: flex;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: clamp(90px, 12vh, 140px) 0 clamp(50px, 6vh, 80px);
    background:
        radial-gradient(circle at 85% 20%, rgba(124, 58, 237, 0.12), transparent 30%),
        #07080b;
}

body.tv-nav-ready[data-view="ai"] #appMain,
body.tv-nav-ready[data-view="search"] #appMain {
    margin-top: 0 !important;
    min-height: 100vh !important;
}

body.tv-nav-ready[data-view="ai"] #heroSearchArea,
body.tv-nav-ready[data-view="search"] #heroSearchArea {
    display: flex !important;
    justify-content: flex-start !important;
    min-height: 100vh !important;
    padding: calc(var(--tv-safe-y) + 70px) var(--tv-safe-x) var(--tv-safe-y) !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

body.tv-nav-ready #heroSearchArea.hidden {
    display: none !important;
}

body.tv-nav-ready #heroSearchArea > div {
    width: min(1180px, 100%) !important;
    max-width: 1180px !important;
}

body.tv-nav-ready #heroSearchArea h2 {
    margin: 0 !important;
    font-size: clamp(36px, 4vw, 54px) !important;
    line-height: 1.02 !important;
}

body.tv-nav-ready #heroSearchArea h2 + p {
    margin-top: 8px !important;
    font-size: clamp(14px, 1.15vw, 18px) !important;
    line-height: 1.4 !important;
}

body.tv-nav-ready #heroSearchArea .mb-6 {
    margin-bottom: 14px !important;
}

body.tv-nav-ready .search-view-eyebrow {
    margin-bottom: 14px !important;
    font-size: clamp(11px, 0.78vw, 15px) !important;
}

body.tv-nav-ready .hero-search-area {
    display: flex;
    flex-direction: column;
    width: min(1150px, calc(100vw - (var(--tv-safe-x) * 2)));
    margin: 0 auto;
    gap: 16px;
}

body.tv-nav-ready .tv-search-intro {
    display: block;
    max-width: 850px;
    margin-bottom: 8px;
}

body.tv-nav-ready .tv-search-intro h2 {
    margin: 0 0 8px;
    color: #fff;
    font-size: clamp(32px, 3.2vw, 56px);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.035em;
}

body.tv-nav-ready .tv-search-intro p {
    margin: 0;
    color: var(--tv-text-secondary);
    font-size: clamp(15px, 1.05vw, 20px);
    line-height: 1.45;
}

body.tv-nav-ready .search-mode-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 10px;
    padding: 4px;
    border-radius: var(--tv-radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    scrollbar-width: none;
}

body.tv-nav-ready .mode-tab,
body.tv-nav-ready .filter-pill,
body.tv-nav-ready .pagination-btn,
body.tv-nav-ready .page-num-btn {
    min-height: 44px;
    padding: 8px 20px;
    border: 1px solid transparent;
    border-radius: var(--tv-radius-sm);
    background: transparent;
    color: var(--tv-text-secondary);
    font-size: clamp(14px, 0.92vw, 17px);
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
}

body.tv-nav-ready .mode-tab.active,
body.tv-nav-ready .filter-pill.active,
body.tv-nav-ready .page-num-btn.active {
    border-color: rgba(255, 255, 255, 0.18);
    background: var(--tv-purple);
    color: #ffffff;
}

body.tv-nav-ready .hero-search-area,
body.tv-nav-ready #recommendForm,
body.tv-nav-ready .search-input-area,
body.tv-nav-ready .saas-search-box {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

body.tv-nav-ready .search-mode-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    padding: 6px !important;
    border-radius: var(--tv-radius-md) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: fit-content !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
}

body.tv-nav-ready .mode-tab,
body.tv-nav-ready .filter-pill,
body.tv-nav-ready .pagination-btn,
body.tv-nav-ready .page-num-btn {
    min-height: 44px !important;
    padding: 8px 22px !important;
    border: 1px solid transparent !important;
    border-radius: var(--tv-radius-sm) !important;
    background: transparent !important;
    color: var(--tv-text-secondary) !important;
    font-size: clamp(14px, 0.95vw, 18px) !important;
    font-weight: 750 !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}

body.tv-nav-ready .mode-tab.active,
body.tv-nav-ready .filter-pill.active,
body.tv-nav-ready .page-num-btn.active {
    border-color: rgba(255, 255, 255, 0.2) !important;
    background: var(--tv-purple) !important;
    color: #ffffff !important;
}

body.tv-nav-ready .saas-search-box {
    width: 100% !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 20px !important;
    background: linear-gradient(135deg, rgba(23, 25, 34, 0.95), rgba(14, 16, 22, 0.98)) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
}

/* PREMIUM FULL-WIDTH TV PROMPT TRIGGER BAR */
body.tv-nav-ready .tv-input-trigger {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 64px !important;
    padding: 12px 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--tv-text) !important;
    cursor: pointer !important;
    text-align: left !important;
    transition: transform 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out, box-shadow 120ms ease-out !important;
}

body.tv-nav-ready .tv-trigger-content {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 16px !important;
}

body.tv-nav-ready .tv-trigger-sparkle {
    font-size: 26px !important;
    color: var(--tv-purple-light) !important;
}

body.tv-nav-ready .tv-trigger-labels {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
}

body.tv-nav-ready .tv-trigger-title {
    font-size: clamp(16px, 1.15vw, 22px) !important;
    font-weight: 850 !important;
    color: #ffffff !important;
}

body.tv-nav-ready .tv-trigger-sub {
    font-size: clamp(12px, 0.85vw, 15px) !important;
    color: var(--tv-text-secondary) !important;
    margin-top: 3px !important;
}

body.tv-nav-ready .tv-trigger-badge {
    padding: 8px 16px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
}

/* Remote-safe search input: browse with the trigger, open the keyboard with OK. */
body.tv-nav-ready input#query.tv-hidden-input {
    position: absolute !important;
    height: 0 !important;
    width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

body.tv-nav-ready input#query:not(.tv-hidden-input) {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: 90px !important;
    padding: 18px 22px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 14px !important;
    background: rgba(17, 19, 26, 0.95) !important;
    color: #ffffff !important;
    font-size: clamp(17px, 1.2vw, 23px) !important;
    line-height: 1.4 !important;
}

body.tv-nav-ready .search-input-area:has(#query:not(.tv-hidden-input)) #tvQueryTrigger,
body.tv-nav-ready .search-input-area:has(#query:not(.tv-hidden-input)) .search-sparkle-icon {
    display: none !important;
}

body.tv-nav-ready .search-bottom-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 50px !important;
    padding: 10px 6px 2px !important;
    margin-top: 6px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.tv-nav-ready .search-quick-actions {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

body.tv-nav-ready .saas-pill-btn {
    min-height: 46px !important;
    padding: 10px 22px !important;
    border-radius: 999px !important;
    font-size: clamp(13px, 0.92vw, 17px) !important;
    font-weight: 750 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    cursor: pointer !important;
}

body.tv-nav-ready .btn-voice {
    background: rgba(124, 58, 237, 0.22) !important;
    border-color: rgba(139, 92, 246, 0.35) !important;
    color: #ede9fe !important;
}

body.tv-nav-ready .saas-submit-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 48px !important;
    padding: 10px 26px !important;
    border-radius: 999px !important;
    border: 0 !important;
    background: linear-gradient(135deg, #ffffff, #f1f5f9) !important;
    color: #07080b !important;
    font-size: clamp(14px, 0.98vw, 18px) !important;
    font-weight: 850 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
    align-self: center !important;
    margin-top: 8px !important;
}

body.tv-nav-ready .mood-pills {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    width: 100% !important;
    margin-top: 8px !important;
    padding: 4px 2px 8px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
}

body.tv-nav-ready .pill {
    min-height: 46px !important;
    padding: 10px 22px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.07) !important;
    color: #e2e8f0 !important;
    font-size: clamp(13px, 0.9vw, 17px) !important;
    font-weight: 750 !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}



/* 6. POSTER CARDS & CAROUSELS */
body.tv-nav-ready .row-section {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: clamp(30px, 4vh, 60px) 0;
    overflow: hidden;
    background: var(--tv-bg);
}

body.tv-nav-ready .section-head {
    width: 100%;
    padding-inline: var(--tv-safe-x);
    margin-bottom: 10px;
}

body.tv-nav-ready .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: clamp(20px, 1.6vw, 32px);
    font-weight: 850;
    letter-spacing: -0.02em;
}

body.tv-nav-ready .section-dot {
    width: 5px;
    height: 24px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--tv-purple-light), var(--tv-purple));
}

body.tv-nav-ready .cards-row,
body.tv-nav-ready .results-grid,
body.tv-nav-ready .genre-grid {
    display: flex;
    align-items: flex-start;
    gap: clamp(14px, 1.3vw, 24px);
    padding: 14px var(--tv-safe-x) 32px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scroll-behavior: auto !important;
}

body.tv-nav-ready .movie-card {
    flex: 0 0 clamp(165px, 11.8vw, 230px);
    width: clamp(165px, 11.8vw, 230px);
    min-width: 165px;
    border: 3px solid transparent;
    border-radius: var(--tv-radius-md);
    background: var(--tv-surface);
    transform-origin: center center;
    transition: transform 120ms ease-out, border-color 120ms ease-out, background-color 120ms ease-out !important;
}

body.tv-nav-ready .poster-container {
    aspect-ratio: 2 / 3;
    border-radius: var(--tv-radius-sm);
    background: var(--tv-surface-hover);
    overflow: hidden;
}

body.tv-nav-ready .poster-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.tv-nav-ready .movie-card .card-content {
    padding: 10px 8px 8px;
}

body.tv-nav-ready .movie-card .card-title {
    overflow: hidden;
    color: #fff;
    font-size: clamp(14px, 0.95vw, 18px);
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.tv-nav-ready .movie-card .card-meta {
    margin-top: 3px;
    color: var(--tv-text-secondary);
    font-size: clamp(12px, 0.78vw, 15px);
}

body.tv-nav-ready .genre-chip {
    flex: 0 0 clamp(220px, 16vw, 310px);
    min-height: 115px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border: 3px solid transparent;
    border-radius: var(--tv-radius-md);
    background: linear-gradient(135deg, var(--tv-surface-hover), var(--tv-surface));
}

body.tv-nav-ready .genre-chip-icon {
    font-size: clamp(28px, 2.3vw, 42px);
}

body.tv-nav-ready .genre-chip-name {
    color: #fff;
    font-size: clamp(16px, 1.1vw, 21px);
    font-weight: 850;
}

/* 7. AI RESULTS SCREEN & MULTI-ROW TV GRID */
body.tv-nav-ready .results-container {
    width: 100%;
    margin-top: 0 !important;
    padding: clamp(72px, 9vh, 105px) 0 30px;
}

body.tv-nav-ready .tv-results-controls-section {
    min-height: 0 !important;
    padding: 0 var(--tv-safe-x) 12px !important;
    background: transparent !important;
}

body.tv-nav-ready .tv-results-content-section {
    min-height: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

body.tv-nav-ready .results-hero-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-inline: var(--tv-safe-x);
}

body.tv-nav-ready .saas-back-btn {
    min-height: 44px;
    padding: 8px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: clamp(13px, 0.9vw, 17px);
    font-weight: 750;
}

body.tv-nav-ready .results-main-heading {
    margin: 0;
    color: #fff;
    font-size: clamp(26px, 2.2vw, 42px);
    font-weight: 900;
}

body.tv-nav-ready .ai-analysis-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px 20px;
    border: 1px solid rgba(124, 58, 237, 0.35);
    border-radius: var(--tv-radius-md);
    background: rgba(124, 58, 237, 0.12);
}

body.tv-nav-ready .analysis-summary-copy p {
    margin: 2px 0 0;
    color: var(--tv-text);
    font-size: clamp(14px, 0.98vw, 18px);
    font-weight: 650;
}

/* SLEEK SINGLE-LINE TOOLBAR (NO DARK CONTAINER BOX) */
body.tv-nav-ready .saas-results-toolbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 4px 0 14px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    margin-bottom: 8px !important;
}

body.tv-nav-ready .quick-filter-bar {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

body.tv-nav-ready .saas-select {
    min-height: 44px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: clamp(13px, 0.88vw, 16px);
    font-weight: 750;
}

/* PROMINENT GLOWING AI THINKING SECTION */
body.tv-nav-ready #loading:not(.hidden) {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(40px, 6vh, 80px) var(--tv-safe-x) !important;
    min-height: 45vh !important;
    background: radial-gradient(circle at center, rgba(124, 58, 237, 0.18), transparent 65%) !important;
    text-align: center !important;
}

body.tv-nav-ready #loading.hidden {
    display: none !important;
}

body.tv-nav-ready .loading-text {
    order: -1 !important;
    margin: 0 0 28px 0 !important;
    color: #ffffff !important;
    font-size: clamp(22px, 2.2vw, 36px) !important;
    font-weight: 850 !important;
    letter-spacing: -0.02em !important;
    text-shadow: 0 4px 24px rgba(124, 58, 237, 0.7) !important;
}

body.tv-nav-ready .skeleton-grid {
    display: flex !important;
    gap: 20px !important;
    justify-content: center !important;
    width: 100% !important;
    overflow: hidden !important;
}

body.tv-nav-ready .skeleton-card {
    flex: 0 0 clamp(165px, 12vw, 220px) !important;
    aspect-ratio: 2 / 3 !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(6, 182, 212, 0.15)) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    animation: tvGlowPulse 1.2s ease-in-out infinite !important;
}

@keyframes tvGlowPulse {
    0%, 100% { opacity: 0.35; transform: scale(0.98); }
    50% { opacity: 0.85; transform: scale(1.01); }
}

/* MULTI-ROW 2D TV RESULTS GRID (AŞAĞI DOĞRU SIRALAMA) */
body.tv-nav-ready #resultsGrid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(clamp(165px, 12vw, 220px), 1fr)) !important;
    gap: clamp(18px, 1.6vw, 28px) !important;
    width: 100% !important;
    padding: 14px var(--tv-safe-x) 50px !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

body.tv-nav-ready #resultsGrid .movie-card {
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

/* STREAMLINED POSTER BADGES */
body.tv-nav-ready .card-badges-row {
    top: 8px !important;
    left: 8px !important;
    right: 8px !important;
    display: flex !important;
    justify-content: space-between !important;
    width: auto !important;
}

body.tv-nav-ready .card-type-badge {
    background: rgba(124, 58, 237, 0.88) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    border-radius: 6px !important;
    padding: 3px 8px !important;
    font-size: 12px !important;
}

body.tv-nav-ready .card-score-badge {
    background: rgba(7, 8, 11, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #facc15 !important;
    font-weight: 800 !important;
    border-radius: 6px !important;
    padding: 3px 8px !important;
    font-size: 12px !important;
}


/* 8. CINEMATIC MOVIE DETAIL MODAL */
body.tv-nav-ready #detailModal {
    padding: 0 !important;
    background: #050609 !important;
}

body.tv-nav-ready #detailModal .modal-content {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #050609 !important;
}

body.tv-nav-ready #detailModal .modal-body {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body.tv-nav-ready #detailModal .modal-detail-shell,
body.tv-nav-ready #detailModal .modal-detail-grid {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
}

body.tv-nav-ready #detailModal .modal-detail-shell {
    align-items: stretch !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background-image: none !important;
}

body.tv-nav-ready #detailModal .modal-cinematic-backdrop,
body.tv-nav-ready #detailModal .modal-cinematic-shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

body.tv-nav-ready #detailModal .modal-cinematic-backdrop {
    z-index: 1;
    background-color: #050609;
    background-repeat: no-repeat;
}

body.tv-nav-ready #detailModal .modal-cinematic-backdrop.tv-wide-backdrop {
    background-position: center 22%;
    background-size: cover;
}

body.tv-nav-ready #detailModal .modal-cinematic-backdrop.tv-poster-fallback {
    background-position: right center;
    background-size: contain;
}

body.tv-nav-ready #detailModal .modal-cinematic-shade {
    z-index: 2;
    background:
        linear-gradient(90deg, #050609 0%, rgba(5, 6, 9, 0.95) 40%, rgba(5, 6, 9, 0.42) 66%, transparent 100%),
        linear-gradient(0deg, #050609 0%, rgba(5, 6, 9, 0.4) 40%, transparent 100%);
}

body.tv-nav-ready #detailModal .close-btn {
    position: absolute;
    top: var(--tv-safe-y);
    right: var(--tv-safe-x);
    z-index: 10;
    min-height: 44px;
    padding: 6px 18px;
    border: 1px solid var(--tv-border);
    border-radius: var(--tv-radius-md);
    background: rgba(17, 19, 24, 0.9);
    color: #fff;
    font-size: clamp(13px, 0.9vw, 17px);
    font-weight: 750;
}

body.tv-nav-ready #detailModal .modal-info {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min(720px, 50vw);
    max-height: 100%;
    padding: var(--tv-safe-y) 24px var(--tv-safe-y) var(--tv-safe-x);
    overflow-y: auto;
    scrollbar-width: none;
}

body.tv-nav-ready #detailModal .modal-info::-webkit-scrollbar {
    display: none;
}

body.tv-nav-ready #detailModal .modal-info h2 {
    margin: 0 0 4px;
    color: #fff;
    font-size: clamp(34px, 3.5vw, 60px);
    font-weight: 900;
    line-height: 1.04;
    letter-spacing: -0.035em;
}

body.tv-nav-ready #detailModal .modal-info .meta {
    margin-bottom: 10px;
    color: #e2e8f0;
    font-size: clamp(14px, 0.98vw, 19px);
    font-weight: 750;
}

body.tv-nav-ready #detailModal .modal-info .overview {
    display: -webkit-box;
    max-width: 680px;
    max-height: calc(1.48em * 3);
    margin: 0 0 18px;
    overflow: hidden;
    color: var(--tv-text-secondary);
    font-size: clamp(14px, 0.98vw, 19px);
    line-height: 1.48;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

/* The AI rationale is the useful synopsis on TV. Avoid squeezing a second,
   repetitive overview into a clipped partial line on content-rich details. */
body.tv-nav-ready #detailModal .recommendation-reason + .overview {
    display: none;
}

/* Detail actions are two explicit D-pad rows. A wrapped flex row looks like
   multiple rows but remains one navigation lane, which made reactions
   unreachable with ArrowDown on narrower TV viewports. */
body.tv-nav-ready #detailModal .detail-action-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

body.tv-nav-ready #detailModal .netflix-actions-bar {
    display: grid;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    padding: 0 4px;
    overflow: visible;
    scrollbar-width: none;
}

body.tv-nav-ready #detailModal .detail-primary-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.tv-nav-ready #detailModal .detail-reaction-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: 8px;
}

/* Compact, readable authentication dialog for 10-foot displays. */
body.tv-nav-ready #authModal {
    padding: var(--tv-safe-y) var(--tv-safe-x) !important;
}

body.tv-nav-ready #authModal .auth-modal-content {
    width: min(620px, calc(100vw - (var(--tv-safe-x) * 2))) !important;
    max-width: 620px !important;
    max-height: calc(100vh - (var(--tv-safe-y) * 2)) !important;
    padding: clamp(30px, 4vh, 48px) !important;
    overflow-y: auto !important;
    border-radius: var(--tv-radius-lg) !important;
    background: #0c0e13 !important;
}

body.tv-nav-ready #authModal .auth-tabs {
    margin: 0 68px 24px 0 !important;
}

body.tv-nav-ready #authModal .auth-tab {
    min-height: 48px !important;
    font-size: clamp(16px, 1.15vw, 21px) !important;
}

body.tv-nav-ready #authModal .auth-form {
    gap: 14px !important;
}

body.tv-nav-ready #authModal .form-group input {
    width: 100% !important;
    min-height: 54px !important;
    padding: 12px 16px !important;
    border-radius: var(--tv-radius-sm) !important;
    font-size: clamp(16px, 1.05vw, 20px) !important;
}

body.tv-nav-ready #authModal .auth-submit-btn {
    min-height: 54px !important;
    margin-top: 6px !important;
    font-size: clamp(16px, 1.08vw, 20px) !important;
}

body.tv-nav-ready #advSearchModal {
    padding: var(--tv-safe-y) var(--tv-safe-x) !important;
}

body.tv-nav-ready #advSearchModal .adv-modal-content {
    width: min(760px, calc(100vw - (var(--tv-safe-x) * 2))) !important;
    max-width: 760px !important;
    max-height: calc(100vh - (var(--tv-safe-y) * 2)) !important;
    padding: clamp(28px, 3.5vh, 42px) !important;
    overflow-y: auto !important;
}

body.tv-nav-ready #advSearchModal .adv-genre-chip {
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid var(--tv-border);
    border-radius: 999px;
    background: var(--tv-surface-hover);
    color: var(--tv-text);
    font-size: 15px;
    font-weight: 700;
}

body.tv-nav-ready #advSearchModal .adv-genre-chip.selected {
    border-color: var(--tv-purple-light);
    background: rgba(124, 58, 237, 0.32);
}

body.tv-nav-ready #detailModal .netflix-btn {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 8px 12px;
    align-items: center;
    justify-content: center;
    border-radius: var(--tv-radius-sm);
    font-size: clamp(12px, 0.82vw, 16px);
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
}

body.tv-nav-ready #detailModal .netflix-btn .btn-label,
body.tv-nav-ready #detailModal .netflix-btn > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

body.tv-nav-ready #detailModal .btn-play-trailer {
    background: #fff;
    color: #050609;
}

/* 9. UNIFIED PREMIUM FOCUS DESIGN SYSTEM (NO PURPLE DOUBLE RINGS & NO LEGACY LEAKS) */
body.tv-nav-ready *:focus,
body.tv-nav-ready *:focus-visible,
body.tv-nav-ready *:focus-within,
body.tv-focus-active *:focus,
body.tv-focus-active *:focus-visible,
body.tv-focus-active *:focus-within {
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

body.tv-focus-active .movie-card:focus,
body.tv-focus-active .genre-chip:focus,
body.tv-focus-active button:focus,
body.tv-focus-active select:focus,
body.tv-focus-active a:focus,
body.tv-focus-active .tv-focused {
    outline: none !important;
    border-color: #ffffff !important;
    background-color: #ffffff !important;
    color: #07080b !important;
    box-shadow: 0 8px 26px rgba(255, 255, 255, 0.35) !important;
}

/* Focused Poster Cards & Genre Chips */
body.tv-focus-active .movie-card:focus,
body.tv-focus-active .genre-chip:focus,
body.tv-focus-active .movie-card.tv-focused,
body.tv-focus-active .genre-chip.tv-focused {
    z-index: 30;
    transform: scale(1.055) !important;
    background-color: var(--tv-surface-raised) !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    outline: 3px solid #ffffff !important;
    outline-offset: 0px !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.85) !important;
}

body.tv-focus-active .movie-card:focus .card-title,
body.tv-focus-active .movie-card.tv-focused .card-title {
    color: #ffffff !important;
}

/* Focused Buttons, Nav Links, Action Pills & Controls */
body.tv-focus-active button:focus,
body.tv-focus-active a:focus,
body.tv-focus-active .tv-card-action:focus,
body.tv-focus-active .tv-input-trigger:focus,
body.tv-focus-active .tv-nav-link:focus,
body.tv-focus-active .mode-tab:focus,
body.tv-focus-active .filter-pill:focus,
body.tv-focus-active .saas-pill-btn:focus,
body.tv-focus-active .btn-voice:focus,
body.tv-focus-active .btn-random:focus,
body.tv-focus-active .saas-submit-btn:focus,
body.tv-focus-active .pill:focus,
body.tv-focus-active button.tv-focused,
body.tv-focus-active a.tv-focused,
body.tv-focus-active .tv-card-action.tv-focused,
body.tv-focus-active .tv-input-trigger.tv-focused,
body.tv-focus-active .tv-nav-link.tv-focused,
body.tv-focus-active .mode-tab.tv-focused,
body.tv-focus-active .filter-pill.tv-focused,
body.tv-focus-active .saas-pill-btn.tv-focused,
body.tv-focus-active .btn-voice.tv-focused,
body.tv-focus-active .btn-random.tv-focused,
body.tv-focus-active .saas-submit-btn.tv-focused,
body.tv-focus-active .pill.tv-focused {
    transform: scale(1.04) !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #07080b !important;
    border-color: #ffffff !important;
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: 0 8px 28px rgba(255, 255, 255, 0.35) !important;
}

body.tv-focus-active .saas-submit-btn:focus,
body.tv-focus-active .saas-submit-btn.tv-focused {
    outline: 3px solid var(--tv-purple-light) !important;
    outline-offset: 3px !important;
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.55) !important;
}

body.tv-focus-active button:focus *,
body.tv-focus-active button.tv-focused *,
body.tv-focus-active a:focus *,
body.tv-focus-active a.tv-focused *,
body.tv-focus-active .tv-focused * {
    color: #07080b !important;
}


/* Fast TV responsiveness transitions (120ms) */
body.tv-nav-ready .movie-card,
body.tv-nav-ready .genre-chip,
body.tv-nav-ready button,
body.tv-nav-ready textarea,
body.tv-nav-ready input,
body.tv-nav-ready select,
body.tv-nav-ready a {
    transition: transform 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out, outline 120ms ease-out !important;
}

/* 10. RESPONSIVE BREAKPOINTS (720p / 1080p / 4K) */
@media (max-height: 750px) {
    body.tv-nav-ready {
        --tv-safe-x: clamp(32px, 4vw, 56px);
        --tv-safe-y: clamp(18px, 2.5vh, 36px);
    }

    body.tv-nav-ready .tv-featured {
        height: 74vh;
        min-height: 440px;
    }

    body.tv-nav-ready .tv-featured h2 {
        font-size: clamp(30px, 3.5vw, 48px);
    }

    body.tv-nav-ready .movie-card {
        flex-basis: clamp(150px, 11vw, 195px);
        width: clamp(150px, 11vw, 195px);
        min-width: 150px;
    }

    body.tv-nav-ready #detailModal .modal-info {
        width: min(620px, 55vw);
    }

    body.tv-nav-ready #detailModal .modal-info h2 {
        font-size: clamp(30px, 3.2vw, 44px);
    }

    body.tv-nav-ready[data-view="ai"] #heroSearchArea,
    body.tv-nav-ready[data-view="search"] #heroSearchArea {
        min-height: auto !important;
        padding-top: calc(var(--tv-safe-y) + 66px) !important;
        padding-bottom: 24px !important;
    }

    body.tv-nav-ready #heroSearchArea > div {
        width: min(1060px, 100%) !important;
    }

    body.tv-nav-ready #heroSearchArea h2 {
        font-size: clamp(34px, 3.7vw, 46px) !important;
    }

    body.tv-nav-ready .search-view-eyebrow {
        margin-bottom: 6px !important;
    }

    body.tv-nav-ready .search-mode-tabs {
        margin-bottom: 8px !important;
    }

    body.tv-nav-ready .mood-pills {
        margin-top: 4px !important;
    }
}

@media (min-width: 2500px) {
    body.tv-nav-ready {
        --tv-safe-x: clamp(80px, 5vw, 140px);
        --tv-safe-y: clamp(48px, 4vh, 90px);
    }
}
