/* =========================================
   zHaus – MAP LAYOUT (Full Screen)
   ========================================= */

:root {
    --zh-primary: #8A7ED9;
    --zh-bg: #f1f3f4;
    --zh-radius-lg: 18px;
    --zh-radius-md: 12px;
    --zh-shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.12);
    --zh-text-muted: #5f6368;
    --zh-marker-color: #ff4b7d;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.body-map {
    background-color: #e5e5e5;
}

.body-map .map-main-container {
    padding: 0;
    margin: 0;
    max-width: 100%;
}

/* Vollbild-Map */
.map-page {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    --map-pane-offset: 0px;
}

#map {
    position: absolute;
    inset: 0;
}

/* =========================================
   Menü-Button & Offcanvas
   ========================================= */

.map-menu-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1044;
}

.btn-map-circle {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    color: #424242;
    font-size: 1.1rem;
    cursor: pointer;
}
.btn-map-circle:active {
    transform: translateY(1px);
}

.offcanvas-map {
    width: 260px;
    background: #ffffff;
}
.offcanvas-map .offcanvas-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.offcanvas-map-logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--zh-primary);
}
.offcanvas-map a {
    text-decoration: none;
    color: #333;
}
.offcanvas-map a:hover {
    color: var(--zh-primary);
}

/* =========================================
   TOP-UI: Suche + Filter + Mode-Buttons
   ========================================= */

.event-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.map-top-ui {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    pointer-events: none;        /* damit Map weiter scroll-/zoombar ist */
}
.map-top-ui > * {
    pointer-events: auto;
}

/* Erste Zeile: Suche + Mode-Buttons */
.map-top-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



/* Suche */
.map-search-wrapper {
    position: relative;
    flex: 1 1 auto;
}

.map-search-bar {
    width: 100%;
    max-width: 680px;
    background: #ffffff;
    border-radius: 999px;
    box-shadow: var(--zh-shadow-soft);
    padding: 4px 4px 4px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 56px;
}

.map-search-bar .search-icon {
    color: var(--zh-text-muted);
}

.map-search-input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 0.95rem;
    background: transparent;
}
.map-search-input::placeholder {
    color: #b0b0b0;
}

.map-search-btn {
    border-radius: 999px;
    border: none;
    padding: 6px 14px;
    background: var(--zh-primary);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.map-search-reset-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}
.map-search-reset-btn:hover {
    background: rgba(148, 163, 184, 0.24);
}
.map-search-reset-btn.is-hidden {
    display: none;
}

/* Suchvorschläge */
.map-search-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 0;
    z-index: 1100;
    display: none;
}
.map-search-suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    cursor: pointer;
}
.map-search-suggestion:hover {
    background: #f1f3f4;
}
.map-search-suggestion-icon {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
.map-search-suggestion-text {
    display: flex;
    flex-direction: column;
}
.map-search-suggestion-title {
    font-weight: 600;
    color: #333;
}
.map-search-suggestion-sub {
    font-size: 0.75rem;
    color: #777;
}

/* Typ-Farben */
.map-search-suggestion--event .map-search-suggestion-icon {
    background: rgba(255, 75, 125, 0.12);
    color: #c93360;
}
.map-search-suggestion--city .map-search-suggestion-icon {
    background: rgba(26, 115, 232, 0.12);
    color: #1a73e8;
}

/* Mode-Buttons */
.map-mode-buttons {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 0.35rem;
}

.map-mode-btn {
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 999px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}
.map-mode-btn.is-active {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
    opacity: 1;
}
/* Desktop: Mode-Buttons rechts in der Top-Bar, keine absolute Position */
@media (min-width: 769px) {
    .map-top-bar {
        align-items: center;
    }
  
}

/* =========================================
   Chips – Kategorien & Datum
   ========================================= */

.map-chip-row {
    position: relative;
}

.map-chip-scroll {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.2rem 0.1rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.map-chip-scroll::-webkit-scrollbar {
    display: none;
}

.map-chip-fade {
    pointer-events: none;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    right: 0;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(248,250,252,0.95));
}

/* eigentliche Chips */
.map-category-chip,
.map-date-chip {
    white-space: nowrap;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(255, 255, 255, 0.95);
    padding: 0.18rem 0.7rem;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #444;
    cursor: pointer;
}
.map-category-chip i,
.map-date-chip i {
    font-size: 0.85rem;
}
.map-category-chip.active,
.map-date-chip.active {
    border-color: var(--zh-primary);
    background: var(--zh-primary);
    color: #ffffff;
}

/* =========================================
   Bottom Controls – Zoom & Locate
   ========================================= */

.map-bottom-controls {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.btn-map-rect {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: #ffffff;
    box-shadow: var(--zh-shadow-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 1rem;
    cursor: pointer;
}
.btn-map-rect--mode {
    position: relative;
}
.map-mode-count-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--zh-primary);
    color: #fff;
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24);
    pointer-events: none;
}
.btn-map-rect:active {
    transform: translateY(1px);
}

