/* ==========================================================================
   V6 — Design ultra-moderne, mobile-first
   ========================================================================== */

/* === Tokens === */
:root {
  --primary: #0284c7;
  --primary-light: #0ea5e9;
  --primary-lighter: #38bdf8;
  --primary-soft: #e0f2fe;
  --primary-bg: #f0f9ff;
  --accent: #f59e0b;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-muted: #94a3b8;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.78);
  --shadow-1: 0 1px 2px rgba(15,23,42,.04);
  --shadow-2: 0 4px 14px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow-3: 0 12px 30px rgba(15,23,42,.10), 0 4px 8px rgba(15,23,42,.05);
  --shadow-cta: 0 10px 28px rgba(2,132,199,.40), 0 3px 8px rgba(2,132,199,.25);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
}

/* === Reset + base === */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

/* === Map === */
#map {
  width: 100%;
  height: calc(100vh - 88px); /* header + disclaimer */
  z-index: 1;
}
@media (min-width: 640px) {
  #map { height: calc(100vh - 100px); }
}

/* === Header — ultra-compact === */
.header-glass {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, .6);
  box-shadow: 0 1px 0 rgba(255,255,255,.5), 0 4px 16px -4px rgba(15,23,42,.08);
}

.brand-logo {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(2,132,199,.25);
}
.brand-logo svg { display: block; width: 100%; height: 100%; }

/* === Icon buttons (header) === */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(226,232,240,.7);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
}
.icon-btn:hover { background: white; border-color: var(--primary-lighter); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.icon-btn .badge-dot {
  position: absolute; top: -3px; right: -3px;
  background: var(--accent);
  color: white;
  font-size: 9px;
  font-weight: 800;
  border-radius: 9999px;
  padding: 2px 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  border: 1.5px solid white;
  min-width: 16px;
  line-height: 1;
}

/* === Widget profil (gauche) === */
.profile-chip {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(1.5) blur(12px);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.6);
  box-shadow: var(--shadow-2);
  padding: 8px 12px 8px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all .15s ease;
  min-width: 160px;
  max-width: 220px;
}
.profile-chip:hover {
  background: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-3);
}
.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(2,132,199,.25);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.profile-pseudo {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}
.profile-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 2px 7px 2px 5px;
  font-size: 10px;
  font-weight: 700;
  color: #78350f;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(202, 138, 4, .15);
}
.profile-badge-icon { font-size: 12px; }
.profile-badge-name {
  letter-spacing: .01em;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.profile-points { font-weight: 600; }

@media (max-width: 380px) {
  .profile-chip { min-width: 150px; max-width: 240px; padding: 6px 10px 6px 6px; gap: 8px; }
  .profile-avatar { width: 34px; height: 34px; font-size: 15px; }
  .profile-pseudo { font-size: 12px; }
  .profile-badge-name { max-width: 70px; }
}

/* === Floating chips (au-dessus de la carte) === */
.float-chip {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.5) blur(12px);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.6);
  box-shadow: var(--shadow-2);
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
}
.float-chip:hover { background: white; transform: translateY(-1px); box-shadow: var(--shadow-3); }
.float-chip .chip-emoji { font-size: 18px; }
.float-chip .chip-count {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  min-width: 22px;
  text-align: center;
}

/* === Pin marker — minimaliste === */
.pin-marker {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,.22);
  font-size: 12px;
  transition: transform .15s ease;
}
.pin-marker:hover { transform: rotate(-45deg) scale(1.2); z-index: 1000 !important; }
.pin-marker > span { transform: rotate(45deg); display: block; line-height: 1; }
.pin-marker.status-resolu { box-shadow: 0 0 0 2px var(--primary-lighter), 0 2px 6px rgba(0,0,0,.22); }
.pin-marker.status-en_cours { box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0,0,0,.22); }
.pin-marker.is-mine {
  box-shadow: 0 0 0 3px var(--primary), 0 0 0 6px rgba(2,132,199,.22), 0 3px 8px rgba(0,0,0,.28);
  animation: pulse-mine 2.4s ease-in-out infinite;
}
@keyframes pulse-mine {
  0%, 100% { box-shadow: 0 0 0 3px var(--primary), 0 0 0 6px rgba(2,132,199,.22), 0 3px 8px rgba(0,0,0,.28); }
  50% { box-shadow: 0 0 0 3px var(--primary), 0 0 0 11px rgba(2,132,199,.1), 0 3px 8px rgba(0,0,0,.28); }
}

