/* =========================================================================
   RSE Photo Map — feuille de style de la page principale.
   ========================================================================= */
:root {
  --accent: #2563eb;
  --bg: #0f172a;
  --panel: #1e293b;
  --panel2: #243043;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --danger: #dc2626;
  --topbar-h: 56px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---- Barre supérieure ---- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 .9rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.brand { font-weight: 700; }
.stats { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.spacer { flex: 1; }
.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: .45rem .7rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--panel2); }

/* ---- Bandeaux d'avertissement ---- */
.banner { padding: .55rem .9rem; font-size: .85rem; }
.banner.err  { background: #7f1d1d; color: #fecaca; }
.banner.warn { background: #78350f; color: #fde68a; }
.banner code { background: rgba(0,0,0,.25); padding: 0 .25rem; border-radius: 4px; }

/* ---- Panneau d'upload ---- */
.uploader {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: .9rem;
  flex: 0 0 auto;
}
.uploader.hidden { display: none; }
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1.4rem;
  text-align: center;
  transition: background .15s, border-color .15s;
}
.dropzone.drag { border-color: var(--accent); background: rgba(37,99,235,.12); }
.dz-main { margin: 0 0 .25rem; font-weight: 600; }
.dz-sub  { margin: 0; color: var(--muted); font-size: .85rem; }
.link { color: #93c5fd; cursor: pointer; text-decoration: underline; }

.progress-wrap { margin-top: .9rem; }
.progress-wrap.hidden, .summary.hidden { display: none; }
.progress {
  height: 10px; background: var(--panel2); border-radius: 999px; overflow: hidden;
}
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.progress-text { margin-top: .35rem; font-size: .8rem; color: var(--muted); }

.summary { margin-top: .9rem; font-size: .85rem; }
.summary .row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }
.summary .chip {
  background: var(--panel2); padding: .25rem .6rem; border-radius: 999px;
}
.summary .chip b { color: #fff; }
.summary .errlist { color: #fca5a5; margin: .3rem 0 0; padding-left: 1.1rem; }

/* ---- Contenu : carte + sidebar ---- */
.content { flex: 1; display: flex; min-height: 0; }
#map { flex: 1; min-height: 0; background: #1a2435; }

.sidebar {
  width: 300px; flex: 0 0 300px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: .9rem;
  overflow-y: auto;
}
.sidebar h2 { font-size: .95rem; margin: 0 0 .3rem; display: flex; align-items: center; gap: .4rem; }
.pill {
  background: var(--panel2); color: var(--muted);
  border-radius: 999px; padding: 0 .5rem; font-size: .75rem; font-weight: 600;
}
.hint { color: var(--muted); font-size: .78rem; margin: 0 0 .8rem; }

.nogeo-list { display: flex; flex-direction: column; gap: .55rem; }
.nogeo-item {
  display: flex; gap: .55rem; align-items: center;
  background: var(--panel2); border-radius: 10px; padding: .45rem;
}
.nogeo-item img {
  width: 54px; height: 54px; object-fit: cover; border-radius: 7px; flex: 0 0 auto; background:#000;
}
.nogeo-meta { min-width: 0; flex: 1; }
.nogeo-meta .name { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nogeo-meta .date { font-size: .72rem; color: var(--muted); }
.empty { color: var(--muted); font-size: .82rem; font-style: italic; }

/* ---- Popup d'un marqueur ---- */
.popup-card { width: 240px; }
.popup-card img.thumb {
  width: 240px; height: auto; max-height: 220px; object-fit: cover;
  border-radius: 8px; display: block; cursor: zoom-in; background:#000;
}
.popup-card .pname { font-weight: 600; font-size: .85rem; margin: .45rem 0 .15rem; word-break: break-word; }
.popup-card .pdate { color: #555; font-size: .78rem; }
.popup-card .pactions { margin-top: .5rem; display: flex; gap: .5rem; }
.popup-card a.open { font-size: .8rem; }

/* Boutons de suppression (popup + sidebar) */
.btn-del {
  border: 1px solid var(--danger); color: #fff; background: var(--danger);
  border-radius: 7px; padding: .3rem .55rem; font-size: .78rem; cursor: pointer;
}
.btn-del:hover { filter: brightness(1.08); }
.btn-del.small { padding: .2rem .45rem; font-size: .72rem; }

/* ====================== Catégories de points ====================== */
/* Choix de la catégorie à l'upload */
.cat-choose {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-bottom: .8rem;
}
.cc-label { color: var(--muted); font-size: .85rem; }
.cc-opt {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; cursor: pointer;
  background: var(--panel2); padding: .35rem .65rem; border-radius: 8px;
}
.cc-opt input { cursor: pointer; }
.cat-dot {
  width: 11px; height: 11px; border-radius: 50%; display: inline-block;
  border: 1px solid rgba(0,0,0,.35); flex: 0 0 auto;
}

/* Épingles colorées (divIcon SVG) */
.cat-pin { background: none; border: none; }
.cat-pin svg { display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.45)); }

/* Légende / filtre posé sur la carte */
.cat-legend {
  background: rgba(30,41,59,.94); color: var(--text);
  padding: .55rem .65rem; border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.45); font-size: .82rem; line-height: 1.25;
}
.cat-legend-title { font-weight: 700; margin-bottom: .45rem; font-size: .8rem; }
.cat-row { display: flex; align-items: center; gap: .45rem; padding: .18rem 0; cursor: pointer; }
.cat-row input { cursor: pointer; margin: 0; }
.cat-swatch {
  width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.35);
}
.cat-label { flex: 1; }
.cat-count { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Badge + sélecteur de catégorie dans les popups (fond clair) */
.cat-badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: #444; margin-top: .4rem; }
.popup-card .cat-select-wrap { margin-top: .45rem; font-size: .78rem; color: #555; }
.cat-select { font-size: .78rem; padding: .12rem .25rem; border-radius: 6px; }

/* Réactif : sidebar repliée sous la carte sur petit écran */
@media (max-width: 720px) {
  .content { flex-direction: column; }
  .sidebar { width: auto; flex: 0 0 auto; max-height: 38vh; border-left: 0; border-top: 1px solid var(--border); }
  .stats { display: none; }
}
