/* ══════════════════════════════════════════════
   PARKSPOT v3 — main.css
   Tema: Urban Dark / Monochrome + Acid Green
   ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── TOKENS ──────────────────────────────────── */
:root {
  --bg-base:      #080b0f;
  --bg-surface:   #0e1218;
  --bg-elevated:  #151b24;
  --bg-overlay:   #1c242f;

  --accent:       #b6f542;   /* acid green */
  --accent-dim:   #7aaa2a;
  --accent-glow:  #b6f54230;

  --amber:        #f0c040;
  --red:          #f06060;
  --red-dim:      #a03030;

  --text-primary:   #e8ead4;
  --text-secondary: #8a9080;
  --text-muted:     #4a5248;

  --border:       #1e2820;
  --border-light: #2a3828;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm: 0 2px 8px #00000060;
  --shadow-md: 0 8px 24px #00000080;
  --shadow-lg: 0 16px 48px #000000a0;

  --font-display: 'Syne', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

/* ── RESET & BASE ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-display);
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ──────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ── HEADER ──────────────────────────────────── */
#header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 54px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 100; position: relative;
}
#logo {
  font-family: var(--font-mono);
  font-size: 15px; font-weight: 500;
  color: var(--accent); letter-spacing: 2px;
  text-transform: uppercase;
}
#logo em { color: var(--text-secondary); font-style: normal; }
#header-right { display: flex; align-items: center; gap: 12px; }

/* Pill de estadísticas */
.stat-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px; font-size: 12px;
  color: var(--text-secondary);
}
.stat-pill strong {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--accent); font-weight: 500;
}
.stat-pill.users strong { color: var(--amber); }

/* Indicador de conexión */
#conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); transition: background 0.4s;
  flex-shrink: 0;
}
#conn-dot.on  { background: var(--accent); animation: pulse-dot 2.5s infinite; }
#conn-dot.off { background: var(--red); }
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50%      { box-shadow: 0 0 0 5px transparent; }
}

/* ── MAP AREA ────────────────────────────────── */
#map-wrap { position: relative; flex: 1; min-height: 0; }
#map { width: 100%; height: 100%; }

/* ── FLOATING BUTTONS ────────────────────────── */
#report-btn {
  position: absolute; bottom: 100px; right: 16px; z-index: 500;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 1px; text-transform: uppercase;
  background: var(--accent); color: var(--bg-base);
  border: none; padding: 13px 20px; border-radius: var(--radius-lg);
  cursor: pointer; box-shadow: 0 4px 20px var(--accent-glow);
  transition: all 0.2s; display: flex; align-items: center; gap: 8px;
}
#report-btn:hover:not(:disabled)  { transform: translateY(-2px); box-shadow: 0 8px 28px var(--accent-glow); }
#report-btn:active:not(:disabled) { transform: scale(0.97); }
#report-btn.picking  { background: var(--amber); box-shadow: 0 4px 20px #f0c04040; }
#report-btn:disabled { opacity: 0.45; cursor: not-allowed; }
#report-btn .btn-icon { font-size: 16px; }

#locate-btn {
  position: absolute; bottom: 160px; right: 16px; z-index: 500;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  color: var(--text-secondary); font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; box-shadow: var(--shadow-sm);
}
#locate-btn:hover { border-color: var(--accent); color: var(--accent); }
#locate-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

