/**
 * Hero Slider Manager - Frontend Styles (Updated for Tourism Design System)
 * 
 * PURPOSE: Hero slider styling that integrates with tourism theme design system
 * 
 * STRUCTURE:
 * - Tourism design system integration
 * - Hero slider with tourism styling
 * - Responsive design
 * - Accessibility features
 * 
 * UPDATE PROCEDURES:
 * - MEDIUM IMPACT: Changes affect hero slider display
 * - Test slider functionality and styling
 * 
 * DEPENDENCIES:
 * - Requires: Tourism theme variables
 * - Used by: Hero slider shortcode
 * 
 * @package HeroSliderManager
 * @version 1.0.0
 */

/* ==========================================================================
   Tourism Design System Integration
   ========================================================================== */

/* Hero Slider Container */
.hsm-hero-slider {
    position: relative;
    width: 100%;
    margin: 0;
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.hsm-slider-container {
    position: relative;
    width: 100%;
    height: 90vh;
    min-height: 600px;
    max-height: none;
}

.hsm-no-slides {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: var(--tourism-primary);
    color: var(--tourism-white);
    font-size: var(--tourism-text-lg);
    font-weight: var(--tourism-font-semibold);
}

/* Individual Slides */
.hsm-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    visibility: visible;
    overflow: hidden;
}

.hsm-slide.active {
    opacity: 1;
    z-index: 2;
    visibility: visible;
}

.hsm-slide:not(.active) {
    pointer-events: none;
    visibility: visible;
    opacity: 0;
}

/* Slide Background and Overlay */
.hsm-slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    transition: opacity 1.2s ease-in-out;
    z-index: 2;
    pointer-events: none;
    display: block;
}

/* Slide Content */
.hsm-slide-content {
    position: relative;
    z-index: 4;
    width: 100%;
    max-width: 1024px;
    padding: var(--tourism-space-10) var(--tourism-space-6);
    color: var(--tourism-white);
    text-align: left;
    opacity: 1;
    visibility: visible;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Text Positioning Classes */
.hsm-slide-content.hsm-text-position-left {
    margin-left: 0;
    margin-right: auto;
    align-items: flex-start;
}

.hsm-slide-content.hsm-text-position-center {
    margin-left: auto;
    margin-right: auto;
    align-items: center;
}

.hsm-slide-content.hsm-text-position-right {
    margin-left: auto;
    margin-right: 0;
    align-items: flex-end;
}

/* Text Alignment Classes */
.hsm-slide-content.hsm-text-align-left,
.hsm-slide-content.hsm-text-align-left * {
    text-align: left;
}

.hsm-slide-content.hsm-text-align-center,
.hsm-slide-content.hsm-text-align-center * {
    text-align: center;
}

.hsm-slide-content.hsm-text-align-right,
.hsm-slide-content.hsm-text-align-right * {
    text-align: right;
}

.hsm-slide-title {
    font-size: var(--tourism-text-5xl);
    font-weight: var(--tourism-font-bold);
    margin: 0 0 var(--tourism-space-4) 0;
    color: var(--tourism-white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    opacity: 1;
    visibility: visible;
    display: block;
    line-height: var(--tourism-leading-tight);
}

.hsm-slide-subtitle {
    font-size: var(--tourism-text-xl);
    font-weight: var(--tourism-font-normal);
    margin: 0 0 var(--tourism-space-6) 0;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 1;
    visibility: visible;
    display: block;
    line-height: var(--tourism-leading-normal);
}

.hsm-slide-description {
    font-size: var(--tourism-text-lg);
    line-height: var(--tourism-leading-relaxed);
    margin: 0 0 var(--tourism-space-8) 0;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 1;
    visibility: visible;
    display: block;
}

.hsm-slide-actions {
    display: flex;
    gap: var(--tourism-space-4);
    justify-content: flex-start;
    flex-wrap: wrap;
    opacity: 1;
    visibility: visible;
}

/* Navigation Buttons - Plugin-specific positioning only */
.hsm-btn-prev,
.hsm-btn-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    font-size: 20px;
    color: #1f2937;
    transition: all 0.3s ease;
    pointer-events: auto;
    z-index: 100 !important;
    margin: 0 !important;
    padding: 0 !important;
    outline: none;
    box-sizing: border-box;
    float: none !important;
    clear: none !important;
}

/* Left button positioning */
.hsm-btn-prev {
    left: 24px !important;
    right: auto !important;
}

/* Right button positioning */
.hsm-btn-next {
    right: 24px !important;
    left: auto !important;
}

/* Hover states with position protection */
.hsm-btn-prev:hover,
.hsm-btn-next:hover {
    background: #ffffff;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: absolute !important;
    top: 50% !important;
}

.hsm-btn-prev:hover {
    left: 24px !important;
    right: auto !important;
}

.hsm-btn-next:hover {
    right: 24px !important;
    left: auto !important;
}

/* Focus states with position protection */
.hsm-btn-prev:focus,
.hsm-btn-next:focus {
    outline: none;
    background: #ffffff;
    box-shadow: 0 0 0 2px #ffdd00;
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.hsm-btn-prev:focus {
    left: 24px !important;
    right: auto !important;
}

.hsm-btn-next:focus {
    right: 24px !important;
    left: auto !important;
}

/* Active states - CRITICAL: Prevent position reset on click */
.hsm-btn-prev:active,
.hsm-btn-next:active {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) scale(0.95) !important;
    background: rgba(255, 255, 255, 0.9);
}

.hsm-btn-prev:active {
    left: 24px !important;
    right: auto !important;
}

.hsm-btn-next:active {
    right: 24px !important;
    left: auto !important;
}

/* Override any inline styles that might be applied */
.hsm-btn-prev[style],
.hsm-btn-next[style] {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.hsm-btn-prev[style] {
    left: 24px !important;
    right: auto !important;
}

.hsm-btn-next[style] {
    right: 24px !important;
    left: auto !important;
}

/* Slider Controls Container */
.hsm-slider-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    z-index: 5;
    pointer-events: none;
    height: 0;
    left: 0;
    right: 0;
}

/* Slider Indicators */
.hsm-slider-indicators {
    position: absolute;
    bottom: var(--tourism-space-6);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--tourism-space-2);
    z-index: 5;
}

