/* =========================================
   VARIABLES GLOBALES & TOKENS DE DISEÑO
   ========================================= */
:root {
  /* Paleta de Colores - Premium Slate & Blue */
  --color-bg-base: #f1f5f9;
  --color-surface: #ffffff;
  --color-surface-glass: rgba(255, 255, 255, 0.85);

  --color-primary: #2563eb;
  /* Royal Blue */
  --color-primary-hover: #1d4ed8;
  --color-secondary: #0f172a;
  /* Slate 900 */

  --color-text-main: #1e293b;
  --color-text-muted: #64748b;

  --color-border: #e2e8f0;
  --color-divider: rgba(0, 0, 0, 0.08);

  /* Map Marker Colors */
  --marker-building: #3b82f6;
  --marker-bathroom: #10b981;
  --marker-food: #f59e0b;

  /* Tipografía */
  --font-primary: "Outfit", system-ui, -apple-system, sans-serif;

  /* Efectos & Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glass: 0 8px 32px rgba(31, 38, 135, 0.07);

  --blur-glass: blur(12px);

  /* Transiciones */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Spacing */
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;

  /* Radios de borde */
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;

  /* Z-Index (Manejo de capas con Leaflet) */
  --z-map: 1;
  --z-ui-base: 1000;
  /* Leaflet usa z-index altos para sus controles (400-800) */
  --z-ui-dropdown: 1010;
}

/* =========================================
   RESET & ESTILOS BASE
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  /* Mobile viewport bug fix */
  font-family: var(--font-primary);
  color: var(--color-text-main);
  background-color: var(--color-bg-base);
  overflow: hidden;
  /* Evitar scroll nativo, Leaflet maneja el pan */
  -webkit-tap-highlight-color: transparent;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

input {
  font-family: inherit;
  border: none;
  outline: none;
}

/* =========================================
   CONTENEDOR DEL MAPA (Leaflet)
   ========================================= */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: var(--z-map);
  background-color: #e5e7eb;
  /* Color de fondo mientras carga la imagen */
}

/* Ocultar controles de Leaflet por defecto para usar los nuestros */
.leaflet-control-zoom {
  display: none !important;
}

/* =========================================
   INTERFAZ DE USUARIO (UI Layer)
   ========================================= */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Deja pasar clicks al mapa */
  z-index: var(--z-ui-base);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--color-surface-glass);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow-glass);
  pointer-events: auto;
  /* Reactivar clicks en elementos UI */
}

/* =========================================
   BARRA DE BÚSQUEDA SUPERIOR
   ========================================= */
.top-bar {
  position: relative;
  z-index: 1100;
  padding: var(--space-4);
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.search-container {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-full);
  transition: var(--transition-normal);
}

.search-container:focus-within {
  box-shadow:
    0 0 0 2px var(--color-primary),
    var(--shadow-md);
  background: var(--color-surface);
}

.search-icon {
  color: var(--color-text-muted);
  font-size: 1.25rem;
  margin-right: var(--space-2);
}

.search-container input {
  flex: 1;
  background: transparent;
  font-size: 1rem;
  color: var(--color-text-main);
  width: 100%;
}

.search-container input::placeholder {
  color: var(--color-text-muted);
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.icon-button:hover {
  color: var(--color-text-main);
}

.hidden {
  display: none !important;
}

/* =========================================
   CONTROLES FLOTANTES
   ========================================= */
.floating-controls {
  position: absolute;
  right: var(--space-4);
  bottom: 120px;
  /* Por encima de la barra inferior colapsada */
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: auto;
  transition: transform var(--transition-normal);
}

/* =========================================
   BOTTOM SHEET & NAVEGACIÓN
   ========================================= */
.bottom-sheet {
  position: absolute;
  bottom: 0;
  width: 100%;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  z-index: var(--z-ui-dropdown);
  overflow: hidden;
  /* Evita que el wrapper deslizable sobresalga */
}

/* Wrapper deslizable para contener handle y contenido sin mover la barra inferior */
.sheet-drag-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  transition: transform var(--transition-normal);
  z-index: 5;
}

