/* ============================================
   Lightbox Gallery Component for leiyue-garden-2
   Touch swipe + keyboard + arrow navigation
   ============================================ */

.ly-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
  pointer-events: none;
  opacity: 0;
}

.ly-lightbox-overlay.active {
  background: rgba(0, 0, 0, 0.92);
  pointer-events: auto;
  opacity: 1;
}

.ly-lightbox-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

/* Main image area */
.ly-lightbox-image-wrapper {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ly-lightbox-image-wrapper img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transition: opacity 0.3s ease;
  will-change: transform;
}

/* Title bar */
.ly-lightbox-title {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px 60px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
  color: #fff;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

.ly-lightbox-title h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Counter */
.ly-lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 10;
  background: rgba(0,0,0,0.4);
  padding: 4px 14px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

/* Close button */
.ly-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 20;
}

.ly-lightbox-close:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.1);
}

/* Arrow buttons */
.ly-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 20;
}

.ly-lightbox-arrow:hover {
  background: rgba(201,169,98,0.4);
  border-color: rgba(201,169,98,0.6);
  transform: translateY(-50%) scale(1.1);
}

.ly-lightbox-arrow.ly-prev {
  left: 20px;
}

.ly-lightbox-arrow.ly-next {
  right: 20px;
}

.ly-lightbox-arrow:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

/* Thumbnail strip */
.ly-lightbox-thumbs {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  max-width: 90vw;
  overflow-x: auto;
  padding: 8px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,169,98,0.5) transparent;
}

.ly-lightbox-thumbs::-webkit-scrollbar {
  height: 4px;
}

.ly-lightbox-thumbs::-webkit-scrollbar-thumb {
  background: rgba(201,169,98,0.5);
  border-radius: 4px;
}

.ly-lightbox-thumb {
  width: 56px;
  height: 42px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  flex-shrink: 0;
  opacity: 0.5;
}

.ly-lightbox-thumb.active {
  border-color: #C9A962;
  opacity: 1;
}

.ly-lightbox-thumb:hover {
  opacity: 0.85;
}

.ly-lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Swipe hint animation */
.ly-lightbox-swipe-hint {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 10;
  animation: ly-fade-out 3s forwards;
  white-space: nowrap;
}

@keyframes ly-fade-out {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* Loading spinner */
.ly-lightbox-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #C9A962;
  border-radius: 50%;
  animation: ly-spin 0.8s linear infinite;
}

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

/* Mobile adjustments */
@media (max-width: 768px) {
  .ly-lightbox-arrow {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .ly-lightbox-arrow.ly-prev { left: 10px; }
  .ly-lightbox-arrow.ly-next { right: 10px; }
  
  .ly-lightbox-thumb {
    width: 48px;
    height: 36px;
  }
  
  .ly-lightbox-thumbs {
    bottom: 50px;
    gap: 6px;
  }
  
  .ly-lightbox-counter {
    bottom: 10px;
    font-size: 0.75rem;
  }
  
  .ly-lightbox-title h3 {
    font-size: 0.95rem;
  }
}

/* Product card hover hint overlay */
.ly-gallery-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}

.ly-gallery-trigger:hover .ly-gallery-hint {
  opacity: 1;
}
