/* ── PYRO Search Widget ───────────────────────────────────────────────────── */

.pyro-search-wrap {
  --pyro-accent:          #e67303;
  --pyro-bg-results:      #111111;
  --pyro-bg-card:         #1a1a1a;
  --pyro-bg-card-hover:   #222222;
  --pyro-border:          #2e2e2e;
  --pyro-text:            #f0f0f0;
  --pyro-text-muted:      #777777;
  --pyro-input-bg:        #161616;
  --pyro-shadow:          0 12px 48px rgba(0,0,0,.7);
  --pyro-radius:          10px;
  --pyro-card-radius:     8px;
  --pyro-img-size:        80px;
  --pyro-title-size:      13px;
  --pyro-title-weight:    700;
  --pyro-price-size:      14px;
  --pyro-btn-size:        11px;
  --pyro-btn-bg:          #e67303;
  --pyro-btn-color:       #ffffff;
  --pyro-btn-radius:      6px;

  position: relative;
  width: 100%;
  font-family: inherit;
  color-scheme: dark;
}

/* Light mode */
.pyro-search-wrap:not(.pyro-search--dark) {
  --pyro-bg-results:    #ffffff;
  --pyro-bg-card:       #f5f5f5;
  --pyro-bg-card-hover: #ebebeb;
  --pyro-border:        #e0e0e0;
  --pyro-text:          #111111;
  --pyro-text-muted:    #666666;
  --pyro-input-bg:      #ffffff;
  --pyro-shadow:        0 8px 32px rgba(0,0,0,.12);
  color-scheme: light;
}

/* ── Input ────────────────────────────────────────────────────────────────── */
.pyro-search__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pyro-search__input {
  width: 100%;
  padding: 14px 48px 14px 18px;
  background: var(--pyro-input-bg);
  border: 1.5px solid var(--pyro-border);
  border-radius: var(--pyro-radius);
  color: var(--pyro-text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.pyro-search__input:focus {
  border-color: var(--pyro-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pyro-accent) 20%, transparent);
}

.pyro-search__input::placeholder { color: var(--pyro-text-muted); }
.pyro-search__input::-webkit-search-cancel-button,
.pyro-search__input::-webkit-search-decoration { -webkit-appearance: none; }

.pyro-search__icon,
.pyro-search__loading {
  position: absolute;
  right: 14px;
  display: flex;
  align-items: center;
  color: var(--pyro-text-muted);
  pointer-events: none;
}
.pyro-search__loading { display: none; color: var(--pyro-accent); }

@keyframes pyro-spin { to { transform: rotate(360deg); } }
.pyro-spin { animation: pyro-spin .7s linear infinite; }

/* ── Panel resultados ─────────────────────────────────────────────────────── */
/* FIX ALTO: max-height:72vh queda solo como fallback; el JS calcula el alto
   real disponible en pantalla. flex column para que "Ver todos" quede abajo. */
.pyro-search__results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--pyro-bg-results);
  border: 1.5px solid var(--pyro-border);
  border-radius: var(--pyro-radius);
  box-shadow: var(--pyro-shadow);
  z-index: 9999;
  overflow: hidden;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
}

/* ── Grid — MOBILE-FIRST: 1 columna por defecto ──────────────────────────── */
/* La altura del panel es proporcional a la cantidad de resultados: crece con
   el contenido y, si hay muchos, el JS le pone un tope y aparece scroll. */
.pyro-search__results-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px;
  align-content: start;
  flex: 1 1 auto;
  overflow-y: auto;
}

/* Tablet en adelante: usar las columnas configuradas (1, 2 o 3) */
@media (min-width: 768px) {
  .pyro-search__results-inner {
    grid-template-columns: repeat(var(--pyro-grid-cols, 2), 1fr);
  }
}

.pyro-search__status {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: var(--pyro-text-muted);
  font-size: 14px;
}

.pyro-search__empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 20px;
  color: var(--pyro-text-muted);
}
.pyro-search__empty svg { opacity: .35; }
.pyro-search__empty p { margin: 0; font-size: 14px; text-align: center; }

.pyro-search__view-all {
  border-top: 1.5px solid var(--pyro-border);
  padding: 10px 16px;
  text-align: center;
  background: var(--pyro-bg-results);
  flex-shrink: 0;
}
.pyro-search__view-all-link {
  color: var(--pyro-accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: opacity .15s;
}
.pyro-search__view-all-link:hover { opacity: .75; }

/* ── PILL CARD — todo dentro de un solo <a> ──────────────────────────────── */
.pyro-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  background: var(--pyro-bg-card);
  border-radius: var(--pyro-card-radius);
  overflow: hidden;
  text-decoration: none !important;
  cursor: pointer;
  color: var(--pyro-text);
  transition: background .15s, transform .12s;
  /* Importante: min-height fijado, no depende de contenido exterior */
  min-height: var(--pyro-img-size);
}