/* Locate-Button – Icon dreht sich beim Suchen */
@keyframes zh-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.btn-map-rect.is-locating i {
    animation: zh-spin 0.9s linear infinite;
}
.map-locate-hint {
    position: absolute;
    right: 64px;
    bottom: 14px;
    z-index: 1001;
    width: min(320px, calc(100vw - 96px));
    background: rgba(17, 24, 39, 0.94);
    color: #fff;
    border-radius: 14px;
    padding: 10px 36px 10px 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
    font-size: 0.8rem;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}
.map-locate-hint::after {
    content: '';
    position: absolute;
    right: -10px;
    bottom: 15px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 10px solid rgba(17, 24, 39, 0.94);
}
.map-locate-hint.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.map-locate-hint-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.map-locate-hint-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* =========================================
   User-Standort – Pulsierender Punkt
   ========================================= */

.zh-user-marker {
    position: relative;
    width: 18px;
    height: 18px;
    background: #1a73e8;
    border: 4px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(26, 115, 232, 0.7);
}
.zh-user-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    background: rgba(26, 115, 232, 0.4);
    border-radius: 50%;
    animation: zh-pulse 1.6s infinite ease-out;
}
@keyframes zh-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.6);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.3);
        opacity: 0;
    }
}

/* =========================================
   Event-Liste – Panel (Bottom-Sheet / Sidebar)
   ========================================= */

.map-event-panel {
    position: absolute;
    left: 8px;
    right: 72px;
    bottom: 64px; /* Abstand zu Bottom-Controls */
    z-index: 900;

    height: 40vh;
    max-height: 80vh;

    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);

    display: flex;
    flex-direction: column;
    overflow: hidden;

    padding: 0 10px 8px;
    transition: height 0.22s ease-out, transform 0.18s ease-out;
}

.map-event-panel--hidden {
    display: none !important;
}

.map-event-panel-header {
    padding: 6px 4px 6px 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.map-event-panel-grip {
    width: 32px;
    height: 4px;
    border-radius: 999px;
    background: rgba(0,0,0,0.2);
    margin: 3px auto 6px;
}
.map-event-panel-header small {
    color: var(--zh-text-muted);
    font-size: 0.75rem;
}

.map-event-panel-body {
    margin-top: 2px;
    padding: 4px 0 0;
    overflow-y: auto;
}

/* Card-Stack statt Tabelle */
.map-event-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.75rem;
}

.map-event-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.4);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
}
.map-event-card:hover {
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.7);
}

.map-event-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: 0.15rem;
}
.map-event-card-title {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    font-weight: 600;
}
.map-event-card-title i {
    font-size: 0.9rem;
}
.map-event-card-date {
    font-size: .78rem;
    color: #6b7280;
    white-space: nowrap;
}

