﻿/* Final responsive layer for the active BullTV Blade UI. */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

html {
    overflow-y: auto;
    scroll-behavior: smooth;
}

body.reference-theme {
    min-height: 100vh;
    overflow-y: visible;
    overscroll-behavior-y: auto;
}

body.reference-theme .nf-header-inner {
    width: min(1180px, calc(100% - 32px));
    min-width: 0;
}

/* Keep active header controls on the BullTV red/black theme. */
body.reference-theme .nf-search button:hover,
body.reference-theme .nf-search button:focus-visible,
body.reference-theme .nf-icon-link:hover,
body.reference-theme .nf-icon-link:focus-visible {
    color: var(--text-on-primary) !important;
    background: var(--primary) !important;
    border-radius: 9px;
}

body.reference-theme .nf-search button:hover svg,
body.reference-theme .nf-search button:focus-visible svg,
body.reference-theme .nf-icon-link:hover svg,
body.reference-theme .nf-icon-link:focus-visible svg {
    stroke: var(--text-on-primary) !important;
}

body.reference-theme .page-wrap {
    width: min(1500px, calc(100% - 48px));
    max-width: 1500px;
    margin-inline: auto;
}

/* The homepage uses normal-hero-carousel as its single source of truth.
   Hide the retired stacked/carousel shell if it is present in an older
   cached Blade view so production cannot render two sliders. */
body.reference-theme.home-page .hero-carousel-frame,
body.reference-theme.home-page .hero-shell {
    display: none !important;
}

body.reference-theme.home-page .normal-hero-carousel {
    position: relative !important;
    z-index: 1;
    margin-top: clamp(28px, 3vw, 46px) !important;
}

body.reference-theme .grid-list {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: clamp(10px, 1.15vw, 18px);
}

body.reference-theme .poster-card,
body.reference-theme .poster-card-wrap {
    min-width: 0;
    max-width: 100%;
}

body.reference-theme .poster-card-image {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

body.reference-theme .poster-card-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.reference-theme .poster-row-shell {
    position: relative;
    min-width: 0;
}

body.reference-theme .poster-row {
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    cursor: grab;
    user-select: none;
}

body.reference-theme .poster-row.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto !important;
}

body.reference-theme .poster-row.is-dragging a,
body.reference-theme .poster-row.is-dragging button {
    pointer-events: none;
}

body.reference-theme .poster-row:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

body.reference-theme .row-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    padding: 0 0 3px;
    border: 1px solid rgba(255, 255, 255, .75);
    border-radius: 50%;
    color: var(--text-on-primary);
    background: rgba(82, 0, 0, .9);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .5);
    font-size: 31px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}

body.reference-theme .row-arrow:hover,
body.reference-theme .row-arrow:focus-visible {
    background: var(--primary);
}

body.reference-theme .row-arrow-prev { left: -14px; }
body.reference-theme .row-arrow-next { right: -14px; }

