/* TemplateRise Image Lightbox Styles */
.image-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-lightbox.active {
  display: flex;
  flex-direction: column;
}

.image-lightbox.visible {
  opacity: 1;
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

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

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  color: white;
  min-height: 60px;
}

.lightbox-counter {
  font-size: 0.875rem;
  opacity: 0.8;
  min-width: 80px;
}

.lightbox-title {
  flex: 1;
  text-align: center;
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lightbox-btn {
  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.2s ease;
  backdrop-filter: blur(10px);
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.lightbox-btn:active {
  transform: translateY(0);
}

.lightbox-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

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

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  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;
  backdrop-filter: blur(10px);
  z-index: 2;
}

.lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 2rem;
}

.lightbox-next {
  right: 2rem;
}

.lightbox-nav i {
  font-size: 1.2rem;
}

.lightbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  color: white;
  min-height: 60px;
}

.lightbox-caption {
  flex: 1;
  font-size: 0.9rem;
  opacity: 0.9;
  margin-right: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zoom-level {
  font-size: 0.875rem;
  opacity: 0.8;
  min-width: 50px;
  text-align: center;
}

/* Dark theme support */
[data-theme="dark"] .lightbox-overlay {
  background-color: rgba(0, 0, 0, 0.95);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .lightbox-header,
  .lightbox-footer {
    padding: 0.75rem 1rem;
  }

  .lightbox-title {
    font-size: 1rem;
    margin: 0 0.5rem;
  }

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

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

  .lightbox-prev {
    left: 1rem;
  }

  .lightbox-next {
    right: 1rem;
  }

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

  .lightbox-caption {
    font-size: 0.8rem;
  }

  .lightbox-controls {
    gap: 0.25rem;
  }

  .lightbox-zoom-controls {
    gap: 0.25rem;
  }
}

@media (max-width: 480px) {
  .lightbox-header {
    flex-wrap: wrap;
    min-height: auto;
  }

  .lightbox-title {
    order: 3;
    width: 100%;
    margin: 0.5rem 0 0 0;
    text-align: left;
    font-size: 0.9rem;
  }

  .lightbox-counter {
    order: 1;
    min-width: auto;
  }

  .lightbox-controls {
    order: 2;
  }

  .lightbox-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .lightbox-caption {
    margin-right: 0;
    white-space: normal;
    line-height: 1.4;
  }

  .lightbox-zoom-controls {
    align-self: center;
  }
}

/* Keyboard shortcuts hint */
.lightbox-shortcuts {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.image-lightbox:hover .lightbox-shortcuts {
  opacity: 0.8;
}

/* Smooth animations */
.lightbox-image {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-container {
  animation: lightboxFadeIn 0.3s ease-out;
}

@keyframes lightboxFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Focus styles for accessibility */
.lightbox-btn:focus,
.lightbox-nav:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .lightbox-overlay {
    background-color: black;
  }

  .lightbox-btn,
  .lightbox-nav {
    border-color: white;
    background: black;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .image-lightbox,
  .lightbox-image,
  .lightbox-btn,
  .lightbox-nav {
    transition: none;
  }

  .loading-spinner {
    animation: none;
  }

  .lightbox-container {
    animation: none;
  }
}