.map-event-card-body {
    justify-content: space-between;
    gap: .5rem;
    margin-top: 0.1rem;
}
.map-event-card-location {
    font-size: 0.82rem;
    line-height: 1.2;
    color: #6b7280;
    margin: 2px 0 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.map-event-card-meta {
    display: flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
}
.map-event-card-distance {
    font-size: .78rem;
    color: #6b7280;
}

/* Details-Button im Chip-Stil */
.map-chip,
.map-chip-outline {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    border-radius: 999px;
    padding: 0.15rem 0.65rem;
    font-size: .78rem;
    font-weight: 500;
    border: 1px solid transparent;
    background: #f3f4f6;
    color: #111827;
}
.map-chip-outline {
    background: #ffffff;
    border-color: #d1d5db;
}
.map-chip:hover,
.map-chip-outline:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* aktive Card (per JS) */
.map-row-active,
.map-event-card.map-row-active {
    border-color: rgba(59, 130, 246, 0.95) !important;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.6), 0 6px 16px rgba(15,23,42,0.22);
}

/* Drag-Status */
.map-event-panel--dragging {
    transition: none !important;
}

/* Desktop: rechte Sidebar */
@media (min-width: 992px) {
    .map-event-panel {
        left: auto;
        right: 16px;
        top: 90px;
        bottom: 16px;
        width: 380px;
        height: auto;
        max-height: none;
        padding: 8px 10px;
        z-index: 1200;
    }
}

/* =========================================
   Event-Overlay (Detailseite als iFrame)
   ========================================= */

.map-event-overlay {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 2000;
}
.map-event-overlay.is-visible {
    display: block;
}
.map-event-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.map-event-overlay-dialog {
    position: absolute;
    inset: 5vh 5vw;
    background: #f5f7fb;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.map-event-overlay-frame {
    flex: 1;
    width: 100%;
    border: 0;
    background: transparent;
}
.map-event-overlay-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 1;
}
.map-event-overlay-close svg,
.map-event-overlay-close i {
    font-size: 18px;
}
@media (max-width: 768px) {
    .map-event-overlay-dialog {
        inset: 0;
        border-radius: 0;
    }
}
body.map-event-overlay-open {
    overflow: hidden;
}

/* =========================================
   Marker & Cluster
   ========================================= */

.map-marker {
    position: relative;
    width: 32px;
    height: 32px;
    background-color: #ffffff;
    border-radius: 50%;
    border: 1px solid #d3d3d3;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.20);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.map-marker-inner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--zh-marker-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-marker::after {
    content: "";
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 9px solid #ffffff;
}

.map-marker i {
    font-size: 15px;
    color: #ffffff !important;
    --fa-primary-color: #ffffff;
    --fa-secondary-color: rgba(255,255,255,0.85);
    --fa-secondary-opacity: 1;
}

.map-marker--active {
    transform: translateY(-3px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.30);
}

@keyframes zh-bounce {
    0%   { transform: translateY(0); }
    30%  { transform: translateY(-8px); }
    60%  { transform: translateY(0); }
    80%  { transform: translateY(-4px); }
    100% { transform: translateY(0); }
}
.map-marker--bounce {
    animation: zh-bounce 0.7s ease-out;
}

/* Cluster-Marker */
.map-marker--cluster {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.1);
}

/* =========================================
   Popups
   ========================================= */

.maplibregl-popup {
    z-index: 1040;
}

.maplibregl-popup-content {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.maplibregl-popup-tip {
    display: none;
}

.map-popup {
    min-width: 220px;
    max-width: 260px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    padding: 10px 12px 10px;
    font-size: 0.85rem;
}

.map-popup-header {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 4px;
}

.map-popup-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    background: #f1f3f4;
    color: #555;
}

.map-popup-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.map-popup-meta {
    font-size: 0.78rem;
    color: #666;
    margin-bottom: 3px;
}

.map-popup-date {
    font-size: 0.78rem;
    color: #444;
    margin-bottom: 6px;
}

.map-popup-footer {
    display: flex;
    justify-content: flex-end;
}

.map-popup-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--zh-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.map-popup-link:hover {
    text-decoration: underline;
}

/* =========================================
   Loading Overlay
   ========================================= */

.map-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 1500;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.map-loading-badge {
    pointer-events: auto;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 8px 24px rgba(0,0,0,0.24);
    font-size: 0.85rem;
    color: #444;
}

/* =========================================
   MapLibre Attribution – Toggle
   ========================================= */

