/**
 * CDA TV Catalog Player CSS
 * Custom controls in stile mb.YTPlayer
 */

/* CRITICAL: Override WordPress admin colors and theme styles */
.cda-tv-catalog-control-bar button.wp-core-ui,
.cda-tv-catalog-control-bar .wp-core-ui button,
.cda-tv-catalog-control-bar button.button,
.cda-tv-catalog-control-bar .button-primary,
.cda-tv-catalog-control-bar .button-secondary {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: #fff !important;
    border: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* Player Wrapper */
.cda-tv-catalog-player-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

/* Player container needs explicit height */
.cda-tv-player-container {
    position: relative;
    width: 100%;
    height: 500px; /* Fixed height */
    background: #000;
}

/* Ensure player wrapper fills container */
.cda-tv-catalog-player-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Player box for video */
.cda-tv-catalog-player-box {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

/* Modal specific styling */
.cda-tv-player-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
}

.cda-tv-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.cda-tv-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    height: 80%;
    max-height: 700px;
}

.cda-tv-modal-content .cda-tv-player-container {
    height: 100%;
}

/* Inline player styling */
.cda-tv-catalog-player {
    margin: 20px 0;
}

.cda-tv-catalog-player .cda-tv-player-wrapper {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.cda-tv-catalog-player-wrapper.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
}

/* Player Box - For letterbox */
.cda-tv-catalog-player-box {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

/* Video letterbox container */
.cda-tv-catalog-video-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Letterbox iframe sizing */
.cda-tv-catalog-video-container iframe {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* mb.YTPlayer-style Overlay to completely block YouTube UI */
.YTPOverlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
    z-index: 5 !important; /* Same as mb.YTPlayer */
    cursor: pointer !important;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform-style: flat;
    box-sizing: border-box;
}

/* Remove - this was the black square */

/* Remove iframe::after - doesn't work on iframes */

/* Gradient overlay element positioned over actual video frame */
.cda-tv-catalog-player-box .cda-tv-video-gradient {
    position: absolute;
    /* Position and size will be set dynamically by JS */
    pointer-events: none;
    z-index: 8; /* Below info (10) and controls (20) */
}

.cda-tv-catalog-player-box .cda-tv-video-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20%; /* Max 20% of player height */
    /* Da 0 a 50px: pieno; da 50px a 100%: sfuma a 0 */
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,1) 0,
        rgba(0,0,0,1) min(50px, 100%),
        rgba(0,0,0,0) 100%
    );
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
}

/* Show gradient when paused OR during initial load */
.cda-tv-catalog-player-wrapper.is-paused .cda-tv-video-gradient::before,
.cda-tv-catalog-player-wrapper.initial-load .cda-tv-video-gradient::before {
    opacity: 1;
}

/* Hide gradient when playing (unless initial load) */
.cda-tv-catalog-player-wrapper:not(.is-paused):not(.initial-load) .cda-tv-video-gradient::before {
    opacity: 0;
}

/* Remove bottom-right gradient - not needed */

/* Click Overlay */
.cda-tv-catalog-player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50px; /* Leave space for controls */
    z-index: 10;
    cursor: pointer;
    pointer-events: none; /* Allow clicks to pass through */
}

/* Netflix-style Control Bar */
.cda-tv-catalog-control-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: transparent; /* Let gradient show through */
    display: flex;
    align-items: center;
    padding: 0 60px; /* Matching streaming player */
    gap: 15px;
    z-index: 20; /* Above everything */
    transition: opacity 0.5s ease;
    opacity: 0;
}

/* Removed first-row wrapper - not needed for desktop */

/* Control bar gradient */
.cda-tv-catalog-control-bar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px; /* Back to 120px as requested */
    background: linear-gradient(to top, 
        rgba(0,0,0,0.95) 0%,  /* More opaque */
        rgba(0,0,0,0.8) 30%,
        rgba(0,0,0,0.5) 60%,
        transparent 100%);
    z-index: -1;
    transition: height 0.3s ease;
    pointer-events: none;
}

/* Keep gradient at standard height always - no expansion */
.cda-tv-catalog-player-wrapper .cda-tv-catalog-control-bar::before {
    height: 120px; /* Standard height for control area */
}

/* Show controls with class or when paused */
.cda-tv-catalog-player-wrapper.show-controls .cda-tv-catalog-control-bar,
.cda-tv-catalog-player-wrapper.is-paused .cda-tv-catalog-control-bar {
    opacity: 1;
}

