/**
 * UniBe Custom Lightbox Styles
 * Custom lightbox implementation for the University of Bern
 * Uses standard CSS with Tailwind-inspired design
 */

/* Lightbox overlay - hidden by default */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
}

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

/* Lightbox content container */
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  transform: scale(0.9);
  transition: transform 0.3s ease-in-out;
}

/* Scale up content when active */
.lightbox-overlay.lightbox-active .lightbox-content {
  transform: scale(1);
}

/* Lightbox image */
.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Close button */
.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: white;
  font-size: 1.5rem;
  font-weight: normal;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.lightbox-close:hover {
  color: white;
  background: rgba(0, 0, 0, 0.95);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.lightbox-close:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5), 0 6px 16px rgba(0, 0, 0, 0.5);
}

/* Navigation buttons */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 2.25rem;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  z-index: 10;
  transition: color 0.2s ease;
  background: none;
  border: none;
  padding: 0.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  min-height: 3rem;
}

.lightbox-nav:hover {
  color: #d1d5db;
}

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

.lightbox-prev {
  left: -4rem;
}

.lightbox-next {
  right: -4rem;
}

/* Disabled navigation buttons */
.lightbox-nav.disabled {
  color: #4b5563;
  cursor: not-allowed;
}

/* Caption */
.lightbox-caption {
  position: absolute;
  bottom: -2.5rem;
  left: 0;
  right: 0;
  color: white;
  text-align: center;
  font-size: 0.875rem;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 0.5rem;
  border-radius: 0.25rem;
}

/* Loading spinner */
.lightbox-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-spinner {
  animation: spin 1s linear infinite;
  border-radius: 50%;
  height: 3rem;
  width: 3rem;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .lightbox-close {
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.25rem;
    width: 2rem;
    height: 2rem;
  }

  .lightbox-nav {
    font-size: 1.875rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
  }

  .lightbox-prev {
    left: -2rem;
  }

  .lightbox-next {
    right: -2rem;
  }

  .lightbox-caption {
    bottom: -2rem;
    font-size: 0.75rem;
  }
}

/* Hide scrollbar on body when lightbox is active */
body.lightbox-open {
  overflow: hidden;
}

/* Ensure lightbox images are clickable */
.lightbox-trigger {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.lightbox-trigger:hover {
  transform: scale(1.05);
}

/* Add subtle hover effect to images that can be opened in lightbox */
.lightbox-trigger img {
  transition: all 0.2s ease;
}

.lightbox-trigger:hover img {
  filter: brightness(1.1);
}