/* ======================================================
   DETALLE DE PRODUCTO (plantilla HTML + CSS)
   Mantiene misma paleta y estilo elegante fashion
   ====================================================== */

.product-detail {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(1.25rem, 2.8vw, 2rem);
}

/* Breadcrumb */
.product__breadcrumb {
  margin-bottom: 1.8rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: rgba(0, 0, 0, 0.65);
}

.breadcrumb a {
  color: rgba(0, 0, 0, 0.65);
  transition: color 180ms ease;
}

.breadcrumb a:hover {
  color: rgba(0, 0, 0, 0.85);
  text-decoration: underline;
}

.breadcrumb__sep {
  color: rgba(0, 0, 0, 0.35);
}

/* Layout principal */
.product__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 4vw, 3.5rem);
  margin-bottom: 3rem;
}

/* Sección de imágenes */
.product__gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product__main-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4/5;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
  background: #fff;
}

.product__main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.product__zoomHint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  font-size: 0.82rem;
  color: rgba(0, 0, 0, 0.70);
  user-select: none;
}

.product__zoomHint svg {
  width: 16px;
  height: 16px;
  stroke: #000;
}

.product__badges {
  position: absolute;
  left: 1rem;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.96);
  color: rgba(0, 0, 0, 0.78);
}

.badge--primary {
  border-color: rgba(231, 76, 60, 0.35);
  background: rgba(231, 76, 60, 0.10);
  color: rgba(0, 0, 0, 0.82);
}

