/* ==========================================
   WATCH VIEW — COMMENTS SYSTEM
   ========================================== */

/* Meta row — inline flex containing meta text + comment trigger */
.watch-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin-top: 6px;
}

/* The meta text span (duration • views • time) */
.watch-video-meta {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #aaa;
}

/* The dot separator between meta and comment trigger */
.meta-dot {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #555;
    flex-shrink: 0;
}

/* Inline comment trigger — same visual weight as the meta text */
.watch-comment-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #c8c8c8;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    transition: opacity 0.18s;
    user-select: none;
    flex-shrink: 0;
}

.watch-comment-trigger:hover {
    opacity: 0.75;
}

/* Active state (panel open) */
.watch-comment-trigger.active {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, 0.3);
}

/* Icon wrapper — gives us a positioning context for the badge */
.comment-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.comment-icon-wrap i {
    font-size: 18px;
    line-height: 1;
}

/* Red notification badge — top-right of the icon */
.comment-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #e50914;
    border-radius: 8px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Count number inside "X Comments" text */
#watchCommentCount {
    font-weight: 500;
}


/* ==========================================
   COMMENTS PANEL (SLIDE-IN DRAWER)
   ========================================== */

.watch-comments-panel {
    position: fixed;
    /* fixed so it layers over all watch-view-overlay content */
    top: 65px;
    /* below the sticky .watch-view-header */
    left: 0;
    right: 0;
    bottom: 0;
    background: #0d0d0d;
    z-index: 10000;
    /* above the watch overlay (z-index: 9999) */
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.watch-comments-panel.open {
    transform: translateY(0);
}

/* Panel Header */
.comments-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    position: relative;
    /* NOT sticky — sticky breaks inside overflow:hidden panels */
    background: #0d0d0d;
    z-index: 2;
}

