/* ========================================
   Atlas Standorte – Modal & Header
   ======================================== */

/* Header-Indikator (platziert via Elementor HTML-Widget) */

/* ── Rechter Header-Bereich ─────────────────────────────────────────────────
   Minimaler Eingriff: nur overflow + flex-shrink direkt setzen,
   keine Elementor-Variablen anfassen.
   → Kinder schrumpfen nie, bei Überlänge läuft Suchicon nach rechts raus.  */
.elementor-element:has(#atlas-standort-indicator):has(.elementor-widget-search-form) {
    overflow: visible !important;
    flex-wrap: nowrap !important;
}

.elementor-element:has(#atlas-standort-indicator):has(.elementor-widget-search-form)
    > .elementor-element {
    flex-shrink: 0 !important;
}

/* ── WPat Language Switcher: Dropdown sichtbar machen ───────────────────────
   WPat setzt height:~0 + overflow:hidden als Inline-Style (Bug bei
   scrollHeight-Berechnung). !important schlägt Inline-Styles.            */

/* Eltern-Container: dropdown darf herausragen */
.elementor-element:has(.auto_translate_button_wrapper),
.elementor-shortcode:has(.auto_translate_button_wrapper),
.auto_translate_button_wrapper,
.auto_translate_minimalist {
    overflow: visible !important;
}

/* Dropdown selbst: sichtbar und mit echter Höhe */
.wpat_minimalist_dropdown {
    overflow: visible !important;
    height: auto !important;
}

/* Standort-Indikator direkt */
.elementor-widget:has(#atlas-standort-indicator),
.elementor-column:has(#atlas-standort-indicator),

/* Elementor Search-Widget */
.elementor-widget-search-form,
.elementor-widget:has(.elementor-search-form),
.elementor-column:has(.elementor-search-form),

/* WPML Language Switcher */
.elementor-widget-wp-widget-icl_lang_sel_widget,
.elementor-widget:has(.wpml-ls),
.elementor-column:has(.wpml-ls),
.elementor-widget:has(.wpml-ls-statics-shortcode),
.elementor-column:has(.wpml-ls-statics-shortcode),

/* Polylang Language Switcher */
.elementor-widget:has(.pll_widget_languages),
.elementor-column:has(.pll_widget_languages) {
    width: auto !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
}

#atlas-standort-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    background: #f0f4f8;
    border: 1px solid #dde3ea;
    border-radius: 20px;
    padding: 6px 14px;
    line-height: 1.4;
    flex-shrink: 0;
}

#atlas-standort-indicator .atlas-city-display {
    font-weight: 600;
    color: #134094;
}

/* Nur bei Child-Standorten vom JS gerendert → immer sichtbar wenn vorhanden */
#atlas-standort-indicator .atlas-hauptstandort-hint {
    color: #888;
    font-size: 11px;
}

/* "Standort:" Label vor dem Hauptstandort-Namen */
#atlas-standort-indicator .atlas-hauptstandort-label {
    color: #888;
    font-size: 11px;
    font-weight: 400;
}

#atlas-standort-indicator .atlas-change-link {
    color: #e8952e;
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    margin-left: 2px;
}

#atlas-standort-indicator .atlas-change-link:hover {
    text-decoration: underline;
}

/* Modal Overlay */
#atlas-standort-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Modal Box */
.atlas-standort-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.atlas-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    z-index: 1;
}

.atlas-modal-close:hover {
    color: #333;
}

.atlas-modal-header {
    padding: 30px 30px 10px;
    text-align: center;
}

.atlas-modal-header h2 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #1a1a1a;
}

.atlas-modal-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.atlas-modal-body {
    padding: 20px 30px 30px;
}

/* Standort-Gruppen */
.atlas-standort-gruppe {
    margin-bottom: 20px;
}

.atlas-gruppe-label {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 10px;
    color: #333;
}

.atlas-gruppe-cities {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* City Buttons */
.atlas-city-btn {
    background: #f0f4f8;
    border: 2px solid #dde3ea;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
}

.atlas-city-btn:hover {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

/* Aktuell gespeicherter Standort: hervorgehoben für 1-Klick-Bestätigung */
.atlas-city-btn--current {
    background: #134094;
    border-color: #134094;
    color: #fff;
    font-weight: 600;
    position: relative;
    padding-left: 32px;
}

.atlas-city-btn--current::before {
    content: "\2713"; /* ✓ */
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 700;
}

.atlas-city-btn--current:hover {
    background: #0d2d68;
    border-color: #0d2d68;
}

/* Loading */
.atlas-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* ── Nicht-verfügbar-Banner ──────────────────────────────────────────────── */

#atlas-not-available-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99998; /* unter dem Modal (99999), über Theme-Header */
    background: #fff3cd;
    border-bottom: 2px solid #f0a500;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* WordPress Admin-Bar (eingeloggte Nutzer) */
.admin-bar #atlas-not-available-banner {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar #atlas-not-available-banner {
        top: 46px;
    }
}

