/* ==========================================================================
   MIGO COMPONENTS — clases reutilizables
   ========================================================================== */

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 44px;
  padding: 0 var(--s-5);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
.btn:active { transform: translateY(1px); }

/* Primario — azul industrial (CTA principal: comprar, agregar, etc) */
.btn-primary {
  background: var(--primary-600);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-700); }
.btn-primary:active { background: var(--primary-800); }

/* WhatsApp — canal de venta directo. Mantiene el verde por convención. */
.btn-wa {
  background: var(--wa-green);
  color: #fff;
}
.btn-wa:hover { background: var(--wa-green-dark); }

/* Secundario — outline */
.btn-secondary {
  background: #fff;
  color: var(--slate-800);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
}

/* Ghost — solo texto, para acciones terciarias */
.btn-ghost {
  background: transparent;
  color: var(--slate-700);
}
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-900); }

/* Tamaños */
.btn-sm { height: 36px; padding: 0 var(--s-4); font-size: var(--fs-xs); }
.btn-lg { height: 52px; padding: 0 var(--s-6); font-size: var(--fs-base); }
.btn-xl { height: 60px; padding: 0 var(--s-8); font-size: var(--fs-md); }

.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 44px; }
.btn-sm.btn-icon { width: 36px; }

/* ==========================================================================
   BADGES / TAGS / CHIPS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  height: 22px;
  padding: 0 var(--s-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--r-xs);
  font-family: var(--font-display);
}
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-amber   { background: var(--amber-50); color: var(--amber-700); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-slate   { background: var(--slate-100); color: var(--slate-700); }
.badge-solid-amber { background: var(--amber-500); color: #fff; }
.badge-solid-red   { background: var(--migo-red); color: #fff; }

/* Chip — pill clickable (filtros, categorías) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 36px;
  padding: 0 var(--s-4);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--slate-700);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.chip:hover {
  border-color: var(--primary-400);
  color: var(--primary-700);
}
.chip[aria-selected="true"], .chip.is-active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #fff;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--s-4);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: var(--shadow-focus);
}

.field-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: var(--s-2);
}

/* Buscador con icono */
.searchbar {
  position: relative;
  display: flex;
  align-items: center;
}
.searchbar .input { padding-left: 44px; }
.searchbar svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--dur-base), box-shadow var(--dur-base), transform var(--dur-base);
}
.card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ==========================================================================
   PRODUCT CARD — el componente más importante del sitio
   ========================================================================== */
.product-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--dur-base), box-shadow var(--dur-base);
  position: relative;
}
.product-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
}
.product-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--slate-50);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12%;
}
.product-card__placeholder {
  width: 48%;
  height: 48%;
  color: var(--slate-300);
}
.product-card__badge {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
}
.product-card__fav {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--slate-500);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.product-card__fav:hover { color: var(--migo-red); background: #fff; }
.product-card__body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex: 1;
}
.product-card__category {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-faint);
}
.product-card__title {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  color: var(--slate-900);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.product-card__meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.product-card__price {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}
.product-card__price-bs {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.product-card__actions {
  display: flex;
  gap: var(--s-2);
}
.product-card__actions .btn { flex: 1; }
.product-card__actions .btn-icon { flex: 0 0 44px; }
.product-card__stock {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-xs);
  color: var(--success);
  font-weight: 600;
}
.product-card__stock::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.product-card__stock.is-low { color: var(--amber-700); }
.product-card__stock.is-low::before { background: var(--amber-500); }

/* ==========================================================================
   CATEGORY TILE
   ========================================================================== */
.cat-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-height: 140px;
  transition: all var(--dur-base);
  position: relative;
  overflow: hidden;
}
.cat-tile:hover {
  border-color: var(--primary-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.cat-tile__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-50);
  color: var(--primary-700);
  border-radius: var(--r-md);
}
.cat-tile__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.2;
}
.cat-tile__count {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.cat-tile__arrow {
  position: absolute;
  bottom: var(--s-5);
  right: var(--s-5);
  color: var(--text-faint);
  transition: transform var(--dur-base) var(--ease-out), color var(--dur-base);
}
.cat-tile:hover .cat-tile__arrow {
  transform: translateX(4px);
  color: var(--primary-600);
}

/* ==========================================================================
   HEADER / NAV
   ========================================================================== */
.topbar {
  background: var(--slate-900);
  color: var(--slate-300);
  font-size: var(--fs-xs);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-2) var(--s-6);
  max-width: var(--container-2xl);
  margin: 0 auto;
}
.topbar__rate { display: inline-flex; align-items: center; gap: var(--s-2); }
.topbar__rate strong { color: #fff; font-family: var(--font-mono); }
.topbar__rate .sep { opacity: 0.4; }
.topbar__links { display: inline-flex; align-items: center; gap: var(--s-1); }
.topbar__links > a { color: var(--slate-300); padding: 0 var(--s-3); position: relative; transition: color var(--dur-fast); }
.topbar__links > a:hover { color: #fff; }
.topbar__links > a + a::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 12px; width: 1px; background: rgba(255,255,255,.2); }
.topbar__wa { display: inline-flex; align-items: center; gap: var(--s-2); color: #25d366 !important; font-weight: 600; font-family: var(--font-mono); }
.topbar__wa:hover { color: #4ade80 !important; }
.topbar__wa svg { width: 14px; height: 14px; }

.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-6);
  max-width: var(--container-2xl);
  margin: 0 auto;
}
.header__logo img { height: 44px; width: auto; }
.header__search { max-width: 640px; width: 100%; }
.header__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.header__action {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 44px;
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  color: var(--slate-700);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--dur-fast);
}
.header__action:hover { background: var(--slate-100); }
.header__action svg { width: 20px; height: 20px; }
.header__action .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--primary-600);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
}

.nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-6);
  max-width: var(--container-2xl);
  margin: 0 auto;
  overflow-x: auto;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 48px;
  padding: 0 var(--s-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--slate-700);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  white-space: nowrap;
}
.nav__link:hover { color: var(--primary-700); }
.nav__link.is-active {
  color: var(--primary-700);
  border-bottom-color: var(--primary-600);
}
.nav__link--accent {
  color: var(--primary-600);
}

/* Hamburguesa: oculta en desktop, visible en móvil (ver responsive) */
.header__burger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: var(--s-2);
  color: var(--slate-700);
  cursor: pointer;
  border-radius: var(--r-md);
}
.header__burger:hover { background: var(--slate-100); }
.header__burger svg { width: 24px; height: 24px; }

/* Herramientas moviles del nav (buscador + selector de tienda en el drawer) */
.nav__mobile-tools { display: none; }
.nav__search { width: 100%; margin-bottom: var(--s-3); }
.nav__store { border-top: 1px solid var(--border); }
.nav__store > summary {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-2); cursor: pointer;
  font-size: var(--fs-sm); font-weight: 600; color: var(--slate-700);
  list-style: none;
}
.nav__store > summary::-webkit-details-marker { display: none; }
.nav__store[open] > summary { color: var(--primary-700); }
.nav__store-menu { max-height: 48vh; overflow-y: auto; padding-bottom: var(--s-2); }
.nav__store-group {
  padding: var(--s-2) var(--s-2) var(--s-1);
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--tracking-wide); color: var(--text-faint);
}
.nav__store-item {
  display: block; width: 100%; text-align: left;
  padding: var(--s-3) var(--s-2);
  background: none; border: 0; cursor: pointer;
  font-size: var(--fs-sm); color: var(--slate-700); border-radius: var(--r-md);
}
.nav__store-item:hover { background: var(--slate-100); }
.nav__store-item.is-active { color: var(--primary-700); font-weight: 700; }
/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  background: var(--slate-900);
  color: var(--slate-300);
  padding: var(--s-16) 0 var(--s-8);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--s-12);
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--s-6);
}
.footer h4 {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: #fff;
  margin-bottom: var(--s-4);
}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: var(--s-3); }
.footer a { font-size: var(--fs-sm); color: var(--slate-400); transition: color var(--dur-fast); }
.footer a:hover { color: #fff; }
.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-12);
  padding: var(--s-6) var(--s-6) 0;
  border-top: 1px solid var(--slate-700);
  max-width: var(--container-2xl);
  margin-left: auto;
  margin-right: auto;
  font-size: var(--fs-xs);
  color: var(--slate-300);
}
.footer__social { display: flex; gap: var(--s-2); }
.footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--slate-800);
  border-radius: var(--r-md);
  color: var(--slate-300);
}
.footer__social a:hover { background: var(--primary-600); color: #fff; }

/* ==========================================================================
   SECTION HEADER (eyebrow + title + link)
   ========================================================================== */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-6);
  margin-bottom: var(--s-8);
}
.section-head__title { display: flex; flex-direction: column; gap: var(--s-1); }
.section-head a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--primary-600);
}
.section-head a:hover { color: var(--primary-700); }

