/* ===== THEME VARIABLES ===== */
:root {
  --bg-color: #f4f4f4;
  --card-bg: #ffffff;
  --text-main: #333333;
  --text-muted: #666666;
  --border-color: #dddddd;
  --stat-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #b0b0b0;
    --border-color: #333333;
    --stat-bg: #1e1e1e;
  }
}

/* ===== RESET & BASE ===== */
body {
  font-family: "Inter", sans-serif;
  background: var(--bg-color);
  margin: 0;
  padding-bottom: 50px;
  color: var(--text-main);
  scroll-behavior: smooth;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

/* ===== HEADER & NAV ===== */
header {
  background: royalblue;
  color: white;
  padding: 30px 10px;
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: 2rem;
}
header h3 {
  margin: 10px 0 25px;
  font-weight: 300;
  opacity: 0.9;
}

.site-nav ul {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  list-style: none;
  gap: 12px;
  padding: 0;
  max-width: 1000px;
  margin: 0 auto;
}

/* Glass Button Style */
.site-nav a {
  display: inline-block;
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ===== STATS & CONTROLS ===== */
.global-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 15px 0;
}

.controls-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 15px;
}

#search {
  padding: 10px 20px;
  width: 100%;
  max-width: 300px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  outline: none;
}

.filter-btn {
  padding: 8px 16px;
  border: none;
  cursor: pointer;
  border-radius: 20px;
  background: var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  margin: 0 5px;
}

.filter-btn.active {
  background: red;
  color: white;
}

/* ===== GALLERY LAYOUT ===== */
.grouped-gallery h2 {
  text-align: center;
  color: royalblue;
  margin-top: 50px;
  scroll-margin-top: 80px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-item {
  position: relative;
  padding: 15px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gallery-item.status-collected {
  background: rgba(65, 105, 225, 0.12);
  border: 1px solid rgba(65, 105, 225, 0.35);
  box-shadow: 0 4px 20px rgba(65, 105, 225, 0.15);
}

.gallery-item.status-wishlist {
  background: rgba(65, 105, 225, 0.04);
  border: 1px solid rgba(65, 105, 225, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  .gallery-item.status-collected {
    background: rgba(100, 140, 255, 0.15);
    border: 1px solid rgba(100, 140, 255, 0.3);
    box-shadow: 0 4px 20px rgba(100, 140, 255, 0.1);
  }
  .gallery-item.status-wishlist {
    background: rgba(100, 140, 255, 0.05);
    border: 1px solid rgba(100, 140, 255, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 28px rgba(65, 105, 225, 0.25);
}

.gallery-item img {
  width: 100%;
  max-width: 180px;
  height: 180px;
  object-fit: contain;
  margin-bottom: 15px;
}

.category-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* ===== BADGES ===== */
.badge {
  position: absolute;
  bottom: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
}

.badge--collected::before {
  content: "💚";
  font-size: 1.5rem;
}
.badge--wishlist::before {
  content: "❤️";
  font-size: 1.5rem;
}

/* ===== FOOTER ===== */
.site-footer {
  background: royalblue;
  padding: 60px 20px;
  margin-top: 60px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  color: white;
}

.social-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 25px;
}

.social-links a {
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.social-links a:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

/* FIX: Removed duplicate .footer-content rule */
.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.copyright {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin: 0 0 8px;
}

.footer-note {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 auto;
  max-width: 600px;
  line-height: 1.4;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox.open {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.lightbox-panel {
  position: relative;
  background: var(--card-bg);
  color: var(--text-main);
  border-radius: 16px;
  max-width: 860px;
  width: 90%;
  display: flex;
  overflow: hidden;
  z-index: 1;
}

/* FIX: Added proper styling for the lightbox close button so it is visible and functional */
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-main);
  z-index: 2;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-image-wrap {
  flex: 0 0 320px;
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.lightbox-image-wrap img {
  width: 100%;
  object-fit: contain;
}

.lightbox-body {
  flex: 1;
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lightbox-fields label {
  font-size: 0.75rem;
  font-weight: 700;
  color: royalblue;
  text-transform: uppercase;
}

.read-only-text {
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
}

.description-text {
  font-style: italic;
  color: #555;
  border-bottom: none;
}

.gallery-item.has-lightbox {
  cursor: zoom-in;
}

@media (max-width: 768px) {
  .lightbox-panel {
    flex-direction: column;
  }
  .lightbox-image-wrap {
    flex: none;
  }
}
