/* ==========================================================================
   Impor Prime 502 — adaptación del diseño aprobado al marcado nativo de WooCommerce
   ========================================================================== */

/* Hello Elementor añade márgenes al contenedor principal: se neutralizan para respetar el diseño */
.site-main, .page-content { max-width: none; padding: 0; margin: 0; }
body { background: var(--ip-white); }
a { color: inherit; }

/* Rejilla de productos: el diseño usa <ul class="products"> de WooCommerce */
ul.products { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.shop ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
ul.products::before, ul.products::after { display: none !important; }
ul.products li.product.card { width: auto !important; margin: 0 !important; float: none !important; }
.card__media img { margin: 0 !important; }

/* Precio nativo */
.card__price .price, .card__price { font-size: 16px; font-weight: 700; color: var(--ip-text); }
.card__price del { color: var(--ip-muted); font-weight: 500; font-size: 13px; margin-right: 6px; }
.card__price ins { text-decoration: none; }
.buybox__price .price, .buybox__price { font-size: 32px; font-weight: 700; letter-spacing: -.02em; color: var(--ip-text); }
.buybox__price del { font-size: 18px; color: var(--ip-muted); }
.buybox__price ins { text-decoration: none; }

/* Botón de agregar al carrito de las tarjetas (marcado nativo) */
.card__actions .button.card__btn--main { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px; border-radius: 999px; background: var(--ip-black); color: var(--ip-white); font-size: 14px; font-weight: 600; border: 0; line-height: 1; }
.card__actions .button.card__btn--main:hover { background: var(--ip-ink-3); color: var(--ip-white); }
.card__actions .button.loading { opacity: .7; }
.card__actions .button.added { background: #11643A; }
.card__actions .added_to_cart { display: none; }
.card__btn.is-disabled { background: var(--ip-surface-2); color: var(--ip-muted); cursor: not-allowed; }

/* Formulario nativo de compra en la ficha */
.ip-addtocart form.cart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin: 20px 0 0; }
.ip-addtocart form.cart .quantity { display: inline-flex; align-items: center; height: 52px; border: 1.5px solid var(--ip-line); border-radius: 999px; padding: 0 8px; }
.ip-addtocart form.cart .quantity input.qty { width: 56px; border: 0; text-align: center; font-size: 15px; font-weight: 600; background: none; }
.ip-addtocart form.cart .quantity.hidden + .single_add_to_cart_button,
.ip-addtocart form.cart:not(:has(.quantity:not(.hidden))) { grid-template-columns: 1fr; }
.ip-addtocart .single_add_to_cart_button { height: 52px; border-radius: 999px !important; border: 0; background: var(--ip-gradient) !important; color: var(--ip-white) !important; font-weight: 600; font-size: 15px; box-shadow: 0 10px 30px rgba(255,63,1,.35); }
.ip-addtocart .single_add_to_cart_button:hover { filter: brightness(1.07); }
.ip-addtocart .single_add_to_cart_button.disabled { opacity: .5; box-shadow: none; }
.ip-addtocart .variations { width: 100%; margin: 18px 0 0; border: 0; }
.ip-addtocart .variations th, .ip-addtocart .variations td { padding: 6px 0; text-align: left; border: 0; display: block; }
.ip-addtocart .variations select { width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid #D6D7DC; border-radius: 12px; font-size: 15px; background: var(--ip-white); }
.ip-addtocart .woocommerce-variation-price { margin: 10px 0; font-size: 20px; font-weight: 700; }
.ip-addtocart .woocommerce-variation-add-to-cart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.ip-addtocart .stock { display: none; }
.ip-addtocart .reset_variations { font-size: 13px; color: var(--ip-muted); }

/* Galería nativa */
.gallery .woocommerce-product-gallery { position: relative; width: 100% !important; float: none !important; margin: 0 !important; }
.gallery .woocommerce-product-gallery__wrapper { margin: 0; }
.gallery .woocommerce-product-gallery__image { 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 .woocommerce-product-gallery__image img { aspect-ratio: 4 / 3; object-fit: contain; padding: 6%; width: 100%; height: auto; }
.gallery .flex-control-thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
.gallery .flex-control-thumbs li { width: auto !important; float: none !important; }
.gallery .flex-control-thumbs img { border: 1.5px solid var(--ip-line); border-radius: 12px; background: var(--ip-surface); aspect-ratio: 1; object-fit: contain; padding: 8%; opacity: 1 !important; cursor: pointer; }
.gallery .flex-control-thumbs img.flex-active { border-color: var(--ip-black); }
.gallery .woocommerce-product-gallery__trigger { position: absolute; top: 14px; right: 14px; z-index: 2; }
.single-product .product .onsale { display: none; }

/* Ordenamiento nativo */
.toolbar__sort .woocommerce-ordering { margin: 0; }
.toolbar__sort select.orderby { height: 46px; padding: 0 40px 0 16px; border: 1.5px solid var(--ip-line); border-radius: 999px; font-size: 14px; font-weight: 500; 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; }

/* Filtros: enlaces de categoría */
.fcheck--link { text-decoration: none; }
.fcheck--link.is-current { font-weight: 600; background: var(--ip-surface); }
.filters__form { display: contents; }
@media (min-width: 901px) { .filters__foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; } .filters__foot .btn { height: 44px; font-size: 14px; } }

/* Paginación nativa */
.woocommerce-pagination ul { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; border: 0 !important; }
.woocommerce-pagination ul li { border: 0 !important; }
.woocommerce-pagination a, .woocommerce-pagination span { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--ip-line); font-weight: 600; }
.woocommerce-pagination span.current { background: var(--ip-black); color: var(--ip-white); border-color: var(--ip-black); }

/* Avisos nativos */
.woocommerce-message, .woocommerce-info, .woocommerce-error { border-radius: 12px; border-top: 0; background: var(--ip-surface); padding: 14px 18px; margin: 0 0 16px; list-style: none; }
.woocommerce-message::before, .woocommerce-info::before, .woocommerce-error::before { display: none; }
.woocommerce-error { background: #FFF1EB; color: #7A2200; }
.woocommerce-message .button { float: right; border-radius: 999px; background: var(--ip-black); color: var(--ip-white); padding: 8px 16px; }

/* Relacionados (marcado nativo) */
.related.products > h2, .related > .related > h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; margin: 0 0 24px; }
.related ul.products { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Ficha: texto de descripción */
.pdp-sec__texto p { margin: 0 0 12px; color: #3B3C41; line-height: 1.7; }

@media (max-width: 1180px) { ul.products, .shop ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .shop ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); } .related ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .shop ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  ul.products, .shop ul.products, .related ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card__actions .button.card__btn--main { height: 40px; font-size: 13px; padding: 0 10px; }
  .buybox__price .price, .buybox__price { font-size: 28px; }
}
@media (max-width: 359px) { ul.products, .shop ul.products, .related ul.products { grid-template-columns: 1fr; } }

/* Etiqueta de productos de DEMOSTRACIÓN (solo staging) */
.card__badge--demo { position: absolute; z-index: 2; top: 12px; left: 12px; padding: 4px 10px; border-radius: 999px; background: var(--ip-ink, #000); color: #fff; font-size: 10.5px; font-weight: 700; font-style: normal; letter-spacing: .08em; text-transform: uppercase; }
.tag-demo { display: inline-flex; margin: 0 0 10px; padding: 5px 12px; border-radius: 999px; background: rgba(255,63,1,.1); color: #C23000; font-size: 12px; font-weight: 600; font-style: normal; }

/* En páginas de WooCommerce sus estilos de rejilla tienen más prioridad: se restablece la tarjeta del diseño */
.woocommerce ul.products li.product.card .card__media img,
.woocommerce-page ul.products li.product.card .card__media img { position: absolute; top: 26px; left: 24px; width: calc(100% - 48px); height: calc(100% - 52px); max-width: none; object-fit: contain; margin: 0; box-shadow: none; }
@media (max-width: 760px) {
  .woocommerce ul.products li.product.card .card__media img,
  .woocommerce-page ul.products li.product.card .card__media img { top: 16px; left: 14px; width: calc(100% - 28px); height: calc(100% - 32px); }
}

/* Venta individual: WooCommerce deja el campo de cantidad oculto; no se dibuja su recuadro */
form.cart .quantity:has(input[type="hidden"]) { display: none; }

/* Botones de la tarjeta: WooCommerce cambia su presentación en sus páginas y agrega un texto accesible oculto */
ul.products li.product.card .card__actions .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: -1px; padding: 0; border: 0; }
ul.products li.product.card .card__actions .card__btn { display: inline-flex !important; align-items: center; justify-content: center; gap: 6px; line-height: 1.2; margin: 0; }

/* WooCommerce agrega un «clearfix» (::before/::after) y flotantes al formulario: en la rejilla se anulan */
.ip-addtocart form.cart::before, .ip-addtocart form.cart::after { content: none !important; display: none !important; }
.ip-addtocart form.cart .quantity, .ip-addtocart form.cart .single_add_to_cart_button { float: none !important; margin: 0 !important; }
.ip-addtocart form.cart .single_add_to_cart_button { width: 100%; }

/* Acceso directo a la tienda en el menú principal y en el menú móvil */
.nav__links .nav__shop a { color: var(--ip-red); font-weight: 700; }
.nav__links .nav__shop a[aria-current="page"] { background: rgba(255,63,1,.1); }
.drawer nav .drawer__shop a { justify-content: flex-start; gap: 10px; margin-bottom: 4px; background: var(--ip-black); color: #fff; font-weight: 600; }
.drawer nav .drawer__shop a:hover { background: var(--ip-ink); }
.drawer nav .drawer__shop .icon { color: #fff; }
.drawer nav .drawer__shop .icon:last-child { margin-left: auto; }

/* Botones de la tarjeta según el ancho de la propia tarjeta (rejillas de 2, 3 o 4 columnas y relacionados) */
ul.products li.product.card { container-type: inline-size; }
ul.products li.product.card .card__actions { grid-template-columns: minmax(0, 1fr) auto; }
ul.products li.product.card .card__btn--main { min-width: 0; overflow: hidden; }
@container (max-width: 270px) {
  .card__actions .card__btn-long { display: none; }
  .card__actions .card__btn-short { display: inline; }
  .card__actions .card__btn { height: 40px; font-size: 13px; padding: 0 10px; }
  .card__actions .card__btn--wa { width: 40px; padding: 0; }
}
@container (max-width: 150px) {
  .card__actions .card__btn--main .icon { display: none; }
}

/* WooCommerce envuelve relacionados y ventas sugeridas en <section class="related products">: la clase
   «products» del diseño es la rejilla de tarjetas y solo debe aplicarse a la lista, no a la sección. */
section.products { display: block; }
section.products > h2 { margin: 0 0 20px; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -.02em; }
/* Sin selector de cantidad (venta individual o una sola unidad disponible): el botón ocupa todo el ancho */
.ip-addtocart form.cart:has(.quantity input[type="hidden"]) { grid-template-columns: 1fr; }
