.archive-header {
  text-align: center;
  color: var(--green);
  font-weight: bold;
  margin: 1rem 0;
}

/* Archive-specific styles */
.filter-section {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.filter-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  color: var(--green);
  font-weight: bold;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  padding: 0.75rem;
  background: var(--sec-color);
  color: var(--white);
  border: 2px solid var(--sec-color-2);
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(86, 222, 147, 0.2);
}

.filter-select optgroup {
  font-weight: bold;
  color: var(--green);
}

.filter-select option {
  padding: 0.5rem;
  background: var(--sec-color);
  color: var(--white);
}

/* Active Filters */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2rem;
}

.filter-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bg-color);
  cursor: pointer;
  transition: var(--transition);
}

.filter-bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.filter-bubble .remove-filter {
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: inherit;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
}

/* Filter bubble colors */
.filter-bubble.project {
  background: #ff6b6b;
}
.filter-bubble.background {
  background: #4ecdc4;
}
.filter-bubble.filter {
  background: #45b7d1;
}
.filter-bubble.history {
  background: #96ceb4;
}
.filter-bubble.character {
  background: var(--green);
}
.filter-bubble.species {
  background: #feca57;
}
.filter-bubble.gender {
  background: #ff9ff3;
}
.filter-bubble.bodyType {
  background: #54a0ff;
}
.filter-bubble.furColor {
  background: #5f27cd;
}

/* Gallery Section - Hidden by default */
.gallery-section {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: none; /* Hidden until search is performed */
}

.gallery-section.visible {
  display: block;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  margin-left: auto;
  margin-right: auto;
}

/* Cap width *only when few items are shown* or on smaller viewports */
@media (min-width: 1024px) {
  .gallery-grid {
    max-width: 1200px; /* enough for 3 full columns + gap */
  }
}

.gallery-item {
  background: var(--sec-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.gallery-item-image {
  width: 100%;
  height: 250px;
  position: relative;
  overflow: hidden;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item-image img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  transition: var(--transition);
  position: absolute;
  top: 0;
  left: 0;
}

.gallery-item {
  aspect-ratio: 1 / 1; /* Forces square shape */
  width: 100%; /* or fixed width */
  position: relative;
  overflow: hidden;
  /* Remove flexbox properties from the parent */
}

.gallery-item-image {
  /* Set image container to fill the parent */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.gallery-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.3s ease; /* Keep the hover effect smooth */
}

.gallery-item:hover .gallery-item-image img {
  transform: scale(1.05);
}

.image-placeholder {
  width: 100%;
  height: 100%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--bg-color);
  font-weight: bold;
  position: absolute;
  top: 0;
  left: 0;
}

.gallery-item-info {
  position: absolute; /* Layer on top of the image */
  bottom: 0; /* Position at the bottom of the gallery item */
  left: 0;
  width: 100%; /* Ensure it spans the full width */
  padding: 1rem;
  z-index: 10;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent); /* Add a subtle gradient for readability */
  color: white; /* Ensure text is visible on the image */
  box-sizing: border-box; /* Include padding in the element's total width */
}

.gallery-item-title {
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: white;
  text-shadow: 1px 1px 2px black;
}

