/* ==============================================
   HIDER · product.css
   Ubicación: /frontend/css/product.css
   Descripción: Estilos para la página de producto, incluyendo galería, información y zoom.
   Página de Producto · galería · info · zoom
   ============================================== */

/* ── Layout principal ────────────────────────── */
.product-section {
  padding: 32px 0 80px;
}

.product-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
  margin-top: 32px;
}

/* ── Galería ─────────────────────────────────── */
.product-gallery {
  display: flex;
  gap: 14px;
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

/* Miniaturas verticales */
.gallery-thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 72px;
  flex-shrink: 0;
  height: 480px;
  overflow-y: auto;
  scrollbar-width: none;
}

.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--duration), opacity var(--duration);
  flex-shrink: 0;
  background: var(--cream-soft);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.gallery-thumb:hover { border-color: var(--line); }
.gallery-thumb.active { border-color: var(--brown); }

/* Imagen principal */
.gallery-main {
  flex: 1;
  position: relative;
  height: 480px;
  min-width: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--cream-soft);
}

.gallery-main__inner {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
}

.gallery-main__inner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: opacity 0.35s var(--ease);
}

/* Zoom al hover — la imagen se escala */
.gallery-main__inner.zoom-active img {
  transform-origin: var(--zoom-x, 50%) var(--zoom-y, 50%);
  transform: scale(2.2);
  transition: transform 0s;
}

.gallery-badges {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.gallery-zoom-hint {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s;
}

.gallery-main__inner.zoom-active + .gallery-zoom-hint,
.gallery-main:hover .gallery-zoom-hint {
  opacity: 0;
}

/* ── Info ────────────────────────────────────── */
.product-cat {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  min-height: 16px;
}

.product-name {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 700;
  font-style: italic;
  color: var(--brown-deep);
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: 0;
}

/* Rating */
.product-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.product-rating__count {
  font-size: 13px;
  color: var(--muted);
}

/* Precio */
.product-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}

.product-price .price-main {
  font-family: var(--font-body);
  font-size: 30px;
  font-weight: 500;
  font-style: normal;
  color: var(--brown-deep);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.product-price .price-was {
  font-size: 18px;
  color: var(--muted);
  text-decoration: line-through;
}

.product-price .price-off {
  font-size: 13px;
  font-weight: 600;
  background: var(--sale);
  color: white;
  padding: 3px 8px;
  border-radius: 999px;
}

/* Stock badge */
.product-stock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  padding: 6px 12px;
  border-radius: 999px;
}

.product-stock.low {
  background: rgba(220, 53, 34, 0.08);
  color: var(--sale);
}

.product-stock.ok {
  background: rgba(34, 197, 94, 0.08);
  color: #16a34a;
}

.product-stock::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* Variantes */
.product-variants,
.product-sizes {
  margin-bottom: 20px;
}

.variants-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.variants-label strong { color: var(--ink); }

/* Cantidad + carrito */
.product-qty-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.product-qty-row .btn-block {
  flex: 1;
}

/* Acciones */
.product-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line-soft);
}

.product-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  transition: color var(--duration);
  padding: 6px 0;
}

.product-action-btn:hover { color: var(--brown); }

.product-action-btn.active {
  color: var(--sale);
}

.product-action-btn.active svg {
  fill: currentColor;
}

/* Garantías */
.product-guarantees {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
  padding: 20px;
  background: var(--cream-soft);
  border-radius: var(--r);
}

.guarantee-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.guarantee-item svg { color: var(--brown); flex-shrink: 0; }

/* ── Sugerencias ─────────────────────────────── */
#suggestionsSection {
  padding: 72px 0 80px;
}

#suggestionsSection .section-head {
  margin-bottom: 40px;
}

#suggestionsSection .product-grid {
  margin-top: 0;
}

/* ── Responsive completo ─────────────────────── */

