/* css/components/cards.css */

/* ========================================================== */
/* --- SECTION 1 : CARTE CHAPITRE (CARROUSEL HOMEPAGE) --- */
/* ========================================================== */
/* --- Chapter Card Styles (UNCHANGED) --- */
.chapter-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: var(--clr-bg-card);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.07);
  flex-shrink: 0;
  width: 300px;
  aspect-ratio: 2717 / 4063;
  scroll-snap-align: start;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  /* Styles pour la balise <a> */
  display: block;
  color: inherit;
  text-decoration: none;
}

.chapter-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.chapter-card .chapter-cover {
  height: 100%;
  overflow: hidden;
}

.chapter-card .chapter-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.chapter-card:hover .chapter-cover img {
  transform: scale(1.07);
}

.chapter-card .chapter-info {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 1rem;
  color: #fff;
  transition: background 0.35s ease;
  line-height: 1.4;
  overflow: hidden;
}

.chapter-card .chapter-time {
  position: absolute;
  bottom: 1.1rem;
  right: 1rem;
  font-size: 0.85rem;
  color: #ddd;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.chapter-card .manga-title,
.chapter-card .chapter-title,
.chapter-card .chapter-number {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.chapter-card .manga-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.1rem;
}

.chapter-card .chapter-number {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--clr-accent);
  margin-bottom: 0.1rem;
}

.chapter-card .chapter-title {
  font-size: 0.85rem;
  color: #ddd;
  margin-bottom: 0.1rem;
}

.new-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(var(--clr-accent-rgb), 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
}

/* ========================================================== */
/* --- SECTION 2 : CARTE SÉRIE (HOMEPAGE, TEAMS, ETC.) --- */
/* ========================================================== */

:root {
  --series-card-scale-factor: 0.8; /* Levier principal : 1 = 100%, 0.85 = 85% */
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(calc(230px * var(--series-card-scale-factor)), 1fr)
  );
  gap: calc(2rem * var(--series-card-scale-factor));
  align-items: stretch;
}

.series-card {
  max-width: calc(320px * var(--series-card-scale-factor));
  justify-self: center;
  aspect-ratio: 2 / 3;
  margin: 0;
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  border-radius: 10px; /* Bordure fixe comme demandé */
  overflow: hidden;
  background: #222;
  box-shadow: 0 calc(8px * var(--series-card-scale-factor))
    calc(24px * var(--series-card-scale-factor)) rgba(0, 0, 0, 0.13);
  transition: transform 0.3s cubic-bezier(0.4, 1, 0.3, 1),
    box-shadow 0.3s cubic-bezier(0.4, 1, 0.3, 1), opacity 0.3s ease-out;
  background-size: cover;
  background-position: center;
  z-index: 1;
}

.series-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 52%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.4) 50%,
    transparent 100%
  );
  z-index: 2;
  transition: height 0.6s cubic-bezier(0.4, 1, 0.3, 1);
  pointer-events: none;
}

.series-card:hover {
  transform: translateY(calc(-12px * var(--series-card-scale-factor)))
    scale(1.025);
  box-shadow: 0 calc(18px * var(--series-card-scale-factor))
    calc(40px * var(--series-card-scale-factor)) rgba(0, 0, 0, 0.22);
}

.series-card:hover::before {
  height: 85%;
}

.series-card .series-content {
  position: relative;
  z-index: 3;
  padding: calc(1.3rem * var(--series-card-scale-factor))
    calc(1.1rem * var(--series-card-scale-factor))
    calc(1.1rem * var(--series-card-scale-factor))
    calc(1.1rem * var(--series-card-scale-factor));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: #fff;
  width: 100%;
  will-change: transform;
}

.series-card .series-title {
  font-size: calc(1.6rem * var(--series-card-scale-factor));
  font-weight: 800;
  color: #fff;
  text-shadow: 0 calc(2px * var(--series-card-scale-factor))
    calc(12px * var(--series-card-scale-factor)) rgba(0, 0, 0, 0.35);
  letter-spacing: 0.01em;
  line-height: 1.18;
  transition: color 0.2s;
}