/* ── LEGEND ──────────────────────────────────── */
#legend {
  position: absolute; top: 14px; left: 14px; z-index: 500;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 13px;
  font-size: 11px; color: var(--text-secondary); line-height: 2;
}
.leg-row { display: flex; align-items: center; gap: 7px; }
.leg-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ── BOTTOM PANEL ────────────────────────────── */
#panel {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 600;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 14px 18px 18px;
  transform: translateY(0); transition: transform 0.25s ease;
}
#panel.hidden { transform: translateY(100%); }
#panel-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 2px;
  color: var(--accent); font-weight: 600; margin-bottom: 10px;
}
#panel-body { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Badges */
.badge {
  font-size: 11px; font-family: var(--font-mono);
  padding: 4px 10px; border-radius: 20px;
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border); white-space: nowrap;
}
.badge.green { background: #0d2e10; color: var(--accent); border-color: #1a4820; }
.badge.amber { background: #2e230a; color: var(--amber); border-color: #4a3a10; }
.badge.red   { background: #2a0d0d; color: var(--red);   border-color: #4a1a1a; }

/* Vote buttons */
.vote-btn {
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 5px;
}
.vote-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.vote-btn.yes:hover { background: #0d2e10; border-color: var(--accent); color: var(--accent); }
.vote-btn.no:hover  { background: #2a0d0d; border-color: var(--red); color: var(--red); }
.vote-btn:disabled  { opacity: 0.4; cursor: not-allowed; }

/* Nav button */
.nav-btn {
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: var(--radius-sm);
  border: 1px solid #1a2e4a; background: #0d1a2e;
  color: #4a90e2; cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 5px; text-decoration: none;
}
.nav-btn:hover { background: #152040; border-color: #4a90e2; }

/* ── MODAL ───────────────────────────────────── */
#modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: #080b0fcc; z-index: 2000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
#modal-backdrop.open { display: flex; }
.modal-box {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-xl); padding: 28px 24px;
  width: 340px; max-width: 92vw;
  animation: modal-in 0.2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.modal-box h3 {
  font-family: var(--font-mono); font-size: 14px; font-weight: 500;
  color: var(--accent); margin-bottom: 8px; letter-spacing: 1px;
}
.modal-box p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; }
.modal-row { display: flex; gap: 10px; }
.modal-row button {
  flex: 1; padding: 12px; border-radius: var(--radius-md);
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; border: 1px solid var(--border);
}
#m-cancel  { background: var(--bg-surface); color: var(--text-secondary); }
#m-cancel:hover  { background: var(--bg-overlay); }
#m-confirm { background: var(--accent); color: var(--bg-base); border-color: var(--accent); }
#m-confirm:hover { filter: brightness(1.1); }
#m-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── ONBOARDING ──────────────────────────────── */
#onboarding {
  display: none; position: fixed; inset: 0;
  background: var(--bg-base); z-index: 9000;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 24px; text-align: center;
}
#onboarding.open { display: flex; }
#ob-logo {
  font-family: var(--font-mono); font-size: 32px; font-weight: 500;
  color: var(--accent); letter-spacing: 3px; margin-bottom: 8px;
}
#ob-logo em { color: var(--text-secondary); font-style: normal; }
#ob-tagline { font-size: 14px; color: var(--text-secondary); margin-bottom: 48px; }
.ob-steps { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 320px; margin-bottom: 40px; }
.ob-step {
  display: flex; align-items: flex-start; gap: 16px; text-align: left;
  animation: ob-fade 0.5s ease both;
}
.ob-step:nth-child(1) { animation-delay: 0.1s; }
.ob-step:nth-child(2) { animation-delay: 0.2s; }
.ob-step:nth-child(3) { animation-delay: 0.3s; }
.ob-step:nth-child(4) { animation-delay: 0.4s; }
@keyframes ob-fade { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.ob-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md); flex-shrink: 0;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.ob-text h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.ob-text p  { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
#ob-start {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  letter-spacing: 1px; text-transform: uppercase;
  background: var(--accent); color: var(--bg-base);
  border: none; padding: 15px 40px; border-radius: var(--radius-lg);
  cursor: pointer; box-shadow: 0 4px 24px var(--accent-glow);
  transition: all 0.2s; animation: ob-fade 0.5s 0.5s ease both;
}
#ob-start:hover { transform: translateY(-2px); filter: brightness(1.1); }

/* ── LOADER ──────────────────────────────────── */
#loader {
  position: fixed; inset: 0; background: var(--bg-base);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 8000; transition: opacity 0.6s;
}
#loader.out { opacity: 0; pointer-events: none; }
#loader-logo { font-family: var(--font-mono); font-size: 26px; color: var(--accent); letter-spacing: 3px; margin-bottom: 12px; }
#loader-logo em { color: var(--text-secondary); font-style: normal; }
#loader-sub { font-size: 12px; color: var(--text-muted); letter-spacing: 1px; }
#loader-bar { width: 140px; height: 2px; background: var(--bg-elevated); border-radius: 2px; margin-top: 20px; overflow: hidden; }
#loader-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width 1.4s ease; }
#loader-err  { font-size: 13px; color: var(--amber); margin-top: 12px; display: none; max-width: 280px; text-align: center; line-height: 1.5; }

/* ── TOAST ───────────────────────────────────── */
#toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  color: var(--text-primary); padding: 10px 20px; border-radius: 30px;
  font-size: 13px; font-weight: 600; z-index: 7000;
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
  pointer-events: none; white-space: nowrap;
  transform: translateX(-50%) translateY(-8px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok  { border-color: var(--accent); color: var(--accent); }
#toast.err { border-color: var(--red); color: var(--red); }
#toast.info{ border-color: var(--border-light); color: var(--text-primary); }

/* ── LEAFLET OVERRIDES ───────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  color: var(--text-primary) !important;
}
.leaflet-popup-content { color: var(--text-primary) !important; font-family: var(--font-display) !important; font-size: 13px !important; }
.leaflet-popup-tip { background: var(--bg-elevated) !important; }
.leaflet-popup-close-button { color: var(--text-secondary) !important; font-size: 18px !important; top: 6px !important; right: 8px !important; }
.leaflet-bar a {
  background: var(--bg-elevated) !important; color: var(--text-secondary) !important;
  border-color: var(--border) !important; font-family: var(--font-mono) !important;
}
.leaflet-bar a:hover { background: var(--bg-overlay) !important; color: var(--text-primary) !important; }

/* Cluster personalizado */
.ps-cluster {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 2px solid var(--accent);
  border-radius: 50%; color: var(--accent);
  font-family: var(--font-mono); font-weight: 500; font-size: 13px;
  box-shadow: 0 0 0 4px var(--accent-glow);
  transition: transform 0.15s;
}
.ps-cluster:hover { transform: scale(1.1); }
.ps-cluster.large { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 0 4px #f0c04030; }
.ps-cluster.huge  { border-color: var(--red);   color: var(--red);   box-shadow: 0 0 0 4px #f0606030; }

/* Dot de usuario */
.user-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #4a90e2; border: 3px solid white;
  box-shadow: 0 0 0 4px #4a90e240;
  animation: user-pulse 2s infinite;
}
@keyframes user-pulse {
  0%,100% { box-shadow: 0 0 0 4px #4a90e240; }
  50%      { box-shadow: 0 0 0 8px transparent; }
}

/* Responsive */
@media (max-width: 480px) {
  #legend { display: none; }
  #panel { padding: 12px 14px 16px; }
  .modal-box { padding: 22px 18px; }
}
