/* =========================
   Hero Video Slider CSS
   Video-specific enhancements
   ========================= */

/* =========================
   Grid Mode - Video Banner Styles
   ========================= */

/* Video Banner Template Styles - Grid Mode */
.hero-grid-mode .hero-slide[data-template="video-banner"] {
    padding: 0;
    min-height: 400px !important;
    max-height: 400px !important;
    height: 400px !important;
    overflow: hidden;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-container {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 400px !important;
    max-height: 400px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-player {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 400px !important;
    max-height: 400px !important;
    object-fit: fill !important;
    object-position: center !important;
    display: block !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    z-index: 0 !important;
    opacity: 1 !important;
}

/* Desktop video - visible by default */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-player.desktop {
    display: block !important;
    position: absolute !important;
    object-fit: fill !important;
}

/* Mobile video - hidden by default in grid mode */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-player.mobile {
    display: none !important;
}

/* Video Overlay - Hidden by default, only show when needed */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0) 30%,
        rgba(0, 0, 0, 0.5) 100%
    );
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show overlay only when video is paused or not playing */
.hero-grid-mode .hero-slide[data-template="video-banner"]:not([data-video-playing="true"]) .video-overlay {
    opacity: 1;
}

/* Video Content Overlay */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-content {
    position: absolute;
    z-index: 2;
    color: white;
    pointer-events: none;
    max-width: 500px;
    padding: 24px;
}

