/* ══════════════════════════════════════════════════════
   LAYOUT: mapa acotado a la izquierda + filtros fijos
   a la derecha, todo en flujo normal (sin solapamiento).
   ══════════════════════════════════════════════════════ */

/* Wrapper principal: fila horizontal que rellena el main */
.mapa-layout {
  display: flex;
  gap: 16px;
  /* viewport - header (4rem=64px) - main padding (2*1.5rem=48px) ≈ 100vh - 7rem */
  height: calc(100vh - 7rem);
  min-height: 0;
}

/* Columna del mapa: flex-1 con min-w-0 para que Leaflet
   no se cuele por debajo del sidebar de la app. */
.mapa-col {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #f8f9fa;
}

/* Day-bar strip: ENCIMA del mapa, en flujo (no absolute) */
.day-bar-strip {
  flex: 0 0 auto;
  height: 52px;
  background: white;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  overflow-x: auto;
  white-space: nowrap;
}

/* Contenedor del mapa (Leaflet). position:relative padre
   + el #mapa absolute inset:0 = Leaflet ocupa exactamente
   su celda flex, sin溢出 a otras columnas. */
.mapa-canvas {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
}
#mapa {
  position: absolute;
  inset: 0;
}
.leaflet-container { z-index: 0; }

/* Stats strip: DEBAJO del mapa, en flujo */
.stats-strip {
  flex: 0 0 auto;
  background: white;
  border-top: 1px solid var(--color-border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.78rem;
  overflow-x: auto;
}
.stats-strip .stat-cell { display: flex; flex-direction: column; gap: 2px; }
.stats-strip .stat-label { color: var(--color-text-muted); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stats-strip .stat-value { font-weight: 600; font-size: 0.95rem; }
.stats-strip .day-row { font-size: 0.7rem; color: var(--color-text-muted); }

/* Aside filtros: columna fija 320px a la derecha */
.filter-aside {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
}
.filter-aside-header {
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-aside-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px;
}
.filter-aside-footer {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
}

/* ══════════════════════════════════════════════════════
   SIDE PANEL → MODAL CON BACKDROP
   Ya no roba espacio al mapa; aparece por encima con
   un fondo semitransparente.
   ══════════════════════════════════════════════════════ */
.side-panel-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: stretch;
  justify-content: flex-end;
}
.side-panel-modal.open { display: flex; }
.side-panel-modal .panel-body {
  width: 380px;
  max-width: 92vw;
  background: white;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: slideInPanel 0.25s ease-out;
  box-shadow: -8px 0 24px rgba(0,0,0,0.18);
}
@keyframes slideInPanel {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* ══════════════════════════════════════════════════════
   COMPONENTES COMPARTIDOS
   ══════════════════════════════════════════════════════ */

/* Category badges */
.category-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; text-transform: uppercase; }
.cat-10A { background: #e8f5e9; color: #2e7d32; }
.cat-20B { background: #fff3e0; color: #e65100; }
.cat-20C { background: #e3f2fd; color: #1565c0; }

/* Day color dot */
.day-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

/* Distance badges */
.dist-badge { font-size: 0.65rem; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.dist-near { background: #e8f5e9; color: #2e7d32; }
.dist-mid  { background: #fff3e0; color: #e65100; }
.dist-far  { background: #fce4ec; color: #c62828; }

/* HCP list item (modal) */
.hcp-item {
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hcp-item:hover { background-color: var(--color-surface); }

/* Toolbar buttons (≥44px tap target) */
.toolbar-btn {
  min-height: 36px;
  min-width: 36px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

/* Loading spinner (sobre el mapa) */
.map-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
}

/* Animation marker bounce */
@keyframes bounce-marker {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.6); }
}
.animating-marker { animation: bounce-marker 0.5s ease; }

/* Panel scrollable */
.panel-scroll { overflow-y: auto; flex: 1; }

/* Day breakdown rows */
.day-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 0.72rem;
}

/* ══════════════════════════════════════════════════════
   MOBILE (TODO — desktop-first por ahora)
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* TODO: en <768px, convertir a flex-col y colapsar el aside */
  .mapa-layout { height: auto; min-height: 70vh; }
  .filter-aside { width: 100%; }
  .side-panel-modal .panel-body { width: 100vw; max-width: 100vw; }
}
