/* ═══════════════════════════════════════════════════════════════════════════
   premium-search.css · Buscador premium + filtro por línea/marca
   ---------------------------------------------------------------------------
   Se carga DESPUÉS de los demás CSS, así que gana sin editar nada existente.
   Acompaña al panel #search-brands inyectado en layout.php. No toca app.js.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Input: un toque más premium (más alto, sombra suave, icono que reacciona) ── */
.gsearch-input {
  border-radius: 14px;
  font-size: .92rem;
  box-shadow: 0 1px 2px rgba(13, 61, 36, .05);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.gsearch-wrap:focus-within .gsearch-icon { color: #1f7a4d; }
.gsearch-input:focus {
  box-shadow: 0 0 0 4px rgba(31, 122, 77, .14), 0 6px 18px rgba(13, 61, 36, .08);
}

/* ── Panel de líneas/marcas (aparece al enfocar el buscador) ── */
.gsearch-brands {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: min(400px, calc(100vw - 32px));
  z-index: 1300;
  background: #fff;
  border: 1px solid #e3ece7;
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(13, 61, 36, .16), 0 2px 6px rgba(0, 0, 0, .05);
  padding: 16px 16px 14px;
  animation: gsbIn .16s cubic-bezier(.22, .9, .22, 1);
}
.gsearch-brands[hidden] { display: none; }
@keyframes gsbIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.gsb-head {
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #6b8576;
  margin: 2px 2px 11px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.gsb-head svg { color: #1f7a4d; }

.gsb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gsb-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1.5px solid #e3ece7;
  border-radius: 999px;
  background: #f7faf8;
  color: #0d3d24;
  font-size: .85rem;
  font-weight: 800;
  text-decoration: none;
  line-height: 1;
  transition: transform .15s ease, border-color .15s ease,
              background .15s ease, box-shadow .15s ease;
}
.gsb-chip:hover,
.gsb-chip:focus-visible {
  border-color: #1f7a4d;
  background: #eafaf0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 122, 77, .16);
  outline: none;
}
.gsb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #1f7a4d);
  flex-shrink: 0;
}
.gsb-cnt {
  font-size: .67rem;
  font-weight: 800;
  color: #1f7a4d;
  background: #fff;
  border: 1px solid #d6e7dd;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.gsb-foot {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid #eef4f0;
}
.gsb-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  font-weight: 800;
  color: #1f7a4d;
  text-decoration: none;
}
.gsb-all:hover { text-decoration: underline; }

/* ── Dropdown de RESULTADOS: más grande, legible y con scroll ── */
.gsearch-dropdown.open {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: min(440px, calc(100vw - 32px));
  z-index: 1300;
  max-height: min(72vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 16px;
  border: 1px solid #e3ece7;
  background: #fff;
  box-shadow: 0 18px 44px rgba(13, 61, 36, .18), 0 2px 6px rgba(0, 0, 0, .05);
  padding: 8px;
}
.gsearch-item {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 12px;
  padding: 11px 12px;
  border-bottom: none !important;
  transition: background .14s ease;
}
.gsearch-item:hover,
.gsearch-item.active {
  background: #eafaf0 !important;
}
.gsearch-item img,
.gsearch-item .prod-thumb-mini {
  width: 48px !important;
  height: 48px !important;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .10);
  flex-shrink: 0;
  object-fit: cover;
}
.gsearch-item-info { flex: 1 1 auto; min-width: 0; }
.gsearch-item-name {
  font-size: .92rem;
  font-weight: 800;
  color: #0d3d24;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gsearch-item-cat {
  font-size: .72rem;
  color: #6b8576;
  margin-top: 3px;
  text-transform: capitalize;
}
.gsearch-item-price {
  flex-shrink: 0;
  align-self: center;
  font-weight: 900;
  color: #1f7a4d;
  font-size: .9rem;
  background: #eafaf0;
  border: 1px solid #d6e7dd;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.gsearch-no-results {
  padding: 20px 16px;
  text-align: center;
  color: #6b8576;
  font-size: .88rem;
}
/* Scrollbar elegante cuando hay muchos resultados */
.gsearch-dropdown.open::-webkit-scrollbar { width: 9px; }
.gsearch-dropdown.open::-webkit-scrollbar-thumb {
  background: #cfe3d8; border-radius: 9px; border: 2px solid #fff;
}
.gsearch-dropdown.open::-webkit-scrollbar-track { background: transparent; }
.gsearch-dropdown.open { scrollbar-width: thin; scrollbar-color: #cfe3d8 transparent; }

/* ── Móvil: paneles a ancho completo + chips compactos ── */
@media (max-width: 720px) {
  .gsearch-brands,
  .gsearch-dropdown.open {
    width: auto;
    left: 0;
    right: 0;
    max-height: 66vh;
  }
  .gsearch-brands { padding: 12px; }
  .gsb-chip { font-size: .8rem; padding: 7px 11px; }
  .gsearch-item { padding: 10px; gap: 12px; }
  .gsearch-item img,
  .gsearch-item .prod-thumb-mini { width: 44px !important; height: 44px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .gsearch-brands { animation: none; }
  .gsb-chip { transition: none; }
}
