/* =====================================================
   Lightbox Styles
   ===================================================== */

/* Overlay */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Content Container */
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image */
.lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.2s ease;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-overlay.active .lightbox-image {
  opacity: 1;
  transform: scale(1);
}

/* Zoomed state */
.lightbox-overlay.is-zoomed .lightbox-image {
  cursor: grab;
  max-width: none;
  max-height: none;
}

.lightbox-overlay.is-zoomed .lightbox-image:active {
  cursor: grabbing;
}

.lightbox-overlay.is-zoomed .lightbox-content {
  overflow: hidden;
}

/* Loading Spinner */
.lightbox-loader {
  position: absolute;
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #c9a227;
  border-radius: 50%;
  animation: lightbox-spin 1s linear infinite;
}

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

.lightbox-loader.hidden {
  display: none;
}

/* Toolbar */
.lightbox-toolbar {
  position: absolute;
  top: 20px;
  right: 80px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1010;
}

.lightbox-toolbar-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.lightbox-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.lightbox-toolbar-btn:focus {
  outline: 2px solid #c9a227;
  outline-offset: 2px;
}

.lightbox-toolbar-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox-toolbar-btn:disabled:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: none;
}

.lightbox-toolbar-btn svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

.lightbox-zoom-level {
  color: #ffffff;
  font-size: 0.85rem;
  min-width: 30px;
  text-align: center;
  padding: 0 4px;
}

.lightbox-fullsize {
  margin-left: 8px;
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.3s ease;
  z-index: 1010;
}

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

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

.lightbox-close svg {
  width: 24px;
  height: 24px;
  fill: #ffffff;
}

/* Navigation Arrows */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.3s ease;
  z-index: 1010;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

.lightbox-nav svg {
  width: 24px;
  height: 24px;
  fill: #ffffff;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.lightbox-next {
  right: 20px;
}

.lightbox-next:hover {
  transform: translateY(-50%) translateX(3px);
}

.lightbox-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox-nav:disabled:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-50%);
}

/* Caption */
.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffffff;
  text-align: center;
  max-width: 80%;
  padding: 15px 25px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  z-index: 1010;
}

.lightbox-caption-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.lightbox-caption-subtitle {
  font-size: 0.9rem;
  color: #c9a227;
}

/* Gallery Link */
.lightbox-gallery-link {
  display: none;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #c9a227;
  text-decoration: none;
  transition: color 0.2s ease;
}

.lightbox-gallery-link:hover {
  color: #e0b830;
  text-decoration: underline;
}

.lightbox-gallery-link:focus {
  outline: 2px solid #c9a227;
  outline-offset: 2px;
}

/* Counter */
.lightbox-counter {
  position: absolute;
  top: 20px;
  left: 20px;
  color: #ffffff;
  font-size: 0.95rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 15px;
  border-radius: 4px;
  z-index: 1010;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .lightbox-close,
  .lightbox-nav {
    width: 44px;
    height: 44px;
  }

  .lightbox-close {
    top: 15px;
    right: 15px;
  }

  .lightbox-toolbar {
    top: 15px;
    right: 65px;
    gap: 4px;
  }

  .lightbox-toolbar-btn {
    width: 36px;
    height: 36px;
  }

  .lightbox-toolbar-btn svg {
    width: 18px;
    height: 18px;
  }

  .lightbox-zoom-level {
    font-size: 0.75rem;
    min-width: 24px;
  }

  .lightbox-fullsize {
    margin-left: 4px;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-counter {
    top: 15px;
    left: 15px;
    font-size: 0.85rem;
    padding: 6px 12px;
  }

  .lightbox-caption {
    bottom: 15px;
    padding: 12px 20px;
    max-width: 90%;
  }

  .lightbox-caption-title {
    font-size: 1rem;
  }

  .lightbox-caption-subtitle {
    font-size: 0.85rem;
  }

  .lightbox-gallery-link {
    font-size: 0.8rem;
  }

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

/* Very small screens - stack toolbar */
@media (max-width: 480px) {
  .lightbox-toolbar {
    top: auto;
    bottom: 70px;
    right: 50%;
    transform: translateX(50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 8px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .lightbox-nav {
    width: 60px;
    height: 60px;
  }

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

  .lightbox-toolbar-btn {
    width: 44px;
    height: 44px;
  }
}

/* Focus trap indicator for accessibility */
.lightbox-overlay:focus {
  outline: none;
}

/* Hide navigation when only one image */
.lightbox-overlay[data-single="true"] .lightbox-nav,
.lightbox-overlay[data-single="true"] .lightbox-counter {
  display: none;
}