/* Boundary */
.commune-boundary { filter: drop-shadow(0 0 6px rgba(2,132,199,.18)); }

/* Cluster */
.marker-cluster div { background: rgba(2, 132, 199, 0.92); color: white; font-weight: 700; font-family: inherit; font-size: 12px; }
.marker-cluster { background: rgba(2, 132, 199, 0.28); }

/* === Disclaimer (bas, ton neutre) === */
.disclaimer-bar {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink-soft);
  font-size: 11px;
  padding: 7px 12px;
  text-align: center;
  border-top: 1px solid var(--line);
  height: 32px;
  box-sizing: border-box;
  font-weight: 500;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.disclaimer-bar::-webkit-scrollbar { display: none; }
.disclaimer-bar a { color: var(--primary); text-decoration: none; font-weight: 600; }
.disclaimer-bar a:hover { text-decoration: underline; }

/* === Zoom Leaflet — repositionné en bas à gauche, au-dessus du disclaimer === */
.leaflet-bottom.leaflet-left {
  bottom: 44px !important; /* disclaimer 32px + 12px de marge */
  left: 12px !important;
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom {
  border: 1px solid rgba(226, 232, 240, .8);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15,23,42,.10), 0 1px 3px rgba(15,23,42,.05);
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom a {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  width: 36px;
  height: 36px;
  line-height: 34px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom a:hover {
  background: white;
  color: var(--primary);
}
/* Sur mobile, on cale au-dessus du FAB "Signaler" pour ne rien chevaucher */
@media (max-width: 639px) {
  .leaflet-bottom.leaflet-left {
    bottom: 44px !important;
    left: 10px !important;
  }
}

/* === Pages légales (mentions, CGU, etc.) === */
.legal-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 18px 80px;
  line-height: 1.6;
  color: var(--ink);
}
.legal-page h1 {
  font-size: 26px; font-weight: 800; color: var(--primary);
  margin: 8px 0 4px;
}
.legal-page .subtitle { color: var(--ink-soft); font-size: 13px; margin-bottom: 24px; }
.legal-page h2 {
  font-size: 18px; font-weight: 700; color: var(--ink);
  margin: 28px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.legal-page h3 {
  font-size: 15px; font-weight: 700; color: var(--ink);
  margin: 18px 0 6px;
}
.legal-page p, .legal-page li { font-size: 14px; color: var(--ink-soft); }
.legal-page ul, .legal-page ol { padding-left: 22px; }
.legal-page a { color: var(--primary); }
.legal-page .legal-callout {
  background: #fffbeb; border: 1px solid #fcd34d; border-radius: 12px;
  padding: 12px 14px; margin: 16px 0; font-size: 13px; color: #78350f;
}
.legal-page .legal-callout-red {
  background: #fef2f2; border: 1px solid #fca5a5; border-radius: 12px;
  padding: 12px 14px; margin: 16px 0; font-size: 13px; color: #7f1d1d;
}
.legal-page .legal-callout-blue {
  background: #eff6ff; border: 1px solid #93c5fd; border-radius: 12px;
  padding: 12px 14px; margin: 16px 0; font-size: 13px; color: #1e3a8a;
}
.legal-page table {
  width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px;
}
.legal-page th, .legal-page td {
  border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top;
}
.legal-page th { background: #f1f5f9; font-weight: 700; color: var(--ink); }
.legal-page .back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 600;
  margin-bottom: 8px;
}
.legal-footer {
  background: #0f172a; color: #cbd5e1;
  font-size: 12px; line-height: 1.65;
  padding: 20px 18px;
  text-align: center;
}
.legal-footer strong { color: white; }
.legal-footer a { color: #7dd3fc; text-decoration: none; }
.legal-footer a:hover { text-decoration: underline; }
.legal-footer .legal-footer-links {
  margin-top: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}

/* === FAB Mobile — élégant === */
.fab-mobile {
  position: fixed;
  right: 16px;
  bottom: 48px; /* au-dessus du disclaimer */
  z-index: 950;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 22px;
  border-radius: 9999px;
  box-shadow: var(--shadow-cta);
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform .2s cubic-bezier(.16,1,.3,1), box-shadow .2s;
  cursor: pointer;
}
.fab-mobile:active { transform: scale(0.96); }
.fab-mobile .fab-plus {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}
@media (min-width: 640px) { .fab-mobile { display: none !important; } }

/* === CTA dans le header (desktop) === */
.btn-cta {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  font-weight: 600;
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: var(--shadow-cta);
  border: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-cta:hover { transform: translateY(-1px); }
.btn-cta:active { transform: translateY(0); }

/* === Bottom sheet panel (récents mobile) === */
.bottom-sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 940;
  background: white;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -8px 30px rgba(15,23,42,.15);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.16,1,.3,1);
  max-height: 75vh;
  display: flex;
  flex-direction: column;
}
.bottom-sheet.expanded { transform: translateY(0); }
.bottom-sheet-handle {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
  cursor: pointer;
}
.bottom-sheet-handle::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 9999px;
}
.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.bottom-sheet-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.bottom-sheet-content {
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

/* === Filtres chips === */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 9999px;
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--line); background: white; color: var(--ink-soft);
  cursor: pointer; user-select: none;
  transition: all .15s ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--primary-lighter); }
