* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #222;
    background: #f7f7f8;
}

.seite {
    max-width: 760px;
    margin: 0 auto;
    padding: 16px;
}

.kopf {
    padding: 20px 0 12px;
}
.kopf h1 {
    margin: 0 0 4px;
    font-size: 1.5rem;
}
.unterzeile {
    margin: 0;
    color: #555;
}

.hinweis {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}
.hinweis-erfolg { background: #e3f6e5; border: 1px solid #a9dcae; }
.hinweis-fehler { background: #fdecea; border: 1px solid #f3b7b0; }

.karte-box {
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.karte-box h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.upload-form input[type="file"] {
    flex: 1 1 220px;
    max-width: 100%;
}
.upload-form button {
    padding: 10px 18px;
    background: #2c7fb8;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
}
.upload-form button:hover { background: #24699b; }

.upload-status {
    margin-top: 10px;
    font-size: 0.88rem;
    color: #555;
}

.button-link {
    display: inline-block;
    padding: 10px 16px;
    background: #2c7fb8;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
}
.button-link:hover { background: #24699b; }
.button-link-klein {
    padding: 6px 12px;
    font-size: 0.85rem;
}
.button-link-sekundaer {
    background: #fff;
    color: #2c7fb8;
    border: 1px solid #2c7fb8;
    padding: 7px 14px;
    font-size: 0.88rem;
}
.button-link-sekundaer:hover { background: #eaf2f7; }

.fusszeile {
    text-align: center;
    color: #888;
    font-size: 0.8rem;
    padding: 12px 0 24px;
}

/* ---- Kartenseite ---- */
.karten-seite { min-height: 100%; }
.karten-layout {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}
.kopf-kompakt {
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
    border-bottom: 1px solid #e2e2e2;
}
.kopf-kompakt h1 {
    font-size: 1.05rem;
    margin: 0;
}

.lade-status {
    display: block;
    color: #777;
    font-size: 0.78rem;
    margin-top: 2px;
}

.veranstaltung-info {
    background: #A2274B;
    color: #fff;
    padding: 8px 14px;
    font-size: 0.82rem;
}
.veranstaltung-zeile {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
}
.veranstaltung-venue {
    margin-top: 4px;
}
.veranstaltung-info strong {
    font-weight: 600;
}
.veranstaltung-ort-hinweis {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ff7a1a;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    vertical-align: middle;
    margin-left: 6px;
}

.intro-satz {
    margin: 0;
    padding: 8px 14px;
    background: #fff;
    border-bottom: 1px solid #eee;
    font-size: 0.84rem;
    color: #444;
}
.filter-reset-inline {
    background: none;
    border: none;
    color: #c94040;
    font-size: 0.84rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
}
.filter-reset-inline[hidden] {
    display: none;
}

/* ---- Filterleiste ---- */
.filterleiste {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 10px;
    padding: 6px 14px;
    background: #fff;
    border-bottom: 1px solid #eee;
}
.filter-gruppe {
    display: flex;
    flex-direction: column;
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
}
.filter-gruppe-titel {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f2f5f7;
    border: 1px solid #dbe2e5;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.8rem;
    color: #333;
    cursor: pointer;
}
.filter-gruppe-titel.offen { background: #e2edf4; border-color: #b9d2e0; }
.filter-anzahl { color: #1f6fa8; font-weight: 600; }
.filter-pfeil { font-size: 0.7rem; color: #888; }
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 2px 4px;
    max-width: 100%;
}
.filter-chips[hidden] {
    display: none;
}
.filter-chip {
    background: #fff;
    border: 1px solid #cfd8dc;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.76rem;
    color: #444;
    cursor: pointer;
}
.filter-chip.aktiv {
    background: #1f6fa8;
    border-color: #1f6fa8;
    color: #fff;
}

.map-wrapper {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

#map {
    flex: 1 1 auto;
    width: 100%;
    min-height: 600px;
    background: #dceaf2;
}

/* ---- Flag markers on the map ---- */
/* iconSize/iconAnchor in karte.js define a 30x30px tap target per marker
   (comfortable minimum for mobile); the visible flag itself is a bit
   smaller and centered within it. */
.punkt-marker-wrapper {
    transition: opacity 0.25s ease;
}
.punkt-marker-wrapper.ausgeblendet {
    opacity: 0;
    pointer-events: none;
}
.punkt-marker {
    display: block;
    width: 19px;
    height: 19px;
    aspect-ratio: 1 / 1;
    margin: 5.5px;
    border-radius: 50%;
    overflow: hidden;
    object-fit: cover;
    object-position: center;
    background: #eee;
    border: 1px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    cursor: pointer;
}
.punkt-marker:hover,
.punkt-marker:active {
    transform: scale(1.2);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* ---- Veranstaltungsort-Marker (Lissabon) ---- */
.ort-marker {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ff7a1a;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    cursor: pointer;
    position: relative;
}
.ort-marker::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: #fff;
}
.ort-marker:hover {
    transform: scale(1.12);
}
.popup-ort-bild {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    border-radius: 6px;
    margin: 6px 0;
}

/* ---- Außereuropäische Einträge (z.B. Südafrika) ---- */
.ausserhalb-liste {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 92%;
    z-index: 500;
}
.ausserhalb-pille {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #cfd8dc;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.72rem;
    color: #333;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: opacity 0.25s ease;
}
.ausserhalb-flagge {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 1px solid #fff;
    box-shadow: 0 0 1px rgba(0,0,0,0.4);
    flex: 0 0 auto;
}
.ausserhalb-pille:hover { border-color: #1f6fa8; }
.ausserhalb-pille.ausgeblendet {
    opacity: 0;
    pointer-events: none;
}

/* ---- Popup-Inhalte ---- */
.popup-inhalt { font-size: 0.85rem; }
.popup-inhalt h3 { margin: 0 0 6px; font-size: 0.98rem; }
.popup-anzahl { margin: 0 0 8px; color: #666; font-size: 0.78rem; }
.popup-eintrag {
    border-top: 1px solid #eee;
    padding: 7px 0;
}
.popup-eintrag:first-of-type { border-top: none; }
.popup-org { font-weight: 600; margin: 0 0 2px; }
.popup-unterzeile { margin: 0 0 2px; color: #555; font-size: 0.8rem; }
.popup-zeile { margin: 2px 0; }
.popup-zeile-klein { margin: 1px 0; font-size: 0.78rem; }
.popup-label { color: #777; }
.popup-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}
.popup-chip {
    background: #eaf2f7;
    color: #1f6fa8;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.72rem;
    white-space: nowrap;
}
.popup-sonstige {
    margin-top: 5px;
    padding-top: 4px;
    border-top: 1px dashed #eee;
}
.popup-bewertungen {
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.popup-bewertungsgruppe {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 0.76rem;
}
.popup-bewertungsgruppe-icon {
    display: inline-flex;
    gap: 2px;
    flex: 0 0 auto;
}
.popup-bewertungsgruppe-liste {
    color: #444;
}
.popup-einzelbewertungen {
    margin-top: 4px;
}
.popup-einzelbewertung .bewertung { margin-left: 3px; vertical-align: middle; }
.bewertung {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    color: #fff !important;
}
.bewertung-plus { background: #2e9e4f; }
.bewertung-minus { background: #c94040; }
.bewertung-neutral { background: #9aa3a8; }
.popup-leer { color: #777; }

.leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup-content { margin: 12px 14px; }

/* ---- Diagramm-Bereich unterhalb der Karte ---- */
.diagramm-bereich {
    padding: 18px 14px 28px;
    background: #f7f9fa;
}
.diagramm-bereich h2 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    color: #24333a;
}
.diagramm-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 700px) {
    .diagramm-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.diagramm-karte {
    background: #fff;
    border: 1px solid #1f6fa8;
    border-radius: 10px;
    padding: 14px 16px;
}
.diagramm-karte h3 {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: #24333a;
}
.diagramm-skala {
    font-weight: 400;
    color: #778089;
    font-size: 0.85em;
}
.diagramm-leer {
    color: #888;
    font-size: 0.85rem;
}
.diagramm-fussnote {
    margin: 10px 0 0;
    color: #888;
    font-size: 0.76rem;
    font-style: italic;
}
.kreisdiagramm-layout {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.kreisdiagramm {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.kreisdiagramm-legende {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.78rem;
    flex: 1 1 160px;
}
.kreisdiagramm-legende li {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: #444;
}
.legende-punkt {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.legende-prozent {
    color: #667680;
    margin-left: auto;
    padding-left: 8px;
    white-space: nowrap;
}
.balken-zeile {
    display: grid;
    grid-template-columns: minmax(90px, 40%) 1fr auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    font-size: 0.8rem;
}
.balken-label {
    color: #444;
    line-height: 1.25;
}
.balken-leiste {
    display: block;
    background: #eef1f2;
    border-radius: 4px;
    height: 14px;
    overflow: hidden;
}
.balken-fuellung {
    display: block;
    height: 100%;
    background: #1f6fa8;
    border-radius: 4px;
}
.balken-wert {
    color: #667680;
    font-variant-numeric: tabular-nums;
    min-width: 26px;
    text-align: right;
}

/* ---- Mobile Anpassungen ---- */
@media (max-width: 480px) {
    .seite { padding: 12px; }
    .kopf h1 { font-size: 1.25rem; }
    .upload-form { flex-direction: column; align-items: stretch; }
    .upload-form button { width: 100%; }
    .kopf-kompakt h1 { font-size: 0.95rem; }
    .balken-zeile { grid-template-columns: minmax(70px, 45%) 1fr auto; }
}
