/**
 * =========================================================
 * Datei:
 * Datei: popup/gui_api/popup_container.css
 * =========================================================
 *
 * Zweck:
 * Styling für das Popup-System.
 *
 * Architektur:
 * popup_container.php
 * ↓
 * popup_container.css
 * ↓
 * popup_container.js
 *
 * Grundregel:
 * Jede Slide enthält Bild + eigenen Content.
 * Das JavaScript berechnet:
 * - größte Contenthöhe
 * - Bildhöhe als Resthöhe
 * - identische Höhe für alle Slides
 *
 * PHP 7.3 unabhängig.
 * Reines CSS.
 */

.wr-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;

    display: none;
    align-items: var(--popup-mobile-align, flex-start);
    justify-content: center;

    padding: 18px 18px 120px 18px;

    background:
        rgba(
            0,
            0,
            0,
            var(--popup-overlay-opacity, 0.68)
        );
}

.wr-popup-overlay.is-visible {
    display: flex;
}

/**
 * Das eigentliche Popup.
 * Höhe und Breite kommen aus popup_config.csv.
 */
.wr-popup-box {
    position: relative;

    width: var(--popup-width, 420px);
    height: var(--popup-fixed-height, 80vh);

    display: flex;
    flex-direction: column;

    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 55px rgba(0,0,0,0.38);

    overflow: hidden;

    font-family: Arial, sans-serif;
    color: #2b2b2b;
}

.wr-popup-close {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 100;

    width: 38px;
    height: 38px;

    border: none;
    border-radius: 50%;

    background: rgba(0,0,0,0.72);
    color: #ffffff;

    font-size: 26px;
    line-height: 36px;

    cursor: pointer;
}

.wr-popup-close:hover {
    background: rgba(0,0,0,0.88);
}

/**
 * Stage enthält alle Slides.
 * Die endgültige Höhe wird durch JS gesetzt.
 */
