/* ============================================
   CLEAN VIDEO PLAYER STYLES
   ============================================ */

/* Video Thumbnails */
.cvp-video-wrapper {
    position: relative;
    width: 100%;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cvp-video-wrapper:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.cvp-video-thumb {
    aspect-ratio: 16/9;
}

.cvp-shorts-thumb {
    aspect-ratio: 9/16;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.cvp-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
}

.cvp-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.cvp-video-wrapper:hover .cvp-thumbnail img {
    transform: scale(1.05);
}

.cvp-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease;
}

.cvp-video-wrapper:hover .cvp-play-overlay {
    background: rgba(0, 0, 0, 0.2);
}

.cvp-play-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0.9;
    transition: all 0.3s ease;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.5));
}

.cvp-play-button:hover {
    opacity: 1;
    transform: scale(1.1);
}

.cvp-play-button:active {
    transform: scale(0.95);
}

.cvp-shorts-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #ff0050, #ff0000);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 2;
}

.cvp-duration-overlay {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
}

/* ============================================
   POPUP MODAL
   ============================================ */

.cvp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cvp-popup-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.cvp-popup-container {
    width: 90%;
    max-width: 1200px;
    height: 80%;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* Adjust for Shorts */
.cvp-popup-container.shorts-mode {
    max-width: 400px;
    height: 90%;
}

.cvp-popup-header {
    padding: 20px;
    background: rgba(20, 20, 20, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cvp-popup-title {
    color: white;
    font-size: 16px;
    font-weight: 500;
    flex: 1;
    padding-right: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cvp-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    flex-shrink: 0;
}

.cvp-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.cvp-video-container {
    flex: 1;
    position: relative;
    background: #000;
    min-height: 0;
}

#cvp-youtube-player {
    width: 100%;
    height: 100%;
    background: #000;
}

/* Ensure YouTube iframe fits */
#cvp-youtube-player iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* ============================================
   POPUP CONTROLS
   ============================================ */

.cvp-popup-controls {
    padding: 15px 20px;
    background: rgba(20, 20, 20, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.cvp-control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
}

.cvp-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.cvp-control-btn:active {
    transform: scale(0.95);
}

.cvp-time-display {
    color: white;
    font-family: monospace;
    font-size: 14px;
    font-weight: 500;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

.cvp-time-separator {
    opacity: 0.6;
    margin: 0 4px;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.cvp-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
}

.cvp-loading-overlay.active {
    display: flex;
}

.cvp-spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.cvp-spinner-circle {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #ff0000;
    animation: cvp-spin 1s linear infinite;
}

@keyframes cvp-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .cvp-popup-container {
        width: 95%;
        height: 85%;
    }
    
    .cvp-popup-container.shorts-mode {
        max-width: 360px;
    }
}

@media (max-width: 768px) {
    .cvp-popup-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-width: none;
    }
    
    .cvp-popup-container.shorts-mode {
        max-width: none;
        width: 100%;
        height: 100%;
    }
    
    .cvp-popup-header {
        padding: 15px;
    }
    
    .cvp-popup-title {
        font-size: 14px;
    }
    
    .cvp-close-btn {
        width: 36px;
        height: 36px;
    }
    
    .cvp-popup-controls {
        padding: 12px 15px;
    }
    
    .cvp-control-btn {
        width: 40px;
        height: 40px;
    }
    
    .cvp-time-display {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .cvp-shorts-thumb {
        max-width: 100%;
    }
    
    .cvp-play-button svg {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .cvp-popup-header {
        padding: 12px;
    }
    
    .cvp-popup-title {
        font-size: 13px;
    }
    
    .cvp-popup-controls {
        justify-content: space-between;
    }
    
    .cvp-time-display {
        font-size: 12px;
        padding: 4px 10px;
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .cvp-shorts-badge {
        top: 10px;
        right: 10px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .cvp-duration-overlay {
        bottom: 10px;
        right: 10px;
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Landscape mode for mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .cvp-popup-container {
        height: 95%;
        width: 95%;
    }
    
    .cvp-popup-container.shorts-mode {
        height: 95%;
        max-height: 600px;
    }
    
    .cvp-popup-header {
        padding: 10px 15px;
    }
    
    .cvp-popup-controls {
        padding: 8px 15px;
    }
}

/* ============================================
   ERROR STATES
   ============================================ */

.cvp-error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f44336;
    margin: 20px 0;
}

.cvp-error::before {
    content: "⚠️ ";
    margin-right: 8px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes cvp-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cvp-popup-container {
    animation: cvp-fade-in 0.3s ease-out;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.cvp-play-button:focus,
.cvp-close-btn:focus,
.cvp-control-btn:focus {
    outline: 2px solid #ff0000;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */

.cvp-popup-container:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
    max-width: none !important;
    max-height: none !important;
}

.cvp-popup-container:fullscreen .cvp-popup-header,
.cvp-popup-container:fullscreen .cvp-popup-controls {
    background: rgba(0, 0, 0, 0.9);
}