/* Premium Lightbox Styles */

.premium-lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.premium-lightbox-backdrop.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s;
}

.premium-lightbox-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  outline: none;
}

/* Header */
.lightbox-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
}

.lightbox-counter {
  color: white;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-counter .separator {
  opacity: 0.5;
}

.lightbox-toolbar {
  display: flex;
  gap: 8px;
}

.toolbar-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  position: relative;
}

/* Tooltip dla przycisków */
.toolbar-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 10;
}

.toolbar-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

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

.toolbar-btn:active {
  transform: scale(0.95);
}

.toolbar-btn.close {
  background: rgba(255, 0, 0, 0.2);
}

.toolbar-btn.close:hover {
  background: rgba(255, 0, 0, 0.4);
}

/* Main content */
.lightbox-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px;
}

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

.lightbox-image-wrapper {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 200px);
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

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

.lightbox-image-container.zoomed .lightbox-image {
  cursor: move;
}

/* Navigation */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  z-index: 5;
}

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

.lightbox-nav-btn.prev {
  left: 20px;
}

.lightbox-nav-btn.next {
  right: 20px;
}

/* Thumbnails */
.lightbox-thumbnails {
  position: absolute;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 10;
  overflow: hidden;
}

.lightbox-thumbnails.bottom {
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-thumbnails.right {
  right: 0;
  top: 60px;
  bottom: 0;
  width: 120px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.thumbnails-wrapper {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  height: 100%;
  align-items: center;
}

.lightbox-thumbnails.right .thumbnails-wrapper {
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

.thumbnail-item {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.05);
  padding: 0;
}

.lightbox-thumbnails.right .thumbnail-item {
  width: 90px;
  height: 60px;
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumbnail-item:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.3);
}

.thumbnail-item.active {
  border-color: var(--acc, #007bff);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}

/* Loader */
.lightbox-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

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

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

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

/* Toast notification */
.lightbox-toast {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 20;
}

.lightbox-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Fullscreen adjustments */
.premium-lightbox-backdrop:fullscreen {
  background: black;
}

.premium-lightbox-backdrop:fullscreen .lightbox-image {
  max-height: 100vh;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .lightbox-header {
    padding: 12px 16px;
  }

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

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

  .lightbox-nav-btn.prev {
    left: 10px;
  }

  .lightbox-nav-btn.next {
    right: 10px;
  }

  .lightbox-thumbnails.bottom {
    height: 80px;
  }

  .thumbnail-item {
    width: 60px;
    height: 60px;
  }

  .lightbox-main {
    padding: 10px;
  }

  .lightbox-image {
    max-height: calc(100vh - 160px);
  }
}

@media (max-width: 480px) {
  .lightbox-toolbar {
    gap: 4px;
  }

  .toolbar-btn {
    width: 32px;
    height: 32px;
  }

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

  .lightbox-thumbnails {
    display: none;
  }
}

/* Smooth scrollbar for thumbnails */
.thumbnails-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.thumbnails-wrapper::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.thumbnails-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.thumbnails-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Animations */
@media (prefers-reduced-motion: reduce) {
  .premium-lightbox-backdrop,
  .lightbox-image,
  .toolbar-btn,
  .lightbox-nav-btn,
  .thumbnail-item,
  .lightbox-toast {
    transition: none !important;
    animation: none !important;
  }
}

/* Touch indicators */
@media (hover: none) {
  .lightbox-image-container::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .lightbox-image-container:active::after {
    opacity: 1;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .toolbar-btn {
    border: 1px solid white;
  }

  .lightbox-nav-btn {
    border: 1px solid white;
  }

  .thumbnail-item {
    border-width: 3px;
  }
}