/*
  GETSMARTCA Lite — HOTFIX GLOBAL v3
  Objetivo:
  - Evitar logos de pago gigantes en footer (cuando algún CSS global fuerza img{width:100%} o cache viejo)
  - Corregir grid de productos cuando el primer producto desaparece por pseudo-elements clearfix
  - Mejorar contención de iframes/widgets de pago en checkout móvil
*/

/* Footer grid columns consolidated in main.css */

/* Payment logo sizing consolidated in style.css (hard-guard) */

/* =============================================
   PRODUCT GRIDS: primer producto no visible (fix)
   ============================================= */
/* Woo clásico + shortcodes */
.woocommerce ul.products:before,
.woocommerce ul.products:after,
.woocommerce ul.products::before,
.woocommerce ul.products::after,
ul.products:before,
ul.products:after,
ul.products::before,
ul.products::after,
.woocommerce .products:before,
.woocommerce .products:after,
.woocommerce .products::before,
.woocommerce .products::after,
.products:before,
.products:after,
.products::before,
.products::after{
  content:none !important;
  display:none !important;
}

/* Woo Blocks (home / catálogo en bloques) */
.wc-block-grid__products:before,
.wc-block-grid__products:after,
.wc-block-grid__products::before,
.wc-block-grid__products::after{
  content:none !important;
  display:none !important;
}

/* Woo Blocks (Product Collection / Product Template) */
ul.wc-block-product-template:before,
ul.wc-block-product-template:after,
ul.wc-block-product-template::before,
ul.wc-block-product-template::after{
  content:none !important;
  display:none !important;
}

