/**
 * Hero Mood - Vollbild Video mit modernem Laufband
 * SMG Mall Theme
 * Version: 2.2 - Korrekte Header/Admin Bar Berechnung & 16:9 Format Priorität
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

:root {
  /* SMG Brand Colors */
  --smg-600: #e31e24;
  --smg-700: #bf161b;
  --smg-400: #fd6c70;
  
  /* Grau-Palette */
  --app-white: #ffffff;
  --app-gray-900: #1a1a1a;
  --app-gray-800: #2c2c2c;
  
  /* Transitions */
  --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Header & Admin Bar heights - Korrekte Berechnung */
  --header-height: clamp(70px, 8vh, 100px); /* Konsistent mit smg-styles.css */
  --admin-bar-height: 0px; /* Default: nicht eingeloggt */
  --total-header-height: calc(var(--header-height) + var(--admin-bar-height));
}

/* WordPress Admin Bar Berücksichtigung */
body.admin-bar {
  --admin-bar-height: 32px; /* WordPress Admin Bar Höhe */
}

@media screen and (max-width: 782px) {
  body.admin-bar {
    --admin-bar-height: 46px; /* WordPress Admin Bar Höhe auf Mobile */
  }
}



/* ==========================================================================
   Mood Hero Layout - Höhe passt sich Video-Format an
   ========================================================================== */

