/* =====================================================
   UPALA TURISMO PLUGIN - Estilos
   ===================================================== */

.ut-container {
  /* Paleta basada en el logo de Upala: azul + blanco + negro */
  --ut-azul-oscuro: #1a3a52;
  --ut-azul-medio: #2c5f7f;
  --ut-azul-claro: #4a8bb5;
  --ut-azul-suave: #e8eef3;

  --ut-tinta: #1a1a1a;
  --ut-gris-oscuro: #333333;
  --ut-gris-medio: #6b6b6b;
  --ut-gris-suave: #8a8a8a;
  --ut-gris-claro: #e5e5e5;
  --ut-gris-muy-claro: #f5f5f5;
  --ut-blanco: #ffffff;

  /* Aliases */
  --ut-verde-selva: #1a3a52;
  --ut-verde-hoja: #2c5f7f;
  --ut-verde-claro: #4a8bb5;
  --ut-crema: #f5f5f5;
  --ut-arena: #e5e5e5;
  --ut-naranja: #555555;
  --ut-terracota: #1a3a52;
  --ut-amarillo: #888888;
  --ut-azul-rio: #2c5f7f;
  --ut-morado: #666666;

  --ut-sombra: 0 4px 16px rgba(26, 58, 82, 0.08);
  --ut-sombra-fuerte: 0 8px 32px rgba(26, 58, 82, 0.15);

  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ut-tinta);
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 500px;
  background: var(--ut-blanco);
  display: grid;
  grid-template-columns: 380px 1fr;
  overflow: hidden;
  box-sizing: border-box;
}

.ut-container *,
.ut-container *::before,
.ut-container *::after { box-sizing: border-box; }

/* Loading state */
.ut-loading {
  position: absolute;
  inset: 0;
  background: var(--ut-crema);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  z-index: 5000;
  transition: opacity 0.4s ease;
}
.ut-loading.ut-hidden { opacity: 0; pointer-events: none; }
.ut-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--ut-arena);
  border-top-color: var(--ut-verde-hoja);
  border-radius: 50%;
  animation: ut-spin 0.8s linear infinite;
}
@keyframes ut-spin { to { transform: rotate(360deg); } }
.ut-loading-text {
  font-size: 13px;
  color: var(--ut-gris-suave);
  letter-spacing: 0.05em;
}

/* Sidebar */
.ut-sidebar {
  background: var(--ut-blanco);
  border-right: 1px solid var(--ut-gris-claro);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.ut-sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ut-azul-oscuro);
  z-index: 10;
}

.ut-sidebar-handle { display: none; }

.ut-header {
  padding: 32px 28px 20px;
  border-bottom: 1px solid var(--ut-gris-claro);
}
.ut-eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ut-azul-medio);
  font-weight: 600;
  margin-bottom: 10px;
}
.ut-title {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ut-azul-oscuro);
  letter-spacing: -0.01em;
  margin: 0;
}
.ut-title em {
  font-style: normal;
  font-weight: 400;
  color: var(--ut-azul-medio);
}
.ut-subtitle {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ut-gris-medio);
  line-height: 1.5;
}

.ut-search-wrap {
  padding: 20px 28px;
  border-bottom: 1px solid var(--ut-gris-claro);
}
.ut-search-box { position: relative; }
.ut-search-box input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--ut-gris-claro);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: white;
  color: var(--ut-tinta);
  transition: border-color 0.2s ease;
}
.ut-search-box input:focus {
  outline: none;
  border-color: var(--ut-tinta);
}
.ut-search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ut-gris-suave);
}

.ut-filters {
  padding: 18px 28px;
  border-bottom: 1px solid var(--ut-gris-claro);
}
.ut-filters-title {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ut-gris-medio);
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ut-filters-actions { display: flex; gap: 10px; }
.ut-filters-actions button {
  background: none;
  border: none;
  color: var(--ut-tinta);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  padding: 0;
  text-transform: uppercase;
}
.ut-filters-actions button:hover { text-decoration: underline; }

.ut-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ut-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--ut-gris-claro);
  background: white;
  color: var(--ut-tinta);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.ut-chip .ut-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.ut-chip:hover {
  border-color: var(--ut-tinta);
}
.ut-chip.ut-inactive {
  opacity: 1;
  background: white !important;
  color: var(--ut-gris-suave) !important;
  border-color: var(--ut-gris-claro) !important;
}
.ut-chip.ut-inactive .ut-dot {
  opacity: 0.3;
}

.ut-places-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 24px;
}
.ut-places-list::-webkit-scrollbar { width: 6px; }
.ut-places-list::-webkit-scrollbar-track { background: transparent; }
.ut-places-list::-webkit-scrollbar-thumb { background: var(--ut-arena); border-radius: 3px; }