/* Netflix-style Control Buttons - OVERRIDE ALL */
.cda-tv-catalog-control-bar button,
.cda-tv-catalog-control-bar button[type="button"],
.cda-tv-catalog-control-bar .button {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    box-shadow: none !important;
    color: rgba(255, 255, 255, 0.9) !important;
    cursor: pointer;
    padding: 8px !important;
    font-size: 20px;
    transition: all 0.15s ease;
    outline: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    text-shadow: none !important;
}

.cda-tv-catalog-control-bar button:hover,
.cda-tv-catalog-control-bar button[type="button"]:hover,
.cda-tv-catalog-control-bar .button:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.15) !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.15);
    border: none !important;
    box-shadow: none !important;
}

/* Muted state - red color */
.cda-tv-control-mute.is-muted {
    background: rgba(255, 0, 0, 0.3) !important;
    color: #ff4444 !important;
}

.cda-tv-control-mute.is-muted:hover {
    background: rgba(255, 0, 0, 0.5) !important;
    color: #ff6666 !important;
}

.cda-tv-catalog-control-bar button:focus,
.cda-tv-catalog-control-bar button:active,
.cda-tv-catalog-control-bar button:visited {
    color: white !important;
    background: rgba(255, 255, 255, 0.1) !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2) !important;
}

/* Remove special play/pause styles - now using dashicons like other buttons */

/* Volume */
.cda-tv-control-volume-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cda-tv-control-volume-slider {
    width: 0;
    opacity: 0;
    transition: all 0.3s ease;
}

.cda-tv-control-volume-wrapper:hover .cda-tv-control-volume-slider {
    width: 80px;
    opacity: 1;
}

.cda-tv-control-volume-slider {
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    cursor: pointer;
}

.cda-tv-control-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

/* Time Display */
.cda-tv-control-time {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-width: 85px;
    user-select: none;
}

/* Netflix-style Seek Bar */
.cda-tv-control-seek-wrapper {
    flex: 1;
    padding: 0 20px;
    display: flex;
    align-items: center;
}

.cda-tv-control-seek-bar {
    position: relative;
    width: 100%;
    height: 2px; /* Reduced to half */
    background: rgba(255,255,255,0.2);
    border-radius: 1px;
    cursor: pointer;
    transition: transform 0.15s ease;
    padding: 8px 0; /* Add clickable area */
    margin: -8px 0; /* Compensate for padding */
}

.cda-tv-control-seek-bar:hover {
    transform: scaleY(1.5);
}

.cda-tv-control-seek-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--streaming-header-bg, #e50914);
    border-radius: 2px;
    transition: background 0.15s ease;
}

.cda-tv-control-seek-bar:hover .cda-tv-control-seek-progress {
    background: var(--streaming-header-bg, #e50914);
    filter: brightness(1.2);
}

.cda-tv-control-seek-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 0; /* Will be set by JS */
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.15s ease;
    pointer-events: none;
    opacity: 0;
}

.cda-tv-control-seek-bar:hover .cda-tv-control-seek-handle {
    opacity: 1;
}

/* Quality & Speed */
.cda-tv-control-quality,
.cda-tv-control-speed {
    font-size: 14px !important;
    padding: 5px 10px !important;
    font-weight: 600;
}

/* Share button */
.cda-tv-control-share {
    margin-left: auto;
    margin-right: 10px;
}

.cda-tv-control-share svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Fullscreen */
.cda-tv-control-fullscreen {
    /* Remove margin-left: auto since share button has it now */
}

/* Episodes Sidebar */
.cda-tv-episodes-sidebar {
    position: absolute;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 110; /* Above chevron (100) and info (30) */
    transition: right 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cda-tv-episodes-sidebar.is-open {
    right: 0;
}

.cda-tv-episodes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.cda-tv-episodes-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.cda-tv-episodes-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    opacity: 0.7;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.cda-tv-episodes-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}

.cda-tv-episodes-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cda-tv-episodes-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
}

.cda-tv-episodes-empty {
    text-align: center;
    color: rgba(255,255,255,0.5);
    padding: 40px 20px;
}

.cda-tv-season-group {
    margin-bottom: 30px;
}

.cda-tv-season-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    opacity: 0.8;
}

.cda-tv-episodes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cda-tv-episode-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.cda-tv-episode-item:hover {
    background: rgba(255,255,255,0.1);
}