.smg-hero-new.has-mood-slide {
    position: relative;
    width: 100%;
    /* Container direkt unter Header positioniert */
    margin-top: var(--total-header-height);
    /* Safari fix for video rendering */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* Schwarzer Hintergrund falls Video nicht gesamten Bereich füllt */
    background: #000;
    /* Höhe passt sich automatisch an Video an */
    height: auto;
    min-height: 300px; /* Fallback-Mindesthöhe */
    /* Flexbox für Video-Zentrierung */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Normale Hero Widgets auch korrekt positionieren */
.smg-hero-new:not(.has-mood-slide) {
    position: relative;
    width: 100%;
    /* Container direkt unter Header */
    margin-top: var(--total-header-height);
    /* Min-Höhe basierend auf viewport minus Header */
    min-height: calc(80vh - var(--total-header-height));
}

/* Mood Slide Container - passt sich Video an */
.mood-slide {
    position: relative;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: 1;
    /* Flexbox für perfekte Video-Zentrierung */
    display: flex;
    align-items: center;
    justify-content: center;
}

.mood-slide.active {
    opacity: 1;
    z-index: 2;
}

.mood-hero-container {
    position: relative;
    width: 100%;
    height: auto;
    /* Flexbox für Video-Anpassung */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Video Background - Höhe passt sich Video-Aspect-Ratio an
   ========================================================================== */

.mood-video-background {
    position: relative;
    width: 100%;
    height: auto;
    z-index: 1;
    overflow: hidden;
    /* Video-Container passt sich automatisch an */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Desktop Video: 16:9 Aspect Ratio */
@media (min-width: 769px) {
    .mood-video-background {
        /* 16:9 Aspect Ratio für Desktop */
        aspect-ratio: 16 / 9;
        width: 100vw;
        max-width: 100%;
    }
    
    .mood-video {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Füllt Container komplett aus */
        object-position: center;
    }
}

/* Ultrawide Bildschirme (21:9 und breiter) */
@media (min-width: 769px) and (min-aspect-ratio: 21/9) {
    .mood-video-background {
        /* Begrenze Höhe bei extrem breiten Bildschirmen */
        aspect-ratio: 21 / 9;
        max-height: 80vh;
    }
}

/* Extrem breite Bildschirme (32:9 Gaming Monitore) */
@media (min-width: 769px) and (min-aspect-ratio: 32/9) {
    .mood-video-background {
        /* Noch stärkere Begrenzung für Gaming-Monitore */
        aspect-ratio: 24 / 9;
        max-height: 70vh;
    }
    
    .mood-video {
        /* Video zentriert croppen bei extremen Formaten */
        object-fit: cover;
        object-position: center center;
    }
}

/* Tablet: Früher Umbruch auf Mobile Video */
@media (max-width: 768px) {
    .mood-video-background {
        /* 1:1 Aspect Ratio für Mobile/Tablet */
        aspect-ratio: 1 / 1;
        width: 100vw;
        max-width: 100%;
    }
    
    .mood-video {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Füllt Container komplett aus */
        object-position: center;
    }
}

/* Sehr schmale Bildschirme (Hochkant-Handys, schmale Fenster) */
@media (max-width: 768px) and (max-aspect-ratio: 1/2) {
    .mood-video-background {
        /* Bei sehr schmalen Bildschirmen: etwas breiteres Format */
        aspect-ratio: 4 / 5;
        max-height: 60vh;
        width: 100vw;
    }
    
    .mood-video {
        /* Video optimal für schmale Bildschirme croppen */
        object-fit: cover;
        object-position: center top;
    }
}

/* Extrem schmale Bildschirme */
@media (max-width: 768px) and (max-aspect-ratio: 1/3) {
    .mood-video-background {
        /* Noch kompakter für extrem schmale Bildschirme */
        aspect-ratio: 3 / 4;
        max-height: 50vh;
    }
}

.mood-video {
    /* Video wird durch aspect-ratio der Container gesteuert */
    display: block;
    z-index: 1;
    /* Safari Video optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
}

.video-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    /* Safari fallback optimization */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Video Overlay für bessere Text-Lesbarkeit */
.mood-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(26, 26, 26, 0.3) 0%,
        rgba(44, 44, 44, 0.2) 50%,
        rgba(26, 26, 26, 0.4) 100%
    );
    z-index: 2;
}

/* ==========================================================================
   Modernes Laufband - Responsive für extreme Bildschirmformate
   ========================================================================== */

.mood-ticker-container {
    position: absolute;
    left: 0;
    width: 100%;
    z-index: 10;
    overflow: hidden;
    background: rgba(227, 30, 36, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Positionierung */
.ticker-position-top {
    top: 20%;
}

.ticker-position-center {
    top: 50%;
    transform: translateY(-50%);
}

.ticker-position-bottom {
    bottom: 20%;
}

/* Ultrawide Bildschirme: Ticker kompakter */
@media (min-width: 769px) and (min-aspect-ratio: 21/9) {
    .ticker-position-top {
        top: 15%;
    }
    
    .ticker-position-bottom {
        bottom: 15%;
    }
    
    .mood-ticker {
        height: 50px;
    }
    
    .ticker-content {
        font-size: 20px;
    }
}

/* Gaming-Monitore: Noch kompakter */
@media (min-width: 769px) and (min-aspect-ratio: 32/9) {
    .ticker-position-top {
        top: 10%;
    }
    
    .ticker-position-bottom {
        bottom: 10%;
    }
    
    .mood-ticker {
        height: 45px;
    }
    
    .ticker-content {
        font-size: 18px;
    }
}

/* Schmale Bildschirme: Ticker anpassen */
@media (max-width: 768px) and (max-aspect-ratio: 1/2) {
    .ticker-position-top {
        top: 5%;
    }
    
    .ticker-position-bottom {
        bottom: 5%;
    }
    
    .mood-ticker {
        height: 35px;
    }
    
    .ticker-content {
        font-size: 14px;
        letter-spacing: 0.05em;
    }
}

/* Extrem schmale Bildschirme: Minimaler Ticker */
@media (max-width: 768px) and (max-aspect-ratio: 1/3) {
    .ticker-position-top {
        top: 2%;
    }
    
    .ticker-position-bottom {
        bottom: 2%;
    }
    
    .mood-ticker {
        height: 30px;
    }
    
    .ticker-content {
        font-size: 12px;
        letter-spacing: 0.02em;
    }
}

.mood-ticker {
    position: relative;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-content {
    display: inline-block;
    color: var(--app-white);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    will-change: transform;
}

/* Moderne Typografie für Laufband */
.ticker-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Content Overlay (Optional)
   ========================================================================== */

.mood-content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.mood-content {
    text-align: center;
    color: var(--app-white);
    max-width: 800px;
    padding: 2rem;
}

.mood-content h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.mood-content p {
    font-size: 1.2rem;
    line-height: 1.6;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Responsive Hero Höhen für verschiedene Geräte
   ========================================================================== */

@media (max-width: 1200px) and (min-width: 1025px) {
    /* Normale Hero Widgets auf großen Tablets */
    .smg-hero-new:not(.has-mood-slide) {
        min-height: calc(75vh - var(--total-header-height));
    }

    .ticker-content {
        font-size: 22px;
    }

    .mood-content h1 {
        font-size: 3rem;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    /* Normale Hero Widgets auf Tablet */
    .smg-hero-new:not(.has-mood-slide) {
        min-height: calc(70vh - var(--total-header-height));
    }

    .ticker-content {
        font-size: 20px;
    }

    .mood-ticker {
        height: 50px;
    }

    .mood-content h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 768px) and (min-width: 569px) {
    /* Normale Hero Widgets auf kleinem Tablet/großes Mobile */
    .smg-hero-new:not(.has-mood-slide) {
        min-height: calc(65vh - var(--total-header-height));
    }

    .ticker-content {
        font-size: 18px;
    }

    .mood-ticker {
        height: 45px;
    }

    .mood-content {
        padding: 2rem 1.5rem;
    }

    .mood-content h1 {
        font-size: 2.5rem;
    }

    .mood-content p {
        font-size: 1.1rem;
    }
}

@media (max-width: 568px) {
    /* Normale Hero Widgets auf Mobile */
    .smg-hero-new:not(.has-mood-slide) {
        min-height: calc(60vh - var(--total-header-height));
    }

    .ticker-content {
        font-size: 16px;
    }

    .mood-ticker {
        height: 40px;
    }

    .mood-content h1 {
        font-size: 2.2rem;
    }

    .ticker-position-top {
        top: 10%;
    }

    .ticker-position-bottom {
        bottom: 10%;
    }
}

/* Kleine Mobile Geräte (≤ 480px) */
@media (max-width: 480px) {
    /* Normale Hero Widgets auf sehr kleinen Geräten */
    .smg-hero-new:not(.has-mood-slide) {
        min-height: calc(50vh - var(--total-header-height));
    }

    .ticker-content {
        font-size: 14px;
    }

    .mood-ticker {
        height: 35px;
    }

    .mood-content h1 {
        font-size: 2rem;
    }

    .mood-content p {
        font-size: 1rem;
    }
}

/* Sehr kleine Mobile Geräte (≤ 360px) */
@media (max-width: 360px) {
    .mood-content h1 {
        font-size: 1.8rem;
    }

    .mood-content p {
        font-size: 0.9rem;
    }
}

/* ==========================================================================
   Safari & ARC Browser spezifische Fixes
   ========================================================================== */

/* Safari Video Rendering Fix */
@media not all and (min-resolution:.001dpcm) {
    @supports (-webkit-appearance:none) {
        .mood-video {
            -webkit-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }
        
        .mood-video-background {
            -webkit-transform: translate3d(-50%, -50%, 0);
            transform: translate3d(-50%, -50%, 0);
        }
        
        .smg-hero-new.has-mood-slide {
            -webkit-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
        }
    }
}

/* Browser-spezifische Performance-Optimierungen */
@supports (-webkit-user-select: none) and (not (-moz-appearance: none)) {
    /* Spezifisch für Chromium-basierte Browser */
    .mood-video {
        /* Optimierungen für bessere Performance */
        will-change: auto;
        contain: layout style paint;
    }
}

/* ==========================================================================
   Performance Optimierungen
   ========================================================================== */

/* GPU-Beschleunigung für smooth Animationen */
.mood-video,
.ticker-content,
.mood-video-overlay {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .ticker-content {
        animation-duration: 20s !important;
    }
    
    .mood-video-overlay {
        background: rgba(26, 26, 26, 0.5);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Screen Reader Support */
.mood-ticker[aria-hidden="true"] {
    display: none;
}

/* Focus States für interaktive Elemente */
.mood-content a:focus,
.mood-content button:focus {
    outline: 2px solid var(--suma-400);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .mood-video-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
    
    .ticker-content {
        text-shadow: 0 0 4px rgba(0, 0, 0, 1);
    }
}

/* ==========================================================================
   Mood Slide Indicators
   ========================================================================== */

.mood-indicators {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mood-indicator {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.indicator-line {
    display: block;
    width: 3px;
    height: 40px;
    background: rgba(255, 255, 255, 0.4);
    transition: all var(--transition-normal);
    border-radius: 2px;
}

.mood-indicator.active .indicator-line,
.mood-indicator:hover .indicator-line {
    background: var(--smg-600);
    width: 4px;
    height: 60px;
}

.mood-indicator:focus {
    outline: 2px solid var(--smg-400);
    outline-offset: 4px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .smg-hero-new.has-mood-slide {
        height: auto;
        min-height: auto;
        background: var(--app-white);
        color: var(--app-gray-900);
    }

    .mood-video-background,
    .mood-ticker-container,
    .mood-indicators {
        display: none;
    }

    .mood-content {
        color: var(--app-gray-900);
        position: static;
    }
}

/* Normale Hero Widgets: Ultrawide Bildschirme */
@media (min-width: 769px) and (min-aspect-ratio: 21/9) {
    .smg-hero-new:not(.has-mood-slide) {
        /* Begrenzte Höhe für Ultrawide */
        min-height: calc(60vh - var(--total-header-height));
        max-height: calc(80vh - var(--total-header-height));
    }
}

/* Normale Hero Widgets: Gaming-Monitore */
@media (min-width: 769px) and (min-aspect-ratio: 32/9) {
    .smg-hero-new:not(.has-mood-slide) {
        /* Noch kompakter für Gaming-Monitore */
        min-height: calc(50vh - var(--total-header-height));
        max-height: calc(70vh - var(--total-header-height));
    }
}

/* Normale Hero Widgets: Schmale Bildschirme */
@media (max-width: 768px) and (max-aspect-ratio: 1/2) {
    .smg-hero-new:not(.has-mood-slide) {
        /* Kompakter für schmale Bildschirme */
        min-height: calc(50vh - var(--total-header-height));
    }
}

/* Normale Hero Widgets: Extrem schmale Bildschirme */
@media (max-width: 768px) and (max-aspect-ratio: 1/3) {
    .smg-hero-new:not(.has-mood-slide) {
        /* Minimal für extrem schmale Bildschirme */
        min-height: calc(40vh - var(--total-header-height));
    }
}