/* Handle de arrastre */
.drag-handle-container {
  width: 100%;
  padding: var(--space-3) 0;
  display: flex;
  justify-content: center;
  cursor: grab;
  /* Bloquea el gesto nativo de scroll vertical para no robar los pointer events del drag */
  touch-action: none;
  -ms-touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.drag-handle-container:active {
  cursor: grabbing;
}

.drag-handle {
  width: 40px;
  height: 4px;
  background-color: var(--color-text-muted);
  border-radius: var(--radius-full);
  opacity: 0.5;
}

/* Área de contenido que se desliza */
.sheet-content {
  overflow-y: auto;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: height;
}

/* Estados de colapso y expansión */
.bottom-sheet.collapsed .sheet-content {
  height: 0;
  overflow: hidden;
}

.bottom-sheet.expanded .sheet-content {
  height: 40vh;
  /* Altura cuando está expandido */
  padding-bottom: var(--space-4);
}

/* Secciones de vista (Mapa, Tour, Info) */
.view-section {
  display: none;
  padding: 0 var(--space-4);
  animation: fadeIn var(--transition-normal);
}

.view-section.active {
  display: block;
}

.view-title {
  font-size: 1.1rem;
  color: var(--color-secondary);
  margin-bottom: var(--space-3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Filtros (Chips) ajustados para la nueva vista */
.filter-chip-container {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  /* Ya no es scroll horizontal, ahora envuelven en el panel expandido */
}

.filter-chip-container::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari */
}

.filter-chip {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition-normal);
}

.filter-chip.active {
  background-color: var(--color-secondary);
  color: var(--color-surface);
  border-color: var(--color-secondary);
}

/* Navegación Principal */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-divider);
  background-color: var(--color-surface);
  position: relative;
  z-index: 10;
  /* Se mantiene al frente de la animación del contenido deslizante */
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding: var(--space-2);
  min-width: 64px;
  transition: color var(--transition-fast);
}

.nav-item .material-symbols-rounded {
  font-size: 1.5rem;
  transition: transform var(--transition-fast);
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item.active .material-symbols-rounded {
  font-variation-settings: "FILL" 1;
  /* Icono relleno cuando está activo */
  transform: scale(1.1);
}

/* =========================================
   ESTILOS DE MARCADORES (Leaflet Custom)
   ========================================= */
.custom-marker {
  background: none;
  border: none;
}

.marker-container {
  position: relative;
  width: 32px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  filter: drop-shadow(0px 3px 5px rgba(0, 0, 0, 0.25));
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.marker-container:hover {
  transform: scale(1.18);
  z-index: 1000 !important;
}

.marker-pin-svg {
  width: 32px;
  height: 40px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Contenedor del icono SVG interior del marcador para centrado milimétrico */
.marker-icon-svg-wrapper {
  position: absolute;
  top: 5px;
  left: 6px;
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.marker-icon-svg-wrapper img {
  width: 14px;
  height: 14px;
  display: block;
  filter: brightness(0) !important;
  opacity: 0.85;
}

/* Popups personalizados */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: var(--font-primary) !important;
}

.leaflet-popup-content {
  margin: var(--space-3) var(--space-4) !important;
}

.leaflet-popup-content h3 {
  margin: 0 0 4px 0;
  font-size: 1rem;
  color: var(--color-secondary);
}

.leaflet-popup-content p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* =========================================
   NUEVOS CONTENIDOS: TOUR & INFO
   ========================================= */
.tour-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tour-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: var(--transition-normal);
  text-align: left;
  width: 100%;
}

.tour-card:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-base);
}

.tour-card .material-symbols-rounded {
  color: var(--color-primary);
}

.info-content {
  background: var(--color-surface);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.info-content p {
  margin-bottom: var(--space-2);
  font-size: 0.95rem;
}

.info-content p:last-child {
  margin-bottom: 0;
}

/* =========================================
   SUGERENCIAS DE BÚSQUEDA
   ========================================= */
.suggestions-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  margin-top: var(--space-2);
  border-radius: var(--radius-md);
  z-index: var(--z-ui-dropdown);
  padding: var(--space-2) 0;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.suggestion-item:hover {
  background-color: rgba(37, 99, 235, 0.08);
}

.suggestion-item .material-symbols-rounded {
  color: var(--color-text-muted);
  font-size: 1.25rem;
}

.suggestion-item .suggestion-info {
  display: flex;
  flex-direction: column;
}

.suggestion-item .suggestion-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-main);
}

