/* =========================================================
   FIX CRÍTICO TIENDA + GALERÍA
   Cargar después de style.css
   ========================================================= */

/* ---------- TIENDA: tarjetas compactas y proporcionales ---------- */
body .store-section{
  max-width:1500px!important;
  margin:0 auto!important;
  padding:48px 5vw!important;
}

body .store-head{
  margin-bottom:22px!important;
}

body .store-head h2,
body .section.store-section h2{
  font-size:clamp(42px,5vw,76px)!important;
  line-height:.9!important;
  letter-spacing:-.06em!important;
  margin:0!important;
}

body .store-filter{
  max-width:100%!important;
  display:grid!important;
  grid-template-columns:minmax(240px,1fr) auto!important;
  gap:14px!important;
  align-items:center!important;
  margin:22px 0 34px!important;
}

body .store-filter select{
  width:100%!important;
  height:52px!important;
  font-size:16px!important;
  border-radius:16px!important;
}

body .store-grid{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(260px,1fr))!important;
  gap:28px!important;
  align-items:stretch!important;
}

body .store-card,
body .product-card,
body article.card{
  min-width:0!important;
}

body .store-card{
  height:auto!important;
  border-radius:26px!important;
  background:#fff!important;
  overflow:hidden!important;
  box-shadow:0 16px 42px rgba(6,20,40,.10)!important;
  display:flex!important;
  flex-direction:column!important;
}

body .store-card-img,
body .store-card .product-img,
body .product-card .product-img{
  height:300px!important;
  min-height:300px!important;
  max-height:300px!important;
  width:100%!important;
  background:#f4f7fb!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  overflow:hidden!important;
}

body .store-card-img img,
body .store-card .product-img img,
body .product-card .product-img img{
  width:100%!important;
  height:100%!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:contain!important;
  object-position:center center!important;
  padding:16px!important;
  display:block!important;
}

body .store-card-body{
  padding:22px 26px 26px!important;
  flex:1!important;
  display:flex!important;
  flex-direction:column!important;
}

body .store-card-body h3,
body .store-card h3{
  font-size:22px!important;
  line-height:1.1!important;
  margin:0 0 10px!important;
  letter-spacing:-.03em!important;
}

body .store-card-body p,
body .store-card p{
  font-size:16px!important;
  line-height:1.35!important;
  margin:0 0 14px!important;
  min-height:auto!important;
}

body .store-price,
body .price{
  font-size:30px!important;
  line-height:1!important;
  margin:10px 0 18px!important;
}

body .store-btn,
body .store-card .btn{
  align-self:flex-start!important;
  font-size:14px!important;
  padding:13px 26px!important;
  border-radius:999px!important;
}

/* ---------- PRODUCTO INDIVIDUAL ---------- */
body .product-page{
  max-width:1500px!important;
  margin:0 auto!important;
  padding:42px 5vw!important;
}

body .product-layout{
  display:grid!important;
  grid-template-columns:minmax(360px,720px) minmax(340px,520px)!important;
  gap:34px!important;
  align-items:start!important;
}

body .product-gallery-card{
  background:#fff!important;
  border-radius:26px!important;
  overflow:hidden!important;
  box-shadow:0 16px 42px rgba(6,20,40,.10)!important;
}

body .product-main-img,
body .product-gallery-card .product-img{
  height:560px!important;
  max-height:560px!important;
  min-height:560px!important;
  width:100%!important;
  background:#f4f7fb!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  overflow:hidden!important;
}

body .product-main-img img,
body .product-gallery-card .product-img img,
body #mainProductImage{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  object-position:center!important;
  padding:18px!important;
  display:block!important;
}

body .product-thumbs{
  display:flex!important;
  gap:10px!important;
  overflow-x:auto!important;
  padding:14px!important;
  height:auto!important;
  background:#fff!important;
}

body .product-thumb{
  width:86px!important;
  height:86px!important;
  min-width:86px!important;
  max-width:86px!important;
  border-radius:14px!important;
  overflow:hidden!important;
  border:2px solid #d8e1ed!important;
  background:#f8fafc!important;
  padding:0!important;
}

body .product-thumb img{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  padding:5px!important;
}

/* ---------- GALERÍA: cards limpias ---------- */
body .gallery-page{
  max-width:1500px!important;
  margin:0 auto!important;
  padding:42px 5vw!important;
}

body .clean-gallery-grid,
body .gallery-grid{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(240px,1fr))!important;
  gap:24px!important;
  align-items:start!important;
}

body .clean-gallery-card,
body .gallery-card{
  margin:0!important;
  border-radius:24px!important;
  overflow:hidden!important;
  background:#fff!important;
  box-shadow:0 12px 34px rgba(6,20,40,.10)!important;
  border:1px solid rgba(15,23,42,.06)!important;
}