/* Empty state (solo cuando no hay resultados) */
.ut-empty-state {
  padding: 40px 24px;
  text-align: center;
}
.ut-empty-title {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ut-tinta);
  margin-bottom: 6px;
}
.ut-empty-text {
  font-size: 13px;
  color: var(--ut-gris-medio);
  line-height: 1.5;
}

/* Mapa */
.ut-map-wrap {
  position: relative;
  height: 100%;
}
.ut-map {
  height: 100%;
  width: 100%;
  background: #d4e8d4;
}

/* Marcadores custom */
.ut-marker {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  border: 2.5px solid white;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.ut-marker:hover { transform: rotate(-45deg) scale(1.15); }
.ut-marker span { transform: rotate(45deg); }

.ut-canton-label {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}
.ut-canton-label-inner {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ut-azul-oscuro);
  text-shadow:
    -1px -1px 0 rgba(255,255,255,0.9),
    1px -1px 0 rgba(255,255,255,0.9),
    -1px 1px 0 rgba(255,255,255,0.9),
    1px 1px 0 rgba(255,255,255,0.9),
    0 2px 8px rgba(0,0,0,0.15);
  letter-spacing: 0.08em;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
}
.ut-canton-label-inner small {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ut-azul-medio);
  margin-top: 2px;
}

.ut-distrito-tooltip {
  background: var(--ut-verde-selva) !important;
  color: white !important;
  border: none !important;
  border-radius: 6px !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 12px !important;
  padding: 6px 10px !important;
  box-shadow: var(--ut-sombra) !important;
}
.ut-distrito-tooltip::before { display: none !important; }

/* ============================
   INFO PANEL - Diseño limpio (sin banner)
   ============================ */
.ut-info-panel {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 340px;
  background: white;
  border-radius: 16px;
  box-shadow: var(--ut-sombra-fuerte);
  padding: 0;
  z-index: 1000;
  overflow: hidden;
  transform: translateX(420px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.ut-info-panel.ut-open { transform: translateX(0); }

.ut-info-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--ut-arena);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: var(--ut-tinta);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
}
.ut-info-close:hover {
  background: var(--ut-verde-selva);
  color: white;
  transform: scale(1.05);
}

/* Contenido del panel */
.ut-info-content {
  padding: 24px 22px 18px;
  position: relative;
}

.ut-info-tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ut-gris-medio);
  background: var(--ut-gris-muy-claro);
  border: 1px solid var(--ut-gris-claro);
  margin-bottom: 14px;
}

/* Ubicación + distancia */
.ut-info-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ut-gris-medio);
  margin-bottom: 10px;
}
.ut-info-location svg {
  color: var(--ut-tinta);
  flex-shrink: 0;
}
.ut-info-distance-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ut-info-location-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ut-gris-suave);
}
.ut-info-distance {
  color: var(--ut-gris-medio);
  font-weight: 500;
}

.ut-info-name {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ut-azul-oscuro);
  margin: 0 0 16px;
  padding-right: 34px;
  letter-spacing: -0.01em;
}

/* Sección de descripción */
.ut-info-desc-wrap {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--ut-azul-suave);
  border-radius: 6px;
  border-left: 3px solid var(--ut-azul-oscuro);
}
.ut-info-section-title {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ut-azul-medio);
  font-weight: 700;
  margin-bottom: 6px;
}
.ut-info-desc {
  font-size: 13px;
  color: var(--ut-tinta);
  line-height: 1.55;
  max-height: 140px;
  overflow-y: auto;
}
.ut-info-desc::-webkit-scrollbar { width: 4px; }
.ut-info-desc::-webkit-scrollbar-thumb { background: var(--ut-gris-claro); border-radius: 2px; }

/* Botón "Cómo llegar" - blanco con borde azul logo */
.ut-info-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: white;
  color: var(--ut-azul-oscuro);
  border: 1.5px solid var(--ut-azul-oscuro);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}
.ut-info-cta:hover {
  background: var(--ut-azul-oscuro);
  color: white;
}
.ut-info-cta:active {
  transform: scale(0.98);
}

/* Coordenadas en pequeño abajo */
.ut-info-coords-small {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  margin-top: 12px;
  font-size: 10px;
  color: #999;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.03em;
}
.ut-info-coords-small svg {
  color: #bbb;
  flex-shrink: 0;
}

/* Mantener compatibilidad con clases viejas (por si quedan referencias) */
.ut-info-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--ut-arena);
  font-size: 13px;
}
.ut-info-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ut-tinta);
}
.ut-info-meta-row svg { color: var(--ut-verde-hoja); flex-shrink: 0; }

/* Stats */
.ut-stats {
  position: absolute;
  top: 24px;
  left: 24px;
  background: white;
  border-radius: 6px;
  padding: 12px 18px;
  box-shadow: var(--ut-sombra);
  z-index: 999;
  display: flex;
  gap: 24px;
  border: 1px solid var(--ut-gris-claro);
}
.ut-stat-num {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ut-tinta);
  line-height: 1;
}
.ut-stat-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ut-gris-medio);
  margin-top: 4px;
}

