/* ==========================================================================
   AGT Map Module — mod_agt_map.css
   ========================================================================== */

/* ── Karten-Container ────────────────────────────── */
.mod-agt-map {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    z-index: 0;
    background: #dde0e4;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

/* ── Benutzerdefinierter SVG-Marker ──────────────── */
.agt-map-marker {
    background: none !important;
    border: none !important;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
    transform-origin: 50% 100%;
    will-change: transform;
}

.agt-map-marker.agt-marker--hover {
    transform: scale(1.3) translateY(-5px);
    z-index: 9999 !important;
}

/* Other markers fade out while one is hovered, so it stands out */
.agt-map-marker.agt-marker--dim {
    opacity: 0.25;
}

/* Marker inner wrapper */
.agt-marker-inner {
    position: relative;
    width: 28px;
    height: 36px;
    display: block;
}

/* Glow ring — pulsing halo centered on the pin head */
.agt-marker-glow {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    left: 14px;
    top: 14px;
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(circle,
        rgba(255, 255, 255, 0.85) 0%,
        rgba(42, 148, 122, 0.55) 38%,
        rgba(42, 148, 122, 0.12) 65%,
        transparent 100%);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.agt-map-marker.agt-marker--hover .agt-marker-glow {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: agt-glow-pulse 1.5s ease-in-out infinite;
}

@keyframes agt-glow-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1);   opacity: 0.95; }
    50%       { transform: translate(-50%, -50%) scale(1.7); opacity: 0.30; }
}

/* SVG drop-shadow on hover */
.agt-marker-inner svg {
    position: relative;
    z-index: 1;
    transition: filter 0.25s ease;
}

.agt-map-marker.agt-marker--hover .agt-marker-inner svg {
    filter:
        drop-shadow(0 0 4px rgba(255, 255, 255, 1))
        drop-shadow(0 0 10px rgba(42, 148, 122, 0.85))
        drop-shadow(0 0 20px rgba(42, 148, 122, 0.45))
        drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

/* ── Leaflet Popup — Wrapper ─────────────────────── */
.agt-map-leaflet-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.20);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.agt-map-leaflet-popup .leaflet-popup-content {
    margin: 0;
    width: 260px !important;
}

.agt-map-leaflet-popup .leaflet-popup-tip-container {
    margin-top: -1px;
}

.agt-map-leaflet-popup .leaflet-popup-close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.95);
    font-size: 18px;
    font-weight: 300;
    line-height: 1;
    z-index: 10;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    transition: background 0.2s;
}

.agt-map-leaflet-popup .leaflet-popup-close-button:hover {
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
}

/* ── Popup — Bild (klickbar zum verlinkten Artikel) ─ */
.agt-map-popup__img {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
    transition: filter 0.2s ease;
}

.agt-map-popup__img-link {
    display: block;
    cursor: pointer;
}

.agt-map-popup__img-link:hover .agt-map-popup__img {
    filter: brightness(0.88);
}

/* ── Popup — Textbereich ─────────────────────────── */
.agt-map-popup__body {
    padding: 12px 16px 16px;
}

/* Kategorie-Pill */
.agt-map-popup__cat {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2a947a;
    background: rgba(42, 148, 122, 0.10);
    border: 1px solid rgba(42, 148, 122, 0.20);
    padding: 2px 8px;
    border-radius: 100px;
    margin-bottom: 7px;
}

/* Titel */
.agt-map-popup__title {
    font-size: 0.93rem;
    font-weight: 700;
    color: #1a2b3c;
    margin: 0 0 6px;
    line-height: 1.3;
}