/* Text immer versteckt … */
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-inner {
    display: none !important;
}
/* … bis der Button sie aufklappt */
.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
    display: inline !important;
}


/* Chips auf Mobile: statt Scrollen einfach umbrechen */
@media (max-width: 768px) {
    .map-chip-scroll {
        display: flex;
        flex-wrap: wrap;
        overflow-x: visible;
        padding-bottom: 0.1rem;
    }

    .map-chip-fade {
        display: none;
    }
}
/* =========================================
   Mode Buttons – links unten (wie Bottom-Controls)
   ========================================= */

/* alte Regeln/Media Queries überschreiben */
.map-mode-buttons{
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 1044;
  display: flex; /* immer sichtbar */
  flex-direction: column;
  gap: 6px;
}

/* optional: Active-State (wenn Panel ausgeblendet ist) */
#btn-list-focus.is-active{
  box-shadow: 0 0 0 3px rgba(138,126,217,0.28), var(--zh-shadow-soft);
}

/* ===== zHaus: Badge fuer gleiche Koordinaten ===== */
.map-marker-badge{
  position:absolute;
  top:-7px;
  right:-7px;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  background:#111;
  color:#fff;
  font-size:11px;
  line-height:18px;
  font-weight:700;
  border:2px solid #fff;
  box-shadow:0 2px 6px rgba(0,0,0,0.25);
}
/* ===== Popup: Liste (alle Eintraege am selben Ort) ===== */
.map-popup-chip--count{ opacity: .95; }

.map-popup-list{
  margin-top:10px;
  max-height: 340px;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding-right:4px;
}

