/**
 * Dual Container Widget Styles
 * Version: 1.2.1
 */

/* CSS-Variablen für Animation */
:root {
    --dcwp-animation-speed: 600ms;
    --dcwp-animation-easing: cubic-bezier(0.4, 0.0, 0.2, 1);
    --dcwp-hover-easing: cubic-bezier(0.33, 1, 0.68, 1);
    --dcwp-hover-timing: 400ms;
    --dcwp-hover-scale: 1.02;
    --dcwp-hover-shadow: 30px;
    --dcwp-hover-brightness: 0.85;
    --dcwp-content-easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --dcwp-shadow-transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Hauptcontainer */
.dcwp-container {
    display: flex;
    width: 100%;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

/* Hälften-Container Basis-Styles */
.dcwp-container-half {
    position: relative;
    width: 50%;
    overflow: hidden;
    background-size: cover;
    background-position: center center;
    transition: width var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                height var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                transform var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                box-shadow var(--dcwp-shadow-transition);
    will-change: width, height, transform;
    transform: translateZ(0);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

/* Overlay für den Hintergrund */
.dcwp-content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1;
}

/* Content-Container */
.dcwp-content {
    position: relative;
    z-index: 2;
    padding: 2em;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    box-sizing: border-box;
    transition: opacity var(--dcwp-animation-speed) var(--dcwp-content-easing),
                transform 0.4s var(--dcwp-content-easing);
    will-change: opacity, transform;
    backface-visibility: hidden;
    transform: translateY(0) scale(1);
}

/* Titel */
.dcwp-title {
    margin-bottom: 0.8em;
    font-size: 2.2em;
    font-weight: 600;
    line-height: 1.2;
}

/* Beschreibung */
.dcwp-description {
    margin-bottom: 2em;
    line-height: 1.6;
    max-width: 80%;
}

/* Buttons */
.dcwp-button {
    cursor: pointer;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s var(--dcwp-hover-easing);
    position: relative;
    overflow: hidden;
    z-index: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dcwp-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.dcwp-button:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease;
}

/* Detailansicht Styles */
.dcwp-detailed-content {
    max-height: 100%;
    overflow-y: auto;
    padding-right: 15px;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.dcwp-detailed-content.active {
    opacity: 1;
    visibility: visible;
}

.dcwp-detailed-text {
    margin-bottom: 2em;
    text-align: left;
    line-height: 1.6;
}

.dcwp-detailed-text ul, 
.dcwp-detailed-text ol {
    text-align: left;
    padding-left: 1.5em;
    margin-bottom: 1.5em;
}

.dcwp-detailed-text li {
    margin-bottom: 0.8em;
    position: relative;
}

/* Aktivzustand (erweitert)
   ACHTUNG, bekannter Fehler, bewusst NICHT korrigiert: 'box-shadow var(--dcwp-shadow-transition)'
   ergibt 'box-shadow all 0.4s ...' und ist ungueltig; die ganze transition-Deklaration faellt
   auf den Initialwert (keine Transition). Ohne .dcwp-hover-ready (Hover-Effekt aus) waechst die
   aktive Haelfte deshalb nur als Flex-Folge der schrumpfenden inaktiven, und Schatten/Transform
   springen. Eine Korrektur wuerde dieses sichtbare Verhalten aendern. Das Widget-JS haengt
   deshalb nichts an transitionend dieser Haelfte. */
.dcwp-container-half.active {
    width: 90%;
    z-index: 5;
    transition: width var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                height var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                transform 0.8s var(--dcwp-animation-easing),
                box-shadow var(--dcwp-shadow-transition);
    transform: translateX(0) scale(1.01);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Inaktivzustand (minimiert) */
.dcwp-container-half.inactive {
    width: 10%;
    z-index: 1;
    transition: width var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                height var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                transform 0.8s var(--dcwp-animation-easing),
                filter 0.6s var(--dcwp-animation-easing);
    transform: scale(0.98);
    filter: brightness(0.7) contrast(0.9);
}

/* Wenn inaktiv, verstecke den Inhalt */
.dcwp-container-half.inactive .dcwp-content {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.3s ease-out,
                visibility 0.3s ease-out,
                transform 0.4s var(--dcwp-content-easing);
}

/* Bei aktivem Container den Inhalt anzeigen */
.dcwp-container-half.active .dcwp-content.dcwp-initial-content,
.dcwp-container-half.active .dcwp-content.dcwp-detailed-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition: opacity 0.5s ease-in 0.3s,
                visibility 0.5s ease-in 0.3s,
                transform 0.6s var(--dcwp-content-easing) 0.2s;
}

/* Scrollbar-Styling für den Detailinhalt */
.dcwp-detailed-content::-webkit-scrollbar {
    width: 6px;
}

.dcwp-detailed-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.dcwp-detailed-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.dcwp-detailed-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Ripple-Effekt für Buttons */
.dcwp-button:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.8s;
}

.dcwp-button:active:after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* Zurück-Button spezielle Styles */
.dcwp-back-button {
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dcwp-back-button:before {
    content: '←';
    margin-right: 8px;
    font-size: 1.2em;
    line-height: 1;
}

/* Responsive Anpassungen */
@media (max-width: 991px) {
    .dcwp-title {
        font-size: 1.8em;
    }
    
    .dcwp-description {
        max-width: 90%;
    }
}

@media (max-width: 767px) {
    .dcwp-container {
        flex-direction: column;
        height: auto !important;
    }
    
    .dcwp-container-half {
        width: 100%;
        height: 50vh;
        transition: height var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                    transform 0.6s var(--dcwp-animation-easing),
                    filter 0.5s var(--dcwp-animation-easing);
    }
    
    .dcwp-container-half.active {
        width: 100%;
        height: 90vh;
        transition: height var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                    transform 0.6s var(--dcwp-animation-easing);
        transform: scale(1);
        box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3);
    }
    
    .dcwp-container-half.inactive {
        width: 100%;
        height: 10vh;
        transition: height var(--dcwp-animation-speed) var(--dcwp-animation-easing),
                    transform 0.6s var(--dcwp-animation-easing),
                    filter 0.5s var(--dcwp-animation-easing);
        transform: scale(0.97);
        filter: brightness(0.6) contrast(0.85);
    }
    
    .dcwp-description {
        max-width: 100%;
    }
    
    .dcwp-content {
        padding: 1.5em;
    }
}

@media (max-width: 479px) {
    .dcwp-title {
        font-size: 1.5em;
    }
    
    .dcwp-container-half {
        height: 40vh;
    }
}

/* Animationsklassen für weiche Übergänge */
.dcwp-fade-in {
    animation: dcwpSmoothFadeIn 0.6s var(--dcwp-content-easing) forwards;
}

.dcwp-fade-out {
    animation: dcwpSmoothFadeOut 0.5s var(--dcwp-content-easing) forwards;
}

@keyframes dcwpSmoothFadeIn {
    0% { 
        opacity: 0;
        transform: translateY(15px) scale(0.97);
    }
    60% {
        opacity: 0.8;
    }
    100% { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes dcwpSmoothFadeOut {
    0% { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    40% {
        opacity: 0.3;
    }
    100% { 
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
}

/* Hover-Effekt für Container */
.dcwp-container-half {
    transition: all var(--dcwp-hover-timing) var(--dcwp-hover-easing);
    z-index: 2;
}

.dcwp-container-half:hover {
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
}

/* Verbesserte Hover-Performance durch will-change */
.dcwp-container-half.dcwp-hover-ready {
    will-change: transform, width, filter, box-shadow;
    transition: all var(--dcwp-hover-timing) var(--dcwp-hover-easing);
}

/* Flaechen-Klick: nur im Gestenmodus (rechte Haelfte mit 3D-Cinematic, Weiche offen — die Klasse
   .dcwp-surface-click setzt allein das Widget-JS) und nur im 50/50-Zustand (weder .active noch
   .inactive), genau dort, wo auch der Button bedienbar ist. Text bleibt markierbar und oeffnet
   nicht (siehe Widget-JS). Ohne die Klasse bleibt der Cursor wie in 1.0.0. */
.dcwp-container-half.dcwp-surface-click:not(.active):not(.inactive) {
    cursor: pointer;
}

.dcwp-container-half.dcwp-surface-click:not(.active):not(.inactive) .dcwp-title,
.dcwp-container-half.dcwp-surface-click:not(.active):not(.inactive) .dcwp-description {
    cursor: auto;
}

/* Zustandsansage fuer Screenreader (Live-Region hinter .dcwp-container): visuell verborgen */
.dcwp-sr-status {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* 3D-Cinematic in der Detailansicht. Die Buehne steht mit hidden im Markup; sichtbar schaltet
   sie nur das Widget-JS. Eigenes display deshalb ausschliesslich mit :not([hidden]). */
.dcwp-cinematic-stage:not([hidden]) {
    display: block;
    align-self: stretch;   /* .dcwp-content zentriert quer (align-items), der Viewer braucht die volle Breite */
    width: 100%;
    flex-shrink: 0;
    margin-bottom: 1.5em;
    text-align: left;      /* kein geerbtes text-align:center in die Viewer-Oberflaeche */
}

/* Buehnenhoehe: nie hoeher als der Platz unter dem Detail-Titel. Die konfigurierte Hoehe steht
   inline am Viewer (cinematic-template.php); die Grenze misst die Cinematic-Steuerung an der
   Haelfte (Detailbereich minus Titel und Innenabstand) und setzt sie als --dcwp-stage-max an der
   Buehne. Ohne Messwert (Buehne versteckt) gilt keine Grenze. Wirksam ist damit
   min(konfigurierte Hoehe, verfuegbarer Platz); der Detailtext darunter bleibt per Scroll erreichbar. */
.dcwp-cinematic-stage > .ecount-viewer {
    max-height: var(--dcwp-stage-max, none);
}

/* Vollbild des Viewers nicht auf die Haelfte begrenzen */
.dcwp-cinematic-stage > .ecount-viewer:fullscreen {
    max-height: none;
}

/* Typografie-Schranke: Das Control "Detailinhalt-Typografie" setzt seine Werte auch auf den
   Container .dcwp-detailed-content, und von dort erben sie in die Viewer-Oberflaeche, die diese
   Eigenschaften nicht selbst setzt (Bauteil-Panel, Untertitel, Tooltip). Eine Regel auf dem
   Kind schlaegt Vererbung unabhaengig von der Spezifitaet. Detail-Titel und Detailtext stehen
   ausserhalb der Buehne und behalten ihren Look. */
.dcwp-cinematic-stage {
    letter-spacing: normal;
    word-spacing: normal;
    text-transform: none;
    font-style: normal;
    font-weight: normal;
}

/* Mit sichtbarer Buehne passen Viewer und Text nicht mehr in die Hoehe: oben ausrichten statt
   zentrieren, sonst schneidet die Zentrierung den oberen Rand unerreichbar ab. Ohne Buehne
   (Mobil, kein WebGL) bleibt die heutige Zentrierung. */
.dcwp-detailed-content.dcwp-cinematic-live {
    justify-content: flex-start;
}

/* Vollflaeche (right_cinematic_layout = full): nur solange die Buehne laeuft (.dcwp-cinematic-live
   setzt allein die Cinematic-Steuerung). Die Buehne fuellt die aufgeklappte Haelfte ohne
   Innenabstand; Detail-Titel (nur visuell verborgen: Name der Region, Fokus-Rueckfall), Detailtext
   und Buttonzeile entfallen. Die Viewer-Hoehe steht dann inline auf 100 %, die Grenze
   --dcwp-stage-max misst die Cinematic-Steuerung wie gehabt (hier = ganze Haelfte). Ohne Buehne
   (Mobil, Touch, kein WebGL, Startfehler) greift nichts davon: Detailtext wie im Rahmen-Modus.
   Das Intro-Video fuellt die Buehne ohne Balken ueber object-fit: cover aus viewer.css. */
.dcwp-detailed-content--full.dcwp-cinematic-live {
    padding: 0;
    overflow: hidden;
}

.dcwp-detailed-content--full.dcwp-cinematic-live > .dcwp-cinematic-stage:not([hidden]) {
    height: 100%;
    margin-bottom: 0;
}

.dcwp-detailed-content--full.dcwp-cinematic-live > .dcwp-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.dcwp-detailed-content--full.dcwp-cinematic-live > .dcwp-cinematic-copy,
.dcwp-detailed-content--full.dcwp-cinematic-live > .dcwp-back-button {
    display: none;
}

/* Zurueck-Knopf der Vollflaeche, oben rechts: die einzige Ecke ohne Viewer-Bedienelement
   (oben links Zurueck der Explosionsansicht, unten links "Ton an", unten rechts "Intro
   ueberspringen", unten Mitte der Hinweis). Glas-Look wie die Viewer-Knoepfe. z-index ueber dem
   Ladezustand des Viewers (400): Schliessen geht auch waehrend des Ladens. */
.dcwp-cinematic-close {
    display: none;
}

.dcwp-detailed-content--full.dcwp-cinematic-live > .dcwp-cinematic-close {
    position: absolute;
    top: 22px;
    right: 22px;
    z-index: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 9px 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    background: rgba(8, 10, 18, 0.55);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: rgba(255, 255, 255, 0.9);
    font: 500 0.85rem/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: background 0.2s ease, color 0.2s ease;
}

.dcwp-cinematic-close::before {
    content: '←';
    font-size: 1.1em;
    line-height: 1;
}

.dcwp-detailed-content--full.dcwp-cinematic-live > .dcwp-cinematic-close:hover {
    background: rgba(8, 10, 18, 0.8);
    color: #fff;
}

/* Fokusring: weiss mit dunklem Aussenring, auf hellem wie dunklem Videobild sichtbar */
.dcwp-detailed-content--full.dcwp-cinematic-live > .dcwp-cinematic-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(8, 10, 18, 0.75);
}

/* Detail-Panel des Viewers (rechts mittig, max-height 84vh aus viewer.css) in der Vollflaeche
   oben und unten freihalten: sonst reicht es bei niedrigen Haelften unter den Zurueck-Knopf und
   dessen Schliessen-Kreuz waere verdeckt. Inhalt scrollt im Panel (overflow-y: auto in viewer.css). */
.dcwp-detailed-content--full .ecount-viewer--cinematic .ecount-detail-panel {
    max-height: calc(100% - 152px);
}

/* Hinweis nur im Elementor-Editor, wenn 3D-Cinematic gewaehlt, aber nicht lauffaehig ist */
.dcwp-cinematic-notice {
    margin: 0 0 1em;
    padding: 0.6em 1em;
    border: 1px dashed rgba(255, 255, 255, 0.6);
    font-size: 0.9em;
}

/* Bewegungspraeferenz: Zustandswechsel finden weiter statt, nur ohne Bewegung. !important,
   weil die Hover-Handler transition inline setzen. Die Dauer ist minimal statt 0, damit
   transitionend weiterhin feuert. Die Viewer-Buehne ist bewusst nicht erfasst: sie hat einen
   eigenen Block in viewer.css. */
@media (prefers-reduced-motion: reduce) {
    .dcwp-container-half,
    .dcwp-content,
    .dcwp-button,
    .dcwp-button:after,
    .dcwp-cinematic-close,
    .dcwp-fade-in,
    .dcwp-fade-out {
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
    }
}