.suggestion-item .suggestion-type {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* =========================================
   PANEL DE RUTAS (Routing UI)
   ========================================= */
.routing-panel {
  position: absolute;
  bottom: 0;
  width: 100%;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-4);
  z-index: var(--z-ui-dropdown);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.routing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.routing-header h3 {
  font-size: 1.1rem;
  color: var(--color-secondary);
}

.routing-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.routing-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background-color: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}

.routing-field .field-icon {
  color: var(--color-text-muted);
  font-size: 1.25rem;
}

.routing-field select {
  flex: 1;
  background: transparent;
  /* ← cámbialo a transparent */
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text-main);
  /* sigue blanco → se ve bien en el panel oscuro */
  cursor: pointer;
}

/* ← Esto es lo que faltaba */
.routing-field select option {
  background-color: #1e293b;
  /* fondo oscuro igual al panel */
  color: #f1f5f9;
  /* texto claro, legible */
}

.route-info-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  background-color: rgba(37, 99, 235, 0.08);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
}

.route-info-bar .material-symbols-rounded {
  font-size: 1.1rem;
}

.route-steps {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-right: var(--space-2);
}

.route-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.85rem;
  color: var(--color-text-main);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.02);
}

.route-step-num {
  font-weight: 700;
  color: var(--color-primary);
  background-color: rgba(37, 99, 235, 0.1);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.route-step-text {
  flex: 1;
  line-height: 1.3;
}

/* =========================================
   PANNELLUM VIEWER
   ========================================= */
#panoramaViewer {
  width: 100%;
  height: 100%;
}

.popup-360-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-primary);
  color: var(--color-surface);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color var(--transition-fast);
}

.popup-360-btn:hover {
  background-color: var(--color-primary-hover);
}

.popup-route-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-secondary);
  color: var(--color-surface);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color var(--transition-fast);
}

.popup-route-btn:hover {
  background-color: #1e293b;
}

/* =========================================
   ANIMACIONES DE RUTA
   ========================================= */
.animated-route-line {
  stroke-dasharray: 12, 12;
  animation: routeDash 30s linear infinite;
}

@keyframes routeDash {
  to {
    stroke-dashoffset: -1000;
  }
}

/* =========================================
   LISTADO DE UBICACIONES EN EL MAPA
   ========================================= */
.poi-list-container {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-right: 4px;
}

.poi-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: var(--transition-normal);
  text-align: left;
  width: 100%;
}

.poi-list-item:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-base);
}

.poi-list-item .material-symbols-rounded {
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.08);
  padding: var(--space-2);
  border-radius: 50%;
  font-size: 1.25rem;
}

.poi-list-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.poi-list-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 2px;
}

.poi-list-desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================
   MARCADOR DE USUARIO DEL TOUR 360 (Google Maps style)
   ========================================= */
.tour-user-marker {
  z-index: 1200 !important;
}

.user-position-pulse {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: rgba(37, 99, 235, 0.4);
  animation: pulseUser 1.8s infinite ease-in-out;
}

@keyframes pulseUser {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }

  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.user-dot {
  width: 14px;
  height: 14px;
  background-color: #2563eb;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.user-dot .material-symbols-rounded {
  font-size: 8px !important;
  font-variation-settings: "FILL" 1;
}

/* =========================================
   ESTILOS DE BOTONES FLOTANTES (Action & Shadow)
   ========================================= */
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-surface-glass);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--color-text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  pointer-events: auto;
  /* Reactivar clicks en ui-layer */
}

.action-btn:hover {
  background: var(--color-surface);
  transform: scale(1.05);
  color: var(--color-primary);
}

.shadow-btn {
  box-shadow: var(--shadow-md);
}

/* =========================================
   MODO OSCURO PREMIUM (Dark Theme overrides)
   ========================================= */
body.dark-theme {
  --color-bg-base: #0f172a;
  /* Slate 900 */
  --color-surface: #1e293b;
  /* Slate 800 */
  --color-surface-glass: rgba(30, 41, 59, 0.82);

  --color-primary: #3b82f6;
  /* Azul más claro */
  --color-primary-hover: #60a5fa;
  --color-secondary: #f8fafc;
  /* Slate 50 */

  --color-text-main: #f1f5f9;
  --color-text-muted: #94a3b8;

  --color-border: #334155;
  --color-divider: rgba(255, 255, 255, 0.08);
}

