/* =========================================
   MODUL: REGIO (KARTE, FILTER, POPUPS)
   ========================================= */

/* --- FILTER CONTROL WRAPPER (Light Glassmorphism & Minimierbar) --- */
.regio-filter-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    color: #2d3436; 
    padding: 12px 15px;
    border-radius: 16px; 
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-family: var(--font-stack, system-ui, sans-serif);
    margin-bottom: 25px; 
    margin-left: 10px; 
    min-width: 250px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Minimierter Zustand: Runder Button */
.regio-filter-wrapper.minimized {
    min-width: 44px !important; 
    width: 44px !important; 
    height: 44px !important;
    padding: 0 !important; 
    border-radius: 50% !important;
    display: flex; 
    align-items: center; 
    justify-content: center;
    cursor: pointer;
}

/* Elemente ausblenden, wenn minimiert */
.regio-filter-wrapper.minimized .regio-filter-container { display: none !important; }

/* Das Icon ist nur sichtbar, wenn die Box minimiert ist */
.filter-min-icon { display: none; font-size: 22px; line-height: 1; }
.regio-filter-wrapper.minimized .filter-min-icon { display: block; }

/* Filter Header Leiste (Titel + Minus-Button) */
.filter-header-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; border-bottom: 1px dashed rgba(0,0,0,0.1); padding-bottom: 8px;
}

