/* ============================================================
   SeDesvara - Estilos Responsive
   ============================================================ */

/* Fix global: evitar scroll horizontal en movil */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
*, *::before, *::after {
  box-sizing: border-box !important;
}

/* ===== MOVIL (max 768px) ===== */
@media (max-width: 768px) {
  /* Banner del negocio - que se comprima, no se corte */
  .hero-negocio, .hero-bg, [style*="height:400px"], [style*="height:340px"] {
    height: 220px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-color: #0f172a !important;
  }
  
  /* Info del negocio debajo del banner */
  [style*="padding:24px 32px"] {
    padding: 16px !important;
  }
  
  /* Botones del hero - que se acomoden */
  .hero-cta, [style*="display:flex; gap:10px; flex-wrap:wrap"] {
    flex-direction: column !important;
  }
  .hero-cta a, .hero-cta button, [style*="display:flex; gap:10px"] a, [style*="display:flex; gap:10px"] button {
    width: 100% !important;
    justify-content: center !important;
  }
  
  /* Buscador del index */
  .buscador-principal, [class*="buscador"] {
    flex-direction: column !important;
  }
  .buscador-principal input, .buscador-principal select, [class*="buscador"] input, [class*="buscador"] select {
    width: 100% !important;
    margin-bottom: 8px;
  }
  
  /* Grid de productos - 1 columna en movil */
  #productos-publico-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Tablas - scroll horizontal */
  .overflow-x-auto, table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Modales - pantalla completa en movil */
  .modal-box {
    width: 95% !important;
    max-width: 95% !important;
    margin: 0 !important;
  }
  
  /* Sidebar de paneles - ocultar en movil, mostrar toggle */
  .sidebar-panel {
    transform: translateX(-100%) !important;
    transition: transform 0.3s !important;
  }
  .sidebar-panel.open {
    transform: translateX(0) !important;
  }
  
  /* Main panel - ocupar todo el ancho en movil */
  .main-panel {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  /* Cards de KPIs - 2 columnas en movil */
  .grid.grid-cols-4, .grid.grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  /* Textos grandes - reducir */
  h1 { font-size: 22px !important; }
  h2 { font-size: 18px !important; }
  .text-2xl { font-size: 18px !important; }
  .text-xl { font-size: 16px !important; }
  
  /* Padding general reducido */
  .p-7 { padding: 12px !important; }
  .p-6 { padding: 12px !important; }
  .p-5 { padding: 10px !important; }
  
  /* Navbar - forzar menu hamburguesa siempre */
  .navbar-center { display: none !important; }
  .navbar-start .dropdown { display: block !important; }
}

/* ===== TABLET (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  .hero-negocio, .hero-bg, [style*="height:400px"], [style*="height:340px"] {
    height: 300px !important;
  }
  
  #productos-publico-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .grid.grid-cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ===== Boton toggle para sidebar en movil ===== */
.sidebar-toggle-btn {
  display: none;
}
@media (max-width: 768px) {
  .sidebar-toggle-btn {
    display: flex !important;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 70;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
  }
}

/* ===== Overlay para cerrar sidebar en movil ===== */
.sidebar-overlay {
  display: none;
}
@media (max-width: 768px) {
  .sidebar-overlay.show {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 55;
  }
}

/* ===== BUSCADOR Y STATS DEL INDEX (responsive) ===== */
@media (max-width: 900px) {
  .hero-content { max-width: 100% !important; padding: 0 12px !important; }
  .search-box {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 12px !important;
    gap: 8px !important;
    border-radius: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .search-box > * {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .search-box > svg:first-child {
    display: none !important;
  }
  .search-box input,
  .search-box select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
  }
  .search-box .search-divider {
    display: none !important;
  }
  .search-box .btn-search,
  .search-box .btn-geo {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px !important;
    box-sizing: border-box !important;
  }

  /* Stats del hero - grid 2x2 en movil */
  .hero-stats-animados {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    margin-top: 20px !important;
    padding: 0 8px !important;
  }
  .hero-stat-item {
    flex-direction: column !important;
    text-align: center !important;
    gap: 4px !important;
    background: rgba(255,255,255,0.1) !important;
    padding: 12px 8px !important;
    border-radius: 12px !important;
  }
  .hero-stat-icon {
    margin: 0 auto !important;
  }
  .hero-stat-num {
    font-size: 22px !important;
  }
  .hero-stat-label {
    font-size: 11px !important;
  }
}