.map-popup--group .map-popup-list{
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

@media (min-width: 992px){
  .map-popup--group{
    max-height: 44vh;
    overflow: hidden;
  }
  .maplibregl-popup.zh-popup-group .maplibregl-popup-content{
    width: min(420px, 38vw) !important;
    max-width: min(420px, 38vw) !important;
    max-height: 44vh;
    overflow: hidden !important;
    overflow-x: hidden !important;
  }
  .map-popup--group .map-popup-list{
    margin-top: 8px;
    gap: 6px;
    max-height: calc(44vh - 56px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
  }
}

.map-popup-row{
  display:block;
  text-decoration:none;
  color:inherit;
  border:1px solid rgba(15,23,42,0.10);
  border-radius:14px;
  padding:10px 12px;
  background:linear-gradient(180deg,#fff 0%, #fbfbfc 100%);
  box-shadow:0 6px 18px rgba(15,23,42,0.06);
}
.map-popup-row:hover{
  transform: translateY(-1px);
  box-shadow:0 10px 22px rgba(15,23,42,0.10);
}
.map-popup-row-title{
  font-weight:850;
  font-size:0.95rem;
  line-height:1.25;
  margin-bottom:6px;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.map-popup-row-meta{
  display:flex;
  flex-wrap:wrap;
  gap:10px 12px;
  font-size:0.80rem;
  color:#475569;
}
.map-popup-row-date,
.map-popup-row-place{
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
@media (max-width:520px){
  .map-popup-row-date,
  .map-popup-row-place{ white-space:normal; }
}
/* Popup: mobile-friendly sizing/alignment */
.maplibregl-popup.zh-popup {
  max-width: min(360px, calc(100vw - 20px));
}
.maplibregl-popup.zh-popup .maplibregl-popup-content{
  width: max-content;
  max-width: min(360px, calc(100vw - 20px)) !important;
  margin: 0 auto;
  transform: none !important;
}
@media (max-width:520px){
  .maplibregl-popup.zh-popup .maplibregl-popup-content{
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
  }
  .map-popup{
    min-width: 0;
    max-width: 100%;
  }
}


/* ===== Category Chips: einzeilig + horizontal scroll (touch) ===== */
.map-category-chips{
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
}
.map-category-chips::-webkit-scrollbar{ height: 6px; }
.map-category-chips *{ flex: 0 0 auto; }
.map-category-chip,
.map-category-chips .chip,
.map-category-chips button{
  white-space: nowrap !important;
}



/* ===== Map Event Panel Header Layout ===== */
.map-event-panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 10px 12px;
}
.map-event-panel-header-left{ min-width:0; }
.map-event-panel-title{ min-width:0; }
.map-event-panel-header-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex: 0 0 auto;
}

/* ===== Category Chips: wirklich einzeilig + horizontal scroll ===== */
.map-category-chips{
  display:flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  touch-action: pan-x;
    padding-top: 10px;
}
.map-category-chip{
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}


/* Popup: Inhalt sauber zentriert */
.maplibregl-popup.zh-popup .maplibregl-popup-content{
  margin: 0 auto;
}

@media (min-width: 992px) {
  .maplibregl-popup.zh-popup:not(.zh-popup-group) .maplibregl-popup-content {
    width: min(400px, 34vw) !important;
    max-width: min(400px, 34vw) !important;
    max-height: 70vh;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .maplibregl-popup.zh-popup:not(.zh-popup-group) .map-popup {
    min-width: 0;
    max-width: 100%;
  }
}


/* Datum unter dem Titel */
.map-event-card-date {
  font-size: 0.82rem;
  line-height: 1.2;
  color: #6b7280;          /* dezentes Grau */
  margin: 2px 0 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/

/* Android / Flexbox Overflow Fix */
.map-event-card-body {
  overflow-x: hidden;
}

.map-event-card-body * {
  min-width: 0;
}

@media (max-width: 480px) {
  .map-event-card-date {
    font-size: 0.78rem;
  }
  .map-event-card-location {
    font-size: 0.88rem;
  }
}

/* Local extensions */
.offcanvas-map--front { z-index: 1300; }
.map-marker-icon-white { color: #ffffff !important; }

.map-event-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 0.75rem;
    margin: 0;
    min-width: 0;
    font-size: 0.78rem;
    line-height: 1.2;
    font-weight: 600;
    color: #fff;
    background: #8A7ED9;
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(138, 126, 217, 0.45);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.map-event-add-btn:hover {
    background: #7a70cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(138, 126, 217, 0.6);
    text-decoration: none;
}

.map-event-add-btn i,
.map-event-add-btn svg {
    font-size: 0.85rem;
    flex: 0 0 auto;
}

.map-event-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 12px 12px;
}

.map-event-add-btn span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-event-add-btn--whatsapp {
    background: #25D366;
    color: #fff;
    border: none;
    position: relative;
    overflow: hidden;
}

.map-event-add-btn--whatsapp:hover {
    background: #1ebe5d;
}

.map-event-add-btn--whatsapp::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6);
    animation: waPulse 3s infinite;
}

@keyframes waPulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6); }
    70%  { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@media (max-width: 430px) {
    .map-event-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .map-event-panel {
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 18px 18px 0 0;
        max-height: 88dvh;
        padding: 0 12px 10px;
        box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.22);
        z-index: 1200;
    }

    .map-event-panel-header {
        padding-top: 6px;
    }

    .map-event-panel-grip {
        margin: 2px auto 8px;
        width: 32px;
        height: 5px;
        background: rgba(15, 23, 42, 0.22);
    }

    .map-bottom-controls {
        bottom: calc(16px + var(--map-pane-offset));
        transition: bottom 180ms ease;
    }

    .map-mode-buttons {
        bottom: calc(16px + var(--map-pane-offset));
        transition: bottom 180ms ease;
    }

    .map-locate-hint {
        bottom: calc(14px + var(--map-pane-offset));
        transition: bottom 180ms ease;
    }

    .map-page .maplibregl-ctrl-bottom-right .maplibregl-ctrl,
    .map-page .maplibregl-ctrl-bottom-left .maplibregl-ctrl {
        margin-bottom: calc(10px + var(--map-pane-offset));
        transition: margin-bottom 180ms ease;
    }

    .map-page.has-mobile-pane .map-bottom-controls,
    .map-page.has-mobile-pane .map-mode-buttons,
    .map-page.has-mobile-pane .map-locate-hint {
        z-index: 1100;
    }
}

.map-info-pane {
    position: absolute;
    left: 8px;
    right: 72px;
    bottom: 64px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    max-height: 33dvh;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.36);
    overflow: hidden;
}

