/* Archive Page Styles */

html {
  scrollbar-gutter: stable;
}

.archive-section {
  padding: 3rem 0;
  background-color: var(--bg-primary);
  min-height: calc(100vh - 400px);
}

/* Filters */
.archive-filters {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.filter-select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  min-width: 150px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.filter-select:hover {
  border-color: var(--primary-color);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(71 74 81 / 0.1);
}

/* Albums Grid */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.album-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.album-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.album-thumbnail {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-accent) 100%);
}

.album-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.album-card:hover .album-image {
  transform: scale(1.05);
}

.album-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.album-card:hover .album-overlay {
  opacity: 1;
}

.album-overlay-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: white;
}

.album-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.album-info {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.album-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.album-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.album-date {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.album-count {
  background: var(--bg-accent);
  color: var(--primary-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius);
  font-weight: 500;
}

.album-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.album-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: var(--transition);
}

.album-link:hover {
  color: var(--primary-dark);
  gap: 0.75rem;
}

/* No Albums */
.no-albums {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-light);
}

.no-albums p {
  font-size: 1.1rem;
  margin: 0;
}

/* Album Modal */
.album-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  padding: 1rem;
  overflow-y: auto;
}

.album-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--border-radius-lg);
  max-width: 1200px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  z-index: 10;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2rem 2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

.modal-date {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0;
}

.modal-date strong {
  color: var(--text-primary);
}

.modal-counter {
  background: var(--bg-accent);
  color: var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.modal-body {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gallery-container {
  position: relative;
  width: 100%;
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--bg-secondary);
}

.gallery-item-wrapper {
  width: 100%;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
}

.modal-image {
  max-width: 100%;
  max-height: 600px;
  height: auto;
  object-fit: contain;
  display: block;
}

.modal-video {
  width: 100%;
  max-height: 600px;
  object-fit: contain;
}

.gallery-nav {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  pointer-events: none;
}

.gallery-prev,
.gallery-next {
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  pointer-events: auto;
  transition: var(--transition);
}

.gallery-prev:hover,
.gallery-next:hover {
  background: rgba(0, 0, 0, 0.8);
}

.gallery-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-height: 450px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  align-content: flex-start;
}

.gallery-pagination::-webkit-scrollbar {
  width: 6px;
}

.gallery-pagination::-webkit-scrollbar-track {
  background: var(--bg-accent);
  border-radius: 3px;
}

.gallery-pagination::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
}

.pagination-item {
  position: relative;
  width: 85px;
  height: 85px;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  background: var(--bg-primary);
  box-sizing: border-box;
}

.pagination-item img,
.pagination-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pagination-item:hover {
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.pagination-item.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px var(--bg-primary), 0 0 0 3px var(--primary-color);
}

.pagination-item-type {
  position: absolute;
  bottom: 0.25rem;
  right: 0.25rem;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.25rem 0.35rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
}

.modal-description {
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
}

.modal-description p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-description strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.5rem;
}

.modal-thumbnails {
  display: none;
}

/* Fullscreen Image Viewer */
.fullscreen-viewer {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10000;
  opacity: 0;
  animation: fadeIn 0.3s ease-out forwards;
}

.fullscreen-viewer.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fullscreen-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.fullscreen-image {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  user-select: none;
}

.fullscreen-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.4);
}

.fullscreen-nav {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  pointer-events: none;
  z-index: 9999;
}

.fullscreen-prev,
.fullscreen-next {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  pointer-events: auto;
  transition: var(--transition);
}

.fullscreen-prev:hover,
.fullscreen-next:hover {
  background: rgba(255, 255, 255, 0.4);
}

.fullscreen-counter {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 1rem;
  font-weight: 600;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

/* Fullscreen responsive */
@media (max-width: 768px) {
  .fullscreen-close {
    width: 2rem;
    height: 2rem;
    font-size: 1.25rem;
    top: 1rem;
    right: 1rem;
  }

  .fullscreen-prev,
  .fullscreen-next {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
  }

  .fullscreen-counter {
    bottom: 1rem;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }
}

/* Dark Theme */
:root[data-theme="dark"] .album-card {
  background-color: #0e1627;
  border-color: var(--border-color);
}

:root[data-theme="dark"] .filter-select {
  background-color: #0b1322;
  border-color: #243148;
  color: var(--text-primary);
}

:root[data-theme="dark"] .modal-content {
  background-color: #0e1627;
}

/* Responsive */
@media (max-width: 1024px) {
  .gallery-pagination {
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
  }
}

@media (max-width: 768px) {
  .albums-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }

  .archive-filters {
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .filter-select {
    min-width: auto;
    width: 100%;
  }

  .filter-group {
    flex: 1;
    min-width: 120px;
  }

  .modal-body {
    padding: 1.5rem;
    gap: 1rem;
  }

  .gallery-item-wrapper {
    min-height: 300px;
  }

  .modal-image,
  .modal-video {
    max-height: 350px;
  }

  .modal-header {
    flex-direction: column;
    gap: 1rem;
  }

  .modal-counter {
    align-self: flex-start;
  }

  .modal-close {
    width: 2rem;
    height: 2rem;
    font-size: 1.25rem;
    top: 0.75rem;
    right: 0.75rem;
  }

  .gallery-pagination {
    max-height: 330px;
  }

  .pagination-item {
    width: 75px;
    height: 75px;
  }
}

@media (max-width: 480px) {
  .albums-grid {
    grid-template-columns: 1fr;
  }

  .archive-filters {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }

  .album-thumbnail {
    height: 150px;
  }

  .album-modal {
    padding: 0.5rem;
  }

  .modal-content {
    border-radius: 0.5rem;
    max-height: 95vh;
  }

  .modal-header {
    padding: 1.5rem 1rem 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .gallery-item-wrapper {
    min-height: 250px;
  }

  .modal-image,
  .modal-video {
    max-height: 250px;
  }

  .modal-header h2 {
    font-size: 1.25rem;
  }

  .gallery-pagination {
    max-height: 350px;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .pagination-item {
    width: 65px;
    height: 65px;
  }

  .modal-description {
    padding: 1rem;
  }
}
