/* ============================================================
   IMPERDIBLES — Mejoras UX
   mejoras.css: Modal · Buscador · WhatsApp · Mapa
   ============================================================ */

/* ══════════════════════════════════════════════
   1. MODAL DE DETALLE
══════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.abierto {
  opacity: 1;
  pointer-events: all;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27,67,50,0.55);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100vw);
  height: 100vh;
  background: var(--blanco);
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(100%);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--verde-mint) transparent;
}

.modal-overlay.abierto .modal-panel {
  transform: translateX(0);
}

/* Galería de imágenes */
.modal-galeria {
  position: relative;
  height: 280px;
  flex-shrink: 0;
  background: var(--gris-claro);
  overflow: hidden;
}

.modal-galeria-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(1.03);
}

.modal-galeria-img.activa {
  opacity: 1;
  transform: scale(1);
}

.modal-galeria-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 50%);
  pointer-events: none;
}

/* Navegación galería */
.modal-galeria-nav {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.modal-galeria-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.5);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  padding: 0;
}

.modal-galeria-dot.activo {
  background: var(--blanco);
  transform: scale(1.3);
}

.modal-galeria-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
  color: white;
  font-size: 16px;
}

.modal-galeria-btn:hover { background: rgba(255,255,255,0.35); }
.modal-galeria-btn.prev { left: 12px; }
.modal-galeria-btn.next { right: 12px; }

/* Contador fotos */
.modal-galeria-count {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.35);
  padding: 3px 8px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
}

/* Botón cerrar */
.modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  background: rgba(0,0,0,0.4);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--blanco);
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}

.modal-close:hover { background: rgba(0,0,0,0.65); }

/* Contenido del modal */
.modal-content {
  padding: var(--space-xl) var(--space-xl) var(--space-3xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  color: var(--blanco);
}

.modal-badge.cat-naturaleza  { background: #2D7A50; }
.modal-badge.cat-gastronomia { background: #B43232; }
.modal-badge.cat-cultura     { background: #8B4513; }
.modal-badge.cat-alojamiento { background: #9A6F0D; }
.modal-badge.cat-cafe        { background: #6B3F1A; }
.modal-badge.cat-senderismo  { background: #2D6A4F; }
.modal-badge.cat-bienestar   { background: #5A7FA8; }
.modal-badge.cat-deportiva   { background: #6A3DAA; }

.modal-municipio-chip {
  font-size: 11px;
  color: var(--verde);
  font-weight: 600;
  background: rgba(45,106,79,0.1);
  border: 1px solid rgba(45,106,79,0.15);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.modal-titulo {
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--gris-oscuro);
  line-height: 1.25;
}

.modal-info-row {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.modal-info-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--gris-medio);
  background: var(--crema-oscura);
  padding: 4px 10px;
  border-radius: 6px;
}

.modal-divider {
  height: 1px;
  background: var(--crema-oscura);
}

.modal-desc-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--verde);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--gris-medio);
  line-height: 1.8;
}

/* Contacto */
.modal-contacto {
  background: var(--crema);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--gris);
}

.modal-contact-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--blanco);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.modal-contact-link {
  color: var(--verde);
  font-weight: 600;
  font-size: 0.85rem;
  transition: color var(--dur-fast);
}

.modal-contact-link:hover { color: var(--verde-oscuro); text-decoration: underline; }

/* Redes sociales */
.modal-redes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-red-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--verde-oscuro);
  background: rgba(45,106,79,0.08);
  border: 1px solid rgba(45,106,79,0.15);
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.modal-red-btn:hover {
  background: var(--verde);
  color: var(--blanco);
  border-color: var(--verde);
  transform: translateY(-1px);
}

/* Botón Como llegar */
.modal-gmaps-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--verde);
  color: var(--blanco);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
  border: none;
  cursor: pointer;
  margin-top: 4px;
}

.modal-gmaps-btn:hover {
  background: var(--verde-oscuro);
  transform: translateY(-1px);
  color: var(--blanco);
}