.map-info-pane--hidden {
    display: none !important;
}

.map-info-pane-close {
    position: absolute;
    z-index: 2;
}

.map-info-pane-body {
    overflow: auto;
    padding: 12px 16px 16px;
    max-height: calc(33dvh - 44px);
}

.map-info-pane .map-popup {
    min-width: 0;
    max-width: 100%;
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: 4px 0 0;
    max-height: none !important;
    overflow: visible !important;
}

.map-info-pane-grip {
    width: 32px;
    height: 5px;
    margin: 8px auto 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.26);
    cursor: pointer;
    flex: 0 0 auto;
}

@media (max-width: 991.98px) {
    .map-info-pane {
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 33dvh;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.22);
        z-index: 1250;
    }

    .map-info-pane-body {
        padding: 12px 16px 16px;
        max-height: calc(33dvh - 46px);
    }
}

/* Event panel header: grip centered, count below, close button right */
.map-event-panel-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    padding: 8px 8px 10px;
}

.map-event-panel-header .map-event-panel-grip {
    margin: 0 auto 4px;
}

.map-event-panel-header-left {
    width: 100%;
    min-width: 0;
}

.map-event-panel-title {
    min-width: 0;
    text-align: left;
}

.map-event-panel-title #event-count {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    color: #475569 !important;
}

.map-event-panel-header-right {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.map-event-actions {
    margin: 10px 12px 12px;
}

.map-chip-primary {
    background: #8A7ED9;
    border-color: #8A7ED9;
    color: #ffffff;
}

.map-chip-primary:hover {
    background: #776bc9;
    border-color: #776bc9;
    color: #ffffff;
}

/* Stable sizing for action buttons (avoid initial oversize flash) */
.map-event-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
}

.map-event-add-btn {
    height: 40px;
    min-height: 40px;
    width: 100%;
    max-width: 220px;
    padding: 0 12px;
    line-height: 1;
    font-size: 0.78rem;
    border-radius: 12px;
    justify-content: center;
}

.map-event-add-btn span {
    line-height: 1.1;
}

@media (max-width: 430px) {
    .map-event-add-btn {
        max-width: none;
    }
}

/* Unified pane close buttons (same look as event pane) */
.map-event-panel-close,
.map-event-panel-back,
.map-info-pane-close,
.map-event-overlay-close {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #111827;
}

.map-event-panel-close:hover,
.map-event-panel-back:hover,
.map-info-pane-close:hover,
.map-event-overlay-close:hover {
    background: #ffffff;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
    color: #0f172a;
}

.map-event-panel-back.is-hidden {
    display: none !important;
}

.map-info-pane-close {
    top: 6px;
    right: 6px;
}

.maplibregl-popup .maplibregl-popup-close-button {
    position: absolute !important;
    z-index: 5;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    color: #111827;
    font-size: 14px;
    line-height: 24px;
    font-weight: 700;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    top: 6px;
    right: 6px;
}

.maplibregl-popup .maplibregl-popup-close-button:hover {
    background: #ffffff;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
    color: #0f172a;
}

.maplibregl-popup.zh-popup-group .map-popup--group {
    padding-top: 42px;
}

.maplibregl-popup.zh-popup-group .maplibregl-popup-close-button {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    top: 2px;
    right: 2px;
    box-shadow: none;
}

.maplibregl-popup.zh-popup-group .maplibregl-popup-content {
    position: relative;
}