.gallery-item-filter {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  margin-left:10px;
  gap:20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.filter-safe, .filter-species, .filter-svg {
  background: var(--green);
  color: var(--bg-color);
  font-weight: bold;
  font-size: 1.1em; /* Makes the font a bit bigger */
}

.filter-hidden {
  background: #feca57;
  color: var(--bg-color);
}

.filter-violent {
  background: #ff6b6b;
  color: var(--white);
}

.filter-explicit {
  background: rgb(222, 86, 86);
  color: var(--white);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.page-btn {
  padding: 0.75rem 1rem;
  background: var(--sec-color);
  color: var(--white);
  border: 2px solid var(--sec-color-2);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
}

/* Example CSS for the page indicator */
.page-indicator {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--green);
  border-radius: var(--border-radius);
  /* You can adjust font-size, color, etc. */
  font-weight: bold;
  color: var(--sec-color-2); /* Assuming you have a text color variable */
}

.page-btn:hover:not(:disabled) {
  background: var(--green);
  color: var(--bg-color);
  border-color: var(--green);
}

.page-btn.active {
  background: var(--green);
  color: var(--bg-color);
  border-color: var(--green);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal Scrollbar */
.modal-content::-webkit-scrollbar {
  width: 10px;
}
.modal-content::-webkit-scrollbar-thumb {
  background: var(--green);
  border-radius: 10px;
}
.modal-content {
  scrollbar-width: thin;
  scrollbar-color: var(--green) var(--sec-color);
}

/* Image Modal */
.image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 600px;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 200vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

.blurred-thumbnail {
  filter: blur(8px);
  transition: filter 0.3s ease;
  pointer-events: none;
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  margin: 5vh auto;
  border-radius: var(--border-radius);
  overflow-y: scroll;
  overflow-x: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.gallery-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
  border-radius: 25px;
  max-height: 100%;
}

.modal-close {
  position: flex;
  margin-bottom: 20px;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--green);
  color: var(--bg-color);
}

.modal-image-container {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  border-radius: 25px;
  max-height: 90vh;
  overflow: hidden;
}

.modal-image-container img {
  max-width: 100%;
  max-height: 600px;
  width: auto;
  height: auto;
  border-radius: 25px;
  object-fit: contain;
  display: block;
}

.modal-image-container svg {
  max-width: 100%;
  max-height: 600px;
  width: auto;
  height: auto;
  display: block;
}

.modal-info {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 300px;
  overflow-y: auto;
}

.modal-info h3 {
  color: var(--green);
  font-size: 1.5rem;
  margin: 0;
}

.modal-meta p {
  color: var(--white);
  margin: 0.5rem 0;
}

.modal-mirrors {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.mirror-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-color);
  color: var(--white);
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.mirror-link:hover {
  background: var(--green);
  color: var(--bg-color);
}

.mirror-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.view-tags-btn {
  padding: 0.75rem 1.5rem;
  background: var(--green);
  color: var(--bg-color);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.view-tags-btn:hover {
  background: var(--white);
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  background: var(--sec-color-2);
  color: var(--white);
  padding: 0.3rem 0.8rem;
  border-radius: 15px;
  font-size: 0.9rem;
}

/* Search Section */
.search-section {
  max-width: 1200px;
  margin: 1rem auto;
  padding: 0 1rem;
  text-align: center;
}

.search-btn {
  padding: 1rem 2rem;
  background: var(--green);
  color: var(--bg-color);
  border: none;
  border-radius: var(--border-radius);
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 150px;
}

.search-btn:hover {
  background: #4ade80;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(86, 222, 147, 0.3);
}

.search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Progress Bar */
.progress-container {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.progress-bar {
  width: 100%;
  max-width: 300px;
  height: 8px;
  background: var(--sec-color-2);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #4ecdc4);
  border-radius: 20px;
  width: 0%;
  transition: width 0.1s ease;
  box-shadow: 0 2px 4px rgba(86, 222, 147, 0.4);
}

.progress-text {
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Error Display */
.error-display {
  max-width: 1200px;
  margin: 1rem auto;
  padding: 1rem;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: var(--border-radius);
  color: #ffb3b3;
  text-align: center;
  font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
  .character-header {
    flex-direction: column;
    text-align: center;
  }

  .character-details {
    grid-template-columns: 1fr;
  }

  .modal-content {
    flex-direction: column;
    max-height: 95vh;
  }

  .modal-info {
    min-width: auto;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap:20px;
  }

  .filter-safe, .filter-species, .filter-svg {
    font-size: 0.7em; /* Makes the font a bit bigger */
    margin: 0;
  }
  .gallery-item-title {
    display: none;
  }

  .gallery-item-info {
    display:none;
  }

  .search-btn {
    width: 100%;
    max-width: 250px;
  }

  .progress-bar {
    max-width: 250px;
  }
}

.gallery-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: rgba(0,0,0,0.6);
}


/* Added styles for interactive SVG layers */
.interactive-svg-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.interactive-layer {
  transition: filter 0.3s ease, transform 0.3s ease;
}

.interactive-layer:hover {
  filter: brightness(1.2) !important;
}

.interactive-layer.animating {
  pointer-events: none;
}

/* Animation keyframes for layer interactions */
@keyframes layerDisappear {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-30px);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-70px);
    opacity: 0;
  }
}
/* Version Buttons in Modal */
.modal-versions-container {
  display: none; /* Hidden by default */
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  position: relative;
  z-index: 100; /* Ensure it's above other elements */
}

.version-btn {
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  min-width: 40px;
  text-align: center;
  transition: all 0.3s ease;
}

/* Base styles for inactive buttons */
.version-btn.inactive {
  background-color: var(--sec-color-2);
  color: var(--white);
  opacity: 0.8;
}

/* Base styles for active buttons */
.version-btn.active {
  opacity: 1;
  cursor: pointer;
  /* Active color is set by safe-active or explicit-active */
}

/* Safe (non-explicit) versions */
.version-btn.safe-active {
  background-color: var(--green);
  color: var(--bg-color);
}

.version-btn.safe-inactive {
  background-color: var(--sec-color-2);
  color: var(--white);
  opacity: 0.8;
}

/* Explicit versions */
.version-btn.explicit-active {
  background-color: #FF5C5C; /* Pastel red */
  color: var(--white);
}

.version-btn.explicit-inactive {
  background-color: rgba(255, 92, 92, 0.2);
  color: rgba(255, 255, 255, 0.6);
}

/* Hover effects */
.version-btn.inactive:hover {
  opacity: 1;
}

.version-btn.explicit-inactive:hover {
  background-color: rgba(255, 92, 92, 0.4);
}

@keyframes popIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#imageModal.modal-pop-in {
  animation: popIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Add this CSS for the fade-in and scale-up effect */
.gallery-item-image img {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.gallery-item-image img.loaded {
  opacity: 1;
  transform: scale(1);
}