/**
 * Hero Video Slideshow - Frontend Styles
 * 
 * Phase 3 - Frontend Rendering & Analytics
 */

.hvs-slideshow-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: #000;
    overflow: hidden;
    border-radius: 4px;
    height: 675px;
    min-height: 675px;
}

.hvs-slide {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    display: none;
}

.hvs-slide.active {
    display: block;
}

/* Background Layer */
.hvs-background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.hvs-background-layer video,
.hvs-background-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Video Overlays */
.hvs-video-overlay {
    position: absolute;
    z-index: 4;
    overflow: hidden;
    border-radius: 2px;
}

.hvs-video-overlay .hvs-video-item {
    width: 100%;
    height: 100%;
    position: relative;
}

.hvs-video-overlay .hvs-video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hvs-video-overlay {
    position: relative;
}

.hvs-volume-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hvs-volume-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.hvs-volume-icon {
    font-size: 20px;
    line-height: 1;
    display: block;
}

.hvs-video-overlay .hvs-video-item.muted .hvs-volume-icon::after {
    content: '🔇';
}

.hvs-video-overlay .hvs-video-item.unmuted .hvs-volume-icon::after {
    content: '🔊';
}

.hvs-video-overlay .hvs-video-embed {
    width: 100%;
    height: 100%;
    position: relative;
}

.hvs-video-overlay .hvs-video-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Image Overlays */
.hvs-image-overlay {
    position: absolute;
    z-index: 5;
    overflow: hidden;
    border-radius: 2px;
}

.hvs-image-overlay img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.hvs-image-overlay a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Screen Type Styles */
.hvs-screen-billboard {
    border: 2px solid rgba(255, 107, 107, 0.5);
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3);
}

.hvs-screen-tv {
    border: 2px solid rgba(168, 85, 247, 0.5);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.hvs-screen-movie {
    border: 2px solid rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.hvs-screen-drivein {
    border: 2px solid rgba(245, 158, 11, 0.5);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.hvs-screen-computer {
    border: 2px solid rgba(59, 130, 246, 0.5);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.hvs-screen-phone {
    border: 2px solid rgba(236, 72, 153, 0.5);
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.3);
}

.hvs-screen-stage {
    border: 2px solid rgba(6, 182, 212, 0.5);
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
}

.hvs-screen-radio {
    border: 2px solid rgba(132, 204, 22, 0.5);
    box-shadow: 0 4px 20px rgba(132, 204, 22, 0.3);
}

/* CTA Layer */
.hvs-cta-layer {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
}

.hvs-cta-button {
    display: inline-block;
    padding: 15px 30px;
    background: #2271b1;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.hvs-cta-button:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.hvs-cta-text {
    display: inline-block;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
}

/* Navigation */
.hvs-slideshow-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 25px;
}

.hvs-nav-prev,
.hvs-nav-next {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hvs-nav-prev:hover,
.hvs-nav-next:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.hvs-nav-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.hvs-nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.hvs-nav-dot:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.2);
}

.hvs-nav-dot.active {
    background: #fff;
    width: 12px;
    height: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hvs-slideshow-container {
        /* Force landscape aspect ratio on mobile (16:9) */
        /* JavaScript will set exact height, but CSS provides fallback */
        position: relative;
        width: 100% !important;
        /* Remove fixed heights - let JavaScript calculate */
    }
    
    /* Remove inline style height on mobile - JavaScript handles this */
    .hvs-slideshow-container[style*="height"] {
        /* JavaScript will override this */
    }
    
    .hvs-slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
    }
    
    /* Ensure background videos/images maintain landscape */
    .hvs-background-layer {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
    }
    
    .hvs-background-layer video,
    .hvs-background-layer img {
        object-fit: cover !important;
        object-position: center !important;
        width: 100% !important;
        height: 100% !important;
        min-width: 100% !important;
        min-height: 100% !important;
    }
    
    /* Fix video overlays (billboards) to scale properly */
    .hvs-video-overlay {
        /* Maintain percentage-based positioning */
        position: absolute !important;
        /* Ensure videos are responsive */
        box-sizing: border-box;
    }
    
    .hvs-video-overlay .hvs-video-player {
        object-fit: contain !important;
        width: 100% !important;
        height: 100% !important;
        /* Ensure video fills the container */
        max-width: 100%;
        max-height: 100%;
    }
    
    /* Ensure videos scale properly on mobile */
    .hvs-video-overlay {
        /* Videos will be auto-scaled by JavaScript */
        transition: all 0.3s ease; /* Smooth scaling */
    }
    
    /* Ensure videos don't overflow and maintain aspect ratio */
    .hvs-video-overlay .hvs-video-item {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden;
    }
    
    /* Ensure video player maintains aspect ratio */
    .hvs-video-overlay .hvs-video-player {
        /* contain ensures full video is visible, fits within container */
        object-fit: contain !important;
        /* Prevent distortion */
        aspect-ratio: auto;
    }
    
    .hvs-cta-button,
    .hvs-cta-text {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    .hvs-nav-prev,
    .hvs-nav-next {
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
    
    .hvs-nav-dots {
        gap: 6px;
    }
    
    .hvs-nav-dot {
        width: 8px;
        height: 8px;
    }
    
    .hvs-nav-dot.active {
        width: 10px;
        height: 10px;
    }
}

/* Additional mobile portrait and landscape protection */
@media (max-width: 768px) {
    /* Both portrait and landscape - force 16:9 */
    .hvs-slideshow-container {
        width: 100% !important;
        /* Height will be set by JavaScript to maintain 16:9 */
    }
    
    @media (orientation: landscape) {
        .hvs-slideshow-container {
            /* In landscape, ensure full width and proper height */
            width: 100% !important;
            /* JavaScript calculates height */
        }
    }
    
    @media (orientation: portrait) {
        .hvs-slideshow-container {
            /* Even in portrait, maintain landscape aspect ratio */
            width: 100% !important;
            /* JavaScript calculates height */
        }
    }
}

/* Loading State */
.hvs-slideshow-container.loading {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
}

.hvs-slideshow-container.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hvs-spin 1s linear infinite;
}

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

/* Accessibility */
.hvs-slideshow-container:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.hvs-nav-prev:focus,
.hvs-nav-next:focus,
.hvs-nav-dot:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}
