/* =========================================
   RESPONSIVE DESIGN (Desktop Adjustments)
   ========================================= */

/* Ocultar el visor 360 por defecto */
.hidden-360 {
  display: none !important;
}

/* Visor 360 a pantalla completa (Móvil y Escritorio) */
#viewer360 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: #000;
}

#close360 {
  position: absolute;
  top: 20px;
  right: 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);
}

/* Ocultar botón de menú hamburguesa de escritorio en móvil por defecto */
.menu-toggle-desktop {
  display: none !important;
}

/* Tablets en adelante (>= 768px) */
@media (min-width: 768px) {
  /* Contenedor de UI general */
  .ui-layer {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Permite clickear el mapa de fondo */
    padding: 20px;
    box-sizing: border-box;
  }

  /* La barra de búsqueda flota arriba a la izquierda, desplazada a la derecha de la barra lateral */
  .top-bar {
    position: absolute;
    top: 20px;
    left: 92px;
    margin: 0;
    width: 360px;
    z-index: 1100;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .search-container {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }

  /* Transformación de BottomSheet a Sidebar Lateral, desplazada a la derecha de la barra lateral */
  .bottom-sheet {
    position: absolute;
    top: 90px; /* Se posiciona justo debajo de la barra de búsqueda */
    left: 92px;
    bottom: 20px;
    width: 360px;
    height: calc(100vh - 110px) !important; /* Altura dinámica fija */
    max-height: none !important;
    border-radius: 16px !important;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    z-index: 1000;
    transform: none !important; /* Desactiva la animación de subida de móvil */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  /* Ocultamos el manejador de arrastre en PC porque el panel ya está fijo */
  .drag-handle-container {
    display: none !important;
  }

  .sheet-drag-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: none !important;
  }

  /* Contenido interno del panel con scroll independiente - Corregimos el bug de especificidad */
  .sheet-content,
  .bottom-sheet.collapsed .sheet-content,
  .bottom-sheet.expanded .sheet-content {
    flex: 1;
    overflow-y: auto !important;
    padding: 20px;
    height: auto !important; /* Evita colapso en escritorio */
    display: block !important;
  }

  /* Barra Lateral Estilo Google Maps (Vertical fija a la izquierda) */
  .bottom-nav {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 72px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    padding-top: 24px;
    background-color: var(--color-surface) !important;
    border-top: none !important;
    border-right: 1px solid var(--color-border) !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08) !important;
    z-index: 1200 !important;
    pointer-events: auto !important;
  }

  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 4px;
  }

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

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

  /* Mostrar botón de menú hamburguesa sólo en escritorio */
  .menu-toggle-desktop {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    margin-bottom: 24px;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 4px;
  }
  
  .menu-toggle-desktop:hover {
    color: var(--color-primary);
    background-color: rgba(37, 99, 235, 0.05);
  }
  
  body.dark-theme .menu-toggle-desktop:hover {
    background-color: rgba(59, 130, 246, 0.08);
  }

  .filter-chip-container {
    padding: 10px 0;
    display: flex;
    flex-wrap: wrap; /* Los chips bajan si no caben */
    gap: 8px;
  }

  /* Controles del mapa (recenter, zoom de leaflet) a la derecha */
  .floating-controls {
    position: absolute;
    bottom: 30px;
    right: 20px;
    pointer-events: auto;
  }

  /* Panel de Rutas de escritorio */
  .routing-panel {
    position: absolute;
    top: 90px;
    left: 92px; /* Alineado a la derecha de la barra lateral */
    bottom: 20px;
    width: 360px;
    height: calc(100vh - 110px) !important;
    max-height: none !important;
    border-radius: 16px !important;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    z-index: 1005;
    transform: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }

  .route-steps {
    max-height: none !important;
    flex: 1;
  }

  .suggestions-panel {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }

  /* Clases para ocultar dinámicamente en escritorio con animación suave
     Usamos opacity + transform + pointer-events para que la transición funcione,
     en lugar de display:none que la mata en seco. */
  .bottom-sheet.desktop-hidden,
  .top-bar.desktop-hidden,
  .routing-panel.desktop-hidden {
    opacity: 0;
    transform: translateX(-20px) !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .bottom-sheet,
  .top-bar,
  .routing-panel {
    transition: opacity 0.25s ease, transform 0.25s ease;
  }
}

/* Pantallas grandes (>= 1024px) */
@media (min-width: 1024px) {
  .top-bar,
  .bottom-sheet,
  .routing-panel {
    width: 400px; /* Un poco más ancho para pantallas amplias */
  }
}