.wr-popup-stage {
    position: relative;

    flex: 1 1 auto;

    display: flex;
    flex-direction: column;

    background: var(--popup-stage-background, #7b1e2b);

    overflow: hidden;
    text-align: center;
}

/**
 * Eine Slide enthält:
 * - Bild
 * - Content
 *
 * Es gibt keine getrennten Content-Slides mehr.
 */
.wr-popup-slide {
    display: none;
    flex-direction: column;
}

.wr-popup-slide.is-active {
    display: flex;
}

/**
 * Bild wird durch JS auf berechnete Höhe gesetzt.
 * object-fit: fill erlaubt bewusstes Strecken.
 */
.wr-popup-slide img {
    display: block;

    width: 100%;
    height: auto;

    max-width: 100%;

    flex-shrink: 0;

    object-fit: fill;

    background: var(--popup-stage-background, #7b1e2b);
}

/**
 * Textbereich innerhalb jeder Slide.
 * JS setzt min-height auf den größten Contentbereich.
 */
.wr-popup-content {
    flex-shrink: 0;

    padding: 16px 18px 18px;

    text-align: center;

    background: #ffffff;
}

.wr-popup-title {
    margin: 0 0 8px;

    font-size: 24px;
    font-weight: bold;

    color: #7b1e2b;
}

.wr-popup-subtitle {
    margin: 0 0 10px;

    font-size: 16px;
    line-height: 1.35;

    color: #666666;
}

.wr-popup-text {
    margin: 10px 0;
}

.wr-popup-hint {
    margin-top: 14px;
    padding: 12px;

    background: #f5f1eb;

    border-left: 4px solid #7b1e2b;
    border-radius: 8px;

    font-size: 15px;
}

.wr-popup-button {
    display: inline-block;

    margin-top: 12px;
    padding: 11px 18px;

    border-radius: 999px;

    background: #7b1e2b;
    color: #ffffff;

    text-decoration: none;
    font-weight: bold;
}

.wr-popup-reservation-button {
    border: 0;
    font-family: inherit;
}

.wr-popup-booking-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000002;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
    background: rgba(0,0,0,0.72);
}

.wr-popup-booking-overlay.is-open {
    display: flex;
}

.wr-popup-booking-window {
    width: min(760px, calc(100vw - 24px));
    height: min(900px, calc(100vh - 24px));
    height: min(900px, calc(100dvh - 24px));
    max-width: 100%;
    min-width: 0;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 22px 70px rgba(0,0,0,0.42);
}

.wr-popup-booking-header {
    flex: 0 0 auto;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px 10px 16px;
    box-sizing: border-box;
    color: #ffffff;
    background: linear-gradient(135deg,#7b1e2b,#9e2436);
}

.wr-popup-booking-title {
    min-width: 0;
    font-size: 21px;
    line-height: 1.2;
    font-weight: bold;
}

.wr-popup-booking-close {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 0;
    border-radius: 11px;
    background: rgba(255,255,255,0.18);
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.wr-popup-booking-frame {
    width: 100%;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    border: 0;
    background: #ffffff;
}

.wr-popup-button:hover {
    opacity: 0.92;
}

.wr-popup-dots {
    display: flex;

    gap: 8px;

    justify-content: center;
    align-items: center;

    flex-shrink: 0;

    padding: 10px;

    background: #f5f1eb;
}

.wr-popup-dot {
    width: 10px;
    height: 10px;

    padding: 0;

    border: none;
    border-radius: 50%;

    background: #bdb5ad;

    cursor: pointer;
}

.wr-popup-dot.is-active {
    background: #7b1e2b;
}

.wr-popup-debug {
    flex-shrink: 0;

    padding: 10px;

    background: #111111;
    color: #00ff00;

    font-family: monospace;
    font-size: 12px;

    white-space: pre-wrap;
    text-align: left;
}

.wr-popup-layout-debug {
    margin: 10px 0 0;
    white-space: pre-wrap;
}

.wr-popup-debug-body {
    margin: 0;
    padding: 20px;

    background: #f5f1eb;

    font-family: Arial, sans-serif;
}

.wr-popup-empty-debug {
    max-width: 760px;

    margin: 20px auto;
    padding: 18px;

    border-radius: 12px;

    background: #ffffff;
    color: #7b1e2b;
}

/**
 * Animationen
 */
@keyframes wrPopupFade {
    from {
        opacity: 0.2;
    }

    to {
        opacity: 1;
    }
}

.wr-popup-anim-fade .wr-popup-slide.is-active {
    animation-name: wrPopupFade;
    animation-duration: 0.35s;
    animation-fill-mode: both;
}

@keyframes wrPopupSlide {
    from {
        opacity: 0.35;
        transform: translateX(18px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wr-popup-anim-slide .wr-popup-slide.is-active {
    animation-name: wrPopupSlide;
    animation-duration: 0.35s;
    animation-fill-mode: both;
}

.wr-popup-anim-none .wr-popup-slide.is-active {
    animation-name: none;
}

/**
 * Mobile Optimierung.
 * Unten bleibt Abstand für den schwebenden Reservieren-Button.
 */
@media (max-width: 640px) {
    .wr-popup-overlay {
        align-items: var(--popup-mobile-align, flex-start);

        padding:
            var(--popup-mobile-padding-top, 10px)
            8px
            96px
            8px;
    }

    .wr-popup-box {
        width: 94%;

        max-width:
            var(
                --popup-width,
                420px
            );

        border-radius: 14px;
    }

    .wr-popup-title {
        font-size: 21px;
    }

    .wr-popup-subtitle {
        font-size: 15px;
    }

    .wr-popup-text,
    .wr-popup-hint {
        font-size: 16px;
    }
}

@media (max-width: 700px), (pointer: coarse) {
    .wr-popup-booking-overlay {
        align-items: flex-start;
        padding: 4px;
        padding-top: max(4px, env(safe-area-inset-top));
        padding-bottom: max(4px, env(safe-area-inset-bottom));
    }

    .wr-popup-booking-window {
        width: calc(100vw - 8px);
        height: calc(100vh - 8px);
        height: calc(100dvh - 8px);
        border-radius: 16px;
    }

    .wr-popup-booking-header {
        min-height: 52px;
        padding: 7px 8px 7px 12px;
    }

    .wr-popup-booking-title {
        font-size: 19px;
    }
}

/*
 * Native Sicherheitsabsicherung:
 * Auch wenn eine ältere gecachte Stylesheet-Version geladen wird, darf der
 * neue Reservierungs-Iframe das Popup nicht sichtbar verbreitern.
 */
.wr-popup-booking-overlay[hidden] {
    display: none !important;
}
