/* ============================================================
   ECOSENDERISMO — Sistema de Diseño Natural
   Paleta: Crema / Tierra / Verde EcoVerde
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;700;900&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

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

:root {
  --cream:    #F7F4EE;
  --cream-2:  #EEEAE1;
  --cream-3:  #E2DDD4;
  --parch:    #D4CFC5;
  --bark:     #2C2218;
  --bark-2:   #4A3D2E;
  --bark-3:   #7A6B58;
  --bark-4:   #A89880;
  --eco:      #3CAB2A;
  --eco-d:    #1D6B10;
  --eco-l:    #7ACC5E;
  --eco-pale: #E8F7E5;
  --accent:   #C8421A;
  --nav-h:    64px;
  --font-d:   'Montserrat', sans-serif;
  --font-s:   'Lora', serif;
}

html { scroll-behavior: smooth; }
body { background: var(--cream); color: var(--bark); font-family: var(--font-d); overflow-x: hidden; }

/* ─── NAVBAR ─── */
.eco-nav {
  position: sticky; top: 0; z-index: 900;
  background: var(--cream);
  border-bottom: 1px solid var(--cream-3);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: var(--nav-h);
}

.eco-nav-brand {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
}
.eco-nav-brand-name {
  font-family: var(--font-d); font-weight: 900; font-size: 14.5px;
  letter-spacing: -0.2px; text-transform: uppercase; color: var(--bark);
}
.eco-nav-brand-name span { color: var(--eco); }

.eco-nav-links { display: flex; gap: 32px; list-style: none; }
.eco-nav-links a {
  text-decoration: none; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase; color: var(--bark-3);
  transition: color .15s;
}
.eco-nav-links a:hover { color: var(--bark); }

.eco-nav-right { display: flex; gap: 10px; align-items: center; }

.btn-nav-ghost {
  background: none; border: none; font-family: var(--font-d); font-size: 11.5px;
  font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--bark-3); cursor: pointer; padding: 8px 4px;
  transition: color .15s;
}
.btn-nav-ghost:hover { color: var(--bark); }

.btn-eco {
  background: var(--eco); color: #fff; border: none;
  padding: 9px 20px; border-radius: 6px; font-family: var(--font-d);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  cursor: pointer; transition: background .2s;
}
.btn-eco:hover { background: var(--eco-d); }

/* ─── BOTONES GENÉRICOS ─── */
.btn-primary {
  background: var(--bark); color: #fff; border: none;
  padding: 14px 28px; border-radius: 6px; font-family: var(--font-d);
  font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  transition: background .2s; text-decoration: none;
}
.btn-primary:hover { background: var(--bark-2); }

.btn-secondary {
  background: transparent; color: var(--bark-2);
  border: 1.5px solid var(--parch);
  padding: 14px 22px; border-radius: 6px; font-family: var(--font-d);
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  cursor: pointer; transition: border-color .15s; text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { border-color: var(--bark-3); }

/* ─── SPLASH SCREEN ─── */
#splashScreen {
  position: fixed; z-index: 9999;
  background: var(--cream);
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 16px;
}
#splashScreen svg { width: 140px; height: auto; animation: fadeIn .5s ease; }
#splashScreen .splash-name {
  font-family: var(--font-d); font-weight: 900; font-size: 13px;
  letter-spacing: 2px; text-transform: uppercase; color: var(--bark-3);
  animation: fadeIn .8s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── MAPA ─── */
#map {
  position: fixed;
  top: var(--nav-h);
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
}

/* Panel de control izquierdo */
#map-panel {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  width: 300px;
  background: var(--cream);
  border-right: 1px solid var(--cream-3);
  z-index: 500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#map-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--cream-3);
  flex-shrink: 0;
}
#map-panel-header h3 {
  font-family: var(--font-s); font-size: 16px; font-weight: 600;
  color: var(--bark); margin-bottom: 10px;
}
#map-panel-body { flex: 1; overflow-y: auto; padding: 12px 0; }

/* Panel cerrado en mobile */
#map-panel.hidden { transform: translateX(-100%); }

/* Toggle panel btn */
#panel-toggle {
  position: fixed; top: calc(var(--nav-h) + 12px); left: 12px; z-index: 600;
  background: var(--cream); border: 1px solid var(--cream-3);
  border-radius: 8px; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px;
  box-shadow: 0 2px 8px rgba(44,34,24,0.08);
}
#panel-toggle.panel-open { display: none; }

/* Map offset when panel open */
body.panel-open #map { left: 300px; }

/* ─── FABs ─── */
#floatingButtons {
  position: fixed;
  bottom: 24px; right: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 600;
}

