/**
 * Karten des Themes – Hülle, Platzhalter bis zur Einwilligung, Fehlermeldung.
 * Ausgabe: cpt/maps.php · Logik: cpt/assets/floss-maps.js
 *
 * Die Größe der Hülle kommt immer vom Layout der jeweiligen Karte (Klasse oder
 * Inline-Style). Die Selektoren beginnen mit .floss-map, damit globale Button- und
 * Absatz-Styles (z. B. aus dem Elementor-Kit) den Platzhalter nicht verändern.
 */

.floss-map {
    position: relative;
    overflow: hidden;
    min-height: 180px;
    background-color: #eef2f5;
    /* Container-Abfragen unten: kompakter Platzhalter in niedrigen Karten. */
    container-type: size;
}

/* Borlabs-Content-Blocker: Der Platzhalter von Borlabs bestimmt seine Höhe selbst. */
.floss-map.floss-map--borlabs_cb {
    container-type: normal;
    overflow: auto;
}

/* Absolut statt height: 100% – bekommt die Hülle ihre Höhe nur über min-height
   oder Flex, würde sich eine prozentuale Höhe nicht auflösen. */
.floss-map__canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* --- Platzhalter ---------------------------------------------------------- */

.floss-map .floss-map__consent {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    padding: 16px;
    overflow: auto;
    text-align: center;
    background-color: #eef2f5;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.7) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.7) 2px, transparent 2px);
    background-position: center;
    background-size: 44px 44px;
}

/* margin: auto zentriert – und lässt bei Platzmangel oben nichts abschneiden. */
.floss-map .floss-map__consent-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: 400px;
    margin: auto;
    padding: 18px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background-color: #ffffff;
    box-shadow: 0 10px 25px -12px rgba(15, 23, 42, 0.3);
    color: #1f2937;
    font-size: 14px;
    line-height: 1.5;
}

.floss-map .floss-map__consent-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    background-color: var(--color-primary, #1E40AF);
    color: #ffffff;
    font-size: 17px;
}

.floss-map .floss-map__consent-title {
    margin: 0;
    padding: 0;
    color: #111827;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.floss-map .floss-map__consent-text {
    margin: 0;
    padding: 0;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.5;
}

.floss-map .floss-map__consent-text a {
    color: var(--color-primary, #1E40AF);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.floss-map .floss-map__consent-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 4px 0 0;
    padding: 9px 18px;
    border: 0;
    border-radius: 10px;
    background-color: var(--color-primary, #1E40AF);
    box-shadow: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.floss-map .floss-map__consent-btn:hover,
.floss-map .floss-map__consent-btn:focus {
    background-color: var(--color-primary, #1E40AF);
    color: #ffffff;
    opacity: 0.9;
}

.floss-map .floss-map__consent-btn:focus-visible {
    outline: 3px solid var(--color-primary, #1E40AF);
    outline-offset: 2px;
}

.floss-map .floss-map__consent-remember {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: #4b5563;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.3;
    cursor: pointer;
}

.floss-map .floss-map__consent-remember input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--color-primary, #1E40AF);
    cursor: pointer;
}

.floss-map .floss-map__consent-remember.is-hidden {
    display: none;
}

/* Während Leaflet nachgeladen wird. */
.floss-map.is-loading .floss-map__consent-box {
    opacity: 0.6;
    pointer-events: none;
}

/* Modus "none" (Sperre per Script-Blocker): Hinweis erst nach kurzer Zeit.
   Läuft das Skript normal, ist die Karte bis dahin längst geladen. */
.floss-map .floss-map__consent--passive {
    opacity: 0;
    animation: floss-map-hint 0.3s ease 1.5s forwards;
}

.floss-map.is-loading .floss-map__consent--passive {
    display: none;
}

@keyframes floss-map-hint {
    to { opacity: 1; }
}

/* --- Fehler (z. B. Leaflet nicht erreichbar) --------------------------------- */

.floss-map .floss-map__error {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: #eef2f5;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

/* --- Niedrige Karten (Ortsplan mobil, Detailseiten) ---------------------------- */

@container (max-height: 340px) {
    .floss-map .floss-map__consent {
        padding: 10px;
    }

    .floss-map .floss-map__consent-box {
        gap: 6px;
        padding: 12px 14px;
    }

    .floss-map .floss-map__consent-icon {
        display: none;
    }

    .floss-map .floss-map__consent-title {
        font-size: 14px;
    }

    .floss-map .floss-map__consent-text {
        font-size: 12px;
        line-height: 1.45;
    }

    .floss-map .floss-map__consent-btn {
        margin-top: 2px;
        padding: 7px 14px;
        font-size: 13px;
    }
}

/* Sehr niedrig (Ortsplan mobil, 200px): Überschrift weglassen – der Text erklärt
   genug, und der Name steht weiter im aria-label des Platzhalters. */
@container (max-height: 230px) {
    .floss-map .floss-map__consent-title {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .floss-map .floss-map__consent--passive {
        animation-duration: 0s;
    }
}