.comments-panel-title {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.comments-close-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.comments-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* CTA — fake input */
.comments-cta {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.comment-fake-input {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.comment-fake-input:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.comment-fake-input i {
    font-size: 20px;
    color: #666;
    flex-shrink: 0;
}

.comment-fake-input span {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #555;
}

/* ==========================================
   COMMENTS LIST
   ========================================== */

.comments-list {
    flex: 1 1 auto;
    min-height: 0;
    /* critical for flex scroll — lets the item shrink below its content */
    overflow-y: auto;
    padding: 8px 0 32px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.comments-list::-webkit-scrollbar {
    width: 4px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

/* Single Comment */
.comment-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #222;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-name {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
}

.comment-time {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #555;
}

.comment-text {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #ccc;
    line-height: 1.5;
    word-break: break-word;
}

/* ── Comment action row (like / dislike / reply) ── */
.comment-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.ca-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.ca-btn i {
    font-size: 13px;
}

.ca-btn:hover {
    color: #ccc;
    background: rgba(255, 255, 255, 0.06);
}

.ca-btn.active {
    color: #4ea3ff;
}

.ca-btn.ca-dislike.active {
    color: #ff6565;
}

.ca-btn.ca-reply-btn {
    margin-left: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.02em;
}

.ca-count {
    font-size: 12px;
    font-weight: 500;
    min-width: 12px;
}

/* ── Inline reply input (subscriber gate) ── */
.reply-input-wrap {
    margin-top: 8px;
    margin-bottom: 4px;
}

.reply-input-fake {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.reply-input-fake:hover {
    background: rgba(255, 255, 255, 0.09);
}

.reply-input-fake i {
    font-size: 16px;
    color: #555;
    flex-shrink: 0;
}

.reply-input-field {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #555;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    cursor: pointer;
    pointer-events: none;
}

.reply-subscribers-note {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #444;
    flex-shrink: 0;
}

/* ── Replies collapse / expand ── */
.replies-wrap {
    margin-top: 10px;
}

.replies-toggle {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #4ea3ff;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 0;
    transition: opacity 0.15s;
}

.replies-toggle:hover {
    opacity: 0.75;
}

.comment-replies {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.comment-replies.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}




.reply-item {
    display: flex;
    gap: 10px;
    padding-left: 0;
}

.reply-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #222;
}

.reply-body .comment-name {
    font-size: 12px;
}

.reply-body .comment-time {
    font-size: 10px;
}

.reply-body .comment-text {
    font-size: 13px;
    color: #bbb;
}

@media (max-width: 768px) {
    .watch-comments-panel {
        border-radius: 12px 12px 0 0;
    }

    .comment-item {
        padding: 12px 16px;
    }

    .comments-panel-header {
        padding: 14px 16px 12px;
    }

    .comments-cta {
        padding: 12px 16px;
    }
}

/* ==========================================
   DESKTOP SPLIT-VIEW (>= 1024px)
   When is on desktop, comments panel lives
   INLINE as the left column — no overlay.
   Mobile behavior (fixed overlay) is untouched.
   ========================================== */

@media (min-width: 1024px) {

    /* Default: panel is hidden inline (zero-width, no flow impact) */
    .watch-comments-panel {
        /* Override the fixed-position overlay used on mobile */
        position: static;
        transform: none !important;
        /* cancel slide-up transform */
        width: 0;
        min-width: 0;
        overflow: hidden;
        opacity: 0;
        flex-shrink: 0;
        flex-direction: column;
        border-radius: 0;
        border-right: 1px solid rgba(255, 255, 255, 0.07);
        background: #0d0d0d;
        z-index: auto;
        /* clear the mobile z-index:10000 — header wins via its own z-index */
        /* Smooth expand on open */
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.25s ease;
        /* Allow internal content to scroll */
        max-height: calc(100vh - 130px);
        /* Align height with video column */
        align-self: flex-start;
        top: 0;
    }

    /* Panel open on desktop: fixed-width left column */
    .watch-comments-panel.open {
        width: 480px;
        flex: 0 0 480px;
        opacity: 1;
        display: flex;
        /* restore flex column for header/list */
    }

    /* Below-player wrapper: always flex row on desktop */
    .watch-below-player {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 0;
    }

    /* When split-active: 24px gap creates the column gutter */
    .watch-below-player.split-active {
        gap: 0 24px;
    }

    /* Videos column: fills remaining space */
    .watch-videos-right {
        flex: 1;
        min-width: 0;
        /* prevent flexbox overflow */
    }

    /* When split-active: allow the full-width #watchFreeRow2 to wrap below */
    .watch-below-player.split-active {
        flex-wrap: wrap;
    }

    /* Right-column main grid (split-active): 2-col, cards 1-4 only */
    .watch-below-player.split-active .watch-related-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    /* Hide cards 5-8 from the main grid — they live in #watchFreeRow2 */
    .watch-below-player.split-active .watch-related-grid>.related-card:nth-child(n+5) {
        display: none !important;
    }

    /* Full-width row that spans BOTH columns (cards 5-8) */
    #watchFreeRow2 {
        display: none;
        /* hidden when comments are closed */
    }

    .watch-below-player.split-active #watchFreeRow2 {
        display: grid;
        flex-basis: 100%;
        /* wraps to a new full-width line in the flex container */
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
        padding: 0 0 16px;
        margin-top: 32px;
    }

    /* When locked section is moved to be a direct flex child (after cards 5-8):
       make it span full-width and match the free card grid rhythm */
    .watch-below-player.split-active>#watchLockedDesktop {
        flex-basis: 100%;
        padding: 0 0 24px;
    }

    /* Override the JS inline flex styles so locked cards use a matching 4-col grid */
    .watch-below-player.split-active>#watchLockedDesktop #watchLockedCards {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        flex-direction: unset !important;
        flex-wrap: unset !important;
        overflow: visible !important;
        gap: 16px !important;
    }


    /* Overflow container — kept in HTML but always hidden (not used) */
    .comments-overflow-videos {
        display: none !important;
    }

    /* Tighten mobile teaser — already hidden on desktop via content-cards.css */
    /* (no change needed here) */
}