.fab {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1.5px solid var(--cream-3);
  background: var(--cream);
  color: var(--bark-2);
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(44,34,24,0.12);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.fab:hover { background: var(--bark); color: #fff; border-color: var(--bark); }
.fab.fab-primary { background: var(--eco); color: #fff; border-color: var(--eco); }
.fab.fab-primary:hover { background: var(--eco-d); }
.fab:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Listado de rutas en panel ─── */
.route-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--cream-3);
  cursor: pointer;
  transition: background .12s;
}
.route-item:hover { background: var(--cream-2); }
.route-item:last-child { border-bottom: none; }
.route-item-name { font-family: var(--font-s); font-size: 13.5px; font-weight: 600; color: var(--bark); }
.route-item-meta { font-size: 11px; color: var(--bark-4); margin-top: 3px; }

.diff-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 4px;
}
.diff-f { background: var(--eco-pale); color: var(--eco-d); }
.diff-m { background: #FFF8E7; color: #9A6A00; }
.diff-d { background: #FDEEE9; color: #C8421A; }
.diff-x { background: #F9E9E9; color: #8B1A1A; }

/* ─── Recording HUD ─── */
#recording-hud {
  position: fixed;
  bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(247,244,238,0.96);
  border: 1px solid var(--cream-3);
  border-radius: 16px; padding: 14px 24px;
  display: flex; gap: 24px; align-items: center;
  box-shadow: 0 8px 32px rgba(44,34,24,0.12);
  z-index: 600;
  display: none;
}
#recording-hud.active { display: flex; }
.hud-stat { text-align: center; }
.hud-val { font-size: 20px; font-weight: 900; color: var(--bark); display: block; line-height: 1; }
.hud-lbl { font-size: 9px; color: var(--bark-4); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px; }
.hud-rec-dot {
  width: 8px; height: 8px; background: var(--eco);
  border-radius: 50%; animation: blink 1.5s infinite;
}
@keyframes blink { 0%,100%{opacity:1}50%{opacity:0.3} }

/* ─── Zoom controls ─── */
.leaflet-control-zoom {
  border: 1px solid var(--cream-3) !important;
  border-radius: 8px !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: var(--cream) !important;
  color: var(--bark-3) !important;
  border-bottom: 1px solid var(--cream-3) !important;
  font-size: 16px !important;
  line-height: 28px !important;
  width: 34px !important; height: 34px !important;
}
.leaflet-control-zoom a:hover { background: var(--cream-2) !important; color: var(--bark) !important; }

/* Leaflet popup */
.leaflet-popup-content-wrapper {
  background: var(--cream) !important;
  border: 1px solid var(--cream-3) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(44,34,24,0.12) !important;
}
.leaflet-popup-content { font-family: var(--font-d) !important; color: var(--bark) !important; font-size: 13px !important; }
.leaflet-popup-tip { background: var(--cream) !important; }

/* Pulse location dot */
.pulse-wrapper { position: relative; width: 20px; height: 20px; }
.pulse-ring {
  position: absolute; inset: -6px;
  border-radius: 50%;
  background: rgba(60,171,42,0.15);
  animation: pulse-anim 2s ease-out infinite;
}
.pulse-core {
  position: absolute; inset: 3px;
  background: var(--eco); border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 6px rgba(60,171,42,0.4);
}
@keyframes pulse-anim {
  0% { transform: scale(0.8); opacity: 0.7; }
  70% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(0.8); opacity: 0; }
}

/* ─── MODAL (login / registro) ─── */
.eco-modal-overlay {
  position: fixed; inset: 0; background: rgba(44,34,24,0.5);
  z-index: 1000; display: none;
  align-items: center; justify-content: center;
}
.eco-modal-overlay.active { display: flex; }
.eco-modal {
  background: var(--cream); border-radius: 16px;
  padding: 40px; width: 100%; max-width: 400px;
  box-shadow: 0 32px 80px rgba(44,34,24,0.2);
}
.eco-modal h2 {
  font-family: var(--font-s); font-size: 24px; font-weight: 600;
  color: var(--bark); margin-bottom: 24px;
}
.eco-modal label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--bark-3); display: block; margin-bottom: 6px; }
.eco-modal input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--cream-3);
  border-radius: 8px; background: #fff; font-family: var(--font-d);
  font-size: 14px; color: var(--bark); margin-bottom: 16px;
  transition: border-color .15s;
}
.eco-modal input:focus { outline: none; border-color: var(--eco); }
.eco-modal-close {
  float: right; background: none; border: none;
  font-size: 22px; color: var(--bark-4); cursor: pointer; line-height: 1;
}
.eco-modal-close:hover { color: var(--bark); }

/* ─── CAPAS BTN ─── */
#layers-btn {
  position: fixed; top: calc(var(--nav-h) + 12px); right: 12px; z-index: 600;
  background: var(--cream); border: 1px solid var(--cream-3);
  border-radius: 8px; padding: 8px 14px;
  font-family: var(--font-d); font-size: 11px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase; color: var(--bark-3);
  cursor: pointer; box-shadow: 0 2px 8px rgba(44,34,24,0.08);
  display: flex; align-items: center; gap: 6px;
  transition: all .15s;
}
#layers-btn:hover { background: var(--bark); color: #fff; border-color: var(--bark); }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .eco-nav { padding: 0 20px; }
  .eco-nav-links { display: none; }
  #map-panel { width: 260px; }
  body.panel-open #map { left: 0; }
}
