/* ==========================================================================
   Impor Prime 502 — Catálogo y ficha de producto
   Reutiliza los tokens y componentes de prototipo.css.
   ========================================================================== */

.proto-note a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.tag-demo { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: #FFF1EB; color: #A32A00; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* Disponibilidad */
.avail { display: inline-flex; align-items: center; gap: 7px; margin-top: 6px; font-size: 12.5px; font-weight: 500; }
.avail::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.avail--ok { color: #11643A; }
.avail--ok::before { background: #1E9E57; }
.avail--no { color: #8A1C00; }
.avail--no::before { background: var(--ip-red); }

/* Encabezado de página */
.page-head { background: var(--ip-surface); border-bottom: 1px solid var(--ip-line); }
.page-head .container { padding-top: 28px; padding-bottom: 28px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; color: var(--ip-muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: #B5B6BC; }
.crumbs a:hover { color: var(--ip-text); }
.page-head h1 { margin: 0; font-size: clamp(26px, 3vw, 36px); letter-spacing: -.02em; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--ip-muted); }

/* --------------------------------------------------------------------------
   Catálogo
   -------------------------------------------------------------------------- */
.shop { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 32px; padding-top: 32px; padding-bottom: 80px; }

.filters { align-self: start; position: sticky; top: 140px; }
.filters__head { display: none; }
.filters__body { display: grid; gap: 4px; }
.fgroup { border-bottom: 1px solid var(--ip-line); }
.fgroup summary { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; font-size: 14.5px; font-weight: 600; cursor: pointer; list-style: none; }
.fgroup summary::-webkit-details-marker { display: none; }
.fgroup summary .icon { width: 16px; height: 16px; transform: rotate(90deg); color: var(--ip-muted); }
.fgroup:not([open]) summary .icon { transform: rotate(0deg); }
.fgroup__content { padding: 0 0 16px; display: grid; gap: 4px; }
.fcheck { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.fcheck:hover { background: var(--ip-surface); }
.fcheck input { width: 18px; height: 18px; margin: 0; accent-color: var(--ip-black); flex: none; }
.fcheck span { flex: 1; }
.fcheck small { color: var(--ip-muted); font-size: 12.5px; }
.fcheck.is-disabled { color: #9A9BA1; cursor: not-allowed; }
.fcheck.is-disabled:hover { background: none; }
.fnote { margin: 4px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--ip-surface); color: var(--ip-muted); font-size: 12.5px; line-height: 1.45; }
.frange { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.frange label { display: block; }
.frange input { width: 100%; height: 42px; padding: 0 12px; border: 1.5px solid var(--ip-line); border-radius: 10px; font-size: 14px; background: var(--ip-white); }
.frange input:focus { outline: none; border-color: var(--ip-black); }
.frange span { color: var(--ip-muted); }
.filters__help { margin-top: 20px; padding: 18px; border-radius: var(--ip-radius); background: var(--ip-ink); color: var(--ip-white); }
.filters__help strong { display: block; font-size: 15px; margin-bottom: 4px; }
.filters__help p { margin: 0 0 14px; font-size: 13px; color: rgba(255,255,255,.7); }
.filters__help .btn { height: 44px; width: 100%; font-size: 14px; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar__search { position: relative; flex: 1; max-width: 420px; }
.toolbar__search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ip-muted); }
.toolbar__search input { width: 100%; height: 46px; padding: 0 14px 0 42px; border: 1.5px solid var(--ip-line); border-radius: 999px; font-size: 14.5px; background: var(--ip-white); }
.toolbar__search input:focus { outline: none; border-color: var(--ip-black); }
.toolbar__count { font-size: 14px; color: var(--ip-muted); white-space: nowrap; }
.toolbar__count strong { color: var(--ip-text); }
.toolbar__sort { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.toolbar__sort label { color: var(--ip-muted); white-space: nowrap; }
.select { height: 46px; padding: 0 40px 0 16px; border: 1.5px solid var(--ip-line); border-radius: 999px; background: var(--ip-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center; appearance: none; font-size: 14px; font-weight: 500; cursor: pointer; }
.select:focus { outline: none; border-color: var(--ip-black); }
.toolbar__filters-btn { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px 0 14px; border-radius: 999px; border: 1px solid var(--ip-line); background: var(--ip-white); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip .icon { width: 16px; height: 16px; color: var(--ip-muted); }
.chip:hover { border-color: var(--ip-black); }
.chip--clear { border: 0; background: none; padding: 0 6px; text-decoration: underline; text-underline-offset: 3px; color: var(--ip-muted); }

.shop .products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.empty { padding: 56px 24px; border: 1.5px dashed var(--ip-line); border-radius: var(--ip-radius); text-align: center; }
.empty h2 { margin: 0 0 6px; font-size: 20px; }
.empty p { margin: 0 0 20px; color: var(--ip-muted); }

.more { display: grid; justify-items: center; gap: 12px; margin-top: 36px; }
.more__text { font-size: 13.5px; color: var(--ip-muted); }
.more__bar { width: 220px; height: 4px; border-radius: 4px; background: var(--ip-line); overflow: hidden; }
.more__bar span { display: block; height: 100%; background: var(--ip-black); border-radius: 4px; }
.btn--outline { background: var(--ip-white); color: var(--ip-black); border: 1.5px solid var(--ip-black); }
.btn--outline:hover { background: var(--ip-black); color: var(--ip-white); }

/* --------------------------------------------------------------------------
   Ficha de producto
   -------------------------------------------------------------------------- */
.pdp { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 48px; padding-top: 28px; padding-bottom: 64px; }
.pdp .crumbs { grid-column: 1 / -1; margin: 0; }

.gallery { align-self: start; position: sticky; top: 140px; }
.gallery__main { position: relative; aspect-ratio: 4 / 3; border-radius: var(--ip-radius-lg); border: 1px solid var(--ip-line); background: radial-gradient(75% 70% at 50% 45%, #FFFFFF 0%, var(--ip-surface) 100%); overflow: hidden; }
.gallery__main img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; filter: drop-shadow(0 22px 24px rgba(0,0,0,.14)); }
.gallery__thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; border: 1.5px solid var(--ip-line); background: var(--ip-surface); padding: 0; cursor: pointer; overflow: hidden; }
.thumb img { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; }
.thumb[aria-current="true"] { border-color: var(--ip-black); }
.thumb--empty { display: grid; place-items: center; border-style: dashed; cursor: default; color: #9A9BA1; font-size: 11px; text-align: center; line-height: 1.3; padding: 6px; }
.gallery__note { margin: 10px 0 0; font-size: 12.5px; color: var(--ip-muted); }

.pdp-info { min-width: 0; }
.pdp-info__brand { font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ip-muted); }
.pdp-info h1 { margin: 6px 0 14px; font-size: clamp(26px, 2.8vw, 36px); line-height: 1.12; letter-spacing: -.02em; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.fact { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--ip-surface); font-size: 13px; }
.fact strong { font-weight: 600; }
.fact .icon { width: 16px; height: 16px; color: var(--ip-muted); }
.fact--pending { background: transparent; border: 1.5px dashed #C9CAD1; color: var(--ip-muted); }

.buybox { padding: 24px; border-radius: var(--ip-radius-lg); border: 1px solid var(--ip-line); box-shadow: var(--ip-shadow); }
.buybox__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.buybox__price strong { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.buybox__price small { color: var(--ip-muted); font-size: 13px; }
.buybox__consult { font-size: 26px !important; }
.buybox__sub { margin: 6px 0 0; font-size: 13.5px; color: var(--ip-muted); }
.buybox .avail { margin-top: 12px; font-size: 14px; }
.buybox__row { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--ip-line); }
.buybox__label { display: block; margin-bottom: 10px; font-size: 13.5px; font-weight: 600; }
.variants { display: flex; flex-wrap: wrap; gap: 8px; }
.variant { height: 42px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--ip-line); background: var(--ip-white); font-size: 14px; font-weight: 500; cursor: pointer; }
.variant[aria-pressed="true"] { border-color: var(--ip-black); box-shadow: inset 0 0 0 1px var(--ip-black); font-weight: 600; }
.buy { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 20px; }
.qty { display: inline-flex; align-items: center; height: 52px; border: 1.5px solid var(--ip-line); border-radius: 999px; }
.qty button { width: 44px; height: 100%; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--ip-text); }
.qty input { width: 36px; border: 0; text-align: center; font-size: 15px; font-weight: 600; background: none; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.buy .btn { width: 100%; }
.buy--single { grid-template-columns: 1fr; }
.btn--wa-solid { background: var(--ip-black); color: var(--ip-white); }
.btn--wa-solid .icon { color: var(--ip-wa); width: 20px; height: 20px; }
.btn--wa-solid:hover { background: var(--ip-ink-3); }
.btn--wa-solid:hover .icon { transform: none; }
.btn--wa-line { margin-top: 10px; width: 100%; background: var(--ip-white); color: var(--ip-black); border: 1.5px solid var(--ip-line); }
.btn--wa-line .icon { color: #1DA851; width: 20px; height: 20px; }
.btn--wa-line:hover { border-color: var(--ip-wa); }
.btn--wa-line:hover .icon { transform: none; }

.perks { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.perks li { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--ip-surface); font-size: 13px; font-weight: 500; line-height: 1.35; }
.perks .icon { width: 34px; height: 34px; padding: 8px; flex: none; border-radius: 10px; background: var(--ip-white); color: var(--ip-orange); }

.deliver { margin-top: 18px; display: grid; gap: 10px; }
.deliver__item { display: flex; gap: 14px; padding: 16px; border-radius: 14px; border: 1px solid var(--ip-line); }
.deliver__item .icon { width: 22px; height: 22px; color: var(--ip-orange); margin-top: 2px; }
.deliver__item strong { display: block; font-size: 14px; }
.deliver__item span { font-size: 13px; color: var(--ip-muted); }

/* Secciones de detalle */
.pdp-nav { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--ip-line); border-bottom: 1px solid var(--ip-line); }
.pdp-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.pdp-nav a { display: block; padding: 16px 14px; font-size: 14px; font-weight: 600; color: var(--ip-muted); white-space: nowrap; border-bottom: 2px solid transparent; }
.pdp-nav a:hover { color: var(--ip-text); border-bottom-color: var(--ip-black); }
.pdp-sections { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 48px; padding-top: 48px; }
.pdp-sec { scroll-margin-top: 200px; padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--ip-line); }
.pdp-sec:last-child { border-bottom: 0; margin-bottom: 0; }
.pdp-sec h2 { margin: 0 0 16px; font-size: 22px; letter-spacing: -.01em; }
.pdp-sec p { margin: 0 0 12px; color: #3B3C41; line-height: 1.7; }
.pending-box { display: flex; gap: 12px; padding: 16px 18px; border-radius: 12px; background: var(--ip-surface); color: var(--ip-muted); font-size: 14px; }
.pending-box .icon { width: 20px; height: 20px; flex: none; color: var(--ip-orange); }
.specs { width: 100%; border-collapse: collapse; font-size: 14px; }
.specs th, .specs td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--ip-line); vertical-align: top; }
.specs th { width: 38%; font-weight: 600; background: var(--ip-surface); }
.specs td.is-pending { color: var(--ip-muted); }
.aside-help { align-self: start; position: sticky; top: 90px; padding: 24px; border-radius: var(--ip-radius-lg); background: var(--ip-ink); color: var(--ip-white); }
.aside-help h3 { margin: 0 0 6px; font-size: 18px; }
.aside-help p { margin: 0 0 18px; font-size: 13.5px; color: rgba(255,255,255,.7); }
.aside-help .btn { width: 100%; height: 48px; font-size: 14px; }

.related { padding-top: 24px; padding-bottom: 88px; }

/* Barra fija de compra en móvil */
.buybar { display: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .shop { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
  .shop .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pdp { gap: 32px; }
  .pdp-sections { grid-template-columns: 1fr; }
  .aside-help { position: static; }
}

@media (max-width: 900px) {
  .shop { grid-template-columns: 1fr; padding-top: 18px; }
  .shop .products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { position: fixed; inset: 0; z-index: 110; top: 0; display: none; background: var(--ip-white); flex-direction: column; }
  .filters.is-open { display: flex; }
  .filters__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--ip-line); }
  .filters__head strong { font-size: 17px; }
  .filters__body { flex: 1; overflow-y: auto; padding: 0 16px 16px; }
  .filters__foot { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--ip-line); }
  .filters__foot .btn { height: 48px; }
  .filters__help { display: none; }
  .toolbar { flex-wrap: wrap; }
  .toolbar__search { flex: 1 1 100%; max-width: none; order: -1; }
  .toolbar__filters-btn { display: inline-flex; height: 44px; padding: 0 16px; font-size: 14px; }
  .toolbar__count { order: 3; flex: 1 1 100%; }
  .toolbar__sort { margin-left: auto; }
  .toolbar__sort label { display: none; }
  .select { height: 44px; }

  .pdp { grid-template-columns: 1fr; gap: 24px; padding-top: 16px; padding-bottom: 32px; }
  .gallery { position: static; }
}
@media (min-width: 901px) { .filters__foot { display: none; } }

@media (max-width: 760px) {
  .page-head .container { padding-top: 18px; padding-bottom: 18px; }
  .shop .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .toolbar { gap: 8px; }
  .toolbar__search input { height: 44px; }

  .gallery__main { border-radius: var(--ip-radius); }
  .gallery__thumbs { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .thumb--empty { font-size: 0; }
  .pdp-info h1 { font-size: 26px; }
  .buybox { padding: 18px; }
  .buybox__price strong { font-size: 28px; }
  .buybox__consult { font-size: 22px !important; }
  .perks { grid-template-columns: 1fr; }
  .pdp-sections { padding-top: 32px; gap: 24px; }
  .pdp-sec { padding-bottom: 28px; margin-bottom: 28px; }
  .pdp-sec h2 { font-size: 19px; }
  .specs th, .specs td { padding: 11px 12px; font-size: 13.5px; }
  .related { padding-bottom: 120px; }

  .buybar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); backdrop-filter: blur(8px); border-top: 1px solid var(--ip-line); box-shadow: 0 -8px 24px rgba(0,0,0,.06); }
  .buybar__price { flex: 1; min-width: 0; line-height: 1.25; }
  .buybar__price small { display: block; font-size: 11.5px; color: var(--ip-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .buybar__price strong { font-size: 16px; }
  .buybar .btn { height: 46px; padding: 0 18px; font-size: 14px; }
  .is-pdp .wa-fab { bottom: 84px; }
  .is-pdp .footer__bottom .container { padding-bottom: 150px; }
}
.avail--pending { color: var(--ip-muted); }
.avail--pending::before { background: #C9CAD1; }
.buybox .btn--primary .icon { transform: none; }
.related .products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1024px) { .related .products { grid-template-columns: repeat(3, minmax(0, 1fr)); } .related .card:nth-child(4) { display: none; } }
@media (max-width: 760px) { .related .products { grid-template-columns: repeat(2, minmax(0, 1fr)); } .related .card:nth-child(4) { display: flex; } }
[hidden] { display: none !important; }
.pdp-nav { position: static; }
.filters, .gallery { top: 172px; }
button.card__btn { border: 0; cursor: pointer; font-family: inherit; }
.card__btn .icon { width: 18px; height: 18px; }
.filters { min-width: 0; }
.frange { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.filters__body, .fgroup__content { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { .filters { top: 0; } }
@media (max-width: 900px) { .filters__body { min-height: 0; } .filters { bottom: 0; height: 100%; } }
.buy { grid-template-columns: auto minmax(0, 1fr); }
.buy .btn { padding: 0 18px; min-width: 0; }
@media (max-width: 760px) { .buy .btn { font-size: 14.5px; padding: 0 14px; gap: 8px; } .qty button { width: 38px; } }

/* v4: catálogo móvil */
.filters__head .drawer__close { width: 44px; height: 44px; }
@media (max-width: 760px) {
  /* En catálogo y ficha, WhatsApp ya está en cada tarjeta y en la barra de compra: el botón fijo se oculta para no tapar controles. */
  .is-shop .wa-fab, .is-pdp .wa-fab { display: none; }
  .is-shop .footer__bottom .container { padding-bottom: 18px; }
}
@media (max-width: 359px) {
  .shop .products, .related .products { grid-template-columns: 1fr; }
  .card__btn-long { display: inline; }
  .card__btn-short { display: none; }
}

/* v4: ficha — área comercial */
.keyfacts { margin: 18px 0 0; padding: 4px 0 0; display: grid; gap: 0; border-top: 1px solid var(--ip-line); }
.keyfacts > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--ip-line); font-size: 14px; }
.keyfacts dt { color: var(--ip-muted); }
.keyfacts dd { margin: 0; font-weight: 600; text-align: right; }
.keyfacts .avail { margin: 0; font-size: 14px; font-weight: 600; }
.keyfacts__demo { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 12.5px; color: var(--ip-muted); }
.variant { display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; height: auto; min-height: 52px; padding: 8px 16px; line-height: 1.25; }
.variant small { font-size: 12px; font-weight: 500; color: var(--ip-muted); }
.buy-note { display: flex; gap: 8px; margin: 12px 0 0; font-size: 13px; color: var(--ip-muted); line-height: 1.45; }
.buy-note .icon { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--ip-orange); }
.btn--primary[disabled] { background: var(--ip-surface-2); color: var(--ip-muted); box-shadow: none; cursor: not-allowed; filter: none; transform: none; }
.btn--primary.is-in-cart[disabled] { background: #E9F7EF; color: #11643A; }
.btn--primary[disabled] .icon { transform: none; }
.pdp-sections { grid-template-columns: minmax(0, 860px); }
.specs-note { margin: 12px 0 0 !important; font-size: 13.5px; color: var(--ip-muted) !important; }
.buy.buy--single { grid-template-columns: minmax(0, 1fr); }