.chip.active {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-lighter));
  color: white; border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(2, 132, 199, .25);
}

/* === Catégories formulaire === */
.cat-btn {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500; color: var(--ink-soft); cursor: pointer;
  background: white;
  transition: all .15s ease;
}
.cat-btn:hover { border-color: var(--primary-lighter); transform: translateY(-1px); }
.cat-btn.active {
  border-color: var(--primary-light); border-width: 2px;
  background: linear-gradient(180deg, var(--primary-bg) 0%, var(--primary-soft) 100%);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(2, 132, 199, .15);
}
.cat-btn .emoji { font-size: 26px; }

/* === Modale === */
.modal-card { animation: slide-up .25s cubic-bezier(.16, 1, .3, 1); }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Recent items === */
.recent-item {
  display: flex; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .12s;
}
.recent-item:hover, .recent-item:active { background: var(--primary-bg); }
.recent-item:last-child { border-bottom: none; }
.recent-item .icon-bubble {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* === Status badges === */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 9999px;
  font-size: 11px; font-weight: 600;
  color: white;
}

/* === Inputs === */
input, textarea, select { font-size: 16px; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-light) !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, .15);
}
@media (min-width: 640px) { input, textarea, select { font-size: 14px; } }

/* === Turnstile === */
.cf-turnstile-wrapper {
  display: flex;
  justify-content: center;
  min-height: 65px;
}

/* Anciens styles captcha gardés au cas où */
.captcha-box { display: none; }

/* === Drag hint === */
.drag-hint {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-cta);
  font-weight: 600;
}

/* === Welcome / onboarding === */
.welcome-hero {
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 50%, #38bdf8 100%);
  color: white;
}
.welcome-step {
  background: white;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
}
.welcome-step-num {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 32px 18px;
  color: var(--ink-soft);
}
.empty-state .icon { font-size: 40px; margin-bottom: 8px; display: block; opacity: 0.6; }
.empty-state .title { font-weight: 700; color: var(--ink); margin-bottom: 4px; font-size: 14px; }
.empty-state .desc { font-size: 12px; margin-bottom: 14px; line-height: 1.5; }

/* === Address suggestions === */
.address-suggestion {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
  transition: background .1s;
}
.address-suggestion:hover { background: var(--primary-bg); }
.address-suggestion:last-child { border-bottom: none; }

/* === Badges === */
.badge-medal {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
  color: #78350f;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(245,158,11,.3);
}

/* === Wind arrow === */
.wind-arrow {
  display: inline-block;
  transform-origin: center;
  transition: transform .3s ease;
}

/* === Hide scrollbars in chip rows === */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* === Recent panel desktop only === */
@media (min-width: 640px) {
  #bottomSheetRecent { display: none; }
  #recentDesktop { display: block; }
}
@media (max-width: 639px) {
  #recentDesktop { display: none; }
}