/* Content positioning */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-content.position-left {
    left: 0;
    bottom: 60px;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-content.position-center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-content.position-right {
    right: 0;
    bottom: 60px;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-content h2 {
    font-size: 2.25rem;
    font-weight: 700;
    margin: 0 0 8px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    line-height: 1.1;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-content h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0 0 12px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
    opacity: 0.95;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-content p {
    font-size: 1rem;
    margin: 0 0 16px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

/* CTA Buttons */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-cta {
    pointer-events: all;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-cta .btn {
    display: inline-block;
    padding: 10px 24px;
    margin-right: 8px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-cta .btn-primary {
    background: #f59e0b;
    color: white;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-cta .btn-primary:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-cta .btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(10px);
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-cta .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Play Button Overlay */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 70px;
    height: 70px;
    background: rgba(245, 158, 11, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-play-overlay:hover {
    background: rgba(245, 158, 11, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-play-overlay svg {
    width: 28px;
    height: 28px;
    fill: white;
    margin-left: 3px;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-play-overlay.hidden {
    display: none;
}

/* Responsive: Mobile - Stack layout */
@media (max-width: 768px) {
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-player.desktop {
        display: none !important;
        visibility: hidden !important;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-player.mobile {
        display: block !important;
        position: absolute !important;
        z-index: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        object-fit: contain !important;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-container {
        min-height: 350px;
        max-height: 450px;
        border-radius: 12px;
        background: #000 !important;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-content {
        padding: 20px;
        max-width: 100%;
        bottom: 50px;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-content h2 {
        font-size: 1.75rem;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-content h3 {
        font-size: 1.125rem;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-content p {
        font-size: 0.95rem;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-cta .btn {
        padding: 10px 20px;
        font-size: 0.875rem;
        margin-right: 6px;
        margin-bottom: 6px;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-play-overlay {
        width: 60px;
        height: 60px;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-play-overlay svg {
        width: 24px;
        height: 24px;
    }
}

/* Breakpoint khusus untuk iPhone dan devices dengan lebar 390-428px */
@media (max-width: 430px) {
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-player.desktop {
        display: none !important;
        visibility: hidden !important;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-player.mobile {
        display: block !important;
        position: absolute !important;
        z-index: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        object-fit: contain !important;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-container {
        background: #000 !important;
    }
}

@media (max-width: 480px) {
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-container {
        min-height: 300px;
        max-height: 400px;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-content h2 {
        font-size: 1.5rem;
    }
    
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-cta .btn {
        display: block;
        width: 100%;
        margin-right: 0;
        text-align: center;
    }
}

/* Accessibility */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-player:focus {
    outline: 3px solid #f59e0b;
    outline-offset: -3px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .hero-grid-mode .hero-slide[data-template="video-banner"] .video-overlay {
        background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.4) 0%,
            rgba(0, 0, 0, 0.2) 40%,
            rgba(0, 0, 0, 0.8) 100%
        );
    }
}

/* =========================
   Video Controls Enhancement
   ========================= */

/* Video Controls Enhancement */
.hero-slide[data-template="video-banner"] video::-webkit-media-controls-panel {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.8));
}

.hero-slide[data-template="video-banner"] video::-webkit-media-controls-play-button,
.hero-slide[data-template="video-banner"] video::-webkit-media-controls-mute-button {
    background-color: rgba(245, 158, 11, 0.8);
    border-radius: 50%;
}

.hero-slide[data-template="video-banner"] video::-webkit-media-controls-play-button:hover,
.hero-slide[data-template="video-banner"] video::-webkit-media-controls-mute-button:hover {
    background-color: rgba(245, 158, 11, 1);
}

/* Firefox */
.hero-slide[data-template="video-banner"] video::-moz-media-controls {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.8));
}

/* Video Performance - Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .hero-slide[data-template="video-banner"] .video-player {
        animation: none !important;
    }
    
    .hero-slide[data-template="video-banner"] .video-content {
        transition: none !important;
    }
}

/* Video Error State */
.hero-slide[data-template="video-banner"] .video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 3;
    padding: 24px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.hero-slide[data-template="video-banner"] .video-error h4 {
    margin: 0 0 8px;
    font-size: 1.125rem;
    color: #f59e0b;
}

.hero-slide[data-template="video-banner"] .video-error p {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Video Poster Image Enhancement */
.hero-slide[data-template="video-banner"] .video-player[poster] {
    background-size: cover;
    background-position: center;
}

/* Buffering indicator */
.hero-slide[data-template="video-banner"] .video-buffering {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: video-spinner 0.8s linear infinite;
    z-index: 3;
    display: none;
}

.hero-slide[data-template="video-banner"].buffering .video-buffering {
    display: block;
}

/* Video Fade In Animation - Disabled for debugging */
.hero-slide[data-template="video-banner"] .video-player {
    opacity: 1 !important;
    transition: opacity 0.5s ease-in;
}

.hero-slide[data-template="video-banner"] .video-player.loaded {
    opacity: 1 !important;
}

/* Mute/Unmute Toggle Button (optional enhancement) */
.hero-slide[data-template="video-banner"] .video-mute-toggle {
    position: absolute;
    bottom: 80px;
    right: 24px;
    z-index: 4;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.hero-slide[data-template="video-banner"] .video-mute-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: #f59e0b;
    transform: scale(1.1);
}

.hero-slide[data-template="video-banner"] .video-mute-toggle svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Hide mute toggle if controls are visible */
.hero-slide[data-template="video-banner"] video[controls] ~ .video-mute-toggle {
    display: none;
}

/* Grid Mode Specific Enhancements */
.hero-grid-mode .hero-slide[data-template="video-banner"] .video-mute-toggle {
    bottom: 70px;
    right: 20px;
    width: 40px;
    height: 40px;
}

.hero-grid-mode .hero-slide[data-template="video-banner"] .video-mute-toggle svg {
    width: 18px;
    height: 18px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .hero-slide[data-template="video-banner"] .video-mute-toggle {
        bottom: 60px;
        right: 16px;
    }
    
    /* Ensure controls are touch-friendly */
    .hero-slide[data-template="video-banner"] .video-play-overlay {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Reduce motion on mobile for better performance */
    .hero-slide[data-template="video-banner"] .video-content,
    .hero-slide[data-template="video-banner"] .video-play-overlay {
        transition-duration: 0.2s;
    }
}

/* Focus states for keyboard navigation */
.hero-slide[data-template="video-banner"] .video-play-overlay:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 4px;
}

.hero-slide[data-template="video-banner"] .video-cta .btn:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero-slide[data-template="video-banner"] .video-overlay {
        background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.5) 0%,
            rgba(0, 0, 0, 0.3) 40%,
            rgba(0, 0, 0, 0.9) 100%
        );
    }
    
    .hero-slide[data-template="video-banner"] .video-content h2,
    .hero-slide[data-template="video-banner"] .video-content h3,
    .hero-slide[data-template="video-banner"] .video-content p {
        text-shadow: 3px 3px 10px rgba(0, 0, 0, 1);
    }
}

/* Video Time Display (optional) */
.hero-slide[data-template="video-banner"] .video-time {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 6px;
    z-index: 4;
    backdrop-filter: blur(5px);
    display: none;
}

.hero-slide[data-template="video-banner"].show-time .video-time {
    display: block;
}

/* Aspect Ratio Containers for different video formats */
.hero-slide[data-template="video-banner"] .video-container.aspect-16-9 {
    aspect-ratio: 16 / 9;
}

.hero-slide[data-template="video-banner"] .video-container.aspect-4-3 {
    aspect-ratio: 4 / 3;
}

.hero-slide[data-template="video-banner"] .video-container.aspect-21-9 {
    aspect-ratio: 21 / 9;
}

/* Print styles - hide videos when printing */
@media print {
    .hero-slide[data-template="video-banner"] .video-player {
        display: none !important;
    }
    
    .hero-slide[data-template="video-banner"] .video-play-overlay,
    .hero-slide[data-template="video-banner"] .video-mute-toggle {
        display: none !important;
    }
}
