/* ================================================================
   IMAGE LIGHTBOX — Zoom y visor de imágenes en alta calidad
   ================================================================ */

/* Overlay principal */
.image-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.image-lightbox.active {
  opacity: 1;
  visibility: visible;
}

/* Contenedor de la imagen */
.il-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Wrapper de imagen con zoom */
.il-image-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90%;
  max-height: 90%;
  cursor: grab;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
}

.il-image-wrapper.dragging {
  cursor: grabbing;
  transition: none;
}

.il-image-wrapper.zoomed {
  cursor: grab;
}

/* Imagen principal */
.il-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(212, 168, 67, 0.15);
  transition: opacity 0.3s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.il-image.loading {
  opacity: 0;
}

/* Botón cerrar */
.il-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  z-index: 10;
  transition: all 0.25s ease;
}

.il-close:hover {
  background: var(--gold-primary, #d4a843);
  color: var(--black-bg, #0a0a0a);
  transform: rotate(90deg) scale(1.1);
  border-color: var(--gold-primary, #d4a843);
}

/* Navegación (anterior/siguiente) */
.il-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 10;
  transition: all 0.25s ease;
}

.il-nav:hover {
  background: var(--gold-primary, #d4a843);
  color: var(--black-bg, #0a0a0a);
  transform: translateY(-50%) scale(1.12);
  border-color: var(--gold-primary, #d4a843);
}

.il-nav--prev {
  left: 24px;
}

.il-nav--next {
  right: 24px;
}

.il-nav[disabled] {
  opacity: 0.3;
  pointer-events: none;
  cursor: default;
}

/* Contador de imágenes */
.il-counter {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  z-index: 10;
}

/* Controles de zoom */
.il-zoom-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  z-index: 10;
}

.il-zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.il-zoom-btn:hover {
  background: var(--gold-primary, #d4a843);
  color: var(--black-bg, #0a0a0a);
  border-color: var(--gold-primary, #d4a843);
  transform: scale(1.05);
}

.il-zoom-level {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
  min-width: 55px;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
}

/* Indicador de carga */
.il-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border: 3px solid rgba(212, 168, 67, 0.2);
  border-top-color: var(--gold-primary, #d4a843);
  border-radius: 50%;
  animation: il-spin 0.8s linear infinite;
  z-index: 5;
}

@keyframes il-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Título del producto */
.il-title {
  position: absolute;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 600;
  z-index: 10;
  max-width: 80%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hint de uso */
.il-hint {
  position: absolute;
  bottom: 24px;
  right: 24px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  z-index: 10;
  pointer-events: none;
}

/* ================================================================
   RESPONSIVE — Tablet
   ================================================================ */
@media (max-width: 1024px) {
  .il-nav {
    width: 46px;
    height: 46px;
    font-size: 16px;
  }

  .il-nav--prev { left: 16px; }
  .il-nav--next { right: 16px; }

  .il-image {
    max-height: 80vh;
  }
}

/* ================================================================
   RESPONSIVE — Mobile
   ================================================================ */
@media (max-width: 768px) {
  .il-close {
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .il-nav {
    width: 42px;
    height: 42px;
    font-size: 14px;
  }

  .il-nav--prev { left: 10px; }
  .il-nav--next { right: 10px; }

  .il-counter {
    top: 14px;
    font-size: 12px;
    padding: 6px 14px;
  }

  .il-image {
    max-height: 70vh;
    max-width: 95%;
  }

  .il-zoom-controls {
    bottom: 16px;
    gap: 6px;
    padding: 8px 10px;
  }

  .il-zoom-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
    border-radius: 8px;
  }

  .il-zoom-level {
    font-size: 12px;
    min-width: 48px;
    padding: 0 8px;
  }

  .il-title {
    bottom: 70px;
    font-size: 13px;
    padding: 8px 16px;
  }

  .il-hint {
    display: none;
  }
}

@media (max-width: 480px) {
  .il-nav--prev { left: 6px; }
  .il-nav--next { right: 6px; }

  .il-nav {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }

  .il-counter {
    font-size: 11px;
    padding: 5px 10px;
  }
}
