/**
 * LIGHTBOX COMPONENT STYLES
 * Complete lightbox modal system with animations and controls
 */

/* ========================================
   LIGHTBOX OVERLAY & CONTAINER
   ======================================== */

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              backdrop-filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  isolation: isolate;
}

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

.lightbox-container {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  isolation: isolate;
  will-change: transform, opacity;
  overflow: hidden;
  border-radius: 8px;
}

/* ========================================
   LIGHTBOX HEADER & CLOSE BUTTON
   ======================================== */

.lightbox-header {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10006;
  padding: 20px;
  pointer-events: none;
}

.lightbox-close {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(15px) saturate(1.5);
  -webkit-backdrop-filter: blur(15px) saturate(1.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10005;
  pointer-events: auto;
  position: relative;
}

.lightbox-close:hover {
  opacity: 0.8;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.lightbox-close svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

/* ========================================
   LIGHTBOX CONTENT & SWIPER
   ======================================== */

.lightbox-content {
  width: 100%;
  height: 100%;
  position: relative;
}

.lightbox-swiper {
  width: 100%;
  height: 100%;
}

.lightbox-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, filter 0.4s ease;
  opacity: 0.3;
  filter: blur(1px) brightness(0.7);
}

.lightbox-swiper .swiper-slide-active {
  opacity: 1;
  filter: blur(0px) brightness(1);
}

.lightbox-swiper .swiper-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.3s ease;
}

.lightbox-swiper .swiper-slide-active img {
  opacity: 1;
}

/* ========================================
   SWIPER ZOOM CONTAINERS
   ======================================== */

.swiper-zoom-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swiper-zoom-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

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

.lightbox-swiper .swiper-button-next,
.lightbox-swiper .swiper-button-prev,
#lightbox-next,
#lightbox-prev {
  position: absolute !important;
  top: 50% !important;
  width: 50px !important;
  height: 50px !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(15px) saturate(1.5) !important;
  -webkit-backdrop-filter: blur(15px) saturate(1.5) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
  color: white !important;
  opacity: 0.7 !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: none !important; /* Let custom cursor handle this */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 100001 !important;
  transform: translateY(-50%) !important;
  pointer-events: auto !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  visibility: visible !important;
}

.lightbox-swiper .swiper-button-next:hover,
.lightbox-swiper .swiper-button-prev:hover,
#lightbox-next:hover,
#lightbox-prev:hover {
  opacity: 0.9 !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  transform: translateY(-50%) scale(1.05) !important;
}

.lightbox-swiper .swiper-button-prev,
#lightbox-prev {
  left: 20px !important;
}

.lightbox-swiper .swiper-button-next,
#lightbox-next {
  right: 20px !important;
}

/* Remove default Swiper button styling for lightbox */
.lightbox-swiper .swiper-button-next:after,
.lightbox-swiper .swiper-button-prev:after {
  display: none !important;
  content: '' !important;
}

.lightbox-swiper .swiper-button-next svg,
.lightbox-swiper .swiper-button-prev svg,
#lightbox-next svg,
#lightbox-prev svg {
  width: 24px !important;
  height: 24px !important;
  pointer-events: none !important;
  stroke: currentColor !important;
  fill: none !important;
}

/* ========================================
   LIGHTBOX PAGINATION
   ======================================== */

.lightbox-swiper .swiper-pagination {
  position: fixed !important;
  pointer-events: auto !important;
  top: 1rem !important;
  left: 1rem !important;
  right: 5rem !important;
  width: auto !important;
  height: 4px !important;
  display: flex !important;
  gap: 4px !important;
  z-index: 2147483647 !important;
  justify-content: space-between !important;
  align-items: center !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.lightbox-swiper .swiper-pagination-bullet {
  position: relative !important;
  flex: 1 !important;
  height: 2px !important;
  width: auto !important;
  min-width: 20px !important;
  background: rgba(255, 255, 255, 0.3) !important;
  opacity: 1 !important;
  margin: 0 !important;
  border-radius: 1px !important;
  cursor: pointer !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  overflow: hidden;
  transform: none !important;
}

.lightbox-swiper .swiper-pagination-bullet-active {
  background: white !important;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3) !important;
}

.lightbox-swiper .swiper-pagination-progress {
  position: absolute;
  left: 0;
  top: 0;
  width: 0%;
  height: 100%;
  background: white;
  transform-origin: left;
  transition: width 0.1s ease;
}

.lightbox-swiper .swiper-pagination-bullet.completed .swiper-pagination-progress {
  width: 100% !important;
  animation: none !important;
}

.lightbox-swiper .swiper-pagination-bullet-active .swiper-pagination-progress {
  animation: lightbox-progress-fill 5s linear forwards;
}

@keyframes lightbox-progress-fill {
  from { width: 0%; }
  to { width: 100%; }
}

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

@media screen and (max-width: 768px) {
  .lightbox-swiper .swiper-slide {
    opacity: 0.2;
    filter: blur(0.5px) brightness(0.8);
  }
  
  .lightbox-swiper .swiper-slide-active {
    opacity: 1;
    filter: blur(0px) brightness(1);
  }

  .lightbox-swiper .swiper-button-next,
  .lightbox-swiper .swiper-button-prev,
  #lightbox-next,
  #lightbox-prev {
    width: 44px;
    height: 44px;
  }

  .lightbox-swiper .swiper-button-next svg,
  .lightbox-swiper .swiper-button-prev svg,
  #lightbox-next svg,
  #lightbox-prev svg {
    width: 20px;
    height: 20px;
  }

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

  .lightbox-close svg {
    width: 20px;
    height: 20px;
  }

  .lightbox-header {
    padding: 15px;
  }

  .lightbox-swiper .swiper-pagination {
    left: 0.5rem !important;
    right: 4rem !important;
    top: 0.75rem !important;
  }
}

/* ========================================
   FALLBACK LIGHTBOX
   ======================================== */

.simple-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: pointer;
}

.simple-lightbox-overlay img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

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

.lightbox-overlay:focus-within {
  outline: none;
}

.lightbox-close:focus,
.lightbox-swiper .swiper-button-next:focus,
.lightbox-swiper .swiper-button-prev:focus,
#lightbox-next:focus,
#lightbox-prev:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .lightbox-overlay {
    background: rgba(0, 0, 0, 0.98);
  }
  
  .lightbox-close,
  .lightbox-swiper .swiper-button-next,
  .lightbox-swiper .swiper-button-prev,
  #lightbox-next,
  #lightbox-prev {
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .lightbox-overlay,
  .lightbox-container,
  .lightbox-close,
  .lightbox-swiper .swiper-slide,
  .lightbox-swiper .swiper-slide img,
  .lightbox-swiper .swiper-button-next,
  .lightbox-swiper .swiper-button-prev,
  #lightbox-next,
  #lightbox-prev {
    transition: none;
    animation: none;
  }
}