/* ==========================================================================
   ALERT / CALLOUT
   ========================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid;
}
.alert-info    { background: var(--info-bg); border-color: var(--primary-200); color: var(--primary-900); }
.alert-success { background: var(--success-bg); border-color: #86EFAC; color: #14532D; }
.alert-warning { background: var(--warning-bg); border-color: #FDE68A; color: #78350F; }
.alert-danger  { background: var(--danger-bg); border-color: #FECACA; color: #7F1D1D; }

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */
.crumbs {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--primary-600); }
.crumbs .sep { color: var(--slate-300); }
.crumbs .current { color: var(--slate-900); font-weight: 600; }

/* ==========================================================================
   CONTAINER
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--s-6);
}

/* ==========================================================================
   GRID UTILITIES
   ========================================================================== */
.grid-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-5);
}
.grid-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s-4);
}

/* ==========================================================================
   STORE PICKER POPOVER
   ========================================================================== */
.store-picker {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.store-picker:hover { border-color: var(--primary-400); background: #fff; }
.store-picker__pin { color: var(--primary-600); }
.store-picker__city { color: var(--slate-900); }
.store-picker__caret { color: var(--text-faint); margin-left: var(--s-1); }
.store-picker-wrap { position: relative; }
.store-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 300px; max-height: 60vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xl, 0 12px 28px rgba(15,23,42,.18));
  padding: var(--s-2); z-index: 1000;
}
.store-menu[hidden] { display: none; }
.store-menu__item {
  display: block; width: 100%; text-align: left;
  padding: var(--s-2) var(--s-3); border: 0; background: none;
  border-radius: var(--r-md); font-size: var(--fs-sm);
  color: var(--slate-700); cursor: pointer; transition: background var(--dur-fast);
}
.store-menu__item:hover { background: var(--slate-100); }
.store-menu__item.is-active { background: var(--primary-50, #fef2f2); color: var(--primary-700); font-weight: 700; }
.store-menu__group {
  padding: var(--s-3) var(--s-3) var(--s-1);
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--tracking-wide, .04em); color: var(--text-faint);
}
.store-menu__sep { height: 1px; background: var(--border); margin: var(--s-2) 0; }

/* ==========================================================================
   WHATSAPP FLOAT
   ========================================================================== */
.wa-fab {
  position: fixed;
  bottom: var(--s-6);
  right: var(--s-6);
  width: 56px;
  height: 56px;
  background: var(--wa-green);
  color: #fff;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur-base) var(--ease-out);
  z-index: var(--z-overlay);
}
.wa-fab:hover { transform: scale(1.06); background: var(--wa-green-dark); }
.wa-fab svg { width: 28px; height: 28px; }

/* ==========================================================================
   ICONS — uniform 20px stroke (lucide-style)
   ========================================================================== */
.icon { width: 20px; height: 20px; stroke-width: 2; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* Filtros del catalogo: colapsables en movil/tablet, abiertos en desktop */
.filters__summary {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--slate-50); border: 1px solid var(--border);
  border-radius: var(--r-md); cursor: pointer; list-style: none;
  font-weight: 700; font-size: var(--fs-sm); color: var(--slate-800);
  margin-bottom: var(--s-4);
}
.filters__summary::-webkit-details-marker { display: none; }
.filters__caret { margin-left: auto; transition: transform var(--dur-fast); }
.filters__details[open] .filters__caret { transform: rotate(180deg); }
@media (min-width: 1025px) {
  .filters__summary { display: none; }
}
/* Accesibilidad: skip-link + landmark main */
.skip-link {
  position: absolute; left: var(--s-4); top: -64px; z-index: 2000;
  background: var(--primary-700); color: #fff;
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  font-weight: 700; font-size: var(--fs-sm);
  transition: top var(--dur-fast);
}
.skip-link:focus { top: var(--s-3); }
#contenido:focus { outline: none; }