/* ============================================================
   ASTRA TELECOM — Tienda / Ecommerce
   Hereda variables de styles.css
   ============================================================ */

/* ── Layout tienda ─────────────────────────────────────────── */
.tienda-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  align-items: start;
  padding-block: 3rem;
}
/* Móvil: quitar grid del layout para que el sidebar no reserve 240px */
@media (max-width: 768px) {
  .tienda-layout {
    display: block !important;
    padding-inline: .75rem !important;
    padding-block: .5rem !important;
  }
  .tienda-sidebar { display: none !important; }
}

/* ── Sidebar ───────────────────────────────────────────────── */
.tienda-sidebar {
  position: sticky;
  top: 5rem;
}
.sidebar-title {
  font-size: .7rem;
  font-family: var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--line);
}
.cat-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cat-link {
  display: block;
  padding: .55rem .8rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: .875rem;
  transition: background .15s, color .15s;
}
.cat-link:hover { background: var(--bg-soft); color: var(--ink); }
.cat-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ── Categorías con subcategorías ──────────────────────────── */
.cat-parent-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.cat-parent-row .cat-link { flex: 1; }
.cat-toggle {
  flex-shrink: 0;
  width: 24px;
  height: 28px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: transform .2s, color .15s;
}
.cat-toggle:hover { color: var(--ink); }
.cat-parent.open .cat-toggle { transform: rotate(90deg); color: var(--accent); }

.cat-subs {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.cat-subs.open { max-height: 500px; }

.cat-sub {
  padding-left: 1.25rem !important;
  font-size: .8rem !important;
  color: var(--ink-2);
  border-left: 2px solid var(--line);
  margin-left: .5rem;
}
.cat-sub.active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Barra superior ────────────────────────────────────────── */
.tienda-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
#search-input {
  width: 100%;
  padding: .65rem 1rem .65rem 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
#search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43,83,127,.12);
}
.btn-filter-mobile {
  display: none;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: .875rem;
  cursor: pointer;
}
@media (max-width: 768px) { .btn-filter-mobile { display: flex; } }

/* ── Grid de productos ─────────────────────────────────────── */
#productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}
#productos-grid > * { min-width: 0; }

/* ── Card de producto ──────────────────────────────────────── */
.prod-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
  position: relative;
}
.prod-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.prod-card__img {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #ffffff;
  position: relative;
}
.prod-card__img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: .5rem;
  transition: transform .4s var(--ease);
}
.prod-card:hover .prod-card__img img { transform: scale(1.04); }
.prod-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
}
.prod-card__body {
  padding: .65rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  overflow: hidden;
}
.prod-brand {
  font-size: .7rem;
  font-family: var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.prod-brand-row { height: 22px; display: flex; align-items: center; }
.prod-brand-logo {
  height: 18px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  filter: grayscale(100%) opacity(.6);
  transition: filter .2s;
}
.prod-card:hover .prod-brand-logo { filter: grayscale(0%) opacity(1); }
.prod-name {
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}
.prod-name a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}
.prod-name a:hover { color: var(--accent); }
.prod-meta {
  font-size: .75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}
.prod-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .5rem;
}
.prod-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.prod-price small { font-size: .65rem; font-weight: 400; color: var(--muted); }
.prod-price--consult {
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
  font-style: italic;
}

/* Badge */
.prod-badge {
  position: absolute;
  top: .6rem;
  left: .6rem;
  font-size: .65rem;
  font-family: var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .2rem .5rem;
  border-radius: 99px;
}
.prod-badge--stock { background: #dcf5e7; color: #167040; }
.prod-badge--nostock { background: #fce8e8; color: #b91c1c; }

/* Botón agregar */
.btn--icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
.btn--icon:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Banner de carga ───────────────────────────────────────── */
.loading-banner {
  display: none;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: .875rem;
  font-weight: 500;
}
.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animación reveal ──────────────────────────────────────── */
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal-card {
  animation: cardReveal .35s var(--ease) both;
}

/* ── Skeleton ──────────────────────────────────────────────── */
.prod-card--skeleton { pointer-events: none; }
.sk-img {
  aspect-ratio: 1/1;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--line) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.sk-line {
  height: 12px;
  border-radius: 6px;
  margin-block: .4rem;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--line) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  width: 80%;
}
.sk-line--sm  { width: 40%; }
.sk-line--lg  { width: 90%; height: 16px; }
.sk-line--xl  { width: 70%; height: 24px; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Paginación ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2.5rem;
}
.pg-btn {
  padding: .5rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: .85rem;
  transition: background .15s, border-color .15s, color .15s;
}
.pg-btn:hover, .pg-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pg-total { font-size: .75rem; color: var(--muted); margin-left: .5rem; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 1rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.empty-state svg { opacity: .35; }

/* ── Página de producto ────────────────────────────────────── */
.producto-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding-block: 2.5rem;
  align-items: start;
}

#producto-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 2.5rem 3rem;
  align-items: start;
  position: relative;
  z-index: 0;
}
@media (max-width: 768px) {
  #producto-detail { grid-template-columns: 1fr; }
}