.filter-header-title { font-weight: 800; font-size: 13px; color: #2d3436; }

.filter-min-btn {
    background: #f1f2f6; border: none; border-radius: 8px; width: 24px; height: 24px;
    font-size: 16px; cursor: pointer; color: #636e72; font-weight: bold;
    display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.filter-min-btn:hover { background: #dfe6e9; color: #d63031; }

/* --- FILTER INHALT --- */
.regio-filter-container { 
    display: flex; flex-direction: column; align-items: stretch; gap: 12px; 
}

.regio-filter-row { 
    display: flex; align-items: center; cursor: pointer; 
    font-size: 11px; font-weight: bold; user-select: none; 
    white-space: nowrap; margin: 0; 
}

.regio-filter-row:hover .regio-filter-box:not(.active) { 
    border-color: #2d3436; 
}

.regio-filter-box { 
    display: inline-flex; width: 14px; height: 14px; 
    border: 2px solid #a4b0be; border-radius: 3px; margin-right: 5px; 
    align-items: center; justify-content: center; 
    font-size: 10px; font-weight: bold; transition: 0.2s; 
    color: transparent; box-sizing: border-box; 
}

.regio-filter-box.active { color: #2d3436; border-color: #2d3436; }

/* --- ROUTING ELEVATION WRAPPER (Light Glassmorphism) --- */
.regio-elevation-container {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 66vw;
    max-width: 1200px;
    min-width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    color: #2d3436;
    padding: 12px 15px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    font-family: var(--font-stack, system-ui, sans-serif);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.regio-elevation-container.minimized {
    min-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.regio-elevation-container.minimized .regio-elevation-content { display: none !important; }
.regio-elevation-container.minimized .filter-header-title { display: none !important; }
/* 🚀 NEU: Ausblenden des Close-Buttons beim Minimieren */
.regio-elevation-container.minimized .elevation-close-btn { display: none !important; }
.regio-elevation-container.minimized .filter-header-bar { border: none; margin: 0; padding: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center;}
.regio-elevation-container.minimized .filter-min-icon { display: block; }

/* --- KARTEN POPUPS (Light Glassmorphism) --- */
.regio-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); 
    color: var(--text-dark, #2d3436);
    border-radius: 12px; border: 1px solid rgba(0, 0, 0, 0.1); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); padding: 5px;
}

.regio-popup .leaflet-popup-tip { 
    background: rgba(255, 255, 255, 0.92); 
    border: 1px solid rgba(0, 0, 0, 0.1); 
}

.regio-popup .leaflet-popup-close-button { 
    color: #636e72 !important; font-weight: bold; 
    padding: 8px 8px 0 0 !important; 
}

.regio-popup .leaflet-popup-close-button:hover { color: #d63031 !important; }

.regio-popup .leaflet-popup-content { 
    margin: 15px 20px; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
}

/* --- POPUP INNENLEBEN (Saubere Klassenstruktur) --- */
.map-popup-container { text-align: center; min-width: 170px; padding-bottom: 5px; }

.map-popup-title { margin: 0 0 5px 0; color: #2d3436; border-bottom: 1px dashed rgba(0,0,0,0.15); padding-bottom: 6px; font-size: 16px; font-weight: bold; }
.map-popup-title-link { display: block; margin-bottom: 12px; color: #2d3436; text-decoration: none; font-weight: bold; border-bottom: 1px dashed rgba(0,0,0,0.15); padding-bottom: 6px; cursor: pointer; font-size: 16px; transition: color 0.2s; }
.map-popup-title-link:hover { color: #0984e3; }

.map-popup-subtitle { font-size: 11px; color: #636e72; margin-bottom: 4px; font-style: italic; }
.map-popup-creator { font-size: 12px; margin-bottom: 10px; color: #636e72; }
.map-popup-creator a { color: #0984e3; text-decoration: none; font-weight: bold; }
.map-popup-creator a:hover { text-decoration: underline; }

.map-popup-meta { font-size: 12px; font-weight: bold; color: #2d3436; margin-bottom: 12px; background: rgba(0,0,0,0.05); padding: 6px; border-radius: 6px; display: flex; justify-content: space-around; align-items: center; }

/* Klickbares Meta-Badge im Popup */
.map-popup-meta-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.map-popup-meta-clickable:hover {
    background: rgba(9, 132, 227, 0.1);
    border: 1px solid rgba(9, 132, 227, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.map-popup-desc { text-align: left; margin-bottom: 12px; font-size: 12px; color: #2d3436; }
.map-popup-desc-clamped { font-size: 12px; color: #636e72; font-style: italic; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; margin-top: 5px;}

.map-popup-tag { font-size: 11px; font-weight: bold; margin-bottom: 5px; }
.map-popup-tag.private { color: #d63031; }
.map-popup-tag.protected { color: #0984e3; }
.map-popup-tag.assigned { color: #e1b12c; }

/* --- MAP BUTTONS --- */
.map-btn { width: 100%; padding: 8px; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: 0.2s; margin-bottom: 8px; font-size: 12px; text-align: center; display: block; box-sizing: border-box; text-decoration: none; }
.map-btn:last-child { margin-bottom: 0; }
.map-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); filter: brightness(1.05); }

.map-btn-primary { background: #0984e3; color: #fff; }
.map-btn-secondary { background: #8e44ad; color: #fff; }
.map-btn-warning { background: #f39c12; color: #fff; }
.map-btn-danger { background: #d63031; color: #fff; }
.map-btn-success { background: #27ae60; color: #fff; }
.map-btn-dark { background: #2d3436; color: #fff; border: 1px solid #555; }

/* --- MAP CONTEXT MENU --- */
.map-context-menu { text-align: left; }
.map-context-menu h4 { margin: 0 0 10px 0; color: #2d3436; border-bottom: 1px dashed rgba(0,0,0,0.15); padding-bottom: 6px; font-size: 14px; font-weight: bold; }
.map-context-menu hr { border: 0; border-top: 1px dashed rgba(0,0,0,0.1); width: 100%; margin: 8px 0; }
.map-context-menu .map-btn { text-align: left; }


/* --- MAP LABEL TOOLTIPS (ZOOM & HOVER) --- */
.map-label-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #000000 !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: bold !important;
    padding: 4px 8px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15) !important;
    
    opacity: 0 !important; 
    transition: opacity 0.2s ease !important;
    pointer-events: none !important;
    white-space: nowrap !important;
    margin-top: -5px !important;
}

.map-label-tooltip.leaflet-tooltip-top:before {
    border-top-color: rgba(255, 255, 255, 0.95) !important;
}

#map.show-labels .map-label-tooltip { opacity: 1 !important; }
.map-label-tooltip.hover-visible { opacity: 1 !important; }

/* --- EXIF POPUP (Light Theme) --- */
#regio-exif-popup {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    z-index: 999999; 
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); 
    padding: 20px; border-radius: 12px; 
    color: #2d3436; font-family: var(--font-stack, sans-serif); 
    box-shadow: 0 10px 40px rgba(0,0,0,0.2); min-width: 280px; 
    border: 1px solid rgba(0,0,0,0.1);
}

#regio-exif-popup h3 { margin: 0 0 15px 0; border-bottom: 1px dashed rgba(0,0,0,0.15); padding-bottom: 10px; font-size: 18px; color: #2d3436; }
#regio-exif-popup p { font-size: 13px; color: #636e72; margin: 0; line-height: 1.5; }

.exif-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 4px; }
.exif-row span { color: #636e72; }
.exif-row strong { color: #2d3436; }