/* Modal producto — foto a sangre en la izquierda, sin marcos */

.product-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}

.product-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.product-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}

.product-modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  height: auto;
  max-height: min(88vh, 620px);
  overflow: hidden;
  background: var(--sh-cream, #fff);
  color: var(--sh-ink, #111);
  border-radius: 0;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: stretch;
  transform: translateY(10px);
  transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}

.product-modal.is-open .product-modal-panel {
  transform: none;
}

.product-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sh-ink, #111);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.product-modal-close:hover {
  opacity: 0.55;
}

/* Cuadro foto 1:1 — llena el cuadrado sin huecos laterales */
.product-modal-gallery {
  position: relative;
  background: var(--sh-cream-deep, #f3f3f3);
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  margin: 0;
  padding: 0;
  align-self: start;
}

.product-modal-gallery-main {
  position: absolute;
  inset: 0;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  line-height: 0;
  background: var(--sh-cream-deep, #f3f3f3);
}

.product-modal-gallery-main img,
.product-modal .product-modal-gallery-main img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  object-fit: cover !important;
  object-position: center center !important;
  transform: none !important;
  display: block !important;
}

.product-modal-gallery-main img.is-wait {
  opacity: 0 !important;
}

.product-modal-track {
  display: none;
}

.product-modal-dots {
  display: none;
}

/* Miniaturas encima de la foto, abajo izquierda */
.product-modal-thumbs {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 0;
}

.product-modal-thumbs:empty {
  display: none;
}

.product-modal-thumb {
  width: 48px;
  height: 48px;
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--sh-line-strong, #fff);
  background: var(--sh-card, #fff);
  padding: 0;
  cursor: pointer;
  opacity: 0.9;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: opacity .2s ease, border-color .2s ease;
}

.product-modal-thumb.is-active,
.product-modal-thumb:hover {
  opacity: 1;
  border-color: var(--sh-btn-bg, #111);
}

.product-modal-thumb img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  display: block !important;
}

.product-modal-body {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  background: var(--sh-cream, #fff);
  color: var(--sh-ink, #111);
  overflow: auto;
  height: 100%;
  box-sizing: border-box;
}

.product-modal-brand {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sh-muted, #aaa);
}

.product-modal-pack {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sh-muted, #bbb);
}

.product-modal-title {
  margin: 0 0 8px;
  font-family: var(--sh-serif, var(--sh-sans, system-ui, sans-serif));
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 600;
  color: var(--sh-ink, #111);
  line-height: 1.25;
}

.product-modal-price {
  margin: 0 0 12px;
  font-family: var(--sh-sans, system-ui, sans-serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--sh-ink, #111);
}

.product-modal-price.has-sizes {
  margin-top: 4px;
}

.product-modal-price[hidden] {
  display: none !important;
}

.product-modal-sizes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 2px;
  width: 100%;
  margin: 0 0 10px;
}

.product-modal-sizes[hidden] {
  display: none !important;
}

.product-modal-size-chip {
  position: relative;
  margin: 0;
  padding: 8px 14px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sh-ink, #111);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  opacity: 0.42;
  cursor: pointer;
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.product-modal-size-chip::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.product-modal-size-chip.is-on {
  opacity: 1;
  font-weight: 700;
}

.product-modal-size-chip.is-on::after {
  transform: scaleX(1);
}

.product-modal-size-chip:hover {
  opacity: 0.78;
}

.product-modal-size-chip:focus-visible {
  outline: none;
  opacity: 1;
}

.product-modal-size-chip + .product-modal-size-chip::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 10px;
  margin-top: -6px;
  background: currentColor;
  opacity: 0.18;
  pointer-events: none;
}

.product-modal-recados {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 0 0 10px;
}

.product-modal-recados[hidden] {
  display: none !important;
}

.product-modal-recado-chip {
  margin: 0;
  padding: 6px 10px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-transform: none;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.product-modal-recado-chip.is-on {
  opacity: 1;
}

.product-modal-recado-chip:hover,
.product-modal-recado-chip:focus-visible {
  outline: none;
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  .product-modal-size-chip,
  .product-modal-size-chip::after,
  .product-modal-recado-chip {
    transition: none;
  }
}

.product-modal-desc {
  margin: 0 0 20px;
  color: var(--sh-muted, #777);
  font-size: 13px;
  line-height: 1.6;
  flex: 1;
}

.product-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.product-modal-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--sh-line-strong, #ddd);
  border-radius: 0;
  overflow: hidden;
  background: var(--sh-card, #fff);
}

.product-modal-qty button {
  width: 34px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--sh-ink, #111);
  font-size: 16px;
  cursor: pointer;
}

.product-modal-qty input {
  width: 36px;
  height: 36px;
  border: 0;
  text-align: center;
  font-family: var(--sh-sans, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--sh-ink, #111);
  background: transparent;
  -moz-appearance: textfield;
  appearance: textfield;
}

.product-modal-qty input::-webkit-outer-spin-button,
.product-modal-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.product-modal-add.sh-btn,
.product-modal-add {
  flex: 1;
  background: var(--sh-btn-bg, #111) !important;
  color: var(--sh-btn-text, #fff) !important;
  border-color: var(--sh-btn-bg, #111) !important;
  border-radius: 0 !important;
  min-height: 36px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.product-modal-add.sh-btn:hover,
.product-modal-add:hover {
  background: var(--sh-btn-hover, #000) !important;
  color: var(--sh-btn-text, #fff) !important;
  border-color: var(--sh-btn-hover, #000) !important;
}

body.modal-product-open {
  overflow: hidden;
}

@media (max-width: 800px) {
  .product-modal {
    padding: 18px 16px;
    align-items: center;
    justify-content: center;
  }

  .product-modal-backdrop {
    background: rgba(0, 0, 0, 0.82);
  }

  .product-modal-panel {
    grid-template-columns: 1fr;
    width: min(340px, 100%);
    height: auto;
    max-height: min(84vh, 620px);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.4);
    transform: translateY(12px) scale(0.97);
  }

  .product-modal.is-open .product-modal-panel {
    transform: none;
  }

  .product-modal-close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 18px;
  }

  .product-modal-gallery {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .product-modal-gallery-main {
    display: none;
  }

  .product-modal-thumbs {
    left: 8px;
    bottom: 8px;
    gap: 4px;
  }

  .product-modal-thumb {
    width: 36px;
    height: 36px;
  }

  .product-modal-track {
    display: flex;
    position: absolute;
    inset: 0;
    gap: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0;
  }

  .product-modal-track::-webkit-scrollbar {
    display: none;
  }

  .product-modal-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    height: 100%;
    overflow: hidden;
    background: #f3f3f3;
  }

  .product-modal-slide img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    transform: none !important;
  }

  .product-modal-body {
    height: auto;
    padding: 14px 14px 16px;
    overflow: visible;
  }

  .product-modal-brand {
    font-size: 9px;
    margin: 0 0 2px;
    letter-spacing: 0.16em;
  }

  .product-modal-pack {
    font-size: 9px;
    margin: 0 0 4px;
  }

  .product-modal-title {
    font-size: 15px;
    margin: 0 0 4px;
    line-height: 1.2;
  }

  .product-modal-price {
    font-size: 14px;
    margin: 0 0 8px;
  }

  .product-modal-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.45;
    flex: none;
    max-height: 2.9em;
  }

  .product-modal-actions {
    gap: 8px;
  }

  .product-modal-qty button,
  .product-modal-qty input {
    width: 30px;
    height: 32px;
    font-size: 13px;
  }

  .product-modal-add.sh-btn,
  .product-modal-add {
    min-height: 32px;
    font-size: 11px;
    letter-spacing: 0.1em;
    padding: 0 12px;
  }
}

@media (max-width: 380px) {
  .product-modal {
    padding: 14px 12px;
  }

  .product-modal-panel {
    width: min(300px, 100%);
  }
}