.cda-tv-episode-item.is-active {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
}

.cda-tv-episode-thumb {
    width: 80px;
    height: 45px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(0,0,0,0.5);
}

.cda-tv-episode-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cda-tv-episode-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px; /* Reduced from 4px */
}

.cda-tv-episode-title {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
    line-height: 1.2; /* Reduced from 1.3 */
    margin-top: -2px; /* Negative margin to reduce space */
}

.cda-tv-episode-number {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    white-space: nowrap; /* Prevent line break */
}

.cda-tv-episode-title {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
    line-height: 1.3;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .cda-tv-catalog-control-bar {
        height: 50px;
        padding: 0 10px;
        gap: 10px;
    }
    
    .cda-tv-catalog-control-bar button {
        font-size: 18px;
    }
    
    .cda-tv-control-volume-wrapper {
        display: none;
    }
    
    .cda-tv-control-time {
        font-size: 12px;
        min-width: 80px;
    }
    
    /* Remove forced visibility on mobile - let controls hide/show normally */
    
    /* Episodes sidebar mobile - full screen */
    .cda-tv-episodes-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .cda-tv-episodes-sidebar.is-open {
        right: 0;
    }
}

/* Fullscreen Mobile */
@media (max-width: 768px) and (orientation: portrait) {
    .cda-tv-catalog-player-wrapper.is-fullscreen {
        transform: rotate(90deg);
        transform-origin: center center;
        width: 100vh !important;
        height: 100vw !important;
        top: calc((100vh - 100vw) / 2) !important;
        left: calc((100vw - 100vh) / 2) !important;
    }
}

/* Mobile Portrait Controls - Streaming Player */
@media (max-width: 768px) and (orientation: portrait) {
    /* Control bar for streaming player - 2 rows layout using CSS Grid */
    .cda-tv-streaming-player-container .cda-tv-catalog-control-bar {
        padding: 10px 20px 20px 20px !important;
        display: grid !important;
        grid-template-columns: auto auto auto 1fr auto auto auto;
        grid-template-rows: auto auto;
        gap: 10px;
        height: auto !important;
        align-items: center;
    }
    
    /* First row - seek bar full width */
    .cda-tv-streaming-player-container .cda-tv-control-seek-wrapper {
        grid-column: 1 / -1; /* Span all columns */
        grid-row: 1;
        width: 100%;
        padding: 0;
        margin: 0 0 5px 0; /* Small margin bottom */
    }
    
    /* Override seek bar margin on mobile */
    .cda-tv-streaming-player-container .cda-tv-control-seek-bar {
        margin: 0; /* Remove negative margin on mobile */
    }
    
    /* Second row controls placement */
    .cda-tv-streaming-player-container .cda-tv-control-play {
        grid-column: 1;
        grid-row: 2;
    }
    
    .cda-tv-streaming-player-container .cda-tv-control-volume-wrapper {
        grid-column: 2;
        grid-row: 2;
        display: flex !important;
    }
    
    /* Hide volume slider on mobile - only show button */
    .cda-tv-streaming-player-container .cda-tv-control-volume-slider {
        display: none !important;
    }
    
    /* Time display */
    .cda-tv-streaming-player-container .cda-tv-control-time {
        grid-column: 3;
        grid-row: 2;
        font-size: 12px;
        min-width: 70px;
    }
    
    /* Space filler to push buttons to right */
    .cda-tv-streaming-player-container .cda-tv-control-time::after {
        content: '';
        grid-column: 4;
        grid-row: 2;
    }
    
    /* Right side buttons */
    .cda-tv-streaming-player-container .cda-tv-control-episodes {
        grid-column: 5;
        grid-row: 2;
        margin-left: 0;
    }
    
    .cda-tv-streaming-player-container .cda-tv-control-share {
        grid-column: 6;
        grid-row: 2;
        margin-left: 0;
        margin-right: 0;
    }
    
    .cda-tv-streaming-player-container .cda-tv-control-fullscreen {
        grid-column: 7;
        grid-row: 2;
    }
    
    /* Hide quality control - already hidden by default */
    .cda-tv-streaming-player-container .cda-tv-control-quality {
        display: none !important;
    }
    
    /* Smaller buttons on mobile */
    .cda-tv-streaming-player-container .cda-tv-catalog-control-bar button {
        width: 35px !important;
        height: 35px !important;
        padding: 6px !important;
        font-size: 18px !important;
    }
    
    /* Adjust control bar gradient height */
    .cda-tv-streaming-player-container .cda-tv-catalog-control-bar::before {
        height: 100px !important; /* Smaller on mobile */
    }
    
    /* Adjust player info position */
    .cda-tv-streaming-player-container .cda-tv-streaming-player-info {
        bottom: 100px; /* Less space needed with 2-row controls */
        padding: 0 20px;
    }
    
    /* Smaller text for player info */
    .cda-tv-streaming-player-container .cda-tv-streaming-player-title {
        font-size: 24px;
    }
    
    .cda-tv-streaming-player-container .cda-tv-streaming-player-meta {
        font-size: 14px;
    }
    
}