body .gallery-zoom-btn,
body .gallery-lightbox-trigger{
  width:100%!important;
  height:260px!important;
  display:block!important;
  padding:0!important;
  border:0!important;
  background:#f4f7fb!important;
  overflow:hidden!important;
  cursor:pointer!important;
}

body .gallery-zoom-btn img,
body .gallery-lightbox-trigger img,
body .gallery-card > img,
body .gallery-card figure img{
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
  object-position:center!important;
  display:block!important;
}

/* ---------- OCULTAR lightbox antiguo que quedaba al fondo ---------- */
body > .lightbox,
body .lightbox:not(.is-open),
body #galleryLightbox:not(.is-open),
body #galleryLightbox[aria-hidden="true"]{
  display:none!important;
  visibility:hidden!important;
  height:0!important;
  max-height:0!important;
  overflow:hidden!important;
  padding:0!important;
  margin:0!important;
  position:fixed!important;
  left:-99999px!important;
  top:-99999px!important;
}

/* ---------- LIGHTBOX EMERGENTE REAL ---------- */
body.no-scroll{
  overflow:hidden!important;
}

#silicioLightbox.silicio-lightbox-overlay{
  position:fixed!important;
  inset:0!important;
  width:100vw!important;
  height:100vh!important;
  z-index:2147483647!important;
  display:none!important;
  align-items:center!important;
  justify-content:center!important;
  background:rgba(6,20,40,.94)!important;
  padding:24px!important;
}

#silicioLightbox.silicio-lightbox-overlay.open{
  display:flex!important;
}

#silicioLightbox .silicio-lightbox-panel{
  max-width:96vw!important;
  max-height:94vh!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
  justify-content:center!important;
}

#silicioLightbox .silicio-lightbox-image{
  max-width:96vw!important;
  max-height:86vh!important;
  width:auto!important;
  height:auto!important;
  object-fit:contain!important;
  border-radius:18px!important;
  background:#fff!important;
  box-shadow:0 28px 90px rgba(0,0,0,.55)!important;
}

#silicioLightbox .silicio-lightbox-caption{
  margin-top:12px!important;
  color:#fff!important;
  font-weight:900!important;
  text-align:center!important;
}

#silicioLightbox .silicio-lightbox-x{
  position:fixed!important;
  top:18px!important;
  right:24px!important;
  width:54px!important;
  height:54px!important;
  border-radius:50%!important;
  border:1px solid rgba(255,255,255,.25)!important;
  background:rgba(255,255,255,.15)!important;
  color:#fff!important;
  font-size:36px!important;
  line-height:1!important;
  cursor:pointer!important;
  z-index:2147483647!important;
}

/* ---------- RESPONSIVE ---------- */
@media(max-width:1200px){
  body .store-grid{grid-template-columns:repeat(2,minmax(260px,1fr))!important}
  body .clean-gallery-grid,
  body .gallery-grid{grid-template-columns:repeat(3,minmax(220px,1fr))!important}
}

@media(max-width:900px){
  body .product-layout{grid-template-columns:1fr!important}
  body .product-main-img,
  body .product-gallery-card .product-img{
    height:420px!important;
    min-height:420px!important;
    max-height:420px!important;
  }
  body .clean-gallery-grid,
  body .gallery-grid{grid-template-columns:repeat(2,minmax(200px,1fr))!important}
}

@media(max-width:640px){
  body .store-grid{grid-template-columns:1fr!important}
  body .store-card-img,
  body .store-card .product-img,
  body .product-card .product-img{
    height:260px!important;
    min-height:260px!important;
    max-height:260px!important;
  }
  body .clean-gallery-grid,
  body .gallery-grid{grid-template-columns:1fr!important}
  body .gallery-zoom-btn,
  body .gallery-lightbox-trigger{height:240px!important}
  body .store-filter{grid-template-columns:1fr!important}
}

.product-description-full{
  color:#475569!important;
  font-size:1rem!important;
  line-height:1.55!important;
  margin:12px 0 18px!important;
  white-space:normal!important;
  max-height:none!important;
  overflow:visible!important;
}
.store-card-body p{
  display:block!important;
  -webkit-line-clamp:unset!important;
  max-height:none!important;
  overflow:visible!important;
}
.product-buy-form small{
  display:block;
  color:#64748b;
  font-size:.78rem;
  margin-top:5px;
}
@media print{
  .print-only{display:block!important}
}

.product-image-admin-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fill,minmax(180px,1fr))!important;
  gap:14px!important;
}
.product-image-admin-card{
  background:#f8fafc!important;
  border:1px solid #d8e1ed!important;
  border-radius:18px!important;
  padding:12px!important;
}
.product-image-admin-card img{
  width:100%!important;
  height:140px!important;
  object-fit:contain!important;
  background:#fff!important;
  border-radius:12px!important;
}