.modal-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #25D366;
  color: var(--blanco);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
  border: none;
  cursor: pointer;
}

.modal-wa-btn:hover {
  background: #1eb554;
  transform: translateY(-1px);
  color: var(--blanco);
}

/* Cards clickeables */
.exp-card { cursor: pointer; }
.exp-card:focus-visible {
  outline: 3px solid var(--verde);
  outline-offset: 3px;
}


/* ══════════════════════════════════════════════
   2. BUSCADOR EN TIEMPO REAL
══════════════════════════════════════════════ */

.buscador-row {
  padding: 10px 0 8px;
  border-bottom: 1px solid rgba(45,106,79,0.08);
}

.buscador-wrap {
  position: relative;
  max-width: 420px;
}

.buscador-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gris-medio);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.buscador-input {
  width: 100%;
  padding: 9px 38px 9px 38px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--gris-oscuro);
  background: var(--blanco);
  border: 1.5px solid var(--gris-claro);
  border-radius: var(--radius-full);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.buscador-input::placeholder { color: var(--gris-medio); }

.buscador-input:focus {
  border-color: var(--verde-claro);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
}

.buscador-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gris-medio);
  cursor: pointer;
  padding: 4px;
  display: none;
  align-items: center;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}

.buscador-clear:hover {
  color: var(--gris-oscuro);
  background: var(--crema-oscura);
}

.buscador-clear.visible { display: flex; }

/* Highlight de búsqueda */
.highlight-match {
  background: rgba(212,168,67,0.3);
  border-radius: 2px;
  font-weight: 600;
}


/* ══════════════════════════════════════════════
   3. BOTÓN FLOTANTE WHATSAPP
══════════════════════════════════════════════ */

.wa-flotante {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.wa-flotante-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #25D366;
  color: var(--blanco);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(37,211,102,0.45);
  cursor: pointer;
  transition: transform 0.2s var(--ease-out),
              box-shadow 0.2s;
  text-decoration: none;
  border: none;
  position: relative;
}

.wa-flotante-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 28px rgba(37,211,102,0.55);
}

.wa-flotante-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(37,211,102,0.35);
  animation: wa-pulse 2.2s ease-in-out infinite;
}

@keyframes wa-pulse {
  0%,100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 0; }
}

.wa-flotante-tooltip {
  background: var(--verde-oscuro);
  color: var(--blanco);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.wa-flotante:hover .wa-flotante-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Badge notificación */
.wa-flotante-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--dorado);
  color: var(--verde-oscuro);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--blanco);
}


/* ══════════════════════════════════════════════
   4. SECCIÓN MAPA LEAFLET
══════════════════════════════════════════════ */

.seccion-mapa {
  padding: var(--space-2xl) 0 0;
}

.seccion-mapa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.seccion-mapa-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--verde-oscuro);
}

.mapa-vista-toggle {
  display: flex;
  gap: 6px;
}

.mapa-vista-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gris-medio);
  background: var(--blanco);
  border: 1.5px solid var(--gris-claro);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.mapa-vista-btn:hover { border-color: var(--verde-claro); color: var(--verde); }
.mapa-vista-btn.activo {
  background: var(--verde);
  border-color: var(--verde);
  color: var(--blanco);
}

/* Contenedor del mapa */
.mapa-leaflet-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--crema-oscura);
  background: var(--crema);
}

#mapa-leaflet {
  height: 460px;
  width: 100%;
}

/* Leyenda del mapa */
.mapa-leyenda {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: 12px var(--space-lg);
  background: var(--blanco);
  border-top: 1px solid var(--crema-oscura);
}

.mapa-leyenda-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--gris-medio);
  font-weight: 500;
}

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

/* Popup personalizado de Leaflet */
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: var(--shadow-lg) !important;
  border: none !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 240px !important;
}

.map-popup {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.map-popup-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.map-popup-body {
  padding: 10px 12px 12px;
}

.map-popup-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--verde);
  margin-bottom: 4px;
}

.map-popup-titulo {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gris-oscuro);
  line-height: 1.3;
  margin-bottom: 6px;
}