.product__thumbnails {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.thumbnail {
  aspect-ratio: 1;
  border: 1px solid rgba(0, 0, 0, 0.07);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease;
  background: #fff;
}

.thumbnail:hover {
  border-color: rgba(0, 0, 0, 0.22);
  transform: translateY(-2px);
}

.thumbnail.is-active {
  border-color: rgba(0, 0, 0, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sección de detalles */
.product__info {
  display: flex;
  flex-direction: column;
}

.product__header {
  margin-bottom: 1.2rem;
}

.product__brand {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.45);
  margin-bottom: 0.4rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.product__title {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(2rem, 3vw, 2.5rem);
  line-height: 1.1;
  color: var(--color-black);
  margin: 0 0 0.8rem;
}

.product__subtitle {
  font-size: 1rem;
  color: rgba(0, 0, 0, 0.65);
  line-height: 1.4;
  margin: 0 0 1.2rem;
}

/* Precio */
.product__price {
  margin-bottom: 1.5rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.price {
  display: inline-flex;
  align-items: baseline;
  gap: 0.75rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.price__now {
  font-weight: 750;
  color: var(--color-primary);
  font-size: 1.8rem;
}

.price__was {
  font-size: 1.2rem;
  color: rgba(0, 0, 0, 0.45);
  text-decoration: line-through;
}

.price__discount {
  font-size: 0.9rem;
  padding: 0.25rem 0.6rem;
  background: rgba(231, 76, 60, 0.10);
  color: rgba(231, 76, 60, 0.9);
  border-radius: 3px;
  margin-left: 0.5rem;
}

/* Cantidad */
.product__quantity {
  margin-bottom: 1.8rem;
}

.quantity__title {
  font-size: 0.95rem;
  color: rgba(0, 0, 0, 0.85);
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.quantity__selector {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.quantity__btn {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: rgba(0, 0, 0, 0.65);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.quantity__btn:hover {
  background: rgba(0, 0, 0, 0.03);
  color: rgba(0, 0, 0, 0.85);
}

.quantity__input {
  width: 60px;
  height: 45px;
  border: none;
  text-align: center;
  font-size: 1rem;
  color: rgba(0, 0, 0, 0.85);
  background: transparent;
  outline: none;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

/* Botones de acción */
.product__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn {
  padding: 1rem 1.5rem;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn svg {
  width: 20px;
  height: 20px;
  stroke: #000;
}

.btn--primary {
  background: var(--color-black);
  color: var(--color-white);
}

.btn--primary svg {
  stroke: #fff;
}

.btn--primary:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Info adicional */
.product__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.meta-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 0.6rem;
  color: rgba(0, 0, 0, 0.72);
}

.meta-icon svg {
  width: 26px;
  height: 26px;
  stroke: #000;
}

.meta-label {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.65);
  margin-bottom: 0.2rem;
}

.meta-value {
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.85);
  font-weight: 600;
}

/* Descripción detallada */
.product__description {
  margin-bottom: 3rem;
}

.description__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  color: var(--color-black);
  margin-bottom: 1.2rem;
  font-weight: 500;
}

/* ✅ FIX: evita que una descripción larga (sin espacios) se vaya a la derecha */
.description__content {
  color: rgba(0, 0, 0, 0.75);
  line-height: 1.7;
  font-size: 1rem;

  max-width: 100%;
  white-space: normal;        /* texto normal */
  overflow-wrap: anywhere;    /* corta donde sea si no hay espacios */
  word-break: break-word;     /* fallback para navegadores */
}

/* ✅ refuerzo por si la descripción incluye tags internos */
.description__content * {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.description__features {
  margin-top: 1.5rem;
  padding-left: 1.2rem;
}

.description__features li {
  margin-bottom: 0.6rem;
  color: rgba(0, 0, 0, 0.7);
}

/* Especificaciones */
.product__specs {
  margin-bottom: 3rem;
}

.specs__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  color: var(--color-black);
  margin-bottom: 1.2rem;
  font-weight: 500;
}

.specs__table {
  width: 100%;
  border-collapse: collapse;
}

.specs__table tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.specs__table td {
  padding: 0.9rem 0.5rem;
  vertical-align: top;
}

.specs__table td:first-child {
  width: 40%;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.85);
}

.specs__table td:last-child {
  color: rgba(0, 0, 0, 0.7);
}

/* Productos relacionados */
.related-products {
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.related__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  color: var(--color-black);
  margin-bottom: 1.5rem;
  font-weight: 500;
  text-align: center;
}

.related__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
}

.related-card {
  background: #fff;
  display: flex;
  flex-direction: column;
}

.related-card__image {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.07);
  margin-bottom: 0.8rem;
}

.related-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

.related-card:hover .related-card__image img {
  transform: scale(1.03);
}

.related-card__brand {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.45);
  margin-bottom: 0.3rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.related-card__name {
  font-size: 0.95rem;
  color: rgba(0, 0, 0, 0.88);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-weight: 650;
  line-height: 1.25;
  margin: 0 0 0.4rem;
}

.related-card__name a {
  color: inherit;
}

.related-card__price {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-weight: 750;
  color: var(--color-primary);
  font-size: 1rem;
}

/* =========================
   MODAL ZOOM IMAGE
   (✅ abre sin “mega-zoom”: arranca ajustada al panel)
   ========================= */

.imgm {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.imgm.is-open {
  display: block;
}

.imgm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.imgm__dialog {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 28px);
}

.imgm__panel {
  position: relative;
  width: min(1100px, 96vw);
  height: min(760px, 86vh);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.imgm__topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 2;
}

.imgm__title {
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.78);
  font-weight: 650;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.imgm__title svg {
  width: 18px;
  height: 18px;
  stroke: #000;
}

.imgm__controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.imgm__btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.96);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.imgm__btn:hover {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.imgm__btn svg {
  width: 18px;
  height: 18px;
  stroke: #000;
}

.imgm__stage {
  position: absolute;
  inset: 0;
  padding-top: 58px; /* topbar */
  overflow: hidden;
  touch-action: none; /* pinch/pan custom */
  background: #fff;
}

/* OJO: mantenemos max-width/height en NONE para permitir zoom real.
   El “fit” inicial lo hace JS con scale calculado. */
.imgm__img {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  max-width: none;
  max-height: none;
  cursor: grab;
}

.imgm__img:active {
  cursor: grabbing;
}

/* Responsive */
@media (max-width: 1024px) {
  .product__layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .product__main-image {
    aspect-ratio: 3/4;
  }

  .related__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .product__meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .related__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .product__thumbnails {
    grid-template-columns: repeat(3, 1fr);
  }

  .product__meta {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .related__grid {
    grid-template-columns: 1fr;
  }

  .specs__table td:first-child {
    width: 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thumbnail,
  .btn,
  .quantity__btn,
  .related-card__image img,
  .imgm__btn {
    transition: none !important;
  }
}
