/* assets/css/player.css */
:root {
    --player-accent: #e11d48;
    --player-accent-hover: #a0022ac7;
    --player-bg: rgba(15, 23, 42, 0.8);
    --player-blur: blur(12px);
    --player-glass-border: rgba(255, 255, 255, 0.1);
}

.genx-player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--player-bg);
    backdrop-filter: var(--player-blur);
    -webkit-backdrop-filter: var(--player-blur);
    padding: 5px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2147483647;
    border-top: 1px solid var(--player-glass-border);
}

.video-watermark {
    position: absolute;
    top: 20%;
    left: 20%;
    color: rgba(255, 255, 255, 0.45);
    font-size: 1rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 2147483647 !important;
    /* MAX Elevation - Above YT Mask & Shields */
    user-select: none;
    font-family: 'Inter', monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
    animation: floatTextSync 20s infinite linear alternate;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

@keyframes floatTextSync {
    0% {
        top: 15%;
        left: 15%;
    }

    33% {
        top: 20%;
        left: 60%;
    }

    66% {
        top: 70%;
        left: 55%;
    }

    100% {
        top: 15%;
        left: 15%;
    }
}

/* Theater Mode Watermark Override for Forum */
.post-card.theater-mode .video-watermark {
    font-size: 2.2rem !important;
    color: rgba(255, 255, 255, 0.3) !important;
    background: transparent !important;
    backdrop-filter: none !important;
}

/* YouTube Visual Masking (Professional Smart Zoom) */
.genx-yt-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 200 !important;
    /* Ensure it is above theater mode highlights but below controls */
    pointer-events: auto !important;
}

.yt-engine-active .genx-yt-mask iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Removed scale(1.15) to prevent cropping content - User request */
    width: 100% !important;
    height: 100% !important;
    pointer-events: auto;
}

/* ============================================================
   ENTERPRISE HARDWARE SHIELD (BLACKOUT PROTECTION)
   ============================================================ */
.genx-hardware-shield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2147483645;
    /* Below controls, above video */
    background: transparent;
    opacity: 0.01;
    /* Nearly invisible but force layer */
    /* This filter combo often blacks out GPU-based screen capture buffers */
    backdrop-filter: contrast(105%) brightness(100%) saturate(100%);
    mix-blend-mode: overlay;
    will-change: backdrop-filter;
}

.genx-integrity-blocking {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2147483647;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.genx-integrity-blocking.active {
    display: flex;
}

.integrity-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid #ef4444;
    padding: 30px;
    border-radius: 12px;
    max-width: 450px;
    backdrop-filter: blur(10px);
}

.integrity-card i {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 20px;
}

.integrity-card h3 {
    color: #f8fafc;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.integrity-card p {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.6;
}

.integrity-action-btn {
    margin-top: 25px;
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.integrity-action-btn:hover {
    background: #dc2626;
}

/* Interaction & Branding Shields */
.genx-yt-shield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2147483640;
    cursor: pointer;
    background: transparent;
}

/* Distract IDM extension by disabling pointer-events on the real iframe during playback */
.is-playing .genx-yt-mask iframe {
    pointer-events: none !important;
}

.genx-idm-decoy {
    pointer-events: none !important;
    opacity: 0.001 !important;
}

.genx-pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 15;
    display: none;
    /* Controlled by JS */
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.genx-pause-overlay i {
    font-size: 4rem;
    color: white;
    opacity: 0.8;
}

.secure-player,
.secure-player-forum {
    aspect-ratio: 16/9;
    position: relative;
}



.controls-active .genx-player-controls {
    opacity: 1;
    transform: translateY(0);
}

/* Progress Bar */
.genx-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s;
}

.genx-progress-container:hover {
    height: 10px;
}

.genx-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--player-accent), #f43f5e);
    border-radius: 10px;
    width: 0%;
    position: relative;
    box-shadow: 0 0 15px rgba(216, 56, 91, 0.5);
}

