/* Vista ampliada de imagen de producto (un solo overlay global). */
.bm-product-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 0.75rem;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.72);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.bm-product-image-lightbox[hidden] {
  display: none !important;
}

.bm-product-image-lightbox__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  max-width: min(82vw, 1100px);
  max-height: 88vh;
  margin: 0;
  padding: 0;
  pointer-events: auto;
  box-sizing: border-box;
}

.bm-product-image-lightbox--has-description .bm-product-image-lightbox__dialog {
  width: fit-content;
  max-width: min(82vw, 1100px);
  align-items: stretch;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.bm-product-image-lightbox__close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 2px solid #2e7d12;
  border-radius: 50%;
  background: #4caf1b;
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bm-product-image-lightbox__close:hover {
  background: #43a017;
  border-color: #25632d;
}

.bm-product-image-lightbox__close:focus-visible {
  outline: 2px solid #ff6a00;
  outline-offset: 2px;
}

.bm-product-image-lightbox__img {
  display: block;
  max-width: min(82vw, 1100px);
  max-height: 78vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  vertical-align: middle;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.bm-product-image-lightbox--has-description .bm-product-image-lightbox__stage {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.bm-product-image-lightbox--has-description .bm-product-image-lightbox__img {
  max-height: min(62vh, 640px);
  margin: 0;
  box-shadow: none;
  border-radius: 0;
}

.bm-product-image-lightbox__description {
  box-sizing: border-box;
  margin: 0;
  padding: 12px 14px 14px;
  background: #fff;
  color: #111827;
  font-size: 0.92rem;
  line-height: 1.45;
  max-height: min(28vh, 220px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
  word-break: break-word;
}

.bm-product-image-lightbox__description[hidden] {
  display: none !important;
}

/* Clickeable solo el marco/imagen marcado */
.store-product-card__media[data-product-image-preview],
.home-product-hit__media[data-product-image-preview],
.bm-fp__media[data-product-image-preview],
.admin-table__thumb-hit[data-product-image-preview] {
  cursor: pointer;
}

.admin-table__thumb-hit[data-product-image-preview] {
  display: inline-flex;
  vertical-align: middle;
}

.bm-global-product-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.bm-global-product-thumb--list[data-product-image-preview],
.bm-global-product-thumb--edit[data-product-image-preview] {
  cursor: pointer;
}

.bm-entity-gallery-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  z-index: 2;
  min-width: 1.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: #1e293b;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
  pointer-events: none;
}

.bm-global-product-thumb--edit .bm-entity-gallery-badge {
  right: 4px;
  bottom: 4px;
  font-size: 0.75rem;
}

.bm-product-image-lightbox--gallery .bm-product-image-lightbox__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  max-width: min(82vw, 1100px);
  max-height: 78vh;
  margin: 0 auto;
}

.bm-product-image-lightbox--has-description.bm-product-image-lightbox--gallery .bm-product-image-lightbox__stage {
  max-height: min(62vh, 640px);
}

.bm-product-image-lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 2px solid #2e7d12;
  border-radius: 50%;
  background: rgba(76, 175, 27, 0.95);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bm-product-image-lightbox__nav--prev {
  left: -0.5rem;
}

.bm-product-image-lightbox__nav--next {
  right: -0.5rem;
}

.bm-product-image-lightbox__nav:hover {
  background: #43a017;
}

.bm-product-image-lightbox__nav:focus-visible {
  outline: 2px solid #ff6a00;
  outline-offset: 2px;
}

.bm-product-image-lightbox__nav[hidden] {
  display: none !important;
}

.bm-product-image-lightbox__counter {
  position: absolute;
  top: 0.35rem;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.bm-product-image-lightbox__counter[hidden] {
  display: none !important;
}

.bm-product-image-lightbox--gallery .bm-product-image-lightbox__dialog {
  position: relative;
  padding: 0 2rem;
}

.bm-public-product-gallery-media[data-product-image-preview] {
  cursor: pointer;
}

.bm-entity-gallery-badge--public {
  right: 6px;
  bottom: 6px;
  font-size: 0.72rem;
  pointer-events: none;
}

.store-product-card__media.bm-public-product-gallery-media {
  position: relative;
}

body.bm-product-image-lightbox--open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .bm-product-image-lightbox {
    padding: 0.75rem 0.35rem;
  }

  .bm-product-image-lightbox__dialog {
    max-width: 92vw;
  }

  .bm-product-image-lightbox__stage,
  .bm-product-image-lightbox__img {
    max-width: 92vw;
    max-height: 72vh;
  }

  .bm-product-image-lightbox--has-description .bm-product-image-lightbox__stage,
  .bm-product-image-lightbox--has-description .bm-product-image-lightbox__img {
    max-height: 58vh;
  }

  .bm-product-image-lightbox--gallery .bm-product-image-lightbox__dialog {
    padding: 0 1.35rem;
  }
}
