/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* Carte plein écran */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* Interface utilisateur - en haut à droite */
#ui-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Sélecteur de langue */
#languageSelector {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #007cad;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    min-width: 120px;
}

#languageSelector:hover {
    background: white;
    border-color: #0056b3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#languageSelector:focus {
    outline: none;
    border-color: #004085;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

#languageSelector option {
    background: white;
    color: #333;
    padding: 5px;
}

/* Contrôles de zoom personnalisés */
#zoom-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#zoom-controls button {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #007cad;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    color: #007cad;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

#zoom-controls button:hover {
    background: #007cad;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#zoom-controls button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#zoom-controls button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Affichage du niveau de zoom - position absolue en bas à gauche */
#zoom-level {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border: 2px solid #007cad;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 80px;
    text-align: center;
}

#zoom-value {
    color: #007cad;
    font-weight: bold;
}

/* Sélecteur de couches */
.layer-selector {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.layer-selector-toggle {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #007cad;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.layer-selector-toggle:hover {
    background: #007cad;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.layer-selector-toggle:active {
    transform: scale(0.98);
}

.layer-selector-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid #007cad;
    border-radius: 8px;
    padding: 15px;
    min-width: 280px;
    max-width: 320px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.layer-selector-panel.hidden {
    display: none;
}

.layer-selector-title {
    font-size: 16px;
    font-weight: bold;
    color: #007cad;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #007cad;
}

.layer-selector-section {
    margin-bottom: 12px;
}

.layer-selector-section:last-child {
    margin-bottom: 0;
}

.layer-selector-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layer-selector-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layer-selector-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(0, 124, 173, 0.05);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.layer-selector-item:hover {
    background: rgba(0, 124, 173, 0.12);
}

.layer-selector-item input[type="checkbox"],
.layer-selector-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007cad;
}

.layer-selector-item span {
    font-size: 14px;
    color: #333;
    user-select: none;
}

/* Style pour les couches hors de portée de zoom */
.layer-selector-item.layer-out-of-range {
    opacity: 0.5;
    background: rgba(150, 150, 150, 0.05);
}

.layer-selector-item.layer-out-of-range input {
    cursor: not-allowed;
}

.layer-selector-item.layer-out-of-range span {
    color: #999;
}

/* Info de plage de zoom */
.layer-zoom-info {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

.layer-selector-item.layer-out-of-range .layer-zoom-info {
    color: #999;
}

.layer-selector-separator {
    border: none;
    border-top: 1px solid #ddd;
    margin: 12px 0;
}

/* Personnalisation du géocodeur Leaflet */
.leaflet-control-geocoder {
    margin-top: 70px !important;
    margin-right: 0px !important;
}

.leaflet-control-geocoder.leaflet-control {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #007cad;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.leaflet-control-geocoder-form input {
    border: none;
    padding: 10px;
    font-size: 14px;
    border-radius: 4px;
    width: 200px;
}

.leaflet-control-geocoder-form button {
    background: #007cad;
    border: none;
    color: white;
    padding: 10px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.leaflet-control-geocoder-form button:hover {
    background: #0056b3;
}

.leaflet-control-geocoder-alternatives {
    background: white;
    border: 2px solid #007cad;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
}

.leaflet-control-geocoder-alternatives a {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    color: #333;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s ease;
}

.leaflet-control-geocoder-alternatives a:hover {
    background: #f8f9fa;
    color: #007cad;
}

/* ===== STYLES POUR LES CLUSTERS DE MARQUEURS (POTEAUX TEC) ===== */

/* S'assurer que les panes sont au bon niveau */
.leaflet-pane {
    position: absolute;
}

.leaflet-marker-pane,
.leaflet-pane[style*="z-index: 650"] {
    z-index: 650 !important;
}

/* Animation des clusters */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
    transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}

/* Clusters petits (1-10 poteaux) */
.marker-cluster-small {
    background-color: rgba(255, 107, 53, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(255, 107, 53, 0.9);
}

/* Clusters moyens (11-100 poteaux) */
.marker-cluster-medium {
    background-color: rgba(241, 128, 23, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(241, 128, 23, 0.9);
}

/* Clusters larges (100+ poteaux) */
.marker-cluster-large {
    background-color: rgba(253, 156, 115, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(253, 156, 115, 0.9);
}

/* Style de base des clusters */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 20px;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 15px;
    font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
}

.marker-cluster span {
    line-height: 30px;
    color: #fff;
    font-weight: bold;
}

/* Animation au survol des clusters */
.marker-cluster:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Animation lors du chargement des clusters */
.marker-cluster-animated {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Style personnalisé pour les icônes individuelles de poteaux TEC */
.poteau-tec-icon {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.poteau-tec-icon:hover {
    transform: scale(1.2);
    z-index: 1000 !important;
}

/* Message de chargement */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    font-size: 16px;
    font-weight: 600;
    color: #007cad;
}

.loading-indicator::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Animation générale de chargement */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Styles pour les tooltips */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1001;
}

/* ===== RESPONSIVE - MOBILES ===== */
@media (max-width: 768px) {
    #ui-controls {
        top: 10px;
        right: 10px;
    }
    
    #zoom-controls {
        top: 10px;
        left: 10px;
    }
    
    #zoom-controls button {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    #zoom-level {
        bottom: 10px;
        left: 10px;
        font-size: 12px;
        padding: 6px 10px;
    }

    .layer-selector {
        bottom: 10px;
        right: 10px;
    }

    .layer-selector-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .layer-selector-panel {
        bottom: 55px;
        min-width: 260px;
        padding: 12px;
    }

    .layer-selector-title {
        font-size: 14px;
    }

    .layer-selector-section-title {
        font-size: 12px;
    }

    .layer-selector-item span {
        font-size: 13px;
    }
    
    /* Géocodeur sur mobile */
    .leaflet-control-geocoder {
        margin-top: 60px !important;
    }
    
    .leaflet-control-geocoder.leaflet-control {
        max-width: calc(100vw - 80px);
    }
    
    .leaflet-control-geocoder-form input {
        width: 150px;
        max-width: 150px;
        padding: 8px;
        font-size: 12px;
    }
    
    /* Clusters plus petits sur mobile */
    .marker-cluster div {
        width: 25px;
        height: 25px;
    }
    
    .marker-cluster span {
        line-height: 25px;
        font-size: 11px;
    }
}