.genx-progress-handle {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}

.genx-progress-container:hover .genx-progress-handle {
    transform: translateY(-50%) scale(1);
}

/* Controls Layout */
.genx-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.genx-controls-left,
.genx-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 3D Colorful Buttons */
.genx-btn {
    background: linear-gradient(145deg, var(--player-accent), #9f1239);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
    box-shadow:
        0 4px 0 #881337,
        0 8px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    top: 0;
}

.genx-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        0 5px 0 #881337,
        0 10px 20px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1);
}

.genx-btn:active {
    top: 4px;
    box-shadow:
        0 0px 0 #881337,
        0 2px 5px rgba(0, 0, 0, 0.2);
}

.genx-btn.btn-wide {
    width: auto;
    padding: 0 18px;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Volume Slider */
.genx-volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100px;
}

.genx-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    outline: none;
}

.genx-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Time Display */
.genx-time {
    color: #e2e8f0;
    font-size: 0.9rem;
    font-family: 'Inter', monospace;
    font-weight: 500;
    min-width: 100px;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .genx-player-controls {
        padding: 10px;
        bottom: 0px;
    }

    .genx-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .genx-volume-container {
        display: none;
    }
}

/* Quality Selector Styles */
.genx-quality-container {
    position: relative;
    display: flex;
    align-items: center;
}

