* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    display: flex;
    height: 100vh;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

#sidebar {
    width: 300px;
    min-width: 300px;
    padding: 20px;
    background: #f8f8f8;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

h1 { font-size: 18px; color: #333; margin-bottom: 4px; }
h2 { font-size: 13px; color: #555; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }

#info-panel {
    background: #eef4fc;
    border-left: 3px solid #2c7be5;
    border-radius: 4px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#info-panel p {
    font-size: 13px;
    color: #444;
    line-height: 1.6;
}

.sources {
    border-top: 1px solid #c8daf5;
    padding-top: 10px;
}

.sources-title {
    font-size: 12px;
    font-weight: bold;
    color: #2c7be5;
    margin-bottom: 6px !important;
}

.sources ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sources ul li {
    font-size: 12px;
    color: #444;
    line-height: 1.5;
}

.sources ul li span {
    font-family: monospace;
    font-size: 11px;
    color: #777;
}

.methode {
    border-top: 1px solid #c8daf5;
    padding-top: 10px;
}

.methode p {
    font-size: 12px;
    color: #555;
    line-height: 1.6;
}

input {
    width: 100%;
    padding: 7px 10px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

button {
    width: 100%;
    padding: 9px;
    background: #2c7be5;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

button:hover { background: #1a5cbf; }

#resultats {
    background: #f0faf4;
    border-left: 3px solid #28a745;
    border-radius: 4px;
    padding: 12px;
}

#resultats h2 { color: #28a745; }
#resultats p { margin-bottom: 8px; line-height: 1.5; font-size: 13px; }
#resultats strong { color: #1a5cbf; }
#resultats button { margin-top: 8px; background: #28a745; }
#resultats button:hover { background: #1e7e34; }

#map { flex: 1; }

#message p {
    padding: 10px;
    background: #fff3cd;
    border-radius: 4px;
    color: #856404;
    font-size: 13px;
}

#section-analyse { }

#section-analyse .hint {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.5;
}

#resultats-analyse {
    background: #f5f0fc;
    border-left: 3px solid #7c3aed;
    border-radius: 4px;
    padding: 12px;
}

#resultats-analyse h2 { color: #7c3aed; }
#resultats-analyse p  { margin-bottom: 8px; line-height: 1.5; font-size: 13px; }
#resultats-analyse strong { color: #7c3aed; }

.alerte {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 12px;
    color: #856404;
    margin-top: 8px;
    line-height: 1.5;
}

.section-desc {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    font-style: italic;
}

#res-ia-hors-bati { color: #7c3aed; }

.analyse-bloc {
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 13px;
}

.analyse-titre {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.sam2-bloc {
    background: #f5f0fc;
    border-left: 3px solid #7c3aed;
}

.sam2-bloc .analyse-titre { color: #7c3aed; }
.sam2-bloc strong { color: #7c3aed; }

.sf-bloc {
    background: #e8f5e9;
    border-left: 3px solid #2e7d32;
}

.sf-bloc .analyse-titre { color: #2e7d32; }
.sf-bloc strong { color: #2e7d32; }

.classes {
    font-size: 11px;
    color: #555;
    font-style: italic;
}

.duree {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
}

#legende ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#legende li {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text, #444);
}

.legende-carre {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.15);
}

.legende-pct {
    margin-left: auto;
    color: #888;
    font-size: 11px;
    min-width: 36px;
    text-align: right;
}

.artificiel {
    font-weight: bold;
    color: #c0392b;
}

.btn-export {
    width: 100%;
    padding: 10px;
    background: #1a3c6e;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 6px;
}

.btn-export:hover { background: #142d52; }

.ou-clic {
    text-align: center;
    font-size: 11px;
    color: #aaa;
    margin-top: 8px;
    font-style: italic;
}

.slider-wrap {
    margin-bottom: 8px;
}
.slider-wrap label {
    font-size: 12px;
    color: #555;
    display: block;
    margin-bottom: 3px;
}
.slider-wrap input[type="range"] {
    width: 100%;
}

.progress-bar-bg {
    background: #e8e8e8;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: #2c7be5;
    width: 0%;
    transition: width 0.3s;
}

#slider-temporel-carte {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: bold;
    color: #1a3c6e;
    min-width: 280px;
}
#slider-temporel-carte input[type="range"] {
    flex: 1;
}

/* ── SÉLECTEUR DE MODE ── */
#mode-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    z-index: 1001;
    display: flex;
    background: #1a3c6e;
    padding: 8px;
    gap: 4px;
}

.mode-btn {
    flex: 1;
    padding: 7px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    background: rgba(255,255,255,0.15);
    color: white;
    transition: background 0.2s;
}

.mode-btn.active {
    background: white;
    color: #1a3c6e;
}

.mode-btn:hover:not(.active) {
    background: rgba(255,255,255,0.25);
}

#sidebar {
    padding-top: 44px;
}

/* ── RECHERCHE COMMUNE ── */
.search-wrap {
    position: relative;
}

.search-wrap input {
    width: 100%;
}

#commune-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    list-style: none;
    padding: 0;
    margin: 0;
}

#commune-suggestions li {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid #f0f0f0;
}

#commune-suggestions li:hover {
    background: #eef4fc;
    color: #1a3c6e;
}

#commune-suggestions li .code-insee {
    font-size: 10px;
    color: #aaa;
    margin-left: 6px;
}

/* ── TOGGLE ANALYSE COMMUNE ── */
.toggle-analyse {
    display: flex;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 6px;
    border: 1px solid #2c7be5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    background: white;
    color: #2c7be5;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: #2c7be5;
    color: white;
}