/* Tablet grande (hasta 1100px): 2 columnas ajustadas */
@media (max-width: 1100px) {
  .product-grid-layout {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }

  .product-gallery {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
  }

  .gallery-thumbs {
    width: 64px;
    flex-shrink: 0;
    height: 400px;
    overflow-y: auto;
    scrollbar-width: none;
  }

  .gallery-thumbs::-webkit-scrollbar { display: none; }

  .gallery-thumb { width: 64px; height: 64px; }

  .gallery-main {
    flex: 1 1 0px;
    width: 0;
    height: 400px !important;
    min-width: 0;
    position: relative;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--cream);
  }

  .gallery-main__inner {
    width: 100%;
    height: 400px;
    position: relative;
    overflow: hidden;
  }

  .gallery-main__inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
  }

  .gallery-main__inner {
    cursor: default;
  }

  .gallery-main__inner.zoom-active img {
    transform: none;
  }

  .gallery-zoom-hint {
    display: none;
  }
}

/* Tablet pequeña (hasta 820px): 1 columna */
@media (max-width: 820px) {
  .product-section { padding: 24px 0 40px; }

  .product-grid-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .product-gallery {
    position: static;
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    gap: 12px;
  }

  .gallery-main {
    height: 380px !important;
  }

  .gallery-main__inner {
    height: 380px;
  }

  .gallery-thumbs {
    height: 380px;
  }

  #suggestionsSection { padding: 48px 0 60px !important; }
}

/* Móvil (hasta 600px) */
@media (max-width: 600px) {
  .product-section { padding: 16px 0 32px; }

  .product-gallery {
    flex-direction: column-reverse;
    max-width: 100%;
    gap: 10px;
  }

  .gallery-thumbs {
    flex-direction: row;
    width: 100%;
    height: auto;
    overflow-x: auto;
    overflow-y: visible;
  }

  .gallery-thumb {
    width: 58px;
    height: 58px;
    flex-shrink: 0;
  }

  .gallery-main {
    height: auto !important;
    min-height: 280px;
    width: 100% !important;
    aspect-ratio: 4 / 5 !important;
    flex-shrink: 0;
  }

  .gallery-main__inner {
    height: 100%;
    min-height: 280px;
    width: 100%;
  }

  .gallery-main__inner {
    cursor: default;
  }

  .gallery-main__inner.zoom-active img {
    transform: none;
  }

  .gallery-zoom-hint {
    display: none;
  }

  .product-qty-row { flex-direction: column; }
  .product-qty-row .qty { width: 100%; justify-content: center; }
  .product-guarantees { padding: 16px; gap: 10px; }
  .guarantee-item { font-size: 12px; }
  .product-actions { flex-wrap: wrap; gap: 10px; }
  #suggestionsSection { padding: 40px 0 48px !important; }
}
/* ══ DARK MODE — product ══ */
[data-theme="dark"] .gallery-thumb { border-color: var(--line); background: var(--surface); }
[data-theme="dark"] .gallery-thumb.active { border-color: var(--gold-light); }
[data-theme="dark"] .gallery-main__inner { background: var(--surface); }
[data-theme="dark"] .product-name { color: var(--text); }
[data-theme="dark"] .product-cat { color: var(--muted); }
[data-theme="dark"] .product-guarantees { border-top-color: var(--line); }
[data-theme="dark"] .guarantee-item { color: var(--muted); }
[data-theme="dark"] .accordion-item { border-top-color: var(--line); }
[data-theme="dark"] .accordion-btn { color: var(--text); }
[data-theme="dark"] .variants-label { color: var(--text); }
[data-theme="dark"] .swatch { border-color: var(--line); }
[data-theme="dark"] .swatch.active { border-color: var(--gold-light); }
[data-theme="dark"] .size-tab { background: var(--surface); border-color: var(--line); color: var(--text); }
[data-theme="dark"] .size-tab.active { background: var(--text); color: var(--bg); }
[data-theme="dark"] .qty-control { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .gallery-zoom-hint  { background: var(--surface); color: var(--muted); }
[data-theme="dark"] .product-price      { color: var(--text); }
[data-theme="dark"] .price-main         { color: var(--text); }
[data-theme="dark"] .price-was          { color: var(--muted); }
[data-theme="dark"] .price-off          { background: var(--sale); color: #fff; }
[data-theme="dark"] .product-stock      { color: var(--muted); }
[data-theme="dark"] .product-rating     { color: var(--muted); }
[data-theme="dark"] .product-action-btn { color: var(--muted); }
[data-theme="dark"] .product-action-btn:hover { color: var(--text); }