.atlas-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.atlas-banner-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.atlas-banner-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #7a4f00;
    min-width: 200px;
}

.atlas-banner-btn {
    background: #e8952e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.atlas-banner-btn:hover {
    background: #d4831f;
}

.atlas-banner-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #7a4f00;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
    opacity: 0.6;
}

.atlas-banner-close:hover {
    opacity: 1;
}

@media (max-width: 600px) {
    .atlas-banner-text {
        font-size: 13px;
    }

    .atlas-banner-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .atlas-standort-modal {
        border-radius: 8px;
    }

    .atlas-modal-header {
        padding: 20px 20px 8px;
    }

    .atlas-modal-header h2 {
        font-size: 18px;
    }

    .atlas-modal-body {
        padding: 16px 20px 24px;
    }

    .atlas-city-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ══════════════════════════════════════════════════════════════
   Mobile Standort-Bar (unterhalb Header, nur auf Mobilgeräten)
   ══════════════════════════════════════════════════════════════ */

#atlas-mobile-bar {
    display: none;          /* eingeblendet per Media-Query */
    width: 100%;
    background: #fff;
    box-sizing: border-box;
    padding: 8px 12px;
    border-bottom: 1px solid #eef0f3;
}

@media (max-width: 1024px) {
    #atlas-mobile-bar {
        display: block;
    }

    /* Desktop-Indikator auf Mobile ausblenden, wenn Mobile-Bar aktiv ist */
    .elementor-widget:has(#atlas-standort-indicator),
    .elementor-column:has(#atlas-standort-indicator) {
        display: none !important;
    }
}

#atlas-mobile-bar .atlas-mobile-bar-inner {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    border: 1px solid #e6eaf0;
    border-radius: 12px;
    padding: 14px 18px;
    min-height: 52px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Linke Seite: Pin + "Standort: Stadt ▾"  – als <button> override */
#atlas-mobile-bar .atlas-mobile-bar-btn {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.3;
    color: #333;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-transform: none;
    letter-spacing: normal;
    min-height: 0;
    height: auto;
}

#atlas-mobile-bar .atlas-mobile-bar-btn:hover,
#atlas-mobile-bar .atlas-mobile-bar-btn:focus,
#atlas-mobile-bar .atlas-mobile-bar-btn:active {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none;
}

#atlas-mobile-bar .atlas-mobile-bar-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #134094;
    width: 16px;
    height: 16px;
}

#atlas-mobile-bar .atlas-mobile-bar-pin svg {
    width: 16px;
    height: 16px;
    display: block;
}

#atlas-mobile-bar .atlas-mobile-bar-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

#atlas-mobile-bar .atlas-mobile-bar-city {
    font-size: 14px;
    font-weight: 700;
    color: #134094;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

#atlas-mobile-bar .atlas-mobile-bar-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #134094;
    width: 14px;
    height: 14px;
    margin-left: -2px;
}

#atlas-mobile-bar .atlas-mobile-bar-chevron svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Trennlinie zwischen linker und rechter Seite */
#atlas-mobile-bar .atlas-mobile-bar-divider {
    width: 1px;
    height: 18px;
    background: #dde3ea;
    flex-shrink: 0;
}

/* Rechte Seite: "Ändern" als Text-Link – aggressives Reset */
#atlas-mobile-bar .atlas-mobile-bar-change {
    display: inline-flex !important;
    align-items: center;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #134094;
    flex-shrink: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: normal;
    min-height: 0;
    height: auto;
}

#atlas-mobile-bar .atlas-mobile-bar-change:hover,
#atlas-mobile-bar .atlas-mobile-bar-change:focus,
#atlas-mobile-bar .atlas-mobile-bar-change:active {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #0d2d68;
    outline: none;
}

/* ══════════════════════════════════════════════════════════════
   Hamburgermenü – Standort-Sektion (am unteren Ende des Menüs)
   ══════════════════════════════════════════════════════════════ */

.atlas-menu-standort {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #f4f7fc;
    border-top: 2px solid #dde3ea;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.15s ease;
    /* Kein border-radius – fügt sich in die Menüstruktur ein */
}

/* Desktop-Sicherheitsnetz: Sektion gehört NUR ins Hamburgermenü.
   Falls sie versehentlich in ein Desktop-Hover-Dropdown injiziert wird,
   bleibt sie damit unsichtbar. */
@media (min-width: 1025px) {
    .atlas-menu-standort {
        display: none !important;
    }
}

.atlas-menu-standort:hover,
.atlas-menu-standort:focus {
    background: #e8edf7;
    outline: none;
}

.atlas-menu-standort:focus-visible {
    outline: 2px solid #134094;
    outline-offset: -2px;
}

.atlas-menu-standort-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: #134094;
}

.atlas-menu-standort-icon svg {
    width: 22px;
    height: 22px;
}

.atlas-menu-standort-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.atlas-menu-standort-row1 {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.atlas-menu-standort-row2 {
    font-size: 15px;
    font-weight: 700;
    color: #134094;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atlas-menu-standort-edit {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: #e8952e;
    white-space: nowrap;
}
