/* Optimized Map Styles for High-Performance Coordinate Display */

/* Map Container */
.optimized-map-container {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.optimized-map-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
}

/* Loading Overlay */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.map-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--bs-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.map-loading-text {
    margin-left: 12px;
    color: var(--bs-primary);
    font-weight: 500;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-control-button {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-size: 12px;
    transition: all 0.2s ease;
}

.map-control-button:hover {
    background: #f8f9fa;
    border-color: var(--bs-primary);
}

.map-control-button.active {
    background: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

/* Status Info Panel */
.map-status-panel {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: white;
    border-radius: 4px;
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-size: 12px;
    z-index: 1000;
    max-width: 250px;
}

.map-status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.map-status-item:last-child {
    margin-bottom: 0;
}

.map-status-label {
    color: #666;
}

.map-status-value {
    font-weight: 500;
}

/* Custom Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.coordinate-popup {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 280px;
}

.popup-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-content p {
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.4;
}

.popup-content strong {
    color: #333;
}

.popup-actions {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    text-align: right;
}

.btn-details {
    background: var(--bs-primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-details:hover {
    background: var(--bs-primary-dark, #0056b3);
}

/* Custom Marker Styles */
.custom-marker {
    border: none !important;
    background: transparent !important;
}

.custom-marker div {
    position: relative;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.custom-marker:hover div {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* Cluster Marker Styles - Barrierefreie Violett-Farben
   WICHTIG: !important Flags überschreiben Leaflet Standard-Styles
   
   Cluster-Aufbau:
   - Äußerer Container (.marker-cluster): Transparent, nur für Größe
   - Innerer Kreis (.marker-cluster div): Trägt die Farbe und Zahl
   
   Farben aus CSS-Variablen (definiert in app.css)
*/
.marker-cluster {
    background-color: transparent !important;  /* Kein Hintergrund = kein Doppelkreis */
    border-radius: 50% !important;
    text-align: center !important;
    color: #fff !important;
    font-weight: bold !important;
}

.marker-cluster div {
    border-radius: 50% !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3) !important;  /* Schatten für bessere Sichtbarkeit */
}

/* Kleiner Cluster (2-10 Marker) - Helles Violett */
.marker-cluster-small div {
    background-color: var(--cluster-small-fg) !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;  /* Weißer Rand für Kontrast */
}

/* Mittlerer Cluster (11-50 Marker) - Mittleres Violett */
.marker-cluster-medium div {
    background-color: var(--cluster-medium-fg) !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
}

/* Großer Cluster (51+ Marker) - Dunkles Violett */
.marker-cluster-large div {
    background-color: var(--cluster-large-fg) !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
}

/* Filter Panel */
.map-filter-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
}

.map-filter-panel.collapsed {
    padding: 8px;
    min-width: auto;
}

.filter-toggle {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.filter-toggle:hover {
    background: #f8f9fa;
}

.filter-content {
    margin-top: 8px;
}

.filter-group {
    margin-bottom: 12px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.filter-select,
.filter-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Performance Stats */
.map-stats-panel {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.map-stats-panel.visible {
    opacity: 1;
}

.stat-item {
    display: inline-block;
    margin-right: 12px;
}

.stat-value {
    font-weight: bold;
    color: #4CAF50;
}

/* Responsive Design */
@media (max-width: 768px) {
    .optimized-map-container {
        height: 300px;
    }
    
    .map-controls {
        top: 5px;
        right: 5px;
        gap: 4px;
    }
    
    .map-control-button {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .map-status-panel {
        bottom: 5px;
        left: 5px;
        padding: 6px 8px;
        font-size: 11px;
        max-width: 200px;
    }
    
    .map-filter-panel {
        top: 5px;
        left: 5px;
        padding: 8px;
        min-width: 150px;
    }
    
    .coordinate-popup {
        max-width: 240px;
    }
    
    .popup-content p {
        font-size: 12px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .custom-marker div {
        border-width: 1px;
    }
}

/* Print Styles */
@media print {
    .map-controls,
    .map-filter-panel,
    .map-status-panel,
    .map-stats-panel {
        display: none !important;
    }
    
    .optimized-map-container {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}