.pyro-card:hover {
  background: var(--pyro-bg-card-hover);
  transform: translateY(-1px);
}

/* Imagen */
.pyro-card__image {
  position: relative;
  width: var(--pyro-img-size);
  min-width: var(--pyro-img-size);
  height: var(--pyro-img-size);
  overflow: hidden;
  flex-shrink: 0;
  background: #0d0d0d;
}
.pyro-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.pyro-card:hover .pyro-card__image img { transform: scale(1.06); }

/* Badges */
.pyro-card__badge {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
  pointer-events: none;
}
.pyro-card__badge--sale  { background: var(--pyro-accent); color: #fff; }
.pyro-card__badge--stock { background: #c0392b; color: #fff; top: auto; bottom: 5px; }

/* Body */
.pyro-card__body {
  flex: 1;
  padding: 10px 8px 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.pyro-card__title {
  margin: 0;
  font-size: var(--pyro-title-size);
  font-weight: var(--pyro-title-weight);
  line-height: 1.3;
  color: var(--pyro-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pyro-card__price {
  font-size: var(--pyro-price-size);
  font-weight: 700;
  color: var(--pyro-accent);
  line-height: 1.2;
}
.pyro-card__price del,
.pyro-card__price del .woocommerce-Price-amount {
  opacity: .5;
  font-weight: 400;
  font-size: 11px;
  color: var(--pyro-text-muted) !important;
  text-decoration: line-through;
  margin-right: 4px;
}
.pyro-card__price ins,
.pyro-card__price ins .woocommerce-Price-amount {
  text-decoration: none;
  color: var(--pyro-accent) !important;
}

/* Botón — dentro de la misma card */
.pyro-card__footer {
  padding: 0 10px 0 6px;
  flex-shrink: 0;
}
.pyro-card__btn {
  display: block;
  padding: 8px 14px;
  background: var(--pyro-btn-bg);
  color: var(--pyro-btn-color);
  font-size: var(--pyro-btn-size);
  font-weight: 800;
  text-align: center;
  text-decoration: none !important;
  cursor: pointer;
  border-radius: var(--pyro-btn-radius);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
  transition: opacity .15s, transform .12s;
}
.pyro-card__btn:hover { opacity: .85; transform: translateY(-1px); }

/* ── Skeleton preview (editor de Bricks) ─────────────────────────────────── */
.pyro-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 8px;
  background: var(--pyro-bg-results, #111);
  border-radius: var(--pyro-radius);
  border: 1.5px solid var(--pyro-border, #2e2e2e);
}

.pyro-preview__card {
  display: flex;
  flex-direction: row;
  align-items: center;
  background: var(--pyro-bg-card, #1a1a1a);
  border-radius: var(--pyro-card-radius, 8px);
  overflow: hidden;
  min-height: var(--pyro-img-size, 80px);
  gap: 0;
}

.pyro-preview__img {
  width: var(--pyro-img-size, 80px);
  min-width: var(--pyro-img-size, 80px);
  height: var(--pyro-img-size, 80px);
  background: #2a2a2a;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.pyro-preview__img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.05) 50%, transparent 100%);
  animation: pyro-shimmer 1.6s infinite;
}

@keyframes pyro-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.pyro-preview__body {
  flex: 1;
  padding: 10px 8px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pyro-preview__line {
  height: 10px;
  border-radius: 4px;
  background: #2e2e2e;
  position: relative;
  overflow: hidden;
}
.pyro-preview__line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.06) 50%, transparent 100%);
  animation: pyro-shimmer 1.6s infinite;
}
.pyro-preview__line--title { width: 80%; }
.pyro-preview__line--price { width: 45%; background: color-mix(in srgb, var(--pyro-accent, #e67303) 30%, #2e2e2e); }

.pyro-preview__btn {
  padding: 0 10px 0 4px;
  flex-shrink: 0;
}
.pyro-preview__btn-inner {
  height: 28px;
  width: 72px;
  border-radius: var(--pyro-btn-radius, 6px);
  background: var(--pyro-btn-bg, #e67303);
  opacity: .7;
}

/* Scrollbar */
.pyro-search__results::-webkit-scrollbar       { width: 4px; }
.pyro-search__results::-webkit-scrollbar-track { background: transparent; }
.pyro-search__results::-webkit-scrollbar-thumb { background: var(--pyro-border); border-radius: 99px; }

/* ── Responsive / mobile-first ───────────────────────────────────────────── */
/* En móviles muy angostos, apilamos el botón debajo del texto para que no
   apriete la tarjeta y todo entre cómodo. */
@media (max-width: 480px) {
  .pyro-card {
    flex-wrap: wrap;
  }
  .pyro-card__footer {
    width: 100%;
    padding: 0 10px 10px 10px;
  }
  .pyro-card__btn {
    width: 100%;
  }
  .pyro-search__input {
    font-size: 16px; /* evita el zoom automático de iOS al enfocar */
  }
}
