/* Visor reutilizable: solo los disparadores explícitos de fotos de producto. */
.product-image-trigger {
  appearance: none;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}
.product-image-trigger--card,
.product-image-trigger--detail { width: 100%; height: 100%; }
.product-image-trigger--card img,
.product-image-trigger--detail img { display: block; width: 100%; height: 100%; }
.product-image-trigger--thumb { width: 44px; min-width: 44px; height: 44px; min-height: 44px; border-radius: var(--r, 10px); }
.product-image-trigger:focus-visible { outline: 3px solid #C99A1F; outline-offset: 3px; }

html.crm-zoom-open, body.crm-zoom-open { overflow: hidden; }
.crm-zoom {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(960px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: min(900px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto !important;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  background: #171717;
  color: #F7F3EA;
  color-scheme: dark;
  box-shadow: 0 25px 70px rgba(0, 0, 0, .58);
}
.crm-zoom[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.crm-zoom::backdrop { background: rgba(8, 8, 8, .86); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.crm-zoom__stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #8B7A55 #242424;
  background: #111;
  outline: none;
}
.crm-zoom__stage:focus-visible { box-shadow: inset 0 0 0 3px #C99A1F; }
.crm-zoom__canvas { display: grid; min-width: 100%; min-height: 100%; place-items: center; background: #111; }
.crm-zoom img { display: block; flex: 0 0 auto; max-width: none; max-height: none; object-fit: contain; }
.crm-zoom__footer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .8rem;
  min-width: 0;
  padding: .55rem 4.25rem .55rem .7rem;
  border-top: 1px solid rgba(255, 255, 255, .12);
  background: #1B1B1B;
  color: #F7F3EA;
}
.crm-zoom__controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .35rem; }
.crm-zoom__control,
.crm-zoom__close {
  appearance: none;
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .28);
  background: #2B2B2B;
  color: #FFF;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
}
.crm-zoom__control { border-radius: 12px; font: 700 1.35rem/1 var(--body, var(--sp-sans, sans-serif)); }
.crm-zoom__control:disabled { opacity: .42; cursor: not-allowed; }
.crm-zoom .crm-zoom__input-wrap {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 44px;
  height: 44px;
  padding-inline: .45rem;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 12px;
  background: #2B2B2B;
  color: #FFF;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
  font: 700 1rem/1 var(--body, var(--sp-sans, sans-serif));
}
/* El visor conserva su superficie neutra, incluso dentro de formularios por tema. */
body .crm-zoom input.crm-zoom__level[type="number"] {
  box-sizing: border-box;
  width: 4.5rem;
  min-width: 0;
  height: 42px !important;
  min-height: 0 !important;
  padding: 0 .2rem !important;
  border: 0;
  outline: 0;
  background: #2B2B2B !important;
  color: #FFF !important;
  -webkit-text-fill-color: currentColor;
  box-shadow: none !important;
  border: 0 !important;
  border-radius: 0;
  font: inherit !important;
  text-align: right;
  appearance: textfield;
  font-variant-numeric: tabular-nums;
}
.crm-zoom__level::-webkit-inner-spin-button,
.crm-zoom__level::-webkit-outer-spin-button { margin: 0; appearance: none; }
.crm-zoom__input-wrap:focus-within { outline: 3px solid #C99A1F; outline-offset: 2px; }
body .crm-zoom input.crm-zoom__level[aria-invalid="true"] { color: #FFB1AA !important; }
.crm-zoom__error { flex: 1 0 100%; max-width: 20rem; color: #FFB1AA; font-size: .72rem; line-height: 1.3; text-align: center; }
.crm-zoom__caption { min-width: 0; margin: 0; overflow-wrap: anywhere; color: #F7F3EA; font-weight: 600; font-size: .82rem; line-height: 1.35; }
.crm-zoom__close {
  position: absolute;
  z-index: 2;
  top: max(.6rem, env(safe-area-inset-top));
  right: max(.6rem, env(safe-area-inset-right));
  border-radius: 50%;
  font: 500 1.55rem/1 var(--body, var(--sp-sans, sans-serif));
}
.crm-zoom :is(.crm-zoom__close,.crm-zoom__control):hover { background: #3A3A3A; }
.crm-zoom :is(.crm-zoom__close,.crm-zoom__control):focus-visible { outline: 3px solid #C99A1F; outline-offset: 2px; }
@media (max-width: 430px) {
  .crm-zoom { width: calc(100vw - 12px); max-width: calc(100vw - 12px); height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); border-radius: 12px; }
  .crm-zoom__footer { grid-template-columns: 1fr; justify-items: center; gap: .35rem; padding: .45rem .6rem .55rem; text-align: center; }
  .crm-zoom__caption { max-width: 100%; }
}
