* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:system-ui,sans-serif; background:#f5f5f5; height:100vh; display:flex; flex-direction:column; }

header { background:#1a1a2e; color:#fff; padding:10px 14px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; gap:12px; flex-wrap:wrap; }
header h1 { font-size:15px; margin:0; }
header p { font-size:11px; opacity:.8; margin:2px 0 0; }

.header-controls { display:flex; align-items:center; gap:12px; flex-wrap:wrap; background:rgba(255,255,255,0.08); padding:6px 12px; border-radius:8px; }
.header-control-item { display:flex; align-items:center; gap:6px; font-size:12px; }
.header-control-item label { font-size:11px; opacity:0.9; white-space:nowrap; }
.header-control-item input, .header-control-item select { padding:4px 8px; border:1px solid #444; border-radius:4px; font-size:12px; background:#fff; color:#333; outline:none; }

.btn { padding:7px 12px; border:none; border-radius:6px; font-size:12px; cursor:pointer; font-weight:600; display:inline-flex; align-items:center; justify-content:center; gap:6px; transition:0.2s; }
.btn-primary { background:#e94560; color:#fff; font-size:13px; padding:8px 16px; border: 2px solid #ffb3c1;}
.btn-primary:hover { background:#c9184a; }
.btn-secondary { background:#0f3460; color:#fff; }
.btn-success { background:#4CAF50; color:#fff; }
.btn-clear { background:#dc3545; color:#fff; }
.btn-info { background:#17a2b8; color:#fff; }
.btn-warning { background:#ff9800; color:#fff; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn-danger { background:#dc3545; color:#fff; padding:3px 8px; font-size:11px; border:none; border-radius:4px; cursor:pointer; }

main { display:flex; flex:1; overflow:hidden; }
.content-area { flex:1; display:flex; flex-direction:column; min-width:0; position:relative; }
#map { flex:1; background:#e5e5e5; }

#elevation-container { height:190px; background:#fff; border-top:2px solid #ddd; padding:8px 12px; display:none; flex-direction:column; gap:4px; }
.elevation-header { display:flex; justify-content:space-between; align-items:center; font-size:11px; font-weight:bold; color:#1a1a2e; }
.elevation-stats { font-size:11px; color:#e94560; font-weight:bold; background:#fff0f3; padding:3px 8px; border-radius:4px; border:1px solid #ffccd5; }
.elevation-chart-wrapper { flex:1; position:relative; min-height:120px; }

.sidebar { width:400px; flex-shrink:0; background:#fff; border-left:1px solid #ddd; overflow-y:auto; padding:12px; display:flex; flex-direction:column; }
.sidebar h3 { font-size:11px; margin-bottom:6px; color:#555; text-transform:uppercase; letter-spacing:.5px; }

.legend { margin-bottom:8px; padding:8px; background:#fafafa; border-radius:6px; display:flex; gap:10px; flex-wrap:wrap; }
.legend-item { display:flex; align-items:center; gap:6px; font-size:11px; }
.legend-bar { width:12px; height:3px; border-radius:2px; }

.options { padding:10px; border-radius:6px; background:#fafafa; border:1px solid #e0e0e0; margin-bottom:10px; }
.options label { display:flex; align-items:center; gap:8px; font-size:11px; margin-bottom:5px; cursor:pointer; }
.options input[type="checkbox"], .options input[type="radio"] { accent-color:#e94560; width:14px; height:14px; }

.edit-box { padding:10px; border-radius:6px; background:#fff0f3; border:1px solid #ffccd5; margin-bottom:10px; }
.edit-box h3 { color:#c9184a; margin-bottom:4px; }
.edit-tools { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.edit-tool-btn { display:flex; align-items:center; gap:8px; padding:6px 10px; background:#fff; border:1px solid #ffb3c1; border-radius:4px; font-size:11px; cursor:pointer; font-weight:600; color:#800f2f; }
.edit-tool-btn.active { background:#c9184a; color:#fff; border-color:#800f2f; }

.mode-group { margin-bottom:8px; padding:8px; background:#fff; border-radius:6px; border:1px solid #e0e0e0; display:flex; flex-direction:column; gap:6px; }
.mode-group label { font-weight:600; }
.dynamic-options-panel { background:#eef2f5; border:1px solid #d0d7de; border-radius:6px; padding:8px; margin-top:6px; font-size:10px; color:#555; line-height:1.4; }
.dynamic-options-panel h4 { font-size:11px; color:#0f3460; margin-bottom:6px; text-transform:uppercase; }

.export-group { display:flex; flex-direction:column; gap:6px; margin-top:8px; padding:8px; background:#f0f4ff; border-radius:6px; }
.export-row { display:flex; gap:6px; }

#status { padding:8px; border-radius:6px; font-size:11px; margin-bottom:10px; font-weight:bold; }
.status-info { background:#e3f2fd; color:#1565c0; border:1px solid #90caf9;}
.status-warn { background:#fff3e0; color:#e65100; border:1px solid #ffcc80;}
.status-ok { background:#e8f5e9; color:#2e7d32; border:1px solid #a5d6a7; }
.status-err { background:#ffebee; color:#c62828; border:1px solid #ef9a9a;}

.wp-list { flex:1; overflow-y:auto; border:1px solid #e0e0e0; border-radius:6px; background:#fafafa; padding:4px; min-height:150px; max-height:240px; }
.wp-item { display:flex; flex-direction:column; gap:4px; padding:6px 8px; background:#fff; border-radius:4px; margin-bottom:6px; border:1px solid #e8e8e8; }
.wp-item-row { display:flex; align-items:center; gap:6px; }
.wp-item:hover { background:#f0f4ff; }
.wp-item .drag-handle { cursor:grab; color:#999; font-size:14px; user-select:none; font-family:monospace; }
.wp-item .wp-num { font-weight:700; min-width:20px; font-size:11px; }
.wp-item .wp-name { flex:1; font-size:11px; font-weight:bold; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wp-item select.wp-day-select { font-size:10px; padding:2px; border-radius:3px; border:1px solid #ccc; }
.wp-label-input { font-size:10px; padding:3px 6px; border:1px solid #ddd; border-radius:3px; width:100%; color:#555; }

.add-wp-container { position:relative; margin-top:8px; flex-shrink:0; }
.add-wp { display:flex; gap:6px; position:relative; }
.add-wp input { flex:1; padding:8px 10px; border:1px solid #ddd; border-radius:6px; font-size:12px; outline:none; }
.add-wp input:focus { border-color:#e94560; }

.suggestions-list { position:absolute; bottom:100%; left:0; right:42px; background:#fff; border:1px solid #ccc; border-bottom:none; border-radius:6px 6px 0 0; max-height:180px; overflow-y:auto; z-index:3000; box-shadow:0 -4px 10px rgba(0,0,0,0.1); display:none; }
.suggestion-item { padding:8px 10px; font-size:11px; border-bottom:1px solid #eee; cursor:pointer; color:#333; text-align:left; background:#fff; }
.suggestion-item:hover { background:#f0f4ff; color:#0f3460; font-weight:bold; }

/* Modals */
.modal-overlay { position:fixed; top:0; left:0; width:100vw; height:100vh; background:rgba(0,0,0,0.5); display:none; justify-content:center; align-items:center; z-index:2000; }
.modal-content { background:#fff; border-radius:10px; width:90%; max-width:550px; display:flex; flex-direction:column; padding:20px; box-shadow:0 10px 25px rgba(0,0,0,0.3); max-height:85vh; }
.modal-header { display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid #eee; padding-bottom:10px; margin-bottom:15px; }
.modal-header h2 { font-size:15px; color:#1a1a2e; }

.form-group { display:flex; flex-direction:column; gap:6px; margin-bottom:12px; text-align:left; }
.form-group label { font-size:11px; font-weight:bold; color:#333; }
.form-group select, .form-group input { padding:6px 10px; border:1px solid #ccc; border-radius:4px; font-size:12px; outline:none; }

.rb-modal-body { overflow-y:auto; flex:1; font-size:11px; margin-bottom:15px; }
.rb-table { width:100%; border-collapse:collapse; text-align:left; }
.rb-table th { background:#0f3460; color:#fff; padding:6px 8px; position:sticky; top:0; }
.rb-table td { padding:6px 8px; border-bottom:1px solid #eee; }

.poi-popup-btn { display:block; margin-top:4px; padding:5px 8px; background:#17a2b8; color:#fff !important; border-radius:4px; text-decoration:none; font-size:10px; font-weight:bold; text-align:center; border:none; cursor:pointer; width:100%; }
.btn-streetview { background:#34a853; }
.btn-streetview:hover { background:#2d8e47; }

.leaflet-div-icon { background: transparent !important; border: none !important; }

.cursor-add { cursor: crosshair !important; }
.cursor-delete { cursor: not-allowed !important; }
.cursor-move { cursor: move !important; }

.weather-badge { display:inline-flex; align-items:center; justify-content:center; gap:4px; background:#e0f2fe; color:#0369a1; padding:4px 8px; border-radius:4px; font-size:11px; font-weight:bold; margin:6px 0; width:100%; border:1px solid #bae6fd; }
.address-badge { font-size:10px; color:#555; background:#f1f5f9; padding:4px 6px; border-radius:4px; margin:4px 0; display:block; text-align:left; line-height:1.3; }
.fuel-prices-badge { font-size:10px; color:#b71c1c; background:#ffebee; padding:4px 6px; border-radius:4px; margin:4px 0; display:block; text-align:left; line-height:1.3; font-weight:bold; }

.trace-tooltip { font-size:11px; background:#1a1a2e; color:#fff; border-radius:6px; padding:6px 10px; border:none; box-shadow:0 3px 8px rgba(0,0,0,0.4); line-height:1.4; }
.poi-panel { padding:10px; border-radius:6px; background:#f8f9fa; border:1px solid #e0e0e0; margin-bottom:10px; }
.poi-panel h3 { font-size:11px; margin-bottom:8px; color:#555; text-transform:uppercase; letter-spacing:.5px; }
.poi-grid { display:grid; grid-template-columns: 1fr 1fr; gap:6px; }
.poi-item { display:flex; align-items:center; gap:6px; font-size:11px; cursor:pointer; padding:4px 6px; border-radius:4px; background:#fff; border:1px solid #e0e0e0; transition:0.15s; }
.poi-item:hover { background:#f0f4ff; border-color:#90caf9; }
.poi-item input { accent-color:#e94560; width:14px; height:14px; cursor:pointer; }
.poi-item.active { background:#e3f2fd; border-color:#2196F3; font-weight:600; }
.poi-loading { font-size:10px; color:#666; text-align:center; padding:4px; }
.poi-count { font-size:9px; color:#888; margin-left:auto; }
.poi-popup-img { max-width:180px; max-height:120px; border-radius:6px; margin:6px 0; display:block; }
.poi-addr-loading { font-size:10px; color:#888; font-style:italic; }


/* SPINNER DE CHARGEMENT POI */
.poi-spinner-overlay { position:fixed; top:0; left:0; width:100vw; height:100vh; background:rgba(0,0,0,0.4); display:none; justify-content:center; align-items:center; z-index:5000; }
.poi-spinner { width:50px; height:50px; border:4px solid #f3f3f3; border-top:4px solid #e94560; border-radius:50%; animation:spin 1s linear infinite; }
@keyframes spin { 0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);} }

/* PANNEAU POI SAUVEGARDÉS */
.saved-poi-panel { padding:10px; border-radius:6px; background:#fff8e1; border:1px solid #ffe082; margin-bottom:10px; }
.saved-poi-panel h3 { font-size:11px; margin-bottom:6px; color:#555; text-transform:uppercase; letter-spacing:.5px; }
.saved-poi-list { max-height:120px; overflow-y:auto; }
.saved-poi-item { display:flex; align-items:center; gap:6px; padding:4px 6px; background:#fff; border-radius:4px; margin-bottom:4px; font-size:11px; border:1px solid #ffe082; }
.saved-poi-item .poi-icon { font-size:14px; }
.saved-poi-item .poi-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.saved-poi-item .poi-remove { color:#c62828; cursor:pointer; font-size:12px; font-weight:bold; }

/* BOUTON AJOUTER AU PROJET DANS POPUP */
.btn-add-project { display:block; margin-top:6px; padding:5px 8px; background:#4CAF50; color:#fff !important; border-radius:4px; text-decoration:none; font-size:10px; font-weight:bold; text-align:center; border:none; cursor:pointer; width:100%; }
.btn-add-project:hover { background:#388E3C; }
.btn-add-project.added { background:#9E9E9E; }
