/* ============================================
   MAPA - ESTILOS
   ============================================ */

.mapa-page {
  overflow: hidden;
}

.mapa-wrapper {
  display: flex;
  height: calc(100vh - 64px);
}

/* SIDEBAR */
.mapa-sidebar {
  width: 380px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
}

.sidebar-search i {
  font-size: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.sidebar-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  color: var(--text);
}

.sidebar-search input::placeholder {
  color: var(--text-tertiary);
}

.sidebar-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-stats span {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-my-location {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--primary);
  color: var(--primary-dark);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-my-location:hover {
  background: var(--primary-light);
}

.btn-my-location i {
  font-size: 14px;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-list::-webkit-scrollbar {
  width: 4px;
}

.sidebar-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.sidebar-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 14px;
}

.sidebar-loading i {
  font-size: 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sidebar-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 14px;
}

/* CLINIC ITEM EN SIDEBAR */
.sidebar-clinic {
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.sidebar-clinic:hover {
  background: var(--bg-secondary);
}

.sidebar-clinic.active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.sidebar-clinic-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.sidebar-clinic-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
}

.sidebar-clinic-rating {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar-clinic-rating i {
  color: var(--warning);
  font-size: 12px;
}

.sidebar-clinic-addr {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-clinic-addr i {
  font-size: 12px;
}

.sidebar-clinic-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-clinic-price {
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-clinic-price strong {
  color: var(--text);
  font-weight: 700;
}

.badge-24h {
  font-size: 10px;
  padding: 3px 8px;
  background: #FCEBEB;
  color: #A32D2D;
  border-radius: 999px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}

.badge-24h i {
  font-size: 11px;
}

.dist-pill {
  font-size: 10px;
  padding: 3px 8px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  font-weight: 600;
}

/* MAPA PRINCIPAL */
.mapa-main {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-legend {
  position: absolute;
  bottom: 24px;
  right: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Sprint #13 — modificadores de color de la leyenda del mapa.
   Sustituyen al style="background:#XXXXXX" inline. Mantienen exactamente
   los mismos hex que antes (matchean con los pines del mapa). */
.legend-dot--general { background: #1D9E75; }
.legend-dot--urgent  { background: #E24B4A; }
.legend-dot--user    { background: #378ADD; }

/* Footer flex de cada tarjeta del sidebar del mapa.
   Antes inline: display:flex;gap:4px;align-items:center;margin-left:auto. */
.sidebar-clinic-footer-cluster {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}

/* POPUP DEL MAPA */
.map-popup {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-width: 200px;
}

.map-popup h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}

.map-popup .popup-addr {
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
}

.map-popup .popup-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.map-popup .popup-rating {
  font-size: 12px;
  font-weight: 600;
  color: #EF9F27;
}

.map-popup .popup-price {
  font-size: 12px;
  color: #666;
}

.map-popup .popup-price strong {
  color: #1a1a1a;
}

.map-popup .popup-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: #1D9E75;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
}

.map-popup .popup-btn:hover {
  background: #0F6E56;
}

.map-popup .popup-24h {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  background: #FCEBEB;
  color: #A32D2D;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .mapa-wrapper {
    flex-direction: column;
    height: calc(100vh - 64px - 70px);
  }

  .mapa-sidebar {
    width: 100%;
    height: 260px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .mapa-main {
    flex: 1;
  }

  .map-legend {
    bottom: 16px;
    right: 8px;
  }
}

@media (max-width: 600px) {
  .mapa-wrapper {
    height: calc(100vh - 64px - 70px);
  }

  .mapa-sidebar {
    height: 220px;
  }
}
