/* Premium Gallery Styles */

/* Kontrolki galerii */
.gallery-controls-wrapper {
  background: var(--card);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .gallery-controls-wrapper {
  border-color: rgba(255, 255, 255, 0.08);
}

/* Wyszukiwarka */
.gallery-search {
  position: relative;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 14px 48px 14px 20px;
  font-size: 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .search-input {
  border-color: rgba(255, 255, 255, 0.1);
}

.search-input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  display: none;
  transition: all 0.2s ease;
}

[data-theme="dark"] .search-clear {
  background: rgba(255, 255, 255, 0.1);
}

.search-clear:hover {
  background: var(--acc);
  color: white;
  transform: translateY(-50%) scale(1.1);
}

/* Kategorie */
.gallery-categories {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.category-btn {
  padding: 10px 18px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .category-btn {
  border-color: rgba(255, 255, 255, 0.1);
}

.category-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: var(--acc);
  transition: width 0.3s ease;
  z-index: -1;
}

.category-btn:hover {
  border-color: var(--acc);
  transform: translateY(-2px);
}

.category-btn.active {
  background: var(--acc);
  color: white;
  border-color: var(--acc);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Toolbar (sortowanie i widok) */
.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* Sortowanie */
.gallery-sort {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.sort-select {
  padding: 8px 12px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="dark"] .sort-select {
  border-color: rgba(255, 255, 255, 0.1);
}

.sort-select:hover {
  border-color: var(--acc);
}

.sort-select:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Przełącznik widoku */
.gallery-view-switcher {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

[data-theme="dark"] .gallery-view-switcher {
  background: rgba(255, 255, 255, 0.05);
}

.view-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
}

[data-theme="dark"] .view-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.view-btn.active {
  background: var(--acc);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* Tagi popularne */
.gallery-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.tags-label {
  font-size: 14px;
  color: var(--muted);
  margin-right: 8px;
}

.tag-btn {
  padding: 6px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .tag-btn {
  border-color: rgba(255, 255, 255, 0.1);
}

.tag-btn:hover {
  background: rgba(0, 123, 255, 0.1);
  border-color: var(--acc);
  transform: translateY(-1px);
}

.tag-btn.active {
  background: var(--acc);
  color: white;
  border-color: var(--acc);
}

.tag-count {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 10px;
}

.tag-btn.active .tag-count {
  background: rgba(255, 255, 255, 0.2);
}

/* Container galerii */
.gallery-container {
  min-height: 400px;
  position: relative;
}

/* Widok siatki */
.albums-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* Widok mozaiki */
.albums-masonry {
  display: flex;
  gap: 24px;
}

.masonry-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Widok osi czasu */
.albums-timeline {
  position: relative;
  padding-left: 40px;
}

.albums-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--acc),
    rgba(0, 123, 255, 0.3)
  );
}

.timeline-section {
  margin-bottom: 48px;
  position: relative;
}

.timeline-header {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  position: relative;
}

.timeline-header::before {
  content: '';
  position: absolute;
  left: -36px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--acc);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2);
}

.timeline-items {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Karta albumu */
.gallery-album {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

[data-theme="dark"] .gallery-album {
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.gallery-album:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .gallery-album:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* Miniatura albumu */
.album-thumbnail {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.album-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.album-image.loaded {
  opacity: 1;
  animation: imageReveal 0.6s ease-out;
}

@keyframes imageReveal {
  from {
    opacity: 0;
    transform: scale(1.1);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gallery-album:hover .album-image {
  transform: scale(1.08);
}

/* Licznik zdjęć */
.album-counter {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

/* Kategoria badge */
.album-category {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--cat-color, var(--acc));
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Informacje o albumie */
.album-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.album-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
}

.album-meta {
  font-size: 13px;
  color: var(--muted);
}

.album-description {
  font-size: 14px;
  color: var(--text);
  opacity: 0.8;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tagi albumu */
.album-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.album-tag {
  font-size: 11px;
  padding: 4px 8px;
  background: rgba(0, 123, 255, 0.1);
  color: var(--acc);
  border-radius: 12px;
  font-weight: 500;
}

/* Akcje albumu */
.album-actions {
  padding: 0 20px 20px;
}

.album-actions .btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.album-actions .btn.primary {
  background: linear-gradient(135deg, var(--acc) 0%, #5a67d8 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.album-actions .btn.primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

.album-actions .btn.primary:hover::before {
  left: 100%;
}

.album-actions .btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

/* Empty state */
.gallery-empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.empty-icon {
  opacity: 0.3;
  margin-bottom: 24px;
}

.gallery-empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px 0;
}

.gallery-empty-state p {
  font-size: 14px;
  margin: 0;
}

/* Animacje */
.animate-rise {
  opacity: 0;
  transform: translateY(20px);
  animation: riseUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: var(--stagger, 0ms);
}

@keyframes riseUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsywność */
@media (max-width: 1200px) {
  .albums-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .gallery-controls-wrapper {
    padding: 16px;
  }

  .gallery-categories {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .category-btn {
    flex-shrink: 0;
  }

  .albums-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .albums-masonry {
    flex-direction: column;
  }

  .timeline-items {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .search-input {
    font-size: 14px;
    padding: 12px 40px 12px 16px;
  }

  .gallery-view-switcher {
    width: 100%;
    justify-content: center;
  }

  .albums-grid {
    grid-template-columns: 1fr;
  }

  .album-info {
    padding: 16px;
  }

  .album-title {
    font-size: 16px;
  }

  .albums-timeline {
    padding-left: 24px;
  }
}

/* Integracja z lightbox */
.lightbox-backdrop.gallery-lightbox {
  backdrop-filter: blur(20px);
  background: rgba(0, 0, 0, 0.9);
}

.lightbox-modal.gallery-modal {
  max-width: min(1400px, 95vw);
  background: transparent;
  border: none;
  box-shadow: none;
}

.lightbox-modal.gallery-modal img {
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Loading state */
.gallery-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.gallery-loading::after {
  content: '';
  width: 48px;
  height: 48px;
  border: 3px solid rgba(0, 123, 255, 0.2);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Smooth scrollbar */
.gallery-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.gallery-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.gallery-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.gallery-container::-webkit-scrollbar-thumb:hover {
  background: var(--acc);
}

[data-theme="dark"] .gallery-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .gallery-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}