/**
 * PinkCode Video Fullscreen Enhancer - Styles
 * Beautiful, mobile-friendly fullscreen controls for Vimeo videos
 * 
 * @package PinkCodeLearnDashBeautifier
 * @version 1.0.0
 * @author Pink Code Queen - Nariman Jafari
 */

/* ==========================================================================
   Video Container
   ========================================================================== */

.pcld-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
}

/* Hide Vimeo's native close button (X) to avoid conflicts */
.pcld-video-container svg[viewBox="0 0 20 20"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Also target by path to be extra sure */
.pcld-video-container svg path[d*="M11.06 10l4.597"] {
    display: none !important;
}

/* Hide any close buttons in the video container */
.pcld-video-container button[aria-label*="close"],
.pcld-video-container button[aria-label*="Close"],
.pcld-video-container [class*="close-button"],
.pcld-video-container [class*="closeButton"] {
    display: none !important;
    visibility: hidden !important;
}

.pcld-video-container iframe {
    pointer-events: auto;
}

.pcld-video-container iframe,
.pcld-video-container video {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

/* Fullscreen state */
.pcld-video-container.pcld-is-fullscreen {
    border-radius: 0;
}

.pcld-video-container.pcld-is-fullscreen iframe,
.pcld-video-container.pcld-is-fullscreen video {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    object-fit: contain;
}

/* Mobile fullscreen fixes */
@media (max-width: 768px) {
    .pcld-video-container.pcld-is-fullscreen {
        width: 100vw !important;
        height: 100vh !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 999999 !important;
    }
    
    .pcld-video-container.pcld-is-fullscreen iframe,
    .pcld-video-container.pcld-is-fullscreen video {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        object-fit: contain !important;
    }
}

/* ==========================================================================
   Fullscreen Button
   ========================================================================== */

.pcld-fullscreen-btn {
    position: absolute;
    z-index: 2147483647; /* Maximum z-index to be above everything */
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(75, 85, 99, 0.92) 0%, rgba(229, 231, 235, 0.92) 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(0.85);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(75, 85, 99, 0.28);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* Button visibility */
.pcld-fullscreen-btn.pcld-fs-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

/* Ensure button is always clickable and above everything */
.pcld-fullscreen-btn.pcld-fs-visible {
    z-index: 2147483647 !important;
}

/* Button hover state */
.pcld-fullscreen-btn:hover {
    background: linear-gradient(135deg, rgba(55, 65, 81, 0.96) 0%, rgba(243, 244, 246, 0.96) 100%);
    box-shadow: 0 6px 20px rgba(55, 65, 81, 0.45);
    transform: scale(1.05);
}

.pcld-fullscreen-btn:active {
    transform: scale(0.95);
}

/* Button focus state */
.pcld-fullscreen-btn:focus-visible {
    outline: 3px solid rgba(209, 213, 219, 0.7);
    outline-offset: 3px;
}

/* ==========================================================================
   Button Positioning
   ========================================================================== */

/* Top Right (default) - adjusted to avoid Vimeo close button */
.pcld-fullscreen-btn-top-right {
    top: 16px;
    right: 70px; /* Move left to avoid Vimeo X button */
}

/* Top Left */
.pcld-fullscreen-btn-top-left {
    top: 16px;
    left: 16px;
}

/* Bottom Right */
.pcld-fullscreen-btn-bottom-right {
    bottom: 16px;
    right: 16px;
}

/* Bottom Left */
.pcld-fullscreen-btn-bottom-left {
    bottom: 16px;
    left: 16px;
}

/* Center */
.pcld-fullscreen-btn-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
}

.pcld-fullscreen-btn-center.pcld-fs-visible {
    transform: translate(-50%, -50%) scale(1);
}

.pcld-fullscreen-btn-center:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.pcld-fullscreen-btn-center:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* ==========================================================================
   Button Icons
   ========================================================================== */

.pcld-fs-icon {
    width: 26px;
    height: 26px;
    transition: transform 0.3s ease;
}

/* Show enter icon by default */
.pcld-fs-enter {
    display: block;
}

.pcld-fs-exit {
    display: none;
}

/* Show exit icon when in fullscreen */
.pcld-is-fullscreen .pcld-fs-enter {
    display: none;
}

.pcld-is-fullscreen .pcld-fs-exit {
    display: block;
}

/* Icon animation on hover */
.pcld-fullscreen-btn:hover .pcld-fs-icon {
    transform: rotate(90deg);
}

/* ==========================================================================
   Mobile Optimizations
   ========================================================================== */

@media (max-width: 768px) {
    /* Optimized touch target on mobile */
    .pcld-fullscreen-btn {
        width: 50px;
        height: 50px;
        /* Always visible on mobile */
        opacity: 1;
        transform: scale(1);
        pointer-events: all;
    }
    
    .pcld-fullscreen-btn-center {
        transform: translate(-50%, -50%) scale(1);
    }
    
    /* Icon size on mobile */
    .pcld-fs-icon {
        width: 24px;
        height: 24px;
    }
    
    /* Adjust positioning for mobile */
    .pcld-fullscreen-btn-top-right,
    .pcld-fullscreen-btn-top-left {
        top: 12px;
    }
    
    .pcld-fullscreen-btn-top-right {
        right: 70px; /* Keep away from Vimeo X button */
    }
    
    .pcld-fullscreen-btn-bottom-right {
        right: 12px;
    }
    
    .pcld-fullscreen-btn-top-left,
    .pcld-fullscreen-btn-bottom-left {
        left: 12px;
    }
    
    .pcld-fullscreen-btn-bottom-right,
    .pcld-fullscreen-btn-bottom-left {
        bottom: 12px;
    }
    
    /* Pulsing animation to draw attention on mobile */
    @keyframes pcld-pulse {
        0%, 100% {
            box-shadow: 0 4px 12px rgba(75, 85, 99, 0.28);
        }
        50% {
            box-shadow: 0 4px 20px rgba(55, 65, 81, 0.5);
        }
    }
    
    .pcld-fullscreen-btn {
        animation: pcld-pulse 2s ease-in-out infinite;
    }
    
    /* Stop pulsing on touch */
    .pcld-fullscreen-btn:active {
        animation: none;
    }
}

@media (max-width: 480px) {
    /* Compact on small phones */
    .pcld-fullscreen-btn {
        width: 50px;
        height: 50px;
    }
    
    .pcld-fs-icon {
        width: 24px;
        height: 24px;
    }
}

/* ==========================================================================
   Fullscreen Mode Styles
   ========================================================================== */

/* Enhanced controls visibility in fullscreen */
.pcld-is-fullscreen .pcld-fullscreen-btn {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
    background: linear-gradient(135deg, rgba(55, 65, 81, 0.94) 0%, rgba(229, 231, 235, 0.94) 100%);
}

/* Smooth transition when entering/exiting fullscreen */
.pcld-video-container {
    transition: border-radius 0.3s ease;
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .pcld-video-container {
        background: #000000;
    }
    
    .pcld-fullscreen-btn {
        background: linear-gradient(135deg, rgba(55, 65, 81, 0.96) 0%, rgba(229, 231, 235, 0.96) 100%);
        box-shadow: 0 4px 16px rgba(31, 41, 55, 0.5);
    }
    
    .pcld-fullscreen-btn:hover {
        box-shadow: 0 6px 24px rgba(31, 41, 55, 0.65);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .pcld-fullscreen-btn {
        background: #4b5563;
        border: 2px solid #ffffff;
    }
    
    .pcld-fullscreen-btn:hover {
        background: #374151;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pcld-fullscreen-btn,
    .pcld-fs-icon,
    .pcld-video-container {
        transition: none !important;
        animation: none !important;
    }
}

/* Focus visible for keyboard navigation */
.pcld-fullscreen-btn:focus:not(:focus-visible) {
    outline: none;
}

/* ==========================================================================
   Loading State (optional)
   ========================================================================== */

.pcld-video-container.pcld-loading .pcld-fullscreen-btn {
    pointer-events: none;
    opacity: 0.5;
}

/* Spinner animation for loading state */
@keyframes pcld-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.pcld-video-container.pcld-loading .pcld-fs-icon {
    animation: pcld-spin 1s linear infinite;
}

/* ==========================================================================
   Double-Tap Feedback
   ========================================================================== */

/* Visual feedback for double-tap action */
@keyframes pcld-tap-feedback {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pcld-video-container.pcld-tap-active {
    animation: pcld-tap-feedback 0.3s ease;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .pcld-fullscreen-btn {
        display: none !important;
    }
}