.map-popup-muni {
  font-size: 11px;
  color: var(--gris-medio);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-popup-ver {
  display: block;
  text-align: center;
  background: var(--verde);
  color: var(--blanco);
  font-size: 11px;
  font-weight: 700;
  padding: 6px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
}

.map-popup-ver:hover { background: var(--verde-oscuro); color: white; }

.leaflet-popup-tip-container { display: none; }

/* Vista mapa activa (ocultar grid) */
.vista-mapa .section-experiencias .experiencias-grid,
.vista-mapa .municipio-bloque,
.vista-mapa .resultados-header { display: none; }

.vista-mapa .seccion-mapa { display: block; }

/* Por defecto (vista cards) */
.seccion-mapa { display: none; }

/* Responsive */
@media (max-width: 768px) {
  .modal-panel { width: 100vw; }
  .modal-galeria { height: 220px; }
  .wa-flotante { bottom: 20px; right: 16px; }
  .wa-flotante-btn { width: 50px; height: 50px; }
  #mapa-leaflet { height: 340px; }
  .mapa-leyenda { gap: var(--space-sm); }
}

@media (max-width: 480px) {
  .modal-content { padding: var(--space-lg); }
}

/* ══════════════════════════════════════════════
   PÁGINA ITINERARIOS
══════════════════════════════════════════════ */
.itinerarios-header {
  padding: 120px 0 60px;
  background: var(--verde-oscuro);
  color: var(--blanco);
  text-align: center;
}

body.dark-mode .itinerarios-header {
  background: #0a2010;
}

.itinerarios-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  margin: var(--space-md) 0;
  color: var(--blanco);
}

.itinerarios-desc {
  max-width: 600px;
  margin: 0 auto;
  font-size: 1.1rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
}

.itinerarios-main {
  padding: var(--space-3xl) 0;
  background: var(--crema);
}

body.dark-mode .itinerarios-main {
  background: #0f1117;
}

.itinerario-card {
  background: var(--blanco);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.05);
}

body.dark-mode .itinerario-card {
  background: #161b22;
  border-color: rgba(255,255,255,0.06);
}

.itinerario-badge {
  display: inline-block;
  background: rgba(212, 168, 67, 0.15);
  color: var(--dorado);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-md);
}

.itinerario-name {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  color: var(--gris-oscuro);
  margin-bottom: var(--space-sm);
}

body.dark-mode .itinerario-name {
  color: #e6edf3;
}

.itinerario-intro {
  font-size: 1.05rem;
  color: var(--gris-medio);
  margin-bottom: var(--space-2xl);
  max-width: 700px;
}

/* Timeline vertical */
.timeline {
  position: relative;
  padding-left: 20px;
  margin-left: 10px;
  border-left: 2px dashed var(--verde-mint);
}

body.dark-mode .timeline {
  border-left-color: #30363d;
}

.timeline-day {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--verde);
  background: var(--verde-mint);
  display: inline-block;
  padding: 4px 16px;
  border-radius: var(--radius-full);
  position: relative;
  left: -20px;
  margin-bottom: var(--space-lg);
}

body.dark-mode .timeline-day {
  background: #1a3d28;
  color: var(--verde-claro);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-xl);
  padding-left: var(--space-lg);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--verde);
  border: 3px solid var(--blanco);
  box-shadow: 0 0 0 2px rgba(45,106,79,0.2);
}

body.dark-mode .timeline-item::before {
  border-color: #161b22;
}

.timeline-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gris-medio);
  margin-bottom: 4px;
  display: inline-block;
}

.timeline-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gris-oscuro);
  margin-bottom: 8px;
}

body.dark-mode .timeline-title {
  color: #c9d1d9;
}

.timeline-text {
  font-size: 0.95rem;
  color: var(--gris-medio);
  line-height: 1.6;
  margin-bottom: var(--space-md);
  max-width: 600px;
}

@media (max-width: 768px) {
  .itinerario-card {
    padding: var(--space-xl) var(--space-md);
  }
}