/* Titel klickbar (Fallback für Punkte ohne Bild) */
.agt-map-popup__title-link {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

.agt-map-popup__title-link:hover .agt-map-popup__title {
    color: #2a947a;
}

/* Beschreibung */
.agt-map-popup__desc {
    font-size: 0.82rem;
    color: #666;
    margin: 0 0 10px;
    line-height: 1.5;
}

/* ── Label permanente sobre el marker ───────────── */
.agt-map-label {
    background: rgba(26, 43, 60, 0.82);
    border: none !important;
    border-radius: 4px;
    color: #fff !important;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 3px 8px !important;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.30);
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Label of a dimmed marker fades along with its pin */
.agt-map-label.agt-map-label--dim {
    opacity: 0.25;
}

/* Flecha del tooltip hacia abajo */
.agt-map-label::before {
    border-top-color: rgba(26, 43, 60, 0.82) !important;
}

/* ── País iluminado — relleno sólido con glow ────── */
.agt-country-path {
    filter:
        drop-shadow(0 0 4px rgba(42, 148, 122, 0.55))
        drop-shadow(0 0 10px rgba(42, 148, 122, 0.25));
    transition: filter 0.25s ease;
}

/* ── Tooltip nombre de país ──────────────────────── */
.agt-country-tooltip {
    background: rgba(26, 43, 60, 0.80);
    border: none !important;
    border-radius: 4px;
    color: #fff !important;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.agt-country-tooltip::before {
    border-top-color: rgba(26, 43, 60, 0.80) !important;
}

/* ── Entry animations ────────────────────────────── */

.mod-agt-map[data-anim]:not([data-anim="none"]) {
    opacity: 0;
    transition-property: opacity, transform;
    transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.mod-agt-map[data-anim="fade-up"]    { transform: translateY(50px); }
.mod-agt-map[data-anim="fade-down"]  { transform: translateY(-50px); }
.mod-agt-map[data-anim="fade-left"]  { transform: translateX(50px); }
.mod-agt-map[data-anim="fade-right"] { transform: translateX(-50px); }
.mod-agt-map[data-anim="zoom-in"]    { transform: scale(0.88); }
.mod-agt-map[data-anim="zoom-out"]   { transform: scale(1.08); }
.mod-agt-map[data-anim="flip-left"]  { transform: perspective(2500px) rotateY(15deg); }
.mod-agt-map[data-anim="flip-right"] { transform: perspective(2500px) rotateY(-15deg); }

.mod-agt-map.agt-anim-done {
    opacity: 1 !important;
    transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .mod-agt-map[data-anim]:not([data-anim="none"]) {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ── Wrapper & Filter bar ────────────────────────── */
.mod-agt-map-wrapper {
    position: relative;
    width: 100%;
}

/* Filter bar — absolute, centered at bottom of the map */
.agt-map-filterbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 800;

    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;

    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 100px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.18),
        0 1px 4px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    max-width: calc(100% - 48px);
    pointer-events: auto;
}

/* Vertical divider between filter groups */
.agt-filter-sep {
    display: inline-block;
    width: 1px;
    height: 16px;
    background: rgba(0, 0, 0, 0.14);
    flex-shrink: 0;
    align-self: center;
    margin: 0 2px;
}

.agt-filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    background: transparent;
    color: #4a5568;
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        box-shadow 0.16s ease;
    white-space: nowrap;
    line-height: 1.4;
    user-select: none;
}

.agt-filter-btn:hover {
    border-color: #2a947a;
    color: #2a947a;
    background: rgba(42, 148, 122, 0.08);
}

.agt-filter-btn.is-active {
    background: #2a947a;
    border-color: #2a947a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(42, 148, 122, 0.32);
}

.agt-filter-btn.is-active:hover {
    background: #237d68;
    border-color: #237d68;
    box-shadow: 0 2px 12px rgba(42, 148, 122, 0.45);
}

/* Countries button — slightly distinct style */
.agt-filter-btn--countries::before {
    content: '●';
    font-size: 0.55rem;
    margin-right: 5px;
    opacity: 0.7;
}

.agt-filter-btn--countries.is-active::before {
    opacity: 1;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 480px) {
    .agt-map-leaflet-popup .leaflet-popup-content {
        width: 220px !important;
    }

    .agt-map-popup__img {
        height: 110px;
    }
}