/* Correcciones de visibilidad para popups en modo oscuro */
body.dark-theme .leaflet-popup-content-wrapper {
  background: var(--color-surface) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-text-main) !important;
}

body.dark-theme .leaflet-popup-tip {
  background: var(--color-surface) !important;
}

body.dark-theme .leaflet-popup-content h3 {
  color: var(--color-secondary) !important;
}

body.dark-theme .leaflet-popup-content p {
  color: var(--color-text-muted) !important;
}

body.dark-theme .popup-360-btn {
  background-color: var(--color-primary);
  color: #ffffff;
}

body.dark-theme .popup-route-btn {
  background-color: #334155;
  color: var(--color-secondary);
}

body.dark-theme .popup-route-btn:hover {
  background-color: #475569;
}

/* =========================================
   ESTILOS ADICIONALES: VISOR 360, OPINIONES Y EDITOR
   ========================================= */

/* 1. ANULACIÓN DE ESTILOS DE PANNELLUM (Botones más pequeños) */
.pnlm-control {
  background: var(--color-surface-glass) !important;
  backdrop-filter: var(--blur-glass) !important;
  -webkit-backdrop-filter: var(--blur-glass) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: var(--color-text-main) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-md) !important;
}

.pnlm-zoom-controls {
  width: 30px !important;
  height: 60px !important;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
}

.pnlm-zoom-in,
.pnlm-zoom-out {
  width: 30px !important;
  height: 30px !important;
  font-size: 16px !important;
  line-height: 28px !important;
  color: var(--color-text-main) !important;
  background: var(--color-surface-glass) !important;
  backdrop-filter: var(--blur-glass) !important;
  -webkit-backdrop-filter: var(--blur-glass) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all var(--transition-fast) !important;
}

.pnlm-zoom-in:hover,
.pnlm-zoom-out:hover {
  background: var(--color-surface) !important;
  color: var(--color-primary) !important;
}

.pnlm-zoom-in {
  border-radius: 8px 8px 0 0 !important;
  border-bottom: none !important;
}

.pnlm-zoom-out {
  border-radius: 0 0 8px 8px !important;
}

/* Hotspots de Pannellum más pequeños y elegantes */
.pnlm-hotspot-base {
  width: 22px !important;
  height: 22px !important;
  background-color: var(--color-primary) !important;
  border: 2px solid white !important;
  border-radius: 50% !important;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.6) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.pnlm-hotspot-base:hover {
  transform: scale(1.2) !important;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.9) !important;
}

.pnlm-hotspot-base.pnlm-scene {
  background-image: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.pnlm-hotspot-base.pnlm-scene::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 7px solid white;
  transform: translateY(-1px);
}

.pnlm-tooltip span {
  font-family: var(--font-primary) !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  background-color: var(--color-secondary) !important;
  color: var(--color-surface) !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  box-shadow: var(--shadow-sm) !important;
}

/* 2. ESTILOS DE SECCIÓN DE OPINIONES */
.campus-reviews-section,
.poi-reviews-section {
  margin-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-4);
}

.section-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-secondary);
  margin-bottom: var(--space-3);
}

.add-review-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3);
  background-color: rgba(37, 99, 235, 0.08);
  border: 1px dashed var(--color-primary);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-normal);
}

.add-review-btn:hover {
  background-color: var(--color-primary);
  color: white;
  border-style: solid;
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
  max-height: 250px;
  overflow-y: auto;
  padding-right: var(--space-2);
}

.reviews-loader {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  padding: var(--space-3) 0;
}

.review-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.review-user {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-main);
}

.review-stars {
  display: flex;
  color: #fbbf24;
  /* Amber star color */
  gap: 1px;
}

.review-stars .material-symbols-rounded {
  font-size: 0.9rem;
  font-variation-settings: 'FILL' 1;
}

.review-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.review-date {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-align: right;
}

/* 3. MODAL DE OPINIONES */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeInModal var(--transition-fast);
}

