/**
 * com_feuerwerksinitiative - Frontend Styles
 * Verein Tierschutz Helfer | Feuerwerksinitiative
 */

#fwi-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 12px 40px;
    font-family: inherit;
    color: #263238;
}

.fwi-no-campaign {
    padding: 40px 20px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 12px;
    color: #607d8b;
}

/* ── Kopfbereich (kompakt, Karte bleibt above the fold) ──────── */

.fwi-header {
    position: relative;
    text-align: center;
    padding: 10px 0 2px;
}

.fwi-title {
    margin: 0 0 2px;
    font-size: clamp(1.3rem, 3vw, 1.9rem);
    line-height: 1.15;
}

.fwi-tagline {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: #546e7a;
}

/* Sprachumschalter DE | FR | IT */
.fwi-lang {
    position: absolute;
    top: 4px;
    right: 0;
    display: flex;
    gap: 2px;
}

.fwi-lang button {
    border: none;
    background: none;
    padding: 4px 7px;
    font: inherit;
    font-weight: 600;
    font-size: 0.8rem;
    color: #78909c;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.fwi-lang button:hover {
    color: #37474f;
}

.fwi-lang button.fwi-lang-active {
    color: #bb0704;
    border-bottom-color: #bb0704;
}

/* Meta-Zeile: Raketen-Zähler und Countdown als dezenter Text,
   bewusst kein Balken/Button-Look */
.fwi-meta {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 6px 22px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #546e7a;
    margin: 0 0 8px;
}

.fwi-meta strong {
    color: #bb0704;
    font-size: 1.05rem;
}

#fwi-countdown {
    font-weight: 600;
    color: #37474f;
}

/* ── Karte ───────────────────────────────────────────────────── */

.fwi-map-card {
    background: #fff;
    border: 1px solid #eceff1;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(38, 50, 56, 0.08);
    padding: 10px 16px 16px;
    margin: 4px 0 20px;
}

.fwi-map-hint {
    text-align: center;
    font-size: 0.85rem;
    color: #90a4ae;
    margin-bottom: 6px;
}

#fwi-map svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Kantonsflächen: graubraun = laut/düster, grün = beruhigt */
#fwi-map .fwi-kanton {
    fill: #cdbfbc;
    stroke: #fff;
    stroke-width: 1;
    cursor: pointer;
    transition: fill 0.4s ease;
}

#fwi-map .fwi-kanton:hover {
    fill: #23bdcb;
}

#fwi-map .fwi-kanton.fwi-calmed {
    fill: #a5d6a7;
}

.fwi-kanton-label {
    font-size: 10px;
    font-weight: 700;
    font-family: sans-serif;
    fill: #37474f;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.75);
    stroke-width: 2.5px;
}

/* Raketen-Slots: Rakete sichtbar, Symbol blendet bei Umwandlung ein */
.fwi-slot {
    cursor: pointer;
}

.fwi-slot-rakete {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.fwi-slot-symbol {
    opacity: 0;
    transform: scale(0.2);
    transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fwi-slot.fwi-converted .fwi-slot-rakete {
    opacity: 0;
}

.fwi-slot.fwi-converted .fwi-slot-symbol {
    opacity: 1;
    transform: scale(1);
}

/* ── Wappen-Grid / Kantonsliste ──────────────────────────────── */

.fwi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin: 10px 0 24px;
}

.fwi-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: #fff;
    border: 1px solid #eceff1;
    border-radius: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    font: inherit;
    color: inherit;
}

.fwi-grid-item:hover {
    box-shadow: 0 4px 12px rgba(38, 50, 56, 0.12);
    transform: translateY(-2px);
}

.fwi-wappen {
    width: 40px;
    height: 46px;
    object-fit: contain;
}

.fwi-grid-name {
    font-size: 0.72rem;
    color: #546e7a;
    text-align: center;
    line-height: 1.2;
}

.fwi-grid-pct {
    font-size: 0.8rem;
    font-weight: 700;
    color: #bb0704;
}

.fwi-grid-pct.fwi-pct-full {
    color: #2e7d32;
}

/* ── Beschreibung (oberhalb der Karte, bewusst schlank) ──────── */

.fwi-description {
    margin: 4px auto 10px;
    max-width: 760px;
    text-align: center;
    font-size: 0.95rem;
}