/* Loading Spinner */
.cda-tv-catalog-player-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
}

.cda-tv-catalog-player-loading::after {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Player Info Overlay */
.cda-tv-catalog-player-info {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    color: #fff;
    z-index: 30; /* Above control bar (20) and gradient (10) */
    opacity: 0;
    transition: opacity 0.3s ease;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
}

.cda-tv-catalog-player-wrapper:hover .cda-tv-catalog-player-info {
    opacity: 1;
}

.cda-tv-catalog-player-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.cda-tv-catalog-player-meta {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
}

/* Hide YouTube pause overlay when paused */
.cda-tv-catalog-player-wrapper.is-paused .ytp-pause-overlay {
    display: none !important;
    visibility: hidden !important;
}

/* Hide ALL YouTube controls and overlays */
/* Note: pointer-events: none can break autoplay on mobile */

.cda-tv-catalog-player-wrapper .ytp-gradient-top,
.cda-tv-catalog-player-wrapper .ytp-gradient-bottom,
.cda-tv-catalog-player-wrapper .ytp-chrome-top,
.cda-tv-catalog-player-wrapper .ytp-chrome-bottom,
.cda-tv-catalog-player-wrapper .ytp-cued-thumbnail-overlay,
.cda-tv-catalog-player-wrapper .ytp-pause-overlay,
.cda-tv-catalog-player-wrapper .ytp-watermark,
.cda-tv-catalog-player-wrapper .ytp-large-play-button,
.cda-tv-catalog-player-wrapper .ytp-show-cards-title,
.cda-tv-streaming-player-container .ytp-gradient-top,
.cda-tv-streaming-player-container .ytp-gradient-bottom,
.cda-tv-streaming-player-container .ytp-chrome-top,
.cda-tv-streaming-player-container .ytp-chrome-bottom,
.cda-tv-streaming-player-container .ytp-cued-thumbnail-overlay,
.cda-tv-streaming-player-container .ytp-pause-overlay,
.cda-tv-streaming-player-container .ytp-watermark,
.cda-tv-streaming-player-container .ytp-large-play-button,
.cda-tv-streaming-player-container .ytp-show-cards-title {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Re-enable pointer events on our overlay */
.cda-tv-catalog-player-wrapper .YTPOverlay,
.cda-tv-catalog-player-wrapper .cda-tv-catalog-player-overlay,
.cda-tv-streaming-player-container .YTPOverlay,
.cda-tv-streaming-player-container .cda-tv-catalog-player-overlay {
    pointer-events: auto !important;
}

/* Instagram mode - ensure overlays don't block first click */
.cda-tv-catalog-player-wrapper.instagram-waiting .YTPOverlay,
.cda-tv-catalog-player-wrapper.instagram-waiting .cda-tv-catalog-player-overlay {
    pointer-events: none !important;
}

/* Hide custom controls on Instagram until first play */
.cda-tv-catalog-player-wrapper.instagram-waiting .cda-tv-catalog-control-bar,
.cda-tv-catalog-player-wrapper.instagram-waiting .cda-tv-catalog-player-info,
.cda-tv-catalog-player-wrapper.instagram-waiting .cda-tv-catalog-player-back {
    display: none !important;
}

/* Instagram hint message */
.cda-tv-instagram-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    font-size: 16px;
    text-align: center;
    z-index: 25;
    pointer-events: none;
}

/* Instagram playing mode - hide YouTube controls */
.cda-tv-catalog-player-wrapper.instagram-playing iframe {
    pointer-events: none !important;
}

/* But allow our overlays to work */
.cda-tv-catalog-player-wrapper.instagram-playing .YTPOverlay,
.cda-tv-catalog-player-wrapper.instagram-playing .cda-tv-catalog-player-overlay {
    pointer-events: auto !important;
}

/* Create overlays to hide YouTube chrome in Instagram mode */
/* Top overlay - covers upper band and YouTube top controls */
.cda-tv-catalog-player-wrapper.instagram-playing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--letterbox-size, 0%); /* Dynamic letterbox band size */
    background: #000;
    z-index: 5; /* Above iframe but below our controls */
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Bottom overlay - covers lower band and YouTube bottom controls */
.cda-tv-catalog-player-wrapper.instagram-playing::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--letterbox-size, 0%); /* Dynamic letterbox band size */
    background: #000;
    z-index: 5; /* Above iframe but below our controls */
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* When playing, show overlays for 4 seconds */
.cda-tv-catalog-player-wrapper.instagram-playing.overlay-active::before,
.cda-tv-catalog-player-wrapper.instagram-playing.overlay-active::after {
    opacity: 1 !important;
}