.map-popup--train .map-popup-train-list {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-popup--train .map-popup-train-row {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.map-popup--train .map-popup-train-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #475569;
    text-transform: uppercase;
}

.map-popup--train .map-popup-train-value {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
}

@media (min-width: 992px) {
    .map-bottom-controls {
        right: calc(16px + 380px + 12px);
    }
}

/* Event pane typography aligned with stop/train pane look */
.map-event-panel-body {
    padding: 6px 0 0;
}

.map-event-list {
    gap: 10px;
    padding: 0.25rem 0.65rem 0.75rem;
}

.map-event-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.map-event-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.map-event-card-title {
    font-size: 0.95rem;
    font-weight: 750;
    line-height: 1.3;
    color: #0f172a;
}

.map-event-card-title i {
    font-size: 0.92rem;
}

.map-event-card-date {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: .2px;
    text-transform: uppercase;
    color: #64748b;
}

.map-event-card-location {
    font-size: 0.83rem;
    color: #475569;
    line-height: 1.3;
    margin: 4px 0 8px;
}

.map-event-card-meta {
    gap: 8px;
}

.map-event-card-distance {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.map-chip {
    border-radius: 10px;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .15px;
}

/* Info pane typography harmonization */
.map-info-pane .map-popup-header {
    margin-bottom: 8px;
}

.map-info-pane .map-popup-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.3;
    color: #0f172a;
    margin-bottom: 6px;
}

.map-info-pane .map-popup-date {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: .2px;
    text-transform: uppercase;
    color: #64748b;
    margin: 4px 0 8px;
}

.map-info-pane .map-popup-meta {
    font-size: 0.84rem;
    line-height: 1.38;
    color: #334155;
}

.map-info-pane .map-popup-meta strong {
    color: #0f172a;
    font-weight: 800;
}

.map-info-pane .map-popup-link {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e007d;
}

.map-info-pane .map-popup-list {
    gap: 10px;
    margin-top: 8px;
}

.map-info-pane .map-popup-row {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.map-info-pane .map-popup-row-title {
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.3;
    color: #0f172a;
}

/* Rebuild UX for "Einträge am selben Ort" popup */
.map-popup--group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.map-group-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.map-group-head-title {
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.25;
    color: #0f172a;
}

.map-group-head-sub {
    font-size: 0.76rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.25;
}

.map-group-list {
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    pointer-events: auto;
}

.map-popup--group .map-event-list {
    padding: 0;
    gap: 8px;
}

.map-popup--group .map-event-card {
    margin: 0;
    cursor: default;
}

.map-popup--group .map-event-card:hover {
    transform: none;
}

.map-popup--group .map-event-card-body {
    margin-top: 0;
}

.map-popup--group .map-event-card-date {
    margin: 0 0 6px 0;
}

.map-popup--group .map-event-card-location {
    margin: 0 0 8px 0;
}

.map-popup--group .map-event-card-meta {
    justify-content: flex-start;
}

.map-popup--group .map-group-details {
    text-decoration: none;
}

@media (min-width: 992px) {
    .maplibregl-popup.zh-popup-group .maplibregl-popup-content {
        width: min(420px, 36vw) !important;
        max-width: min(420px, 36vw) !important;
        max-height: 42vh;
        overflow: hidden !important;
    }
    .maplibregl-popup.zh-popup-group .map-popup--group {
        max-height: calc(42vh - 10px);
    }
    .maplibregl-popup.zh-popup-group .map-group-list {
        max-height: calc(42vh - 108px);
        padding-right: 4px;
    }
}

/* Hard override for grouped desktop popup sizing/close-button alignment */
@media (min-width: 992px) {
    .maplibregl-popup.zh-popup.zh-popup-group {
        max-width: min(420px, 36vw) !important;
    }

    .maplibregl-popup.zh-popup.zh-popup-group .maplibregl-popup-content {
        width: min(420px, 36vw) !important;
        max-width: min(420px, 36vw) !important;
        max-height: 42vh !important;
        overflow: hidden !important;
        position: relative;
        padding-right: 0 !important;
    }

    .maplibregl-popup.zh-popup.zh-popup-group .maplibregl-popup-close-button {
        top: 4px;
        right: 4px;
    }
}

/* "Details ansehen" aligns left and matches event-list details button style */
.map-popup-footer {
    justify-content: flex-start;
}

.map-popup-link,
.map-info-pane .map-popup-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.3rem 0.7rem;
    border-radius: 10px;
    border: 1px solid #8A7ED9;
    background: #8A7ED9;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .15px;
    line-height: 1;
    text-decoration: none;
}

.map-popup-link:hover,
.map-info-pane .map-popup-link:hover {
    background: #776bc9;
    border-color: #776bc9;
    color: #ffffff;
    text-decoration: none;
}