.genx-quality-menu {
    position: absolute;
    bottom: calc(100% + 15px);
    right: 0;
    background: var(--player-bg);
    backdrop-filter: var(--player-blur);
    -webkit-backdrop-filter: var(--player-blur);
    border: 1px solid var(--player-glass-border);
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column-reverse;
    min-width: 120px;
    z-index: 2147483647;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: menuFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.genx-quality-container.active .genx-quality-menu {
    display: flex;
}

.genx-quality-item {
    padding: 8px 15px;
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.genx-quality-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.genx-quality-item.active {
    color: var(--player-accent);
    background: rgba(225, 29, 72, 0.1);
}

.genx-quality-item.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Spinner */
.genx-loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
    display: none;
    /* Controlled by JS */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 2147483645;
    pointer-events: none;
    transition: all 0.3s ease;
}

.genx-loading-spinner i {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(225, 29, 72, 0.5);
}

.genx-loading-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(225, 29, 72, 0.8);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    z-index: 2147483647;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

.genx-loading-close:hover {
    background: #e11d48;
    transform: rotate(90deg);
}

.genx-loading-spinner span {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #cbd5e1;
}

/* anti-idm & Extension Stealth (Hide downloader buttons) */
div[id^="idm_"],
iframe[id^="Iframe_idm"],
.idm-downloader,
#idm_downloader,
[class*="idm-"],
[id*="idm-"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
    left: -9999px !important;
    position: absolute !important;
}

/* Theater Mode & split layout */
.theater-title-bar {
    display: none;
    /* Hide top bar in normal view */
}

/* Base Body Layout (Feed) */
.theater-body {
    display: flex;
    flex-direction: column;
}

/* Sidebar behavior in Feed */
.post-details-sidebar {
    display: contents;
    /* Let children participate in theater-body flex */
}

/* Feed Ordering & Base Styles */
.post-header {
    order: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
}

.post-content-text {
    order: 2;
    padding: 0 15px 15px 15px;
    word-wrap: break-word;
    color: var(--text-color);
}

.post-content-text .post-text-body {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.post-content-text .post-text-body.expanded {
    -webkit-line-clamp: unset;
    display: block;
}

.post-read-more-btn {
    display: none;
    background: none;
    border: none;
    color: var(--accent-color, #e11d48);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 0;
    margin-top: 4px;
}

.post-read-more-btn:hover {
    text-decoration: underline;
}

.post-media-area {
    order: 3;
    width: 100%;
    position: relative;
}

.post-stats {
    order: 4;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--glass-border);
}

.post-actions {
    order: 5;
    padding: 10px 15px;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

.comments-section {
    order: 6;
    padding: 15px;
}

/* Toggle visibility between feed and theater */
.theater-only {
    display: none !important;
}

.post-card.theater-mode .theater-only {
    display: flex !important;
}

body.theater-active {
    overflow: hidden !important;
}

.post-card.theater-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2100000 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #000 !important;
    overflow: hidden !important;
}

.post-card.theater-mode .theater-title-bar {
    display: none !important;
}

.post-card.theater-mode .theater-body {
    display: flex !important;
    flex: 1;
    flex-direction: row !important;
    height: calc(100vh - 60px);
    overflow: hidden;
}

.post-card.theater-mode .post-media-area {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    max-width: 75%;
    order: 1 !important;
    padding: 0;
}

.post-card.theater-mode .post-media {
    width: 100%;
    height: 100%;
    max-height: none !important;
    pointer-events: auto;
}

/* Force player container to fill theater area */
.post-card.theater-mode .secure-player-forum,
.post-card.theater-mode .secure-player {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: unset !important;
    border-radius: 0 !important;
    max-height: none !important;
}

/* Video/iframe fills its container naturally */
.post-card.theater-mode .secure-player-forum>video,
.post-card.theater-mode .secure-player>video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.post-card.theater-mode .post-details-sidebar {
    display: flex !important;
    width: 400px;
    background: #0f172a;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    flex-direction: column;
    overflow-y: auto;
    z-index: 10;
    order: 2 !important;
}

.post-card.theater-mode .post-details-sidebar>* {
    order: unset !important;
}

/* Close buttons inside theater mode */
.theater-close-btn-top,
.desktop-theater-close {
    display: none;
    /* Hide in feed */
    cursor: pointer;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s;
    z-index: 100;
}

.post-card.theater-mode .theater-close-btn-top,
.post-card.theater-mode .desktop-theater-close {
    display: flex !important;
}

.theater-close-btn-top:hover,
.desktop-theater-close:hover {
    color: #fff;
    transform: scale(1.1);
}



/* Hide non-theater specific parts inside theater mode to save space */
.post-card.theater-mode .post-content,
.post-card.theater-mode .post-stats {
    padding: 10px 15px;
}

.post-card.theater-opening {
    pointer-events: none;
}

@media (max-width: 1024px) {
    .post-card.theater-mode .theater-body {
        flex-direction: column !important;
        overflow-y: auto;
    }

    .post-card.theater-mode .post-media-area {
        max-width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        flex: none;
    }

    .post-card.theater-mode .post-details-sidebar {
        width: 100%;
        flex: 1;
        overflow-y: visible;
    }
}

/* Secure YouTube Premium Placeholder */
.genx-yt-premium-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 1) 0%, rgba(15, 23, 42, 1) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    z-index: 210 !important;
    /* Higher than mask */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(225, 29, 72, 0.1);
    pointer-events: auto !important;
}

.genx-yt-premium-placeholder:hover {
    background: radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 1) 100%);
    border-color: rgba(225, 29, 72, 0.4);
}

.yt-play-btn {
    width: 80px;
    height: 80px;
    background: var(--player-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(225, 29, 72, 0.4);
    transition: all 0.3s;
    margin-bottom: 20px;
}

.genx-yt-premium-placeholder:hover .yt-play-btn {
    transform: scale(1.1);
    box-shadow: 0 0 50px rgba(225, 29, 72, 0.6);
}

.yt-play-btn i {
    font-size: 2.5rem;
    color: white;
    margin-left: 5px;
}

.yt-secure-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 50px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

.yt-secure-badge i {
    color: var(--player-accent);
}

.secure-unlock-required .genx-player-controls {
    display: none !important;
}

/* Ensure placeholder is visible even if player hasn't loaded */
.youtube-placeholder {
    background: #000;
}