/* Galería ocupa columna 1 fila 1, info columna 2 fila 1, tabs span completo */
.pd-gallery  { grid-column: 1; grid-row: 1; }
.pd-info     { grid-column: 2; grid-row: 1; }
.pd-tabs-section { grid-column: 1 / -1; grid-row: 2; }
@media (max-width: 768px) {
  .pd-gallery      { grid-column: 1; grid-row: 1; }
  .pd-info         { grid-column: 1; grid-row: 2; }
  .pd-tabs-section { grid-column: 1; grid-row: 3; }
}

.pd-gallery { display: flex; flex-direction: column; gap: .75rem; }
.pd-main-img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
  aspect-ratio: 1/1;
}
.pd-main-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1.5rem;
}
.pd-thumbs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.pd-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: .3rem;
  background: var(--bg-soft);
  transition: border-color .15s;
}
.pd-thumb.active, .pd-thumb:hover { border-color: var(--accent); }

.pd-info { display: flex; flex-direction: column; gap: .75rem; }
.pd-title { font-size: clamp(1.3rem, 2.5vw, 1.9rem); font-weight: 700; margin: 0; line-height: 1.2; }
.pd-modelo { font-size: .8rem; color: var(--muted); font-family: var(--font-mono); margin: 0; }
.pd-price { font-size: 1.8rem; font-weight: 800; color: var(--ink); }
.pd-price small { font-size: .9rem; font-weight: 400; color: var(--muted); }
.pd-price--consult { font-size: 1.1rem; color: var(--muted); font-style: italic; }
.pd-stock { font-size: .85rem; color: #167040; margin: 0; }
.pd-stock.no-stock { color: #b91c1c; }
.pd-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: .5rem; }

.qty-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qty-btn {
  width: 36px;
  height: 40px;
  border: none;
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .15s;
}
.qty-btn:hover { background: var(--line); }
#qty {
  width: 52px;
  height: 40px;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--ink);
  background: var(--surface);
}
#qty:focus { outline: none; }

/* WhatsApp button */
.btn--whatsapp {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.2rem;
  background: #25D366;
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  transition: background .15s, transform .15s;
}
.btn--whatsapp:hover { background: #1ebe5d; transform: translateY(-1px); }

/* ── Carrito ───────────────────────────────────────────────── */
.carrito-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2.5rem;
  padding-block: 3rem;
  align-items: start;
}
@media (max-width: 960px) { .carrito-layout { grid-template-columns: 1fr; } }

/* Formulario de datos del carrito — responsive */
#form-datos .form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
}
#form-datos .form-row-addr {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: .6rem;
  align-items: end;
}
@media (max-width: 600px) {
  #form-datos .form-row-2,
  #form-datos .form-row-addr { grid-template-columns: 1fr; }
  #form-datos .form-row-addr input[style*="width:80px"] { width: 100% !important; }
  .carrito-summary { padding: 1rem; }
  #sec-dir-factura .form-row-2,
  #sec-dir-factura .form-row-addr { grid-template-columns: 1fr; }
}

