/* YouTube Video Widget Styles */

.youtube-video-widget {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.yvw-container {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #000;
}

/* Aspect Ratios */
.yvw-aspect-auto .yvw-container {
    aspect-ratio: 16/9;
}

.yvw-aspect-16_9 .yvw-container {
    aspect-ratio: 16/9;
}

.yvw-aspect-9_16 .yvw-container {
    aspect-ratio: 9/16;
}

.yvw-aspect-1_1 .yvw-container {
    aspect-ratio: 1/1;
}

/* Overlay Styles */
.yvw-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.yvw-overlay-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.yvw-overlay-text {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    z-index: 15;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    border-radius: 5px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    max-width: 80%;
    word-wrap: break-word;
    white-space: normal;
    transition: opacity 0.3s ease;
}

/* Text shadow options */
.yvw-overlay-text.yvw-text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 
                 0 0 10px rgba(0, 0, 0, 0.9),
                 0 0 20px rgba(0, 0, 0, 0.7);
}

.yvw-overlay-text.yvw-no-shadow {
    text-shadow: none;
}

/* Text always visible option */
.yvw-overlay-text.yvw-text-always {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hide text on hover when overlay is present (unless always visible) */
.youtube-video-widget:hover .yvw-overlay-text:not(.yvw-text-always) {
    opacity: 0;
}

/* Show text when playing (unless always visible) */
.youtube-video-widget.playing .yvw-overlay-text:not(.yvw-text-always) {
    opacity: 0;
}

/* Video Container */
.yvw-video-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.yvw-player {
    width: 100%;
    height: 100%;
}

.yvw-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Hover Effects */
.yvw-container:hover {
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.youtube-video-widget:hover .yvw-overlay {
    opacity: 0;
}

.youtube-video-widget.playing .yvw-overlay {
    opacity: 0;
    pointer-events: none;
}

/* Hide YouTube branding and controls */
.yvw-player iframe {
    pointer-events: auto;
}

.youtube-video-widget.hide-controls .yvw-player iframe {
    pointer-events: none;
}

.youtube-video-widget.hide-controls:hover .yvw-player iframe {
    pointer-events: auto;
}

/* Aggressive YouTube element hiding */
.youtube-video-widget iframe {
    position: relative;
    z-index: 1;
}

/* Hide YouTube watermark, logo, and suggestions using CSS */
.youtube-video-widget.hide-controls::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 2;
    pointer-events: none;
}

/* Additional hiding for YouTube elements */
.youtube-video-widget .yvw-player {
    position: relative;
    overflow: hidden;
}

.youtube-video-widget .yvw-player iframe {
    position: absolute;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
}

/* Ensure overlay is above YouTube player */
.yvw-overlay {
    z-index: 10;
}

/* Loading state */
.yvw-container.loading {
    background: #000;
}

.yvw-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #333;
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .yvw-overlay-text {
        font-size: 1.5rem;
        padding: 8px 16px;
        max-width: 90%;
    }
    
    /* Better touch targets on mobile */
    .youtube-video-widget {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Adjust hover effects for touch devices */
    .yvw-container:hover {
        transform: none; /* Disable hover scale on mobile */
    }
    
    /* Touch-friendly overlay */
    .yvw-overlay {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    .yvw-overlay-text {
        font-size: 1.2rem;
        padding: 6px 12px;
        max-width: 95%;
    }
    
    /* Smaller border on mobile */
    .yvw-container {
        border-width: 2px !important;
    }
    
    /* Adjust aspect ratios for mobile */
    .yvw-aspect-auto .yvw-container {
        aspect-ratio: 9/16; /* Prefer vertical on mobile */
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .yvw-container:hover {
        transform: none;
        box-shadow: none;
    }
    
    .yvw-container:hover::before {
        opacity: 0;
    }
    
    /* Make overlay more prominent on touch */
    .yvw-overlay {
        cursor: pointer;
    }
    
    .yvw-overlay::after {
        content: '▶';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 3rem;
        color: rgba(255, 255, 255, 0.8);
        text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
        z-index: 5;
        pointer-events: none;
    }
    
    .youtube-video-widget.playing .yvw-overlay::after {
        display: none;
    }
}
/* Self-hosted video styles */
.yvw-self-hosted-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Link styles */
.yvw-video-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.yvw-video-link:hover {
    text-decoration: none;
    color: inherit;
}

.yvw-text-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

.yvw-text-clickable {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.yvw-text-clickable:hover {
    opacity: 0.8;
}

/* Hide Vimeo watermark and branding */
.yvw-player iframe[src*="vimeo"] {
    /* Crop iframe slightly to hide potential watermarks */
    transform: scale(1.02);
    transform-origin: center;
}

/* Additional Vimeo hiding */
.yvw-player iframe[src*="vimeo"]::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 80px;
    height: 30px;
    background: transparent;
    z-index: 10;
    pointer-events: none;
}

/* Hide any remaining Vimeo elements */
.yvw-container .vp-overlay,
.yvw-container .vp-watermark,
.yvw-container .vp-logo,
.yvw-container .vp-byline,
.yvw-container .vp-title {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Link-only mode (disable video functionality) */
.yvw-link-only .yvw-player iframe,
.yvw-link-only .yvw-self-hosted-player {
    pointer-events: none;
}

.yvw-link-only .yvw-overlay {
    pointer-events: none;
}

.yvw-has-link.yvw-link-only {
    cursor: pointer;
}    background: #000;
}

.yvw-self-hosted-player::-webkit-media-controls {
    display: none !important;
}

.yvw-self-hosted-player::-webkit-media-controls-enclosure {
    display: none !important;
}

.youtube-video-widget.hide-controls .yvw-self-hosted-player {
    pointer-events: none;
}

.youtube-video-widget.hide-controls:hover .yvw-self-hosted-player {
    pointer-events: auto;
}

/* Ensure proper stacking */
.youtube-video-widget {
    isolation: isolate;
}

/* Animation for border glow effect */
.yvw-container {
    position: relative;
}

.yvw-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.yvw-container:hover::before {
    opacity: 1;
}

/* Smooth transitions for all interactive elements */
* {
    box-sizing: border-box;
}

.youtube-video-widget * {
    transition: all 0.3s ease;
}