@media (max-width: 1399px) {
    body.reference-theme .grid-list { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
}

@media (max-width: 1099px) {
    body.reference-theme .page-wrap { width: min(960px, calc(100% - 32px)); }
    body.reference-theme .grid-list { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
}

@media (max-width: 899px) {
    body.reference-theme .page-wrap { width: calc(100% - 28px); margin-top: 20px; }
    body.reference-theme .grid-list {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 12px 10px;
    }
    body.reference-theme .section-head h1 { font-size: clamp(25px, 4vw, 34px); }
}

@media (max-width: 760px) {
    body.reference-theme .nf-header {
        position: sticky !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
    }

    body.reference-theme .nf-header-inner {
        width: 50%;
        min-height: 58px;
        gap: 8px;
    }

    body.reference-theme .nf-brand { min-width: 0; }
    body.reference-theme .nf-brand img { width: clamp(100px, 30vw, 132px); max-width: 100%; }
    body.reference-theme .nf-desktop-links { display: none; }

    body.reference-theme .nf-mobile-links {
        display: flex !important;
        width: 100%;
        min-height: 36px;
        align-items: center;
        justify-content: flex-start;
        gap: 2%;
        border-top: 1px solid rgba(149, 6, 14, .26);
        background: var(--bg-primary);
        align-content: center;
    }

    body.reference-theme .nf-mobile-links a {
        padding: 8px 4px 9px;
        color: rgba(255, 255, 255, .76);
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
    }

    body.reference-theme .nf-mobile-links a.is-active { color: var(--text-on-primary); border-bottom: 2px solid var(--primary); }
    body.reference-theme .nf-header-actions { gap: 2px; }
    body.reference-theme .nf-icon-link,
    body.reference-theme .nf-search,
    body.reference-theme .nf-search button { width: 36px; height: 36px; }

    body.reference-theme .nf-search.is-open {
        position: absolute;
        top: 9px;
        left: 10px;
        right: 10px;
        z-index: 10;
        width: auto;
        height: 40px;
        background: var(--surface);
    }

    body.reference-theme .nf-search.is-open input {
        display: block;
        width: calc(100% - 40px);
        flex: 1;
    }

    body.reference-theme .row-arrow {
        width: 32px;
        height: 32px;
        font-size: 26px;
    }

    body.reference-theme .row-arrow-prev { left: -8px; }
    body.reference-theme .row-arrow-next { right: -8px; }
}

/* Legacy header fallback used by older production Blade caches. */
@media (max-width: 900px) {
    body.reference-theme:has(.topbar):not(:has(.nf-header)) {
        padding-top: 64px !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar {
        position: fixed !important;
        inset: 0 0 auto 0 !important;
        z-index: 1000 !important;
        display: flex !important;
        height: 64px !important;
        min-height: 64px !important;
        flex-wrap: nowrap !important;
        align-content: center !important;
        gap: 6px !important;
        padding: 4px 10px !important;
        background: var(--bg-primary) !important;
        border-bottom: 1px solid rgba(149, 6, 14, .55) !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .site-brand {
        width: auto !important;
        height: 54px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .site-brand img {
        width: clamp(100px, 25vw, 145px) !important;
        max-width: 100% !important;
        max-height: 46px !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .main-nav {
        position: static !important;
        display: flex !important;
        width: auto !important;
        height: 54px !important;
        flex: 0 1 auto !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        overflow-x: auto !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .main-nav a {
        height: 32px !important;
        flex: 0 0 auto !important;
        padding: 0 10px !important;
        font-size: 12px !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .actions {
        display: flex !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        gap: 5px !important;
        margin: 0 !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .actions .top-search,
    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .actions .plan-btn,
    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .actions .user-notification-bell {
        display: inline-flex !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .login-btn,
    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .actions a[href*="login"] {
        min-height: 36px !important;
        height: 36px !important;
        padding: 0 12px !important;
        font-size: 12px !important;
    }
}

@media (max-width: 480px) {
    body.reference-theme:has(.topbar):not(:has(.nf-header)) {
        padding-top: 94px !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar {
        height: 94px !important;
        min-height: 94px !important;
        flex-wrap: wrap !important;
        align-content: center !important;
        padding: 4px 8px 0 !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .main-nav {
        order: 3 !important;
        width: 100% !important;
        height: 32px !important;
        flex: 0 0 100% !important;
        gap: 4px !important;
        overflow-x: auto !important;
        justify-content: center !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .main-nav a {
        height: 30px !important;
        padding-inline: 9px !important;
        font-size: 11px !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .site-brand {
        height: 50px !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .site-brand img {
        width: clamp(92px, 27vw, 116px) !important;
        max-height: 42px !important;
    }

    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .plan-btn,
    body.reference-theme:has(.topbar):not(:has(.nf-header)) .topbar .user-notification-bell {
        display: none !important;
    }
}

/* Final narrow-screen guard for production/legacy .topbar markup. */
@media (max-width: 480px) {
    body.reference-theme:has(.topbar) {
        padding-top: 94px !important;
    }

    body.reference-theme:has(.topbar) .topbar {
        position: fixed !important;
        inset: 0 0 auto 0 !important;
        display: flex !important;
        width: 100% !important;
        height: 94px !important;
        min-height: 94px !important;
        flex-wrap: wrap !important;
        align-content: center !important;
        gap: 0 !important;
        padding: 4px 8px 0 !important;
    }

    body.reference-theme:has(.topbar) .topbar .site-brand {
        position: static !important;
        width: auto !important;
        height: 50px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        order: 1 !important;
    }

    body.reference-theme:has(.topbar) .topbar .site-brand img {
        width: clamp(92px, 27vw, 116px) !important;
        max-width: 100% !important;
        max-height: 42px !important;
    }

    body.reference-theme:has(.topbar) .topbar .actions {
        position: static !important;
        width: auto !important;
        height: 50px !important;
        flex: 0 0 auto !important;
        order: 2 !important;
        margin: 0 !important;
        gap: 5px !important;
    }

    body.reference-theme:has(.topbar) .topbar .main-nav {
        position: static !important;
        inset: auto !important;
        display: flex !important;
        width: 100% !important;
        height: 32px !important;
        flex: 0 0 100% !important;
        order: 3 !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        overflow-x: auto !important;
    }

    body.reference-theme:has(.topbar) .topbar .main-nav a {
        position: static !important;
        width: auto !important;
        height: 30px !important;
        flex: 0 0 auto !important;
        padding: 0 9px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 599px) {
    body.reference-theme .page-wrap { width: calc(100% - 20px); margin-top: 16px; }
    body.reference-theme.home-page .normal-hero-carousel { margin-top: 20px !important; }
    body.reference-theme .grid-list {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 10px 7px;
    }

    body.reference-theme .poster-card-title {
        min-height: 34px;
        padding: 8px 5px;
        font-size: clamp(10px, 2.7vw, 13px) !important;
        text-align: center;
    }

    body.reference-theme .poster-card .premium-badge,
    body.reference-theme .poster-card .favorite-form { top: 5px; }
    body.reference-theme .poster-card .premium-badge { left: 5px; width: 25px; height: 25px; min-width: 25px; }
    body.reference-theme .poster-card .favorite-form { right: 5px; }
    body.reference-theme .poster-card .heart-btn { width: 25px; height: 25px; font-size: 15px; }
}

@media (max-width: 399px) {
    body.reference-theme .grid-list { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px 10px; }
    body.reference-theme .nf-brand img { width: 100px; }
    body.reference-theme .nf-mobile-links { gap: 22px; }
}

@media (max-width: 900px) {
    html body.reference-theme:not(.auth-only):not(.checkout-only) {
        padding-top: 0 !important;
    }
}

/* One vertical scroll owner: the document root. */
html {
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body.reference-theme {
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    scrollbar-width: none;
}

body.reference-theme::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

body.reference-theme main,
body.reference-theme .site-footer {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    body.reference-theme .poster-card,
    body.reference-theme .poster-card-image { transition: none !important; }
}


/* ==========================================================================
   Header: final layout. Earlier rules in ott.css / reference-theme.css /
   bulltv-header.css still set colours; this block owns the geometry.
   ========================================================================== */
/* The <header> stacks its rows (nav row, mobile tabs row) vertically. */
body.reference-theme .nf-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

body.reference-theme .nf-header-inner {
    position: relative;
    display: flex !important;
    align-items: center !important;
    align-self: center !important;
}

body.reference-theme .nf-header-actions {
    position: static !important;
    inset: auto !important;
    margin-left: auto !important;
    display: flex !important;
    flex: none !important;
    align-items: center !important;
}

body.reference-theme .nf-profile-menu {
    right: 0;
    max-width: calc(100vw - 24px);
}

@media (max-width: 900px) {
    body.reference-theme .nf-header {
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
    }

    body.reference-theme .nf-header-inner {
        width: calc(100% - 24px) !important;
        gap: 10px !important;
    }
}

@media (max-width: 760px) {
    body.reference-theme .nf-header-inner {
        min-height: 56px !important;
        gap: 8px !important;
    }

    body.reference-theme .nf-brand {
        flex: 0 0 auto !important;
        min-width: 0 !important;
    }

    body.reference-theme .nf-brand img {
        width: clamp(96px, 28vw, 124px) !important;
        max-width: 100% !important;
        height: auto !important;
    }

    body.reference-theme .nf-desktop-links {
        display: none !important;
    }

    body.reference-theme .nf-header-actions {
        gap: 4px !important;
    }

    body.reference-theme .nf-header-actions .nf-icon-link,
    body.reference-theme .nf-header-actions .nf-search:not(.is-open),
    body.reference-theme .nf-header-actions .nf-search button {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
    }

    body.reference-theme .nf-header-actions .nf-login {
        padding: 8px 12px !important;
        font-size: 13px !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
    }

    /* Open search covers the first row instead of pushing icons off-screen. */
    body.reference-theme .nf-search.is-open {
        position: absolute !important;
        top: 8px !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 10 !important;
        width: auto !important;
        height: 40px !important;
        border-color: var(--border-hover) !important;
        background: var(--surface) !important;
    }

    body.reference-theme .nf-mobile-links {
        display: flex !important;
        width: 100% !important;
        min-height: 40px !important;
        box-sizing: border-box !important;
        padding: 0 16px !important;
        gap: 24px !important;
        align-items: stretch !important;
        border-top: 1px solid var(--border-color) !important;
        background: var(--bg-primary) !important;
    }

    body.reference-theme .nf-mobile-links a {
        display: flex !important;
        align-items: center !important;
        padding: 0 2px !important;
        border-bottom: 2px solid transparent !important;
        color: var(--text-secondary) !important;
        font-size: 12px !important;
        font-weight: 800 !important;
        letter-spacing: .04em !important;
        text-decoration: none !important;
        text-transform: uppercase !important;
    }

    body.reference-theme .nf-mobile-links a.is-active {
        color: var(--text-on-primary) !important;
        border-bottom-color: var(--primary) !important;
    }
}

/* ==========================================================================
   Live chat widget: fits the viewport, messages scroll, form stays visible.
   Uses only brand-palette tokens so colours never depend on page scope.
   ========================================================================== */
body.reference-theme .live-chat-widget {
    z-index: 45;
}

body.reference-theme .live-chat-toggle {
    color: var(--text-on-primary);
    background: var(--brand-gradient);
    box-shadow: var(--glow-medium), 0 12px 28px rgba(0, 0, 0, .45);
}

body.reference-theme .live-chat-box {
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 28px));
    height: min(520px, calc(100vh - 180px));
    height: min(520px, calc(100dvh - 180px));
    min-height: 300px;
    border-color: var(--border-hover);
    background: var(--bg-secondary);
}

body.reference-theme .live-chat-box header {
    flex: 0 0 auto;
    background: var(--surface);
}

body.reference-theme .live-chat-box header span,
body.reference-theme .live-chat-message span,
body.reference-theme .live-chat-empty {
    color: var(--text-secondary);
}

body.reference-theme .live-chat-box header button {
    color: var(--text-primary);
}

body.reference-theme .live-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

body.reference-theme .live-chat-message {
    max-width: 85%;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

body.reference-theme .live-chat-message.from-user {
    border-color: rgba(227, 32, 27, .35);
    background: rgba(227, 32, 27, .2);
}

body.reference-theme .live-chat-form {
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    background: var(--surface);
}

body.reference-theme .live-chat-form input {
    height: 44px;
    color: var(--text-primary);
    font-size: 16px; /* 16px stops iOS zooming into the field */
}

body.reference-theme .live-chat-form input:focus {
    border-color: var(--primary);
}

body.reference-theme .live-chat-form button {
    height: 44px;
    min-width: 72px;
    color: var(--text-on-primary);
    background: var(--brand-gradient);
}

body.reference-theme .live-chat-form button:disabled {
    opacity: .6;
    cursor: wait;
}

body.reference-theme .live-chat-error {
    grid-column: 1 / -1;
    margin: 0;
    color: #fca5a5;
    font-size: 12px;
}

/* Phones: the chat opens as a bottom sheet and the toggle steps aside. */
@media (max-width: 600px) {
    body.reference-theme .live-chat-widget.is-open {
        inset: auto 8px 8px 8px;
    }

    body.reference-theme .live-chat-widget.is-open .live-chat-toggle {
        display: none;
    }

    body.reference-theme .live-chat-widget.is-open .live-chat-box {
        position: fixed;
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        height: min(80vh, calc(100vh - 16px));
        height: min(80dvh, calc(100dvh - 16px));
        border-radius: 16px;
    }
}