/* ==========================================
   INLINE COMMENTS SECTION
   Below all videos on both desktop + mobile
   ========================================== */

.watch-inline-comments {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
}

.wic-header {
    margin-bottom: 20px;
}

.wic-title {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.wic-composer {
    margin-bottom: 28px;
}

/* wic-list: no overflow — comments expand naturally, page scrolls */
.wic-list .comment-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wic-list .comment-item:last-child {
    border-bottom: none;
}

/* Hidden state: panel is active — no blank space left behind */
.watch-inline-comments.wic-hidden {
    display: none;
}


/* ==========================================
   DESKTOP LARGE AD BANNER
   Between CTA and inline comments.
   Hidden on mobile.
   ========================================== */

.watch-desktop-ad-banner {
    display: none;
    /* default hidden — shown via desktop media query */
}

@media (min-width: 1024px) {
    .watch-desktop-ad-banner {
        display: block;
        width: 100%;
        margin: 40px 0 32px;
        position: relative;
        cursor: pointer;
        border-radius: 12px;
        overflow: hidden;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .watch-desktop-ad-banner:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    }

    .desktop-ad-inner {
        width: 100%;
        height: 250px;
        background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 40%, #141414 100%);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        /* Container ready for background-image or <img> injection */
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }

    .desktop-ad-inner img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 12px;
    }

    .desktop-ad-inner .ad-label {
        /* Placeholder label — hidden when a real creative image is loaded */
        font-size: 14px;
        letter-spacing: 0.2em;
        color: rgba(255, 255, 255, 0.12);
    }

    .desktop-ad-sponsored {
        position: absolute;
        bottom: 10px;
        right: 14px;
        font-family: 'Inter', sans-serif;
        font-size: 10px;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.25);
        letter-spacing: 0.06em;
        text-transform: uppercase;
        pointer-events: none;
    }
}


/* ==========================================
   MOBILE INLINE COMMENTS BLOCK
   Toggled by the Comments trigger on mobile.
   Always hidden on desktop (split panel used instead).
   ========================================== */

.watch-mobile-comments {
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 4px;
}

.wmc-header {
    margin-bottom: 12px;
}

.wmc-title {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.wmc-composer {
    margin-bottom: 16px;
}

.wmc-list .comment-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wmc-list .comment-item:last-child {
    border-bottom: none;
}

.wmc-load-more {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ccc;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.wmc-load-more:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Desktop: always hide the mobile inline block */
@media (min-width: 1024px) {
    .watch-mobile-comments {
        display: none !important;
    }

    /* Also hide ad card on desktop split (already handled) */
}

/* Mobile: hide the AD filler card — grid reflows naturally to 8 cards */
@media (max-width: 1023px) {
    .related-card--ad {
        display: none !important;
    }

    /* Mobile ad banner between row 2 and row 3: spans full width of 2-col grid */
    .related-card--mobile-ad {
        grid-column: 1 / -1;
        /* span both columns */
        cursor: pointer;
        transition: transform 0.2s ease, filter 0.2s ease;
    }

    .related-card--mobile-ad:hover {
        filter: brightness(1.12);
    }

    .related-card--mobile-ad:active {
        transform: scale(0.98);
    }

    .ad-mobile-thumb {
        position: relative;
        width: 100%;
        aspect-ratio: 32 / 9;
        /* wider banner ratio — same height as a card thumbnail */
        background: linear-gradient(135deg, #111 0%, #1a1a1a 50%, #0f0f0f 100%);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
}

/* Desktop: hide the mobile ad banner entirely */
@media (min-width: 1024px) {
    .related-card--mobile-ad {
        display: none !important;
    }
}