.modal-content {
  width: 100%;
  max-width: 450px;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.2rem;
  color: var(--color-secondary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text-main);
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  outline: none;
}

.star-rating {
  display: flex;
  gap: var(--space-2);
}

.star-btn {
  color: #d1d5db;
  /* Light gray */
  cursor: pointer;
  font-size: 1.75rem !important;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.star-btn:hover {
  transform: scale(1.15);
}

.star-btn.active {
  color: #fbbf24;
  font-variation-settings: 'FILL' 1;
}

.submit-btn {
  background-color: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background-color var(--transition-fast);
  margin-top: var(--space-2);
  cursor: pointer;
}

.submit-btn:hover {
  background-color: var(--color-primary-hover);
}

@keyframes fadeInModal {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 4. NOTIFICACIONES TOAST */
.toast-notification {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 15000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDownToast 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDownToast {
  from {
    top: 10px;
    opacity: 0;
  }

  to {
    top: 30px;
    opacity: 1;
  }
}

.dev-panel {
  position: fixed;
  top: 80px;
  /* debajo de la barra de búsqueda */
  right: 60px;
  /* a la izquierda de los controles flotantes */
  width: 280px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  z-index: 1100;
  /* por encima de todo */
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dev-panel.hidden {
  display: none;
}

.dev-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dev-panel-header h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin: 0;
}

.dev-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-1);
}

.dev-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-1);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.2s;
}

.dev-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-main);
}

.dev-tool-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.dev-tool-btn .material-symbols-rounded {
  font-size: 1.1rem;
}

.dev-tool-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding: var(--space-2);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  text-align: center;
  line-height: 1.4;
}

.dev-panel-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dev-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-main);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  text-align: left;
}

.dev-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.dev-btn .material-symbols-rounded {
  font-size: 1rem;
  color: var(--color-primary);
}

.dev-stats {
  display: flex;
  justify-content: space-around;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

/* Marcadores de Edición en Leaflet */
.dev-edit-marker {
  background-color: #f97316 !important;
  border: 2px solid white !important;
  border-radius: 50% !important;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.8) !important;
  cursor: grab !important;
  pointer-events: auto !important;
  z-index: 5000 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.dev-edit-marker:active {
  cursor: grabbing !important;
}

.dev-marker-icon-wrapper img {
  filter: brightness(0) invert(1) !important;
  /* Force icon to be white inside the orange circle */
  opacity: 0.95;
}

/* Tooltip de los marcadores de edición */
.dev-marker-tooltip {
  background-color: #0f172a !important;
  color: white !important;
  border: none !important;
  font-family: var(--font-primary) !important;
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  border-radius: 4px !important;
  padding: 2px 6px !important;
}

/* Estilo del botón devModeBtn activo */
#devModeBtn.active {
  background-color: #f97316 !important;
  color: white !important;
  border-color: #f97316 !important;
}

#devModeBtn.active .material-symbols-rounded {
  color: white !important;
}

/* Soporte para modo oscuro en opiniones */
body.dark-theme .review-card {
  background-color: var(--color-surface);
  border-color: var(--color-border);
}

