/* ============================================================
   CABECERA — buscador + icono de cuenta
   Sustituye al widget HTML del buscador y a los snippets 193/199.
   ============================================================ */

:root {
  --mqt-h-ink: #2a2520;
  --mqt-h-muted: #6f6663;
  --mqt-h-line: #e6e0d8;
  --mqt-h-soft: #faf8f5;
  --mqt-h-pink: #efcad6;
  --mqt-h-sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mqt-h-serif: 'Noto Serif', Georgia, serif;
}

/* Icono de usuario: oculto hasta 900px (antes lo hacía el snippet 199) */
@media (max-width: 900px) { .mqt-user { display: none !important; } }

/* ---------- Botón "Buscar" (misma tipografía que "Mi cuenta") ---------- */
.mqt-search { display: inline-block; }
.mqt-search__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  font-family: var(--mqt-h-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--mqt-h-ink);
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}
.mqt-search__trigger:hover { opacity: .65; background: none; color: var(--mqt-h-ink); }
.mqt-search__trigger svg { flex: 0 0 auto; }

/* ---------- Capa + panel ---------- */
.mqt-search__overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(42, 37, 32, .4);
  opacity: 0;
  transition: opacity .3s ease;
}
.mqt-search.is-open .mqt-search__overlay { opacity: 1; }

.mqt-search__panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99991;
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  box-shadow: 0 24px 60px rgba(42, 37, 32, .16);
  transform: translateY(-100%);
  transition: transform .4s cubic-bezier(.22, 1, .36, 1);
}
.mqt-search.is-open .mqt-search__panel { transform: none; }
body.admin-bar .mqt-search__panel { top: 32px; max-height: calc(100dvh - 32px); }
body.mqt-search-open { overflow: hidden; }

.mqt-search__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px 40px;
  box-sizing: border-box;
}

/* ---------- Campo ---------- */
.mqt-search__form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  margin: 0;
  border-bottom: 1px solid var(--mqt-h-ink);
  color: var(--mqt-h-ink);
}
.mqt-search__form > svg { flex: 0 0 auto; }
.mqt-search .mqt-search__input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  height: auto;
  padding: 4px 0;
  font-family: var(--mqt-h-serif);
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 400;
  line-height: 1.3;
  color: var(--mqt-h-ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: 0;
  -webkit-appearance: none;
  appearance: none;
}
.mqt-search .mqt-search__input::placeholder { color: #a8a099; opacity: 1; }
.mqt-search .mqt-search__input::-webkit-search-cancel-button { display: none; }

.mqt-search__close {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}
.mqt-search__close span::before,
.mqt-search__close span::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 1.5px;
  background: var(--mqt-h-ink);
}
.mqt-search__close span::before { transform: translate(-50%, -50%) rotate(45deg); }
.mqt-search__close span::after { transform: translate(-50%, -50%) rotate(-45deg); }
.mqt-search__close:hover { opacity: .6; background: none; }

/* ---------- Resultados ---------- */
.mqt-search__label {
  margin: 28px 0 16px;
  font-family: var(--mqt-h-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mqt-h-ink);
}
.mqt-search__results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 24px 20px;
  min-height: 60px;
}
.mqt-search__card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: var(--mqt-h-ink);
}
.mqt-search__thumb {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--mqt-h-soft);
}
.mqt-search__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.mqt-search__card:hover .mqt-search__thumb img { transform: scale(1.04); }
.mqt-search__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--mqt-h-sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: uppercase;
}
.mqt-search__price {
  font-family: var(--mqt-h-serif);
  font-size: 15px;
  color: var(--mqt-h-ink);
}
.mqt-search__price .mqt-price-unit,
.mqt-search__price small {
  font-family: var(--mqt-h-sans);
  font-size: 11px;
  color: var(--mqt-h-muted);
}
.mqt-search__price del { opacity: .5; margin-right: 6px; }
.mqt-search__price ins { text-decoration: none; }

.mqt-search__skeleton {
  aspect-ratio: 1 / 1.25;
  background: linear-gradient(90deg, #f3efe9 25%, #faf8f5 50%, #f3efe9 75%);
  background-size: 200% 100%;
  animation: mqt-search-shimmer 1.2s linear infinite;
}
@keyframes mqt-search-shimmer { to { background-position: -200% 0; } }
.mqt-search__results.is-loading .mqt-search__card { opacity: .5; }

.mqt-search__empty {
  margin: 8px 0 0;
  font-family: var(--mqt-h-serif);
  font-size: 18px;
  font-style: italic;
  color: var(--mqt-h-muted);
}

.mqt-search__all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 32px;
  font-family: var(--mqt-h-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--mqt-h-ink);
  border-bottom: 1px solid var(--mqt-h-ink);
  padding-bottom: 4px;
}
.mqt-search__all:hover { opacity: .65; }

@media (max-width: 600px) {
  .mqt-search__inner { padding: 20px 16px 32px; }
  .mqt-search .mqt-search__input[type="search"] { font-size: 18px; }
  .mqt-search__results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
}
@media (max-width: 782px) { body.admin-bar .mqt-search__panel { top: 46px; max-height: calc(100dvh - 46px); } }
@media (prefers-reduced-motion: reduce) {
  .mqt-search__panel, .mqt-search__overlay { transition: none; }
  .mqt-search__skeleton { animation: none; }
}
