/* ============================================================
   Beshop SearchBar v2.0.0 — front.css
   ============================================================ */

/* ---- Trigger (lupa) ---- */
.bsb-trigger {
  display: inline-flex; align-items: center; justify-content: center;

  background: none; border: none; cursor: pointer;
  color: currentColor; border-radius: 50%;
  transition: opacity .15s;
}
.bsb-trigger:hover { opacity: .7; }
.bsb-trigger:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---- Backdrop ---- */
.bsb-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1040;
}
.bsb-backdrop--visible { display: block; }
.beshopcart_unavailable{
  display: flex;
  align-items: center;
  font-size: 14px;
}
/* ---- Overlay ---- */
.bsb-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1050; background: var(--beshop-bg-card);
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  transform: translateY(-8px); opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.bsb-overlay.is-open {
  display: block;
  transform: translateY(0); opacity: 1;
}

.bsb-overlay__inner { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* ---- Header overlay ---- */
.bsb-overlay__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0; border-bottom: 1px solid var(--beshop-line);
}

.bsb-input-wrap {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--beshop-bg-soft); border-radius: 8px; padding: 10px 14px;
}
.bsb-input-icon { color: var(--beshop-text-subtle); flex-shrink: 0; }
.bsb-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 1rem; color: var(--beshop-text);
}
.bsb-input::placeholder { color: var(--beshop-text-subtle); }
.bsb-clear {
  background: none; border: none; cursor: pointer;
  color: var(--beshop-text-subtle); font-size: 1.2rem; line-height: 1;
  display: flex; align-items: center; padding: 0;
}
.bsb-clear:hover { color: var(--beshop-text); }

.bsb-close {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--beshop-text-muted); border-radius: 50%;
  transition: background .15s;
}
.bsb-close:hover { background: var(--beshop-bg-soft); }
.bsb-close:focus-visible { outline: 2px solid currentColor; }

/* ---- Resultados ---- */
.bsb-results {
  max-height: 70vh; overflow-y: auto;
  padding: 16px 0;
}

.bsb-hint, .bsb-noresults {
  text-align: center; padding: 30px 20px;
  color: var(--beshop-text-subtle); font-size: .9rem;
}

/* ---- Grid de productos ---- */
.bsb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.bsb-card {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  border: 1px solid var(--beshop-line); border-radius: 8px;
  overflow: hidden; transition: box-shadow .15s;
}
.bsb-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }

.bsb-card__img {
  aspect-ratio: 1; overflow: hidden; background: var(--beshop-bg-soft);
}
.bsb-card__img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .2s;
}
.bsb-card:hover .bsb-card__img img { transform: scale(1.03); }
.bsb-card__no-img { width: 100%; height: 100%; background: var(--beshop-line); }

.bsb-card__info {
  padding: 10px; display: flex; flex-direction: column; gap: 3px;
}
.bsb-card__name {
  font-size: .83rem; font-weight: 600; color: var(--beshop-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.bsb-card__ref { font-size: .75rem; color: var(--beshop-text-subtle); }
.bsb-card__price { font-size: .875rem; font-weight: 700; color: var(--beshop-text); margin-top: 2px; }
.bsb-card__price-old { font-size: .8rem; font-weight: 400; color: var(--beshop-text-subtle); text-decoration: line-through; margin-top: 2px; }
.bsb-card__price--sale { color: var(--beshop-error); }

/* ---- Spinners ---- */
.bsb-loading {
  display: flex; justify-content: center; padding: 30px;
}
.bsb-loadmore {
  display: flex; justify-content: center; padding: 16px;
}
.bsb-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--beshop-line); border-top-color: var(--beshop-primary);
  border-radius: 50%; animation: bsb-spin .7s linear infinite;
}
.bsb-spinner--sm { width: 20px; height: 20px; border-width: 2px; }
@keyframes bsb-spin { to { transform: rotate(360deg); } }

/* ---- Body locked ---- */
.bsb-locked { overflow: hidden; }

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .bsb-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .bsb-overlay__inner { padding: 0 12px; }
}