body.dark-theme .add-review-btn {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

body.dark-theme .add-review-btn:hover {
  background-color: var(--color-primary);
  color: white;
}

body.dark-theme .form-group input,
body.dark-theme .form-group textarea {
  background-color: #0f172a;
  border-color: var(--color-border);
}

/* =========================================
   ESTILOS DE ICONOS PERSONALIZADOS
   ========================================= */
.poi-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Colores de fondo por categoría */
.poi-icon-wrapper.building {
  background-color: rgba(37, 99, 235, 0.08);
}

.poi-icon-wrapper.bathroom {
  background-color: rgba(16, 185, 129, 0.08);
}

.poi-icon-wrapper.food {
  background-color: rgba(245, 158, 11, 0.08);
}

.poi-icon-img {
  width: 16px;
  height: 16px;
  display: block;
}

/* Tintar iconos SVG de forma dinámica usando CSS filters */
.poi-icon-wrapper.building .poi-icon-img {
  filter: brightness(0) saturate(100%) invert(31%) sepia(87%) saturate(2250%) hue-rotate(209deg) brightness(97%) contrast(92%);
  /* Royal Blue #2563eb */
}

.poi-icon-wrapper.bathroom .poi-icon-img {
  filter: brightness(0) saturate(100%) invert(58%) sepia(58%) saturate(543%) hue-rotate(113deg) brightness(96%) contrast(90%);
  /* Emerald Green #10b981 */
}

.poi-icon-wrapper.food .poi-icon-img {
  filter: brightness(0) saturate(100%) invert(67%) sepia(85%) saturate(497%) hue-rotate(352deg) brightness(99%) contrast(94%);
  /* Amber Orange #f59e0b */
}

/* Soporte para Modo Oscuro en iconos */
body.dark-theme .poi-icon-wrapper.building {
  background-color: rgba(59, 130, 246, 0.15);
}

body.dark-theme .poi-icon-wrapper.bathroom {
  background-color: rgba(52, 211, 153, 0.15);
}

body.dark-theme .poi-icon-wrapper.food {
  background-color: rgba(251, 191, 36, 0.15);
}

body.dark-theme .poi-icon-wrapper.building .poi-icon-img {
  filter: brightness(0) saturate(100%) invert(60%) sepia(80%) saturate(1000%) hue-rotate(200deg);
  /* Azul claro en dark mode */
}

body.dark-theme .poi-icon-wrapper.bathroom .poi-icon-img {
  filter: brightness(0) saturate(100%) invert(60%) sepia(80%) saturate(1000%) hue-rotate(100deg);
  /* Verde claro en dark mode */
}

body.dark-theme .poi-icon-wrapper.food .poi-icon-img {
  filter: brightness(0) saturate(100%) invert(60%) sepia(80%) saturate(1000%) hue-rotate(20deg);
  /* Amarillo claro en dark mode */
}

/* =========================================
   BARRA DE SCROLL PERSONALIZADA
   ========================================= */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  /* Gris pizarra semitransparente */
  border-radius: 4px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.45);
}

body.dark-theme ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}


.dev-node-marker {
  background: transparent !important;
  border: none !important;
  cursor: grab !important;
}

.dev-node-marker:active {
  cursor: grabbing !important;
}

/* ── Enhanced Dev Panel ─────────────────────────────── */
.dev-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.dev-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-1);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.2s;
}

.dev-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-main);
}

.dev-tool-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.dev-tool-btn .material-symbols-rounded {
  font-size: 1.1rem;
}

.dev-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.dev-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-1);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.2s;
}

.dev-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-main);
}

.dev-tool-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.dev-tool-btn .material-symbols-rounded {
  font-size: 1.1rem;
}

.dev-tool-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding: var(--space-2);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
}

.dev-panel-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dev-stats {
  display: flex;
  justify-content: space-around;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

/* =========================================
   SPINNER PARA OPINIONES
   ========================================= */
.reviews-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.reviews-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: reviews-spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* =========================================
   MENÚ DE NAVEGACIÓN DEL TOUR 360
   ========================================= */
#toggleSceneMenu {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10000;
  background: white;
  color: #333;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.scene-menu {
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;
  max-width: 85vw;
  height: 100%;
  z-index: 10001;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  border-radius: 0;
}

.scene-menu.open {
  transform: translateX(0);
}

.scene-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}

.scene-menu-header h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--color-secondary);
}

.scene-menu-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-2);
}

.scene-menu-empty {
  padding: var(--space-4);
  color: var(--color-text-muted);
  text-align: center;
  font-size: 0.9rem;
}

.scene-group {
  margin-bottom: var(--space-4);
}

.scene-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 var(--space-3);
  margin: 0 0 var(--space-2);
}

.scene-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scene-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  text-align: left;
  font-size: 0.875rem;
  color: var(--color-text-main);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  width: 100%;
}

.scene-item:hover {
  background-color: rgba(37, 99, 235, 0.08);
  color: var(--color-primary);
}

.scene-item.active {
  background-color: rgba(37, 99, 235, 0.12);
  color: var(--color-primary);
  font-weight: 600;
}

.scene-item .material-symbols-rounded {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.scene-item.active .material-symbols-rounded {
  color: var(--color-primary);
  font-variation-settings: "FILL" 1;
}

body.dark-theme .scene-menu {
  background: var(--color-surface);
}