/* ── Panel (Modal) ───────────────────────────────────────────── */

.fwi-panel-backdrop[hidden] {
    display: none;
}

.fwi-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(38, 50, 56, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 16px;
}

.fwi-panel {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    max-width: 550px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px;
}

.fwi-panel h2 {
    margin: 0 0 12px;
    font-size: 1.3rem;
    padding-right: 30px;
}

.fwi-panel-close {
    position: absolute;
    top: 10px;
    right: 14px;
    border: none;
    background: none;
    font-size: 1.6rem;
    line-height: 1;
    color: #90a4ae;
    cursor: pointer;
}

.fwi-panel-pct {
    margin-bottom: 12px;
}

.fwi-panel-pct-bar {
    height: 10px;
    background: #eceff1;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 4px;
}

.fwi-panel-pct-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ef6c00, #2e7d32);
    border-radius: 999px;
    transition: width 0.5s ease;
}

#fwi-panel-pct-text {
    font-size: 0.85rem;
    color: #546e7a;
}

.fwi-panel-symbols {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    font-size: 0.95rem;
}

.fwi-panel-symbols li {
    padding: 4px 0;
    border-bottom: 1px dashed #eceff1;
}

.fwi-panel-full {
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* Spendenknöpfe */
.fwi-donate-title {
    font-weight: 700;
    margin: 14px 0 8px;
}

.fwi-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 8px;
    padding: 11px 14px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: filter 0.15s ease;
}

.fwi-btn:hover {
    filter: brightness(1.08);
    color: #fff;
    text-decoration: none;
}

.fwi-btn-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    padding: 4px;
    object-fit: contain;
}

.fwi-btn-edelweiss { background: #23bdcb; }
.fwi-btn-alphorn   { background: #8d6e63; }
.fwi-btn-fahne     { background: #bb0704; }
.fwi-btn-frei      { background: #37474f; justify-content: center; }

.fwi-share {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px 14px;
    border: 2px solid #bb0704;
    border-radius: 10px;
    background: #fff;
    color: #bb0704;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.fwi-share:hover {
    background: #fdecea;
}

/* Danke-Overlay */
.fwi-danke {
    text-align: center;
}

.fwi-danke-icon {
    font-size: 2.6rem;
    margin-bottom: 6px;
}

/* ── Popups ──────────────────────────────────────────────────── */

#fwi-popup-area {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1100;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    max-width: 360px;
}

/* "Alle schliessen" über dem Popup-Stapel (ab 2 Popups) */
.fwi-popup-clear {
    align-self: flex-end;
    border: none;
    background: rgba(38, 50, 56, 0.75);
    color: #fff;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.fwi-popup-clear:hover {
    background: rgba(38, 50, 56, 0.9);
}

.fwi-popup {
    position: relative;
    background: #fff;
    border-left: 4px solid #bb0704;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    padding: 12px 30px 12px 14px;
    animation: fwi-popup-in 0.35s ease;
    font-size: 0.85rem;
}

@keyframes fwi-popup-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.fwi-popup-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: none;
    font-size: 1.1rem;
    line-height: 1;
    color: #b0bec5;
    cursor: pointer;
}

.fwi-popup-title {
    font-weight: 700;
    margin-bottom: 2px;
}

.fwi-popup-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: #bb0704;
}

.fwi-popup-donor {
    color: #546e7a;
}

.fwi-popup-kanton {
    color: #37474f;
    margin-top: 2px;
}

.fwi-popup-symbols {
    display: block;
    color: #78909c;
    font-size: 0.78rem;
}

/* ── Footer ──────────────────────────────────────────────────── */

.fwi-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #90a4ae;
}

.fwi-footer a {
    color: #90a4ae;
}

/* ── Responsive: Mobile zeigt Karte UND Wappen-Grid ──────────── */

@media (max-width: 767px) {
    .fwi-map-card {
        padding: 6px 6px 10px;
        border-radius: 12px;
    }

    /* Kürzel auf der kleinen Karte etwas grösser */
    .fwi-kanton-label {
        font-size: 14px;
        stroke-width: 3px;
    }

    .fwi-grid {
        grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    }

    #fwi-popup-area {
        left: 16px;
        max-width: none;
    }

    .fwi-header {
        padding-top: 30px; /* Platz für den Sprachumschalter */
    }
}
