/* ========================================
   styles-pwa.css — Layout Mobile-First PWA
   Sobreescribe solo layout no visual
   ======================================== */

/* ---- RESET LAYOUT EXISTENTE ---- */
main {
  display: block !important;
  height: 100vh !important;
  padding: 0 !important;
  position: relative !important;
  overflow: hidden !important;
}

#mapContainer {
  position: fixed !important;
  inset: 0 !important;
  flex: none !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  z-index: 1 !important;
}

#map {
  width: 100% !important;
  height: 100% !important;
}

/* ---- BOTTOM SHEET (lista de locales) ---- */
#resultsPanel {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 100 !important;
  flex: none !important;
  width: 100% !important;
  height: 35vh !important;
  min-height: 80px !important;
  max-height: 85vh !important;
  background: #fff !important;
  border-radius: 16px 16px 0 0 !important;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15) !important;
  display: flex !important;
  flex-direction: column !important;
  transition: height 0.3s ease !important;
  touch-action: none !important;
}

#resultsPanel.expanded {
  height: 75vh !important;
}

/* Handle de arrastre */
.panel-handle {
  width: 40px;
  height: 5px;
  background: #ccc;
  border-radius: 3px;
  margin: 8px auto;
  cursor: grab;
  flex-shrink: 0;
}

.panel-handle:active {
  cursor: grabbing;
}

.panel-header {
  flex-shrink: 0;
  padding: 8px 16px !important;
  background: #fff !important;
  border-bottom: 1px solid #eee !important;
}

.panel-header h3 {
  font-size: 0.95rem !important;
}

.places-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px !important;
  -webkit-overflow-scrolling: touch;
}

/* ---- HEADER COMPACTO ---- */
header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 200 !important;
  padding: 0.5rem 1rem !important;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
  flex-wrap: nowrap !important;
  gap: 0.5rem !important;
}

.logo h1 {
  font-size: 1.1rem !important;
}

.logo i {
  font-size: 1.2rem !important;
}

.header-badge .badge-certified,
.header-badge .badge-verified {
  display: none !important;
}

.header-badge a {
  padding: 0.3rem 0.6rem !important;
  font-size: 0.7rem !important;
  margin-right: 0 !important;
}

.header-badge a span {
  display: none !important;
}

/* ---- STATS MINI ---- */
.stats-mini {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 199 !important;
  padding: 0.2rem 0.4rem !important;
  gap: 0.2rem !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  /* top se asigna dinámicamente */
}

.stats-mini-item {
  font-size: 0.6rem !important;
  padding: 0.1rem 0.5rem !important;
  white-space: nowrap !important;
}

/* ---- BARRA DE BÚSQUEDA ---- */
.search-bar {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 198 !important;
  padding: 0.3rem 0.5rem !important;
  background: transparent !important;
  box-shadow: none !important;
  /* top se asigna dinámicamente */
}

.search-container {
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  padding: 0 !important;
}

.search-container i {
  font-size: 0.8rem !important;
  margin-left: 0.5rem !important;
}

.search-container input {
  font-size: 0.8rem !important;
  padding: 0.4rem 0 !important;
}

.btn-search {
  padding: 0.35rem 0.6rem !important;
  font-size: 0.7rem !important;
}

#clearSearchBtn {
  padding: 0.35rem 0.5rem !important;
  font-size: 0.7rem !important;
}

/* ---- FILTROS ---- */
.filters {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 197 !important;
  padding: 0.3rem 0.5rem !important;
  gap: 0.3rem !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #eee !important;
  /* top se asigna dinámicamente */
}

.filters > div:last-child {
  display: none !important;
}

.filter-group {
  flex: 1;
  min-width: 0;
}

.filter-group label {
  display: none !important;
}

.filter-group select {
  padding: 0.25rem 0.4rem !important;
  font-size: 0.7rem !important;
  min-width: 0 !important;
  width: 100% !important;
}

/* ---- CONTENIDO DEBE RESPETAR HEADER (se calcula dinámicamente en JS) ---- */
body {
  padding-top: 0 !important;
}

/* ---- MODAL ---- */
.modal {
  z-index: 300 !important;
}

.modal-content {
  margin: 15% auto !important;
  max-width: 400px !important;
}

/* ---- BOTÓN DE GEOLOCALIZACIÓN ---- */
.locate-btn {
  position: fixed !important;
  bottom: calc(35vh + 60px) !important;
  right: 12px !important;
  z-index: 1000 !important;
  width: 40px !important;
  height: 40px !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  background: white !important;
  border: 2px solid rgba(0,0,0,0.15) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.2rem !important;
  color: #1a1a2e !important;
  transition: transform 0.2s !important;
}

.locate-btn:active {
  transform: scale(0.9) !important;
}

.locate-btn.locating {
  color: #3498db !important;
  animation: locatePulse 1s infinite !important;
}

@keyframes locatePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,152,219,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(52,152,219,0); }
}

/* ---- FOOTER ---- */
footer {
  display: none !important;
}

/* ========================================
   DESKTOP (>900px)
   ======================================== */
@media (min-width: 900px) {
  main {
    display: flex !important;
    height: calc(100vh - 220px) !important;
    padding: 1rem !important;
    position: static !important;
    overflow: visible !important;
  }

  #mapContainer {
    position: relative !important;
    flex: 2 !important;
    height: auto !important;
    border-radius: 12px !important;
    z-index: auto !important;
  }

  #resultsPanel {
    position: relative !important;
    flex: 1 !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    touch-action: auto !important;
  }

  #resultsPanel.expanded {
    height: auto !important;
  }

  .panel-handle {
    display: none !important;
  }

  header {
    position: relative !important;
    padding: 1rem 2rem !important;
    flex-wrap: wrap !important;
  }

  .logo h1 {
    font-size: 1.6rem !important;
  }

  .logo i {
    font-size: 1.8rem !important;
  }

  .header-badge .badge-certified,
  .header-badge .badge-verified {
    display: inline-block !important;
  }

  .header-badge a {
    padding: 0.5rem 1rem !important;
    font-size: inherit !important;
  }

  .stats-mini {
    position: relative !important;
    top: auto !important;
    padding: 0.5rem 2rem !important;
    justify-content: space-around !important;
  }

  .stats-mini-item {
    font-size: 0.9rem !important;
    padding: 0.3rem 1.2rem !important;
  }

  .search-bar {
    position: relative !important;
    top: auto !important;
    padding: 1rem 2rem !important;
    background: white !important;
  }

  .search-container {
    background: #f5f5f5 !important;
    backdrop-filter: none;
    box-shadow: none;
  }

  .search-container input {
    font-size: 1rem !important;
    padding: 0.8rem 0 !important;
  }

  .btn-search {
    padding: 0.7rem 1.5rem !important;
    font-size: inherit !important;
  }

  #clearSearchBtn {
    padding: 0.7rem 1rem !important;
    font-size: inherit !important;
  }

  .filters {
    position: relative !important;
    top: auto !important;
    padding: 1rem 2rem !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
    background: white !important;
    backdrop-filter: none;
  }

  .filter-group {
    flex: none;
  }

  .filter-group label {
    display: flex !important;
  }

  .filter-group select {
    padding: 0.5rem 1rem !important;
    font-size: inherit !important;
    min-width: 150px !important;
    width: auto !important;
  }

  body {
    padding-top: 0 !important;
  }

  footer {
    display: block !important;
  }
}
