/* =============================================
   ClicGIS – style.css
   ============================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; overflow: hidden; }
#map { width: 100%; height: 100vh; }

/* ===== BARRE DE CATÉGORIES ===== */
.category-bar {
    position: absolute; top: 10px; left: 60px; z-index: 1000;
    background: white; padding: 8px; border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex; gap: 6px;
}
.cat-btn {
    padding: 6px 12px; border-radius: 999px;
    border: 2px solid #ddd; background: #f9fafb;
    cursor: pointer; font-size: 13px;
    display: flex; align-items: center; gap: 4px;
}
.cat-btn:hover { background: #f3f4f6; }
.cat-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; }

/* ===== BARRE D'OUTILS ===== */
.toolbar {
    position: absolute; top: 60px; left: 60px; z-index: 1000;
    background: white; padding: 10px; border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex; gap: 5px; flex-wrap: wrap; max-width: 520px;
}
.tool-btn {
    padding: 8px 12px; border: 2px solid #ddd; background: white;
    cursor: pointer; border-radius: 4px; font-size: 13px; transition: all 0.2s;
}
.tool-btn:hover { background: #f0f0f0; }
.tool-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; }

/* ===== PANNEAU CALQUES ===== */
.layers-panel {
    position: absolute; top: 65px; right: 10px; bottom: 10px;
    width: 240px; z-index: 1000; background: white;
    border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    display: flex; flex-direction: column; overflow: hidden; font-size: 12px;
}
.layers-panel-header {
    padding: 8px 10px; border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; font-size: 13px; background: #f8fafc;
}
.layers-panel-header .count-badge {
    background: #e0e7ff; color: #3730a3;
    border-radius: 999px; font-size: 10px;
    padding: 1px 7px; font-weight: 700; min-width: 20px; text-align: center;
}
.layers-panel-header .count-badge.green { background: #dcfce7; color: #15803d; }
.layers-panel-sub {
    padding: 3px 10px; border-bottom: 1px solid #f3f4f6;
    background: #f9fafb; font-size: 11px; color: #6b7280;
}
.layers-refresh-btn {
    border: none; background: transparent; cursor: pointer;
    font-size: 14px; padding: 2px 4px;
}
.layers-list { flex: 1; overflow-y: auto; padding: 4px 6px 6px; }

.layer-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px; margin-bottom: 2px; border-radius: 5px; cursor: pointer;
    transition: background 0.1s;
}
.layer-item:hover { background: #f3f4f6; }
.layer-item-left { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.layer-type-icon {
    width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 10px;
}
.layer-type-icon.poly  { background: #dbeafe; color: #1d4ed8; }
.layer-type-icon.line  { background: #dcfce7; color: #15803d; }
.layer-type-icon.point { background: #fef9c3; color: #92400e; }
.layer-item-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.layer-item-title { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-item-meta  { font-size: 10px; color: #9ca3af; }
.layer-item-actions { display: flex; gap: 1px; flex-shrink: 0; }
.layer-item-actions button {
    border: none; background: transparent; cursor: pointer;
    font-size: 11px; padding: 2px 3px; border-radius: 3px;
}
.layer-item-actions button:hover { background: #e5e7eb; }

/* ===== SECTION ARBRES ===== */
.trees-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 10px; background: #f0fdf4;
    border-top: 1px solid #bbf7d0; border-bottom: 1px solid #bbf7d0;
}
.trees-section-header span { font-weight: 600; font-size: 12px; color: #15803d; }
.trees-section-body { padding: 5px 10px 7px; background: #f9fffe; }
.trees-count-row {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: #374151;
}

/* ===== BOUTONS ===== */
.btn-primary {
    padding: 7px 14px; background: #3b82f6; color: white;
    border: none; border-radius: 4px; cursor: pointer; font-size: 13px;
}
.btn-primary:hover { background: #2563eb; }

.btn-sm {
    padding: 2px 8px; font-size: 11px; border: none;
    border-radius: 4px; cursor: pointer; font-weight: 500;
}
.btn-sm.red   { background: #fee2e2; color: #dc2626; }
.btn-sm.red:hover   { background: #fecaca; }
.btn-sm.green { background: #dcfce7; color: #16a34a; }
.btn-sm.green:hover { background: #bbf7d0; }
.btn-sm.blue  { background: #dbeafe; color: #1d4ed8; }
.btn-sm.blue:hover  { background: #bfdbfe; }

/* ===== SOURCES ===== */
.source-item {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; margin-bottom: 4px; padding: 3px 4px; border-radius: 4px;
}
.source-item label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.source-item input[type="radio"],
.source-item input[type="checkbox"] { margin: 0; }

/* ===== SLIDER OPACITÉ ===== */
.source-item input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
    outline: none;
    margin-left: 6px;
    flex: none;
    width: 50px;
    min-width: 50px;
    cursor: pointer;
    padding: 0;
    border: none;
    box-shadow: none;
    vertical-align: middle;
}
.source-item input[type="range"]::-webkit-slider-container { background: transparent; }
.source-item input[type="range"]::-webkit-slider-runnable-track {
    height: 4px; border-radius: 2px; background: #d1d5db;
}
.source-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    margin-top: -4px;
    box-shadow: none;
    border: none;
}
.source-item input[type="range"]::-moz-range-track {
    height: 4px; border-radius: 2px; background: #d1d5db; border: none;
}
.source-item input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
    box-shadow: none;
}
.file-controls {
    position: absolute; top: 10px; right: 260px; z-index: 1000;
    background: white; padding: 8px 10px; border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex; gap: 8px;
}
input[type="file"] { display: none; }

/* ===== BARRE D'INFO ===== */
.info-panel {
    position: absolute; bottom: 10px; left: 10px; z-index: 1000;
    background: white; padding: 10px 15px; border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-size: 13px; max-width: 520px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ===== PANNEAUX FLOTTANTS ===== */
.floating-panel {
    position: absolute; z-index: 1000; background: white; padding: 10px;
    border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: none; font-size: 13px;
}
.floating-panel.show { display: block; }
.floating-panel input { padding: 4px; width: 80px; margin: 2px 0 4px; }
.floating-panel label { display: block; }

/* ===== DIVERS ===== */
.panel-divider { height: 1px; background: #e5e7eb; margin: 4px 0; }

.count-badge {
    background: #e0e7ff; color: #3730a3;
    border-radius: 999px; font-size: 10px;
    padding: 1px 7px; font-weight: 700; min-width: 20px; text-align: center;
}
.count-badge.green { background: #dcfce7; color: #15803d; }

/* ===== LEAFLET DRAW : poignées d'édition ===== */
.leaflet-div-icon.leaflet-editing-icon,
.leaflet-div-icon.leaflet-edit-move-icon {
    border-radius: 50%; border: 1px solid #2563eb; background: #bfdbfe;
    width: 8px !important; height: 8px !important;
    margin-left: -4px !important; margin-top: -4px !important;
    box-shadow: 0 0 2px rgba(37, 99, 235, 0.6);
}
.leaflet-editing-icon span { display: none; }

/* ===== TOOLTIP RPG ===== */
.rpg-tooltip {
    background: rgba(255,255,255,0.95);
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 12px;
    padding: 4px 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    color: #1f2937;
    line-height: 1.5;
}
