/* ==========================================================================
   Foto Zoom / Lightbox Minimalista para Excel Copiers Gestión
   Zoom directo de la foto sin apariencia de editor.
   Cierre rápido e intuitivo con Esc, la tecla X, el botón X o click.
   ========================================================================== */

body.foto-viewer-open {
  overflow: hidden !important;
}

/* Overlay a pantalla completa con fondo oscuro translúcido */
.foto-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.18s ease-in-out;
  cursor: zoom-out;
  user-select: none;
  box-sizing: border-box;
  padding: 20px;
}

.foto-viewer-overlay.is-visible {
  display: flex !important;
  opacity: 1 !important;
}

/* Botón de cierre 'X' grande, limpio y accesible */
.foto-viewer-close {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 1000000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 32px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 42px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  padding: 0;
  outline: none;
  user-select: none;
}

.foto-viewer-close:hover,
.foto-viewer-close:focus {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

/* Contenedor central del zoom */
.foto-viewer-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 92vh;
  position: relative;
  cursor: zoom-out;
  animation: fotoViewerZoomIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fotoViewerZoomIn {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Imagen con zoom */
.foto-viewer-img {
  max-width: 90vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.15);
  cursor: zoom-out;
  display: block;
}

/* Leyenda inferior sutil (código y nombre) */
.foto-viewer-caption {
  margin-top: 12px;
  padding: 6px 18px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-align: center;
  max-width: 85vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* Spinner de carga limpio */
.foto-viewer-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: fotoViewerSpin 0.75s linear infinite;
  margin-bottom: 8px;
}

@keyframes fotoViewerSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Cartel de error */
.foto-viewer-error {
  color: #fca5a5;
  background: rgba(185, 28, 28, 0.6);
  border: 1px solid rgba(239, 68, 68, 0.5);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hover e interactividad sobre miniaturas en listados */
.foto-zoomable {
  cursor: zoom-in !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.foto-zoomable:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  filter: brightness(1.05);
  z-index: 10;
  position: relative;
}