/* Botón refresh */
.ut-refresh-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 999;
  background: white;
  border: 1px solid var(--ut-gris-claro);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: var(--ut-sombra);
  cursor: pointer;
  color: var(--ut-tinta);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.ut-refresh-btn:hover {
  background: var(--ut-tinta);
  color: white;
  border-color: var(--ut-tinta);
}
.ut-refresh-btn.ut-refreshing svg { animation: ut-spin 1s linear infinite; }

/* Leyenda */
.ut-legend {
  position: absolute;
  bottom: 24px;
  left: 24px;
  background: white;
  border-radius: 6px;
  padding: 14px 16px;
  box-shadow: var(--ut-sombra);
  z-index: 999;
  font-size: 12px;
  max-width: 200px;
  border: 1px solid var(--ut-gris-claro);
}
.ut-legend-title {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ut-gris-medio);
  margin-bottom: 10px;
  font-weight: 600;
}
.ut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--ut-tinta);
}
.ut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.ut-legend-divider {
  height: 1px;
  background: var(--ut-gris-claro);
  margin: 10px 0;
}
.ut-legend-canton {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ut-gris-medio);
}
.ut-legend-canton .ut-canton-swatch {
  width: 16px;
  height: 10px;
  border: 1px dashed var(--ut-tinta);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 2px;
}

/* Toast */
.ut-toast {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: var(--ut-tinta);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: var(--ut-sombra-fuerte);
  z-index: 2000;
  font-size: 13px;
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}
.ut-toast.ut-show { transform: translateY(0); opacity: 1; }
.ut-toast.ut-error { background: #8a2222; }

/* Cluster icon */
.ut-cluster-icon { background: none !important; border: none !important; }

/* ===== MÓVIL: Bottom Sheet ===== */
@media (max-width: 900px) {
  .ut-container {
    display: block;
    overflow: hidden;
  }
  .ut-map-wrap {
    position: absolute;
    inset: 0;
    height: 100%;
    z-index: 1;
  }
  .ut-map { height: 100%; }

  .ut-sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 90%;
    border-right: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -6px 24px rgba(31, 77, 43, 0.15);
    z-index: 1500;
    transform: translateY(calc(100% - 90px));
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
  }
  .ut-sidebar::before { border-radius: 20px 20px 0 0; height: 4px; }

  .ut-sidebar.ut-medium { transform: translateY(60%); }
  .ut-sidebar.ut-full { transform: translateY(0); }

  .ut-sidebar-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }
  .ut-sidebar-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: var(--ut-arena);
    border-radius: 2px;
    transition: background 0.2s ease;
  }
  .ut-sidebar-handle:active::before { background: var(--ut-verde-hoja); }

  .ut-header { padding: 8px 20px 14px; flex-shrink: 0; }
  .ut-eyebrow { font-size: 10px; margin-bottom: 4px; }
  .ut-title { font-size: 22px; }
  .ut-subtitle { font-size: 12px; margin-top: 4px; }

  .ut-search-wrap { padding: 12px 20px; flex-shrink: 0; }
  .ut-search-box input { padding: 10px 14px 10px 38px; font-size: 14px; }

  .ut-filters { padding: 10px 20px 12px; flex-shrink: 0; }
  .ut-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px 4px;
  }
  .ut-filter-chips::-webkit-scrollbar { display: none; }
  .ut-chip { flex-shrink: 0; padding: 8px 14px; font-size: 13px; }

  .ut-places-list { padding: 4px 12px 24px; flex: 1; min-height: 0; }

  .ut-stats {
    top: 12px;
    left: 12px;
    padding: 8px 14px;
    gap: 14px;
    border-radius: 12px;
  }
  .ut-stat-num { font-size: 16px; }
  .ut-stat-lbl { font-size: 9px; }

  .ut-refresh-btn {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .ut-info-panel {
    position: absolute;
    width: calc(100% - 20px);
    max-width: 400px;
    left: 10px;
    right: 10px;
    margin: 0 auto;
    top: auto;
    bottom: 100px;
    transform: translateY(calc(100% + 120px));
    max-height: 75vh;
    overflow-y: auto;
    z-index: 1600;
    border-radius: 16px;
  }
  .ut-info-panel.ut-open { transform: translateY(0); }

  .ut-info-content { padding: 22px 20px 18px; }
  .ut-info-name { font-size: 18px; }
  .ut-info-cta { padding: 13px 16px; font-size: 12px; }
  .ut-info-coords-small { font-size: 9px; }

  .ut-legend { display: none; }
  .ut-toast { bottom: 100px; right: 10px; left: 10px; text-align: center; }
}
