/**
 * Hero Video Player - Frontend Styles
 */

.hvp-video-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
}

.hvp-video-wrapper {
    position: relative;
    width: 100%;
    display: block;
}

.hvp-video {
    width: 100%;
    display: block;
}

/* ===== DESKTOP: Fixed height container + cover (may crop) ===== */
.hvp-video-container.hvp-desktop {
    /* Set fixed height based on viewport minus header */
    /* Add 6% extra height so video slightly overflows viewport for better visual effect */
    height: 106vh;
}

/* When header height is detected, JavaScript will set --header-height */
.hvp-video-container.hvp-desktop[style*="--header-height"] {
    height: calc(106vh - var(--header-height, 0px));
}

.hvp-video-container.hvp-desktop .hvp-video-wrapper {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hvp-video-container.hvp-desktop .hvp-video {
    height: 100%;
    /* Fill container, may crop video to avoid black bars */
    object-fit: cover;
}

/* ===== TABLET: Natural video size, no cropping ===== */
/* Tablets use desktop video quality but with natural sizing (no crop/stretch) */
.hvp-video-container.hvp-tablet {
    /* Override desktop fixed height - use natural height */
    height: auto !important;
}

.hvp-video-container.hvp-tablet .hvp-video-wrapper {
    height: auto !important;
}

.hvp-video-container.hvp-tablet .hvp-video {
    /* Override desktop cover - use natural aspect ratio without cropping */
    height: auto !important;
    object-fit: contain !important;
}

/* ===== MOBILE: Auto height + contain (no cropping) ===== */
.hvp-video-container.hvp-mobile {
    height: auto;
}

.hvp-video-container.hvp-mobile .hvp-video-wrapper {
    height: auto;
}

.hvp-video-container.hvp-mobile .hvp-video {
    height: auto;
    /* Fit video inside container without cropping */
    object-fit: contain;
}

/* Loading Spinner */
.hvp-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.hvp-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hvp-spin 0.8s linear infinite;
}

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

/* Play Overlay (Mobile) */
.hvp-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 5;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.hvp-play-overlay:hover {
    background: rgba(0, 0, 0, 0.4);
}

.hvp-play-button {
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.hvp-play-button:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.hvp-play-button svg {
    margin-left: 4px;
    color: #fff;
}

/* Custom Controls */
.hvp-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    opacity: 0;
    -webkit-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
    pointer-events: none;
    /* Safari-specific: force GPU acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: opacity;
}

.hvp-controls.visible {
    opacity: 1 !important;
    pointer-events: all !important;
}

.hvp-controls-left {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.hvp-controls-right {
    position: absolute;
    top: 20px;
    right: 20px;
}

.hvp-control {
    width: 55px;
    height: 55px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.hvp-control:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

.hvp-control svg {
    width: 32px;
    height: 32px;
    color: #fff;
}

/* Play/Pause Button Icons */
.hvp-play-pause .hvp-icon-pause {
    display: none;
}

.hvp-play-pause.playing .hvp-icon-play {
    display: none;
}

.hvp-play-pause.playing .hvp-icon-pause {
    display: block;
}

/* Mute Button Icons */
.hvp-mute .hvp-icon-mute {
    display: none;
}

.hvp-mute.muted .hvp-icon-volume {
    display: none;
}

.hvp-mute.muted .hvp-icon-mute {
    display: block;
}

/* Progress Bar */
.hvp-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 15;
    cursor: pointer;
}

.hvp-progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    position: relative;
}

.hvp-progress-filled {
    height: 100%;
    background: #fff;
    width: 0%;
    transition: width 0.1s linear;
}

/* Mobile Specific Styles */
.hvp-video-container.hvp-mobile .hvp-controls {
    opacity: 0 !important;
    pointer-events: none !important;
    -webkit-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
    /* Safari/iOS specific */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.hvp-video-container.hvp-mobile .hvp-controls.visible {
    opacity: 1 !important;
    pointer-events: all !important;
}

/* Desktop Specific Styles */
.hvp-video-container.hvp-desktop .hvp-controls {
    /* Safari/iOS: controls hidden by default, shown on hover (via JS) */
    opacity: 0;
    pointer-events: none;
    -webkit-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.hvp-video-container.hvp-desktop .hvp-controls.visible {
    opacity: 1 !important;
    pointer-events: all !important;
}

/* Video adapts to its natural aspect ratio on all devices */

/* Responsive Design */
@media (max-width: 768px) {
    .hvp-controls-right {
        top: 15px;
        right: 15px;
    }
    
    .hvp-control {
        width: 60px;
        height: 60px;
    }
    
    .hvp-control svg {
        width: 28px;
        height: 28px;
    }
    
    .hvp-play-button {
        width: 90px;
        height: 90px;
    }
    
    .hvp-play-button svg {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .hvp-controls-right {
        top: 12px;
        right: 12px;
    }
    
    .hvp-control {
        width: 55px;
        height: 55px;
    }
    
    .hvp-control svg {
        width: 26px;
        height: 26px;
    }
    
    .hvp-play-button {
        width: 80px;
        height: 80px;
    }
    
    .hvp-play-button svg {
        width: 55px;
        height: 55px;
    }
}

/* Performance Optimizations */
.hvp-video-container * {
    will-change: transform, opacity;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .hvp-video-container *,
    .hvp-control,
    .hvp-play-button,
    .hvp-progress-filled {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .hvp-control {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid #fff;
    }
    
    .hvp-play-button {
        border: 3px solid #000;
    }
}

