/**
 * ============================================
 * GALLERY SYSTEM STYLES
 * ============================================
 *
 * Estilos para el sistema de galería:
 * - Lightbox modal
 * - Lazy loading states
 * - Image zoom effects
 * - Responsive design
 * - Animaciones suaves
 *
 * @version 1.0.0
 */

/* ============================================
   LIGHTBOX OVERLAY
   ============================================ */

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ============================================
   LIGHTBOX CONTAINER
   ============================================ */

.lightbox-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ============================================
   LIGHTBOX HEADER
   ============================================ */

.lightbox-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
}

.lightbox-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.lightbox-close:focus {
  outline: 2px solid #00B36A;
  outline-offset: 2px;
}

.lightbox-counter {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

/* ============================================
   LIGHTBOX CONTENT
   ============================================ */

.lightbox-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 60px;
  position: relative;
}

.lightbox-image-container {
  max-width: 90%;
  max-height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
  object-fit: contain;
}

/* ============================================
   LIGHTBOX LOADER
   ============================================ */

.lightbox-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.lightbox-loader .spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #00B36A;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   NAVIGATION BUTTONS
   ============================================ */

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:focus {
  outline: 2px solid #00B36A;
  outline-offset: 2px;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

/* ============================================
   LIGHTBOX FOOTER
   ============================================ */

.lightbox-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 30px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  z-index: 10;
}

.lightbox-title {
  color: white;
  text-align: center;
  font-size: 16px;
  margin: 0;
  font-weight: 500;
}

/* ============================================
   ZOOM CONTROLS
   ============================================ */

.lightbox-zoom-controls {
  position: absolute;
  bottom: 80px;
  right: 30px;
  display: flex;
  gap: 10px;
  z-index: 10;
}

.lightbox-zoom-controls button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 12px;
  font-weight: 600;
}

.lightbox-zoom-controls button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.lightbox-zoom-controls button:focus {
  outline: 2px solid #00B36A;
  outline-offset: 2px;
}

/* ============================================
   LAZY LOADING STATES
   ============================================ */

.lazy-image {
  opacity: 0;
  transition: opacity 0.4s ease;
  background: #f0f0f0;
}

.lazy-image.lazy-loaded {
  opacity: 1;
}

.lazy-image.lazy-error {
  opacity: 1;
  background: #fee;
  position: relative;
}

.lazy-image.lazy-error::after {
  content: '❌ Error al cargar';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #c00;
  font-size: 14px;
}

/* ============================================
   IMAGE ZOOM EFFECT
   ============================================ */

.image-zoom,
[data-zoom] {
  overflow: hidden;
  position: relative;
}

.image-zoom img,
[data-zoom] img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.image-zoom:hover img,
[data-zoom]:hover img {
  transform: scale(1.15);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .lightbox-header {
    padding: 15px 20px;
  }

  .lightbox-close {
    width: 40px;
    height: 40px;
  }

  .lightbox-counter {
    font-size: 12px;
    padding: 6px 12px;
  }

  .lightbox-content {
    padding: 60px 10px 50px;
  }

  .lightbox-image-container {
    max-width: 95%;
  }

  .lightbox-image {
    max-height: 70vh;
  }

  .lightbox-nav {
    width: 44px;
    height: 44px;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-footer {
    padding: 15px 20px;
  }

  .lightbox-title {
    font-size: 14px;
  }

  .lightbox-zoom-controls {
    bottom: 70px;
    right: 15px;
    gap: 8px;
  }

  .lightbox-zoom-controls button {
    width: 36px;
    height: 36px;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

.dark .lazy-image {
  background: #1a1a1a;
}

.dark .lazy-image.lazy-error {
  background: #3a1a1a;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus visible for keyboard navigation */
.lightbox-overlay button:focus-visible {
  outline: 3px solid #00B36A;
  outline-offset: 3px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .lightbox-overlay,
  .lightbox-image,
  .lightbox-nav,
  .lightbox-close,
  .lazy-image {
    transition: none;
  }

  .lightbox-loader .spinner {
    animation: none;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .lightbox-overlay {
    display: none;
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
  .lightbox-nav,
  .lightbox-close,
  .lightbox-zoom-controls button {
    border: 2px solid white;
    background: rgba(0, 0, 0, 0.8);
  }

  .lightbox-counter {
    border: 1px solid white;
  }
}

/* ============================================
   ANIMATION ENTRANCE
   ============================================ */

.lightbox-overlay.active .lightbox-image {
  animation: lightboxZoomIn 0.3s ease;
}

@keyframes lightboxZoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   CUSTOM CURSOR FOR ZOOM
   ============================================ */

.lightbox-image[style*="scale"] {
  cursor: move !important;
}

/* ============================================
   PLACEHOLDER SHIMMER EFFECT
   ============================================ */

.lazy-image:not(.lazy-loaded) {
  position: relative;
  overflow: hidden;
}

.lazy-image:not(.lazy-loaded)::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  to {
    left: 100%;
  }
}


.project-gallery {
  position: relative;
  overflow: hidden;
}

.project-gallery__viewport {
  overflow: hidden;
  border-radius: 24px;
}

.project-gallery__track {
  display: flex;
  transition: transform 0.45s ease;
  will-change: transform;
}

.project-gallery__slide {
  flex: 0 0 100%;
  padding: 0;
}

.project-gallery__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.project-gallery__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(4, 9, 22, 0.35);
  color: #ffffff;
  transition: background 0.2s ease, border 0.2s ease;
}

.project-gallery__nav:hover {
  background: rgba(33, 200, 122, 0.25);
  border-color: rgba(33, 200, 122, 0.6);
}

.project-gallery__pagination {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.project-gallery__dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.45);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.project-gallery__dot.is-active {
  transform: scale(1.25);
  background: #21C87A;
}

@media (prefers-reduced-motion: reduce) {
  .project-gallery__track {
    transition: none;
  }
  .project-gallery__dot {
    transition: none;
  }
}