.hsm-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all var(--tourism-transition-normal);
}

.hsm-indicator.active {
    background: var(--tourism-white);
    transform: scale(1.2);
}

.hsm-indicator:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Shapes and Single Images */
.hsm-slide-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    overflow: visible;
    /* Allow shapes to overflow on both axes */
}

.hsm-shape {
    position: absolute;
    border-radius: 50%;
    /* Ensure shapes can extend beyond container on both axes */
    transform-origin: center;
    max-width: none;
    max-height: none;
    min-width: auto;
    min-height: auto;
}

.hsm-shape-circle {
    border-radius: 50%;
}

.hsm-shape-square {
    border-radius: var(--tourism-border-radius);
}

.hsm-shape-triangle {
    border-radius: var(--tourism-border-radius);
}

.hsm-slide-single-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    overflow: visible;
    /* Allow single images to overflow on both axes */
}

.hsm-single-image-element {
    position: absolute;
    z-index: 3;
    /* Allow single image elements to overflow on both axes */
    transform-origin: center;
    max-width: none;
    max-height: none;
    min-width: auto;
    min-height: auto;
    /* Desktop: use contain for proper scaling */
    background-size: contain;
}

/* Desktop: apply contain for proper scaling */
.hsm-single-image {
    background-size: contain;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hsm-slider-container {
        height: 125vw !important;
        /* 4:5 aspect ratio (100vw * 1.25 = 125vw) */
        min-height: 400px !important;
        max-height: 80vh !important;
    }

    .hsm-slide-content {
        padding: 40px 16px;
    }

    .hsm-slide-title {
        font-size: 2.25rem;
    }

    .hsm-slide-subtitle {
        font-size: 1.125rem;
    }

    .hsm-slide-description {
        font-size: 1rem;
    }

    .hsm-btn-prev,
    .hsm-btn-next {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }

    .hsm-btn-prev {
        left: 12px !important;
    }

    .hsm-btn-next {
        right: 12px !important;
    }

    .hsm-btn-prev:hover,
    .hsm-btn-next:hover {
        transform: translateY(-50%) scale(1.1) !important;
    }

    .hsm-btn-prev:active,
    .hsm-btn-next:active {
        transform: translateY(-50%) scale(0.95) !important;
    }

    .hsm-indicators {
        bottom: 20px !important;
    }

    .hsm-indicator {
        width: 8px !important;
        height: 8px !important;
        margin: 0 4px !important;
    }

    /* Mobile decorative shapes - fill height */
    .hsm-slide-shapes {
        height: 100% !important;
        overflow: visible !important;
        /* Allow shapes to overflow on both axes */
        width: auto !important;
        /* Allow width to expand beyond container */
    }

    .hsm-shape {
        /* Ensure shapes scale appropriately for mobile */
        transform-origin: center;
        /* Allow shapes to extend beyond container boundaries on both axes */
        max-width: none !important;
        max-height: none !important;
        min-width: auto !important;
        min-height: auto !important;
        width: auto !important;
        /* Allow width to expand */
        height: auto !important;
        /* Allow height to expand */
    }

    /* Allow single images to overflow on mobile */
    .hsm-slide-single-image {
        overflow: visible !important;
        width: auto !important;
        /* Allow width to expand beyond container */
    }

    /* Mobile: remove background-size constraint to allow overflow and use mobile image */
    .hsm-single-image {
        background-image: var(--single-image-mobile, var(--single-image-desktop)) !important;
        width: 100% !important;
        /* Ensure full width on mobile */
    }
}

