/* ====== Anime 列表页 ====== */

.anime-section {
  display: none;
  scroll-margin-top: 70px;
}

.anime-section.active {
  display: block;
}

/* ===== 顶部切换栏 ===== */
.anime-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 10px;
  padding: 6px 0 14px;
  margin: 0 0 10px;
  background: var(--bg-main);
}

.anime-tabs button {
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #e5e7eb;
  color: #333;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.anime-tabs button:hover {
  transform: translateY(-1px);
}

.anime-tabs button.active {
  background: var(--primary);
  color: #fff;
}

/* ===== 动漫网格 ===== */
.anime-gallery {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.anime-item {
  width: 100%;
  min-width: 0;
}

/* ===== 整个卡片 ===== */
.anime-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-decoration: none;
}

.anime-card img {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.anime-card img:hover {
  transform: scale(1.05);
}

.anime-card p {
  margin: 8px 0 0;
  text-align: center;
  font-size: 14px;
  color: #333;
}

/* ===== 图片容器 / 状态角标 ===== */
.anime-image-wrapper {
  position: relative;
  width: 100%;
}

.anime-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  z-index: 2;
}

.anime-badge.finished {
  background: #22c55e;
}

.anime-badge.ongoing {
  background: #f59e0b;
}

.anime-badge.upcoming {
  background: #3b82f6;
}

/* ====== 动漫详情页 ====== */

.anime-detail-cover {
  max-width: 320px;
  margin: 0 0 20px 0;
}

.anime-detail-cover img {
  display: block;
  width: 100%;
  border-radius: 10px;
}

#anime-links a {
  color: var(--primary-dark);
  text-decoration: none;
}

#anime-links a:hover {
  text-decoration: underline;
}

.back-link {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: bold;
}

.back-link:hover {
  text-decoration: underline;
}

/* ====== 详情页额外图片展示 ====== */

.anime-extra-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.anime-extra-gallery img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
}

/* ====== 详情页图片悬浮动画 ====== */
.anime-detail-cover img,
.anime-extra-gallery img {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: zoom-in;
}

.anime-detail-cover img:hover,
.anime-extra-gallery img:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

/* ====== 图片放大弹窗 ====== */
.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 2000;
}

.image-lightbox.show {
  opacity: 1;
  visibility: visible;
}

.lightbox-image {
  max-width: min(1000px, 90vw);
  max-height: 85vh;
  border-radius: 12px;
  transform: scale(0.85);
  transition: transform 0.25s ease;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.image-lightbox.show .lightbox-image {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 26px;
  font-size: 42px;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}

.lightbox-close:hover {
  transform: scale(1.1);
}

/* ====== 响应式 ====== */

@media (max-width: 1000px) {
  .anime-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .anime-extra-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .anime-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .anime-extra-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .anime-tabs {
    padding: 4px 0 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .anime-tabs button {
    padding: 12px 18px;
    font-size: 15px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: #e5e7eb;
    color: #333;
    font-weight: 600;
    transition: 0.2s ease;
  }

  .anime-card img {
    height: 220px;
  }
}