.series-card .series-extra {
  width: 100%;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.6s cubic-bezier(0.4, 1, 0.3, 1),
    max-height 0.6s cubic-bezier(0.4, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: calc(0.9rem * var(--series-card-scale-factor));
  pointer-events: none;
}

.series-card:hover .series-extra {
  opacity: 1;
  max-height: calc(150px * var(--series-card-scale-factor));
  pointer-events: auto;
}

.series-card .series-tags {
  margin-top: calc(0.5rem * var(--series-card-scale-factor));
  display: flex;
  flex-wrap: wrap;
  gap: calc(0.35rem * var(--series-card-scale-factor));
}

.series-card .series-tags .tag {
  font-size: calc(0.7rem * var(--series-card-scale-factor));
  padding: 0.25em 0.7em; /* em est relatif à font-size, donc il s'adapte automatiquement */
  border-radius: 4px; /* Bordure fixe comme demandé */
}

.series-card .series-tags .tag-more {
  background-color: rgba(var(--clr-text-rgb), 0.1);
  color: var(--clr-text-sub);
  font-weight: 600;
  cursor: default;
}

.series-card .series-actions {
  display: flex;
  gap: calc(0.7rem * var(--series-card-scale-factor));
  width: 100%;
}

.series-card .series-action-btn {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  justify-content: center;
  text-align: center;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: calc(1.5px * var(--series-card-scale-factor)) solid
    rgba(255, 255, 255, 0.22);
  border-radius: calc(7px * var(--series-card-scale-factor));
  padding: 0.4em 0; /* em est relatif à font-size, donc il s'adapte automatiquement */
  font-size: calc(0.85rem * var(--series-card-scale-factor));
  font-weight: 700;
  text-decoration: none;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  cursor: pointer;
  outline: none;
  box-shadow: 0 calc(1px * var(--series-card-scale-factor))
    calc(6px * var(--series-card-scale-factor)) rgba(0, 0, 0, 0.08);
}

.series-card .series-action-btn:hover,
.series-card .series-action-btn:focus {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.38);
  text-decoration: none;
}

/* --- Tooltip description qui suit la souris --- */
.series-tooltip-description {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  min-width: 260px;
  max-width: 500px;
  background: rgba(24, 24, 28, 0.6);
  color: #fff;
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  font-size: 0.9rem;
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s;
  white-space: pre-line;
  max-height: 320px;
  overflow-y: auto;
}

.series-tooltip-description.visible {
  opacity: 1;
}

@media (max-width: 768px) {
  :root {
    --series-card-scale-factor: 1;
  }

  .series-grid {
    grid-template-columns: repeat(2, 1fr); /* Deux colonnes flexibles */
    gap: calc(
      1rem * var(--series-card-scale-factor)
    ); /* Espace entre les cartes */
  }

  .series-card {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    aspect-ratio: 2 / 3;
    border-radius: 10px; /* Bordure fixe comme demandé */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: 0 calc(4px * var(--series-card-scale-factor))
      calc(12px * var(--series-card-scale-factor)) rgba(0, 0, 0, 0.1);
    transform: none !important;
  }

  .series-card::before {
    height: 85% !important;
    transition: none;
  }

  .series-card .series-content {
    padding: calc(0.5rem * var(--series-card-scale-factor));
  }

  .series-card .series-title {
    font-size: calc(1rem * var(--series-card-scale-factor));
    line-height: 1.2;
    margin-bottom: calc(0.4rem * var(--series-card-scale-factor));
  }

  .series-card .series-extra {
    opacity: 1 !important;
    max-height: none !important;
    pointer-events: auto;
    gap: calc(0.5rem * var(--series-card-scale-factor));
    transition: none;
  }

  .series-card .series-tags {
    margin-top: 0;
    gap: calc(0.25rem * var(--series-card-scale-factor));
  }

  .series-card .series-tags .tag {
    font-size: calc(0.65rem * var(--series-card-scale-factor));
    padding: 0.2em 0.6em;
    border-radius: 4px; /* Bordure fixe comme demandé */
  }

  .series-card .series-actions {
    gap: calc(0.5rem * var(--series-card-scale-factor));
    flex-wrap: wrap;
  }

  .series-card .series-action-btn {
    font-size: calc(0.7rem * var(--series-card-scale-factor));
    padding: 0.4em 0.6em;
    border-radius: calc(6px * var(--series-card-scale-factor));
  }

  .series-tooltip-description {
    display: none !important;
  }
}