@media (max-width: 480px) {
    .hsm-slider-container {
        height: 125vw !important;
        /* 4:5 aspect ratio maintained */
        min-height: 300px !important;
        max-height: 75vh !important;
    }

    .hsm-slide-content {
        padding: 30px 12px;
    }

    .hsm-slide-title {
        font-size: 1.875rem;
    }

    .hsm-slide-subtitle {
        font-size: 1rem;
    }

    .hsm-slide-description {
        font-size: 0.875rem;
    }

    .hsm-btn-prev,
    .hsm-btn-next {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }

    .hsm-btn-prev {
        left: 8px !important;
    }

    .hsm-btn-next {
        right: 8px !important;
    }

    .hsm-indicators {
        bottom: 15px !important;
    }

    .hsm-indicator {
        width: 6px !important;
        height: 6px !important;
        margin: 0 3px !important;
    }

    /* Mobile decorative shapes - fill height */
    .hsm-slide-shapes {
        height: 100% !important;
        overflow: visible !important;
        width: auto !important;
    }

    .hsm-shape {
        /* Ensure shapes scale appropriately for mobile */
        transform-origin: center;
        /* Allow shapes to extend beyond container boundaries on both axes */
        max-width: none !important;
        max-height: none !important;
        min-width: auto !important;
        min-height: auto !important;
        width: auto !important;
        /* Allow width to expand */
        height: auto !important;
        /* Allow height to expand */
    }

    /* Allow single images to overflow on mobile */
    .hsm-slide-single-image {
        overflow: visible !important;
        width: auto !important;
        /* Allow width to expand beyond container */
    }

    .hsm-single-image-element {
        /* Allow single image elements to overflow on both axes */
        transform-origin: center;
        max-width: none !important;
        max-height: none !important;
        min-width: auto !important;
        min-height: auto !important;
        width: auto !important;
        /* Allow width to expand */
        height: auto !important;
        /* Allow height to expand */
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .hsm-slide {
        transition: none;
    }

    .hsm-slide-overlay {
        transition: none;
    }

    .hsm-btn-prev,
    .hsm-btn-next {
        transition: none;
    }

    .hsm-indicator {
        transition: none;
    }
}

/* Focus Styles */
.hsm-btn-prev:focus,
.hsm-btn-next:focus,
.hsm-indicator:focus {
    outline: 2px solid var(--tourism-accent-yellow);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .hsm-hero-slider {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {

    .hsm-btn-prev,
    .hsm-btn-next {
        border: 2px solid currentColor;
    }
}