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

:root {
  --bg: #1a1a2e;
  --panel: #16213e;
  --accent: #0f3460;
  --highlight: #e94560;
  --text: #e0e0e0;
  --text-muted: #8a8a9a;
  --border: #2a2a4a;
  --input-bg: #0d1b2a;
  --success: #4caf50;
  --warning: #ff9800;
}

html, body { height: 100%; overflow: hidden; font-family: 'Segoe UI', system-ui, sans-serif; }

body {
  display: flex;
  background: var(--bg);
  color: var(--text);
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 1000;
}

#sidebar h1 {
  padding: 16px 20px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--highlight);
  border-bottom: 1px solid var(--border);
  letter-spacing: 2px;
  text-transform: uppercase;
}

section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

section h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Formulaires ─────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus { border-color: var(--highlight); }
input::placeholder { color: var(--text-muted); }

#gps-label { margin-bottom: 10px; }

.btn-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
button:hover { opacity: 0.85; }
button:active { transform: scale(0.97); }

.btn-primary   { background: var(--highlight); color: #fff; }
.btn-secondary { background: var(--accent); color: var(--text); }
.btn-active    { background: #1a5c2a; color: #7dffaa; border: 1px solid #4caf50; }
.full { width: 100%; }

.hint { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; }

.info-box {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

/* ── Points list ─────────────────────────────────────────── */
#points-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

#points-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
#points-list li:hover { border-color: var(--highlight); }

#points-list li .point-coords { color: var(--text-muted); font-size: 0.72rem; }
#points-count { font-weight: normal; color: var(--text-muted); }

/* ── Progress ────────────────────────────────────────────── */
#update-progress {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 44px;
  text-align: right;
}

.progress-bar {
  flex: 1;
  height: 7px;
  border-radius: 4px;
  border: none;
  appearance: none;
  background: var(--input-bg);
}
.progress-bar::-webkit-progress-bar   { background: var(--input-bg); border-radius: 4px; }
.progress-bar::-webkit-progress-value { background: var(--highlight); border-radius: 4px; transition: width 0.3s; }

.progress-bar.worker-bar::-webkit-progress-value { background: #4a90d9; }
.progress-bar.worker-bar.idle::-webkit-progress-value { background: #555; }

.progress-text {
  font-size: 0.68rem;
  color: var(--text-muted);
  min-width: 56px;
  text-align: right;
  white-space: nowrap;
}

.worker-tile {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-left: 50px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#update-status.error { color: var(--warning); }
#update-status.success { color: var(--success); }

.ok-estimate   { color: var(--success) !important; border-color: var(--success) !important; }
.warn-estimate { color: var(--warning) !important; border-color: var(--warning) !important; }
.error-estimate { color: #f44 !important; border-color: #f44 !important; }

.hidden { display: none !important; }

/* ── Carte ───────────────────────────────────────────────── */
#map {
  flex: 1;
  height: 100%;
  background: #111;
}

/* ── Coords overlay ──────────────────────────────────────── */
#crosshair-coords {
  position: fixed;
  bottom: 14px;
  right: 14px;
  background: rgba(22, 33, 62, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--text);
  pointer-events: none;
  z-index: 999;
  letter-spacing: 0.5px;
}

/* ── Indicateur zoom ─────────────────────────────────────── */
#zoom-indicator {
  position: fixed;
  bottom: 14px;
  right: 170px;
  background: rgba(22, 33, 62, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--highlight);
  pointer-events: none;
  z-index: 999;
  letter-spacing: 1px;
}

/* ── Leaflet overrides ───────────────────────────────────── */
.leaflet-control-attribution {
  background: rgba(22,33,62,0.85) !important;
  color: var(--text-muted) !important;
}
.leaflet-control-attribution a { color: var(--highlight) !important; }
