/* Climat Map Plugin Styles */

.climat-map-container {
    position: relative;
    margin: 20px 0;
    padding: 15px;
    border-radius: 12px;
}

.climat-map {
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.9);
    position: relative;
}

/* Optimisation pour thème Positron */
.climat-map .leaflet-container {
    filter: 
        contrast(1.05) 
        brightness(1.02) 
        saturate(0.95);
    transition: filter 0.3s ease;
}

.climat-map:hover .leaflet-container {
    filter: 
        contrast(1.1) 
        brightness(1.05) 
        saturate(1);
}

/* Overlay vintage pour accentuer l'effet ancien */
.climat-map::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 30%, rgba(139, 115, 85, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(101, 67, 33, 0.05) 0%, transparent 50%),
        linear-gradient(45deg, rgba(139, 115, 85, 0.02) 0%, rgba(160, 136, 106, 0.02) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Optimisation pour les tuiles Positron */
.climat-map .leaflet-tile {
    filter: 
        contrast(1.02) 
        brightness(1.01);
}

/* Style spécifique pour les tuiles Positron */
.climat-map .positron-tiles {
    filter: 
        contrast(1.05) 
        brightness(1.02) 
        saturate(0.98) !important;
}

/* Style pour les tuiles sombres Dark Matter */
.climat-map .dark-tiles {
    filter: 
        contrast(1.1) 
        brightness(0.95) 
        saturate(1.05) !important;
}

/* Styles pour les couches terrain et relief */
.climat-map .terrain-tiles {
    filter: 
        contrast(1.1) 
        brightness(1.02) 
        saturate(1.1) !important;
}

.climat-map .hillshade-tiles {
    filter: 
        contrast(1.15) 
        brightness(0.98) 
        saturate(0.9) !important;
}

.climat-map .topo-tiles {
    filter: 
        contrast(1.05) 
        brightness(1.01) 
        saturate(1.05) !important;
}

.climat-map .esri-terrain-tiles {
    filter: 
        contrast(1.1) 
        brightness(1.03) 
        saturate(1.08) !important;
}

/* Style spécifique pour Positron GL */
.climat-map .positron-gl-tiles {
    filter: 
        contrast(1.08) 
        brightness(1.05) 
        saturate(0.95) !important;
}

.climat-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    padding: 25px 35px;
    border-radius: 12px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #4a5568;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.climat-map-error {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1002;
    background: linear-gradient(145deg, #dc3545, #c82333);
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    display: none;
    max-width: 320px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 
        0 4px 16px rgba(220, 53, 69, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.climat-map-controls {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    padding: 18px;
    border-radius: 12px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 300px;
}

.climat-map-controls .search-box {
    margin-bottom: 15px;
    display: flex;
    gap: 8px;
}

.climat-map-controls .climat-search {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.climat-map-controls .climat-search:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.climat-map-controls .search-button {
    padding: 8px 16px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.climat-map-controls .search-button:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.climat-map-controls .control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.climat-map-controls .control-buttons button {
    padding: 8px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 80px;
}

.climat-map-controls .control-buttons button:hover {
    background: #218838;
    transform: translateY(-1px);
}

.climat-map-controls .control-buttons .reset-button {
    background: #dc3545;
}

.climat-map-controls .control-buttons .reset-button:hover {
    background: #c82333;
}

/* Popup styles */
.leaflet-popup-content {
    margin: 10px 15px;
    line-height: 1.4;
}

.leaflet-popup-content h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
}

.leaflet-popup-content small {
    color: #666;
    display: block;
    margin: 2px 0;
}

/* Info control styles */
.climat-info-control {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    max-width: 280px;
    backdrop-filter: blur(10px);
}

.climat-info-control h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #007cba;
    padding-bottom: 5px;
}

.climat-info-control .climat-details {
    font-size: 13px;
    line-height: 1.5;
}

.climat-info-control .climat-details strong {
    color: #555;
}

/* Responsive design */
@media (max-width: 768px) {
    .climat-map-controls {
        position: static;
        margin-bottom: 10px;
        border-radius: 0;
        box-shadow: none;
        background: #f8f9fa;
        border: 1px solid #e0e0e0;
    }
    
    .climat-map-controls .search-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .climat-map-controls .control-buttons {
        flex-direction: column;
    }
    
    .climat-map-controls .control-buttons button {
        flex: none;
        width: 100%;
    }

    /* Popup responsive sur tablette */
    .leaflet-popup-content-wrapper {
        max-width: 85vw !important;
        width: auto !important;
    }

    .climat-popup-custom .leaflet-popup-content {
        margin: 8px 10px !important;
        width: auto !important;
    }
}

.climat-map-container {
    transition: all 0.3s ease;
}

/* Animation de pulse pour le loading */
.climat-map-loading {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Style pour les popups de climat */
.climat-popup {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95)) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    backdrop-filter: blur(10px) !important;
}

.climat-popup .leaflet-popup-content-wrapper {
    background: transparent !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

.climat-popup .leaflet-popup-content {
    color: #4a5568 !important;
    font-weight: 500 !important;
}

@media (max-width: 480px) {
    .climat-map-controls {
        padding: 10px;
        min-width: auto;
    }
    
    .climat-map-container {
        margin: 10px 0;
        padding: 10px;
    }
    
    .climat-info-control {
        max-width: calc(100vw - 40px);
        left: 10px !important;
        right: 10px !important;
    }

    /* Popup responsive sur mobile */
    .leaflet-popup-content-wrapper {
        max-width: 95vw !important;
        width: auto !important;
        min-width: 280px !important;
    }

    .climat-popup-custom .leaflet-popup-content {
        margin: 5px 8px !important;
        width: auto !important;
    }

    /* Zone de toucher plus large sur mobile */
    .leaflet-interactive {
        cursor: pointer !important;
        touch-action: manipulation !important;
    }
    
    /* Amélioration des interactions tactiles */
    .climat-popup-custom .leaflet-popup-content-wrapper {
        touch-action: pan-y pinch-zoom !important;
    }
    
    /* Boutons plus facilement cliquables sur mobile */
    .climat-popup-custom a {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        touch-action: manipulation !important;
    }

    /* Contrôles Leaflet plus grands sur mobile */
    .leaflet-control-zoom a {
        width: 35px !important;
        height: 35px !important;
        line-height: 35px !important;
        font-size: 20px !important;
    }

    .leaflet-control-attribution {
        font-size: 10px !important;
        padding: 2px 4px !important;
    }
}

/* Custom leaflet control styles */
.leaflet-control-layers {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.leaflet-control-scale-line {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
}

/* Animation for map loading */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.climat-map {
    animation: fadeIn 0.5s ease-in;
}

/* Polygon hover effects */
.leaflet-interactive:hover {
    transition: all 0.3s ease;
}

/* Custom popup styles */
.climat-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
}

.climat-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95);
}

/* ========== STYLES ANCIENS POUR LES CONTROLES LEAFLET ========== */

/* Contrôles de zoom avec style Positron */
.climat-map .leaflet-control-zoom {
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 4px !important;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    background: linear-gradient(145deg, #ffffff, #f8f9fa) !important;
}

.climat-map .leaflet-control-zoom a {
    background: linear-gradient(145deg, #ffffff, #f1f3f4) !important;
    color: #2c3e50 !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    transition: all 0.2s ease !important;
}

.climat-map .leaflet-control-zoom a:hover {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef) !important;
    color: #1a252f !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2) !important;
}

.climat-map .leaflet-control-zoom a:first-child {
    border-top-left-radius: 4px !important;
    border-top-right-radius: 4px !important;
}

.climat-map .leaflet-control-zoom a:last-child {
    border-bottom-left-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
}

/* Attribution avec style Positron moderne */
.climat-map .leaflet-control-attribution {
    display: none !important;
}

.climat-map .leaflet-control-attribution a {
    color: #007bff !important;
    text-decoration: none !important;
}

.climat-map .leaflet-control-attribution a:hover {
    color: #0056b3 !important;
    text-decoration: underline !important;
}

/* Contrôle des couches avec style Positron */
.climat-map .leaflet-control-layers {
    background: linear-gradient(145deg, #ffffff, #f8f9fa) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 4px !important;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.climat-map .leaflet-control-layers-toggle {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23495057' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2z'/%3E%3C/svg%3E") no-repeat center !important;
    filter: none !important;
}

/* Effet vintage sur les marqueurs et popups */
.climat-map .leaflet-marker-icon {
    filter: sepia(20%) contrast(1.1) brightness(0.95) !important;
}

/* Scale control avec style Positron */
.climat-map .leaflet-control-scale {
    background: linear-gradient(145deg, #ffffff, #f8f9fa) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 4px !important;
    color: #495057 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-weight: 500 !important;
    text-shadow: none !important;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.climat-map .leaflet-control-scale-line {
    border: 2px solid #2c3e50 !important;
    border-top: 2px solid #2c3e50 !important;
    color: #495057 !important;
}

.leaflet-popup-content {
    margin: 0px 0px;
    /* line-height: 1.4; */
    width: 0;

}

.leaflet-popup-tip-container {
    width: 0;
}

.leaflet-popup-content-wrapper {
    width: 50%;
    background: none !important;
    color: none !important;
    box-shadow: none !important;

}