/* Hide overlays after timeout */
.cda-tv-catalog-player-wrapper.instagram-playing:not(.overlay-active)::before,
.cda-tv-catalog-player-wrapper.instagram-playing:not(.overlay-active)::after {
    opacity: 0;
}

/* Also add gradient for smooth transition on actual video area */
.cda-tv-catalog-player-wrapper.instagram-playing .cda-tv-video-gradient {
    display: block !important;
    opacity: 1 !important;
    background: linear-gradient(to bottom, 
        #000 0%, 
        transparent 15%,
        transparent 85%,
        #000 100%
    ) !important;
    height: 100% !important;
    z-index: 6 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease;
}

/* Show gradient when overlay active */
.cda-tv-catalog-player-wrapper.instagram-playing.overlay-active .cda-tv-video-gradient {
    opacity: 1 !important;
}

/* Hide gradient after timeout */
.cda-tv-catalog-player-wrapper.instagram-playing:not(.overlay-active) .cda-tv-video-gradient {
    opacity: 0 !important;
}

/* Alternative approach using higher z-index for our gradient */
.cda-tv-catalog-player-wrapper.is-paused .cda-tv-video-gradient {
    z-index: 9 !important; /* Still below info (10) and controls (20) */
}

/* Force show gradient */
.cda-tv-video-gradient.force-show::before {
    opacity: 1 !important;
}

/* Countdown overlay */
.cda-tv-countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.cda-tv-countdown-content {
    text-align: center;
    color: #fff;
    max-width: 500px;
    padding: 40px;
}

.cda-tv-countdown-content h3 {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 300;
}

.cda-tv-countdown-timer {
    font-size: 60px;
    font-weight: 700;
    margin-bottom: 30px;
}

.cda-tv-countdown-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 8px;
}

.cda-tv-countdown-thumb img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 4px;
}

.cda-tv-countdown-details {
    text-align: left;
    flex: 1;
}

.cda-tv-countdown-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 5px;
}

.cda-tv-countdown-meta {
    font-size: 14px;
    opacity: 0.8;
}

.cda-tv-countdown-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.cda-tv-countdown-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cda-tv-countdown-cancel {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.cda-tv-countdown-cancel:hover {
    background: rgba(255,255,255,0.3);
}

.cda-tv-countdown-play {
    background: #e50914;
    color: #fff;
}

.cda-tv-countdown-play:hover {
    background: #f40612;
}

/* Suggestions overlay */
.cda-tv-suggestions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.cda-tv-suggestions-content {
    max-width: 1200px;
    width: 90%;
    padding: 40px;
    position: relative;
}

.cda-tv-suggestions-content h3 {
    color: #fff;
    font-size: 28px;
    margin-bottom: 30px;
    font-weight: 300;
}

.cda-tv-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.cda-tv-suggestion-item {
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cda-tv-suggestion-item:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.05);
}

.cda-tv-suggestion-item img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.cda-tv-suggestion-info {
    padding: 15px;
}

.cda-tv-suggestion-title {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
    line-height: 1.3;
}

.cda-tv-suggestion-meta {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
}

.cda-tv-suggestions-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cda-tv-suggestions-close:hover {
    background: rgba(255,255,255,0.2);
}

.cda-tv-suggestions-close .dashicons {
    font-size: 24px;
    color: #fff;
}

.cda-tv-suggestions-loading,
.cda-tv-suggestions-empty {
    text-align: center;
    color: #fff;
    padding: 40px;
    font-size: 16px;
}