/* Asegura grid consistente en bloques (sin romper el layout del tema) */
.wc-block-grid__products{
  list-style:none !important;
  padding:0 !important;
  margin:0 !important;
  display:grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:14px;
}
@media (max-width: 980px){
  .wc-block-grid__products{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px){
  .wc-block-grid__products{ grid-template-columns: 1fr; }
}
.wc-block-grid__product{
  margin:0 !important;
  float:none !important;
  width:auto !important;
  min-width:0 !important;
}

/* Product Collection / Template grid */
ul.wc-block-product-template{
  list-style:none !important;
  padding:0 !important;
  margin:0 !important;
  display:grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:14px;
}
@media (max-width: 980px){
  ul.wc-block-product-template{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px){
  ul.wc-block-product-template{ grid-template-columns: 1fr; }
}
li.wc-block-product{
  margin:0 !important;
  min-width:0 !important;
}

/* ==================================
   CHECKOUT: contención de widgets/iframes
   ================================== */
.woocommerce-checkout #payment,
.woocommerce-checkout .woocommerce-checkout-payment{
  overflow-x:hidden;
}
.woocommerce-checkout #payment iframe,
.woocommerce-checkout .woocommerce-checkout-payment iframe,
.woocommerce-checkout #payment img,
.woocommerce-checkout .woocommerce-checkout-payment img{
  max-width:100% !important;
}

/* Si algún plugin mete contenedores con width fija */
.woocommerce-checkout #payment .payment_box,
.woocommerce-checkout .woocommerce-checkout-payment .payment_box{
  max-width:100% !important;
  overflow-x:auto;
}

/* ==================================
   SINGLE PRODUCT: Woo gallery safety (WP Rocket / RUC)
   - If gallery JS is delayed, Woo may remain hidden (opacity:0)
   - If Remove Unused CSS strips Woo rule, ensure images are still visible
   ================================== */
/* === Custom Product Gallery (no FlexSlider) === */

/* Hide Woo native gallery if it renders (fallback) */
.single-product .woocommerce-product-gallery{
  opacity: 1 !important;
}

/* Custom gallery: flex column so main image fills available height */
.gs-gallery{
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

/* Main image — grows to fill remaining space */
.gs-gallery__main{
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  min-height: 200px;
  flex: 1 1 auto;
}
.gs-gallery__main a{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}
.gs-gallery__main img{
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  transition: opacity .2s;
}

/* Thumbnails */
.gs-gallery__thumbs{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border, #e5e7eb);
}
.gs-gallery__thumb{
  width: 68px;
  height: 68px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s;
  flex-shrink: 0;
}
.gs-gallery__thumb:hover,
.gs-gallery__thumb.is-active{
  border-color: var(--brand-red, #dc2626);
}
.gs-gallery__thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Mobile: horizontal scroll for thumbnails */
@media (max-width: 980px){
  .gs-gallery__thumbs{
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
  }
  .gs-gallery__thumbs::-webkit-scrollbar{ display: none; }
  .gs-gallery__thumb{
    width: 60px;
    height: 60px;
    flex-shrink: 0;
  }
}

/* === Lightbox overlay === */
.gs-lightbox{
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0,0,0,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
  cursor: zoom-out;
}
.gs-lightbox.is-open{
  opacity: 1;
  visibility: visible;
}
.gs-lightbox__img{
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  cursor: default;
}
.gs-lightbox__close{
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  opacity: .8;
  transition: opacity .2s;
  z-index: 2;
}
.gs-lightbox__close:hover{
  opacity: 1;
}

/* Lightbox navigation arrows */
.gs-lightbox__prev,
.gs-lightbox__next{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 48px;
  line-height: 1;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  opacity: .7;
  transition: opacity .2s, background .2s;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.gs-lightbox__prev{ left: 12px; }
.gs-lightbox__next{ right: 12px; }
.gs-lightbox__prev:hover,
.gs-lightbox__next:hover{
  opacity: 1;
  background: rgba(255,255,255,.25);
}

/* Lightbox image counter */
.gs-lightbox__counter{
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.8);
  font-size: 14px;
  font-weight: 600;
  background: rgba(0,0,0,.4);
  padding: 6px 16px;
  border-radius: 999px;
  z-index: 2;
}

/* Mobile: smaller nav buttons */
@media (max-width: 980px){
  .gs-lightbox__prev,
  .gs-lightbox__next{
    font-size: 36px;
    padding: 6px 10px;
  }
  .gs-lightbox__prev{ left: 6px; }
  .gs-lightbox__next{ right: 6px; }
}

/* ==================================
   RELATED PRODUCTS: prevent "amontonado" layout
   Some global CSS may turn the section into flex row and squeeze the grid.
   ================================== */
.single-product .gs-related,
.single-product .gs-related .related.products{
  display:block !important;
  width:100% !important;
}
.single-product .gs-related .related.products > h2{
  width:100% !important;
  display:block !important;
  margin: 0 0 12px !important;
}
.single-product .gs-related .related.products ul.products{
  width:100% !important;
}


/* ==================================
   HOME: Tabs products (Top's / Marcas / Categorías)
   Nota: usamos clases únicas (gs-home-tabs*) para evitar colisiones con estilos del tema.
   ================================== */

.gs-home-tabs{
  margin-top: 10px;
  width: 100%;
}
.gs-home-tabs__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 14px;
  width: 100%;
}

/* En escritorio: que no muestre scrollbars; si no cabe, que baje a otra línea */
.gs-home-tabs__buttons{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
  background:#fff;
  border:1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--shadow);
  max-width: 100%;
}

.gs-home-tabs__btn{
  appearance:none;
  border:0;
  background:transparent;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--muted);
  cursor:pointer;
  line-height:1;
  white-space:nowrap;
}
.gs-home-tabs__btn.is-active{
  background: var(--brand-blue-dark);
  color:#fff;
  box-shadow: 0 10px 20px rgba(2,6,23,.15);
}

.gs-home-tabs__panels,
.gs-home-tabs__panel{
  width: 100%;
  display:block;
}

.gs-home-tabs__panels .gs-home-tabs__panel{
  display:none;
}
.gs-home-tabs__panels .gs-home-tabs__panel.is-active{
  display:block;
}
.gs-home-tabs__panel.is-loading{
  opacity:.75;
}
.gs-home-tabs__skeleton{
  padding: 18px;
  color: var(--muted);
  border: 1px dashed rgba(2,6,23,.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,.6);
}

/* Móvil: permitimos scroll horizontal suave pero ocultamos el scrollbar */
@media (max-width: 780px){
  .gs-home-tabs__head{ flex-direction:column; align-items:flex-start; }
  .gs-home-tabs__buttons{
    width:100%;
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  .gs-home-tabs__buttons::-webkit-scrollbar{ display:none; }
}

/* ==================================
   Product TOC (generated by GS SEO AI)
   ================================== */
.gs-toc{
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 12px);
  padding: 14px 18px;
  margin: 16px 0;
}
.gs-toc strong{ font-size: 14px; }
.gs-toc ol{ margin: 8px 0 0; padding-left: 22px; }
.gs-toc li{ margin-bottom: 4px; font-size: 14px; }
.gs-toc a{ color: var(--brand-blue, #203088); font-weight: 600; }
