/**
 * Aktionspreise Promo Bar Styles
 *
 * Styles für die Promo-Bar: Fixed Positioning, Animationen, Mobile-Support.
 * Berücksichtigt iPhone Notch via safe-area-inset.
 *
 * @package Aktionspreise
 */

/* =============================================================================
   PROMO BAR CONTAINER
   ============================================================================= */

/* --- Haupt-Container (fixed am oberen Bildschirmrand) --- */

.promotion-promo-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100000; /* Über Divi Header (99999), unter Borlabs (999999) */
    padding: 6px 15px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px)); /* iPhone Notch */
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px; /* Fallback für ältere Browser */
    font-size: clamp(13px, 3.5vw, 15px); /* Fluid Typography */
    line-height: 1.4;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%); /* Initial versteckt */
    transition: transform 0.4s ease-out;
}

/* --- Sichtbarer Zustand (via JS hinzugefügt) --- */

.promotion-promo-bar.visible {
    transform: translateY(0);
}

/* --- Versteckter Zustand (nach Schließen) --- */

.promotion-promo-bar.hidden {
    display: none !important;
}

/* --- Mobile-Only Variante --- */

.promotion-promo-bar.mobile-only {
    display: none;
}

@media screen and (max-width: 980px) {
    .promotion-promo-bar.mobile-only {
        display: flex;
    }
}

/* =============================================================================
   CONTENT
   ============================================================================= */

/* --- Content Container (Text + Button) --- */

.promotion-promo-bar-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
}

/* --- Text --- */

.promotion-promo-bar-text {
    font-weight: 500;
}

/* --- Desktop/Mobile Varianten --- */

.promotion-promo-bar .mobile-only {
    display: none;
}

@media screen and (max-width: 767px) {
    .promotion-promo-bar .desktop-only {
        display: none;
    }
    .promotion-promo-bar .mobile-only {
        display: inline;
    }
    .promotion-promo-bar .promotion-promo-bar-button.mobile-only {
        display: inline-block; /* Button braucht inline-block für Padding */
    }
}

/* =============================================================================
   BUTTON
   ============================================================================= */

/* --- CTA Button --- */

.promotion-promo-bar-button {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.promotion-promo-bar-button:hover {
    opacity: 0.9;
    transform: translateY(-1px); /* Subtiler Hover-Effekt */
}

.promotion-promo-bar-button:active {
    transform: translateY(0);
}

/* =============================================================================
   CLOSE BUTTON
   ============================================================================= */

/* --- Schließen-Button (X) --- */

.promotion-promo-bar-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 24px;
    line-height: 1;
    padding: 0 5px;
    margin-left: 15px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.promotion-promo-bar-close:hover {
    opacity: 1;
}

/* =============================================================================
   BODY OFFSET
   ============================================================================= */

/*
 * Wenn die Bar sichtbar ist, muss der Body-Content nach unten verschoben werden,
 * damit er nicht von der Bar überdeckt wird.
 *
 * Die CSS Variable --promo-bar-h wird dynamisch von promo-bar.js gesetzt
 * basierend auf der tatsächlichen Banner-Höhe.
 */

body.promotion-promo-bar-active {
    padding-top: var(--promo-bar-h, 60px) !important;
}

/* =============================================================================
   DIVI THEME INTEGRATION
   ============================================================================= */

/*
 * Divi nutzt ein fixed #main-header Element.
 * Dieses muss ebenfalls nach unten verschoben werden.
 */

body.promotion-promo-bar-active #main-header {
    margin-top: var(--promo-bar-h, 60px) !important;
}

/* =============================================================================
   MOBILE: X-BUTTON ÜBER DIVI HAMBURGER
   ============================================================================= */

/*
 * Divi Row ist zentriert:
 * - Tablet (≤980px): 80% breit → 10% Rand rechts
 * - Mobile (≤767px): 90% breit → 5% Rand rechts
 * Hamburger sitzt am rechten Rand des Rows.
 */

@media screen and (max-width: 980px) {
    .promotion-promo-bar-close {
        position: absolute;
        right: 10%;  /* (100% - 80%) / 2 */
        top: 50%;
        transform: translateY(-50%);
        margin-left: 0;
    }

    .promotion-promo-bar-content {
        padding-right: 60px;
    }
}

@media screen and (max-width: 767px) {
    .promotion-promo-bar-close {
        right: calc(5% + 10px);  /* Row-Rand + Hamburger-Offset */
    }
}

/* =============================================================================
   SAFARI THEME COLOR
   ============================================================================= */

/*
 * Die theme-color für Safari (iPhone Notch-Bereich) wird via JavaScript
 * dynamisch über ein <meta name="theme-color"> Tag gesteuert.
 * Siehe promo-bar.js: updateThemeColor() / resetThemeColor()
 */
