/* ==========================================================================
   STYLE GLOBAL
   ========================================================================== */
body, html { 
    margin: 0; 
    padding: 0; 
    height: 100%; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: #f8f9fa; 
    overflow: hidden; /* Empêche le scroll global, tout se passe sur la carte */
}

/* ==========================================================================
   EN-TÊTE (HEADER)
   ========================================================================== */
#header-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
}

.header-title-group h1 { 
    font-size: 16px; 
    margin: 0; 
    color: #333; 
}

.header-title-group p { 
    font-size: 12px; 
    margin: 2px 0 0 0; 
    color: #666; 
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #555;
}

.control-group select {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 13px;
    margin-top: 2px;
    background: #fff;
    cursor: pointer;
    max-width:300px;
}

/* ==========================================================================
   CARTE SVG & ZOOM
   ========================================================================== */
#map-container {
    width: 100%;
    height: calc(100vh - 70px);
    margin-top: 70px;
}

#map-container svg {
    width: 100%;
    height: 100%;
    display: block;
}

path.circo {
    transition: fill-opacity 0.2s, stroke 0.2s, stroke-width 0.1s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Supprime le flash bleu sur mobile au toucher */
}

.zoom-controls {
    position: absolute;
    bottom: 120px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.zoom-btn {
    background: white;
    border: 1px solid #ccc;
    width: 32px;
    height: 32px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.zoom-btn:hover { 
    background: #f0f0f0; 
}

/* ==========================================================================
   PANNEAUX D'INFORMATIONS ET LÉGENDE
   ========================================================================== */
#legend-panel {
    position: absolute;
    top: 85px;
    right: 20px;
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 999;
    font-size: 12px;
    max-height: 75vh;
    overflow-y: auto;
}

.legend-item { 
    display: flex; 
    align-items: center; 
    margin-bottom: 4px; 
}

.color-box { 
    width: 14px; 
    height: 14px; 
    margin-right: 8px; 
    border-radius: 3px; 
    border: 1px solid #ccc; 
    flex-shrink: 0;
}

.interactive-legend {
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 4px;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.interactive-legend:hover { 
    background: #f0f4f8; 
}

.interactive-legend.active { 
    background: #e2e8f0; 
    font-weight: bold; 
}

.info-box {
    position: absolute;
    bottom: 20px;
    left: 20px;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-size: 13px;
    min-width: 250px;
    z-index: 1000;
    pointer-events: none;
}

.info-box h4 { 
    margin: 0 0 5px 0; 
    color: #004488; 
    font-size: 14px; 
}

.loading { 
    color: #d9534f; 
    font-weight: bold; 
}

/* ==========================================================================
   RESPONSIVE DESIGN (SMARTPHONES & TABLETTES)
   ========================================================================== */
@media (max-width: 768px) {
    #header-panel {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
        gap: 8px;
    }

    .header-controls {
        width: 100%;
        justify-content: space-between;
        gap: 5px;
    }

    .control-group select { 
        font-size: 11px; 
        padding: 4px; 
    }

    #map-container { 
        height: calc(100vh - 110px); 
        margin-top: 110px; 
    }

    #legend-panel {
        top: auto;
        bottom: 20px;
        right: 10px;
        max-height: 35vh;
        font-size: 10px;
        padding: 8px;
    }

    .info-box { 
        bottom: auto; 
        top: 120px; 
        left: 10px; 
        right: 10px; 
        min-width: 0; 
    }

    .zoom-controls { 
        bottom: 150px; 
        left: 10px; 
    }
}