.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr auto auto 32px;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: .75rem;
  background: var(--surface);
  transition: border-color .15s;
}
.cart-item:hover { border-color: var(--line-2); }
@media (max-width: 600px) {
  .cart-item { grid-template-columns: 56px 1fr; grid-template-rows: auto auto auto; }
  .cart-item__qty, .cart-item__price, .cart-item__remove { grid-column: 2; }
}
.cart-item__img img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: .3rem;
}
.cart-item__info h4 { font-size: .9rem; font-weight: 600; margin: 0 0 .2rem; }
.cart-item__qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.cart-item__qty input {
  width: 44px;
  height: 34px;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  font-size: .85rem;
  background: var(--surface);
  color: var(--ink);
}
.cart-item__qty input:focus { outline: none; }
.cart-item__price { font-weight: 700; white-space: nowrap; font-size: .95rem; }
.cart-item__price small { font-weight: 400; color: var(--muted); font-size: .7rem; }
.cart-item__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--faint);
  padding: .25rem;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.cart-item__remove:hover { color: #b91c1c; background: #fce8e8; }

/* Summary box */
.carrito-summary {
  position: sticky;
  top: 5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.carrito-summary.hidden { display: none; }
.carrito-summary h3 { margin: 0; font-size: 1rem; }
.cart-total { font-size: 1.1rem; font-weight: 700; }
.cart-note { font-size: .78rem; color: var(--muted); margin: 0; line-height: 1.5; }
.form-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.form-field label { font-size: .8rem; color: var(--muted); }
.form-field input {
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: .875rem;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .15s;
}
.form-field input:focus { outline: none; border-color: var(--accent); }

/* ── Precio USD secundario ─────────────────────────────────── */
.pd-price-usd { font-size: .75rem; font-weight: 400; color: var(--muted); margin-top: .1rem; }

/* ── Chips horizontales móvil ──────────────────────────────── */
.cat-chips {
  display: none;
  gap: .5rem;
  overflow-x: auto;
  padding: .75rem 0 .5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.cat-chips::-webkit-scrollbar { display: none; }
@media (max-width: 768px) { .cat-chips { display: flex; } }
.cat-chip-btn {
  flex-shrink: 0;
  padding: .4rem .9rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  background: var(--surface);
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.cat-chip-btn:hover,
.cat-chip-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── FAB carrito (móvil) ───────────────────────────────────── */
.fab-cart {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(43,83,127,.4);
  text-decoration: none;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.fab-cart:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(43,83,127,.5); }
@media (max-width: 768px) { .fab-cart { display: flex; } }
.fab-cart__badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 20px; height: 20px;
  background: #e63946;
  color: #fff;
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* ── Botón volver arriba ───────────────────────────────────── */
.btn-back-top {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 200;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s var(--ease), background .15s;
  box-shadow: var(--shadow-md);
}
.btn-back-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.btn-back-top:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Sort y filtro precio ──────────────────────────────────── */
.sort-filter-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.sort-select {
  padding: .55rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: .85rem;
  cursor: pointer;
}
.precio-filter { display: flex; align-items: center; gap: .5rem; font-size: .82rem; }
.precio-filter__label { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.precio-range { display: flex; align-items: center; gap: .35rem; }
.precio-range input {
  width: 80px;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--surface);
}
.btn-precio-apply {
  padding: .4rem .7rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}
@media (max-width: 600px) { .precio-filter { display: none; } }

/* ── Autocompletado ────────────────────────────────────────── */
.autocomplete-box {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
}
.autocomplete-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  text-decoration: none;
  color: var(--ink);
  transition: background .12s;
  border-bottom: 1px solid var(--line);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg-soft); }
.autocomplete-item img { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 4px; flex-shrink: 0; }
.autocomplete-nombre { font-size: .82rem; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.autocomplete-precio { font-size: .75rem; color: var(--accent); font-weight: 600; margin-top: 2px; }

/* ── Historial de vistos ───────────────────────────────────── */
.historial-section { padding-block: 2.5rem; border-top: 1px solid var(--line); margin-top: 1rem; }
.historial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}
.historial-item {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .15s, transform .15s;
}
.historial-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.historial-item img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: var(--radius-sm); }
.historial-nombre { font-size: .75rem; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.historial-precio { font-size: .72rem; color: var(--accent); font-weight: 600; }

/* ── Relacionados ──────────────────────────────────────────── */
.relacionados-section { padding-block: 2.5rem; border-top: 1px solid var(--line); }

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--dark);
  color: var(--on-dark);
  padding: .75rem 1.5rem;
  border-radius: var(--radius);
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s var(--ease);
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--warn { background: #92400e; }
.toast--error { background: #7f1d1d; }

/* ── Cart badge ────────────────────────────────────────────── */
.cart-badge {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}

/* ── Chips de producto ─────────────────────────────────────── */
.pd-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.pd-chip {
  font-size: .72rem;
  font-family: var(--font-mono);
  padding: .25rem .7rem;
  border-radius: 99px;
  font-weight: 600;
  letter-spacing: .03em;
}
.pd-chip--green { background: #dcf5e7; color: #167040; }
.pd-chip--red   { background: #fce8e8; color: #b91c1c; }
.pd-chip--blue  { background: #e0eaf8; color: #1e3a5f; }
.pd-marca-logo  { height: 28px; width: auto; object-fit: contain; opacity: .8; }

/* ── Tabs de producto ──────────────────────────────────────── */
.pd-tabs-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: .5rem;
}
.pd-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.pd-tab {
  padding: .85rem 1.4rem;
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--ink-2);
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.pd-tab:hover  { color: var(--ink); }
.pd-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--surface); }
.pd-tab-panels { background: var(--surface); }
.pd-tab-panel  { display: none; padding: 1.75rem 2rem; isolation: isolate; overflow: hidden; position: relative; z-index: 0; }
.pd-tab-panel.active { display: block; }
@media (max-width: 600px) {
  .pd-tab  { padding: .7rem .9rem; font-size: .78rem; }
  .pd-tab-panel { padding: 1.25rem 1rem; }
}

/* Contenido de pestañas */
.pd-desc { font-size: .88rem; color: var(--ink-2); line-height: 1.7; contain: layout; }
/* Neutralizar estilos inline del HTML de Syscom */
.pd-desc * { position: static !important; float: none !important; max-width: 100% !important; box-sizing: border-box; }
.pd-desc img    { height: auto !important; border-radius: var(--radius-sm); margin-block: .5rem; display: block; }
.pd-desc iframe { width: 100% !important; aspect-ratio: 16/9; height: auto !important; border-radius: var(--radius-sm); border: none; }
.pd-desc table  { width: 100% !important; border-collapse: collapse; font-size: .82rem; margin-block: .75rem; }
.pd-desc td, .pd-desc th { padding: .4rem .6rem; border: 1px solid var(--line); }
.pd-desc div    { width: auto !important; min-width: 0 !important; }
.pd-no-content  { color: var(--muted); font-size: .88rem; }

.pd-specs-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.pd-specs-table th {
  text-align: left;
  width: 160px;
  padding: .6rem .8rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pd-specs-table td {
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.pd-specs-table tr:last-child th,
.pd-specs-table tr:last-child td { border-bottom: none; }

.pd-envio-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.pd-envio-list li {
  font-size: .9rem;
  color: var(--ink-2);
  line-height: 1.5;
  padding: .75rem 1rem;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.pd-envio-list a { color: var(--accent); }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb span { color: var(--faint); }

/* ── Page hero mini ────────────────────────────────────────── */
.page-hero-mini {
  background: var(--dark);
  color: var(--on-dark);
  padding: 3.5rem var(--gutter) 2.5rem;
}
.page-hero-mini h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin: 0 0 .5rem;
}
.page-hero-mini p { color: var(--on-dark-muted); margin: 0; font-size: .95rem; }

/* ── Botón regresar móvil ──────────────────────────────────── */
.btn-back-mobile {
  display: none; /* Solo visible en móvil */
}
@media (max-width: 768px) {
  .btn-back-mobile {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .6rem var(--gutter, 1.25rem);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    width: 100%;
  }
  .btn-back-mobile svg { flex-shrink: 0; }
  .btn-back-mobile:hover { background: var(--bg-soft); }
}

/* Prevenir scroll horizontal en toda la tienda */
.tienda-layout,
.producto-layout,
.carrito-layout,
#productos-grid,
.prod-card,
.tienda-topbar,
.sort-filter-wrap,
.cat-chips-wrap,
.page-hero-mini { max-width: 100%; }

/* ════════════════════════════════════════════════════════════
   MOBILE ≤ 768px — REESCRITO LIMPIO
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Reducir padding del container */
  .container { padding-left: .75rem !important; padding-right: .75rem !important; }

  /* Layout */
  .tienda-layout { padding-block: .75rem; gap: 0; }
  .page-hero-mini { padding: 1.25rem 1rem 1rem; }
  .page-hero-mini h1 { font-size: 1.3rem; }
  .page-hero-mini p  { font-size: .875rem; }

  /* Topbar: búsqueda + sort en fila */
  .tienda-topbar { flex-direction: column; align-items: stretch; gap: .5rem; margin-bottom: .75rem; }
  #search-input  { font-size: 16px; padding: .75rem 1rem .75rem 2.5rem; } /* 16px = sin zoom iOS */
  .sort-filter-wrap { gap: .5rem; }
  .sort-select   { flex: 1; font-size: 14px; padding: .55rem .75rem; }
  .precio-filter { display: none; }

  /* ── GRID: 2 columnas verticales ── */
  #productos-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: .6rem;
  }

  /* ── CARD: layout vertical (imagen arriba, texto abajo) ── */
  .prod-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .prod-card__img {
    aspect-ratio: unset !important;
    height: 110px !important;
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    flex-shrink: 0;
    background: #ffffff;
  }

  .prod-card__img img {
    padding: .25rem !important;
    object-fit: contain;
  }

  /* Cuerpo debajo de la imagen */
  .prod-card__body {
    padding: .55rem .5rem .5rem;
    gap: .2rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .prod-brand-row   { height: 16px; overflow: hidden; }
  .prod-brand       { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .prod-brand-logo  { height: 13px; max-width: 60px; }
  .prod-meta        { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Nombre: 2 líneas exactas con ellipsis */
  .prod-name {
    font-size: 13px !important;
    line-height: 1.35 !important;
    height: 35px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  .prod-name a {
    display: inline !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }

  /* Precio y botón */
  .prod-footer      { margin-top: auto; padding-top: .4rem; }
  .prod-price       { font-size: 15px; font-weight: 800; }
  .prod-price small { font-size: 10px; }
  .prod-price--consult { font-size: 11px; }
  .btn--icon        { width: 34px; height: 34px; flex-shrink: 0; }
  .btn--icon svg    { width: 16px; height: 16px; }
  .prod-badge       { font-size: 10px; top: .35rem; left: .35rem; }

  /* Skeleton */
  .prod-card--skeleton { flex-direction: column; }
  .sk-img { height: 110px; aspect-ratio: unset; border-radius: var(--radius) var(--radius) 0 0; }

  /* Chips categorías */
  .cat-chips { padding: .4rem 0; gap: .35rem; }
  .cat-chip-btn { font-size: 13px; padding: .4rem .85rem; }

  /* Loading banner */
  .loading-banner { font-size: 13px; padding: .6rem .75rem; }

  /* Paginación */
  .pagination { gap: .35rem; margin-top: 1.5rem; justify-content: center; }
  .pg-btn     { padding: .6rem .9rem; font-size: 14px; min-width: 42px; text-align: center; }
  .pg-total   { display: none; }

  /* ─── Página de producto ─── */
  .producto-layout { padding-block: .75rem; }
  #producto-detail { gap: 1rem; }
  .pd-main-img img { padding: 1rem; }
  .pd-title        { font-size: 1.15rem; line-height: 1.3; }
  .pd-price        { font-size: 1.7rem; }
  .pd-modelo       { font-size: 12px; }
  .pd-actions { flex-direction: column; align-items: stretch; gap: .6rem; }
  .pd-actions .btn,
  .pd-actions .btn--whatsapp { justify-content: center; width: 100%; padding: .9rem 1rem; font-size: 15px; }
  .qty-wrap  { align-self: flex-start; }
  .pd-tab    { padding: .65rem .85rem; font-size: 14px; }
  .pd-tab-panel { padding: 1rem; }

  /* Carrito */
  .carrito-layout { padding-block: .75rem; }

  /* Toast */
  .toast { bottom: 5rem; max-width: 88vw; font-size: 13px; white-space: normal; text-align: center; }

  /* Breadcrumb */
  .breadcrumb { font-size: 12px; margin-bottom: .75rem; }
}

/* ≤ 360px: imagen más pequeña */
@media (max-width: 360px) {
  .prod-card__img { height: 95px !important; }
  .sk-img         { height: 95px !important; }
  .prod-name      { font-size: 12px !important; height: 32px !important; }
  .prod-price     { font-size: 13px; }
  #productos-grid { gap: .4rem; }
}

/* ── Botones base ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.3rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-strong); box-shadow: 0 4px 14px rgba(43,83,127,.35); }
.btn--outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: .45rem .9rem; font-size: .8rem; }

/* ════════════════════════════════════════════════════════════
   MOBILE OVERRIDE FINAL — mayor prioridad
   ════════════════════════════════════════════════════════════ */
@media screen and (max-width: 768px) {

  /* Grid 2 columnas forzado */
  #productos-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: .6rem !important;
  }

  /* Tarjeta vertical */
  .prod-card {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-width: 0 !important;
  }

  /* Imagen arriba, altura fija */
  .prod-card__img {
    display: block !important;
    width: 100% !important;
    height: 110px !important;
    aspect-ratio: unset !important;
    flex-shrink: 0 !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    background: #fff !important;
  }
  .prod-card__img img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    padding: .25rem !important;
  }

  /* Cuerpo con texto contenido */
  .prod-card__body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding: .5rem !important;
    gap: .2rem !important;
  }

  /* Nombre: 2 líneas con ellipsis */
  .prod-name {
    font-size: 13px !important;
    line-height: 1.35 !important;
    height: 35px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
  .prod-name a {
    display: inline !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }
  .prod-brand { font-size: 10px !important; }
  .prod-meta  { font-size: 10px !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
  .prod-price { font-size: 15px !important; font-weight: 800 !important; }
  .prod-price small { font-size: 10px !important; }

  /* Skeleton */
  .prod-card--skeleton {
    display: flex !important;
    flex-direction: column !important;
  }
  .sk-img {
    height: 110px !important;
    aspect-ratio: unset !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
  }
}
