/* css/components/cards.css */

/* --- Chapter Card Styles --- */
.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;
}

/* --- Series Card Styles --- */
.series-card {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  background: var(--clr-bg-card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.07);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  /* Styles pour la balise <a> */
  text-decoration: none;
  color: inherit;
}

.series-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.1);
}

.series-card .series-cover {
  flex: 0 0 var(--series-fixed-cover-width-desktop);
  width: var(--series-fixed-cover-width-desktop);
  height: auto;
  position: relative;
  overflow: hidden;
}

.series-card .series-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.series-card:hover .series-cover img {
  transform: scale(1.07);
}

.series-card .series-info {
  flex: 1;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
}

.series-card .series-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--clr-text);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.series-card .meta {
  font-size: 0.9rem;
  color: var(--clr-text-sub);
  margin-bottom: 0.25rem;
}

.series-card .series-author-year-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  font-size: 0.85rem;
  color: var(--clr-text-sub);
  margin-bottom: 0.4rem;
}

.series-card .series-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  line-height: 1.4;
  overflow: hidden;
  max-height: calc(1.4em * 2 * 1.2);
}

.series-card .series-description {
  font-size: 0.9rem;
  color: var(--clr-text-sub);
  margin-top: 0;
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.series-latest-chapters-container-desktop {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(var(--clr-text-rgb), 0.05);
  color: var(--clr-text);
  margin-top: auto;
}

body.dark .series-latest-chapters-container-desktop {
  border-top-color: rgba(var(--clr-text-rgb), 0.08);
}

.series-chapter-item-desktop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  padding: 0.2rem 0.3rem;
  /* Styles pour la balise <a> */
  text-decoration: none;
  color: inherit;
}

.series-chapter-item-desktop:hover {
  background-color: rgba(var(--clr-primary-rgb), 0.08);
}

.chapter-number-desktop {
  font-weight: 600;
  color: var(--clr-primary);
  flex-shrink: 0;
  margin-right: 0.5rem;
}

.chapter-title-desktop {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--clr-text);
  margin-right: 0.5rem;
}

.chapter-date-desktop {
  color: var(--clr-text-sub);
  font-size: 0.75rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.series-latest-chapters-container-mobile {
  display: none;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(var(--clr-text-rgb), 0.1);
}

.series-latest-chapters-container-mobile .series-chapter-item {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background: rgba(var(--clr-primary-rgb), 0.08);
  color: var(--clr-text);
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.series-latest-chapters-container-mobile .series-chapter-item:hover {
  background-color: rgba(var(--clr-primary-rgb), 0.15);
}

.series-latest-chapters-container-mobile .series-chapter-item-main-info-mobile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-grow: 1;
  overflow: hidden;
  margin-right: 0.5rem;
}

.series-latest-chapters-container-mobile .chapter-number-small {
  font-weight: 600;
  color: var(--clr-primary);
  font-size: 0.8em;
}

.series-latest-chapters-container-mobile .chapter-title-small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9em;
  color: var(--clr-text);
  margin: 0;
}

.series-latest-chapters-container-mobile .chapter-date-small-mobile {
  font-size: 0.75em;
  color: var(--clr-text-sub);
  white-space: nowrap;
  flex-shrink: 0;
}


/* --- Media Queries --- */
@media (max-width: 768px) {
  .chapter-card {
    width: calc(100% - 1rem);
    aspect-ratio: var(--mobile-carousel-card-aspect-ratio);
    height: auto;
    margin-right: 1rem;
  }

  .chapter-card .chapter-info {
    padding: 0.6rem;
    font-size: 0.8rem;
    line-height: 1.25;
  }
  
  .chapter-card .manga-title { font-size: 0.95rem; }
  .chapter-card .chapter-number { font-size: 0.85rem; }
  .chapter-card .chapter-title { font-size: 0.7rem; }
  .chapter-card .chapter-time { font-size: 0.65rem; bottom: 0.6rem; right: 0.6rem; }

  .series-card {
    flex-direction: row;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(var(--clr-text-rgb), 0.06);
  }

  .series-card:hover {
    transform: none;
    box-shadow: 0 10px 20px rgba(var(--clr-text-rgb), 0.08);
  }

  .series-card .series-cover {
    flex: 0 0 var(--series-fixed-cover-width-mobile);
    width: var(--series-fixed-cover-width-mobile);
  }

  .series-card .series-info {
    flex-grow: 1;
    padding: 0.8rem .5rem;
    font-size: .8rem;
  }

  .series-card .series-title { font-size: 1rem; }
  .series-card .series-author-year-line { font-size: .75rem; }
  .series-card .series-description { display: none; }
  .series-latest-chapters-container-desktop { display: none; }
  .series-latest-chapters-container-mobile { display: block; }
}

/* --- Badge / Vignette sur les cartes --- */
/* ===== Vignette lisible sur toutes les covers ===== */
.series-cover{ position:relative; overflow:hidden; }

/* style par défaut : pastille bien contrastée */
.series-badge{
  position:absolute; top:8px; left:8px;
  padding:5px 12px;
  max-width:calc(100% - 16px);
  border-radius:999px;
  font:700 0.84rem/1.15 "Urbanist",system-ui,sans-serif;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;

  /* ↴ Lisibilité : texte blanc, fond coloré + opaque */
  color:#fff;
  background: rgba(var(--badge-rgb,16,224,193), .85);
  border:1px solid rgba(var(--badge-rgb,16,224,193), .95);
  box-shadow:0 4px 14px rgba(0,0,0,.28);
  text-shadow:0 1px 1px rgba(0,0,0,.35);
  letter-spacing:.15px;
  pointer-events:none;
}

/* Bonus lisibilité : blur derrière la pastille si dispo */
@supports (backdrop-filter: blur(4px)) {
  .series-badge{
    backdrop-filter: blur(4px) saturate(120%);
    -webkit-backdrop-filter: blur(4px) saturate(120%);
    /* on peut alors baisser un peu l’opacité du fond */
    background: rgba(var(--badge-rgb,16,224,193), .70);
  }
}

/* Dark mode: inutile de noircir davantage, on garde le même rendu */
html.dark .series-badge{
  background: rgba(var(--badge-rgb,16,224,193), .82);
  border-color: rgba(var(--badge-rgb,16,224,193), .95);
}

/* Option: taille compacte si le texte est très long (petits écrans) */
@media (max-width: 520px){
  .series-badge{ font-size:0.8rem; padding:4px 10px; }
}

/* === Vignettes : version compacte sur petits écrans === */

/* ≤ 640px : chip compacte */
@media (max-width: 640px){
  .series-badge{
    top:6px; left:6px;
    padding:3px 8px;
    font-size:0.72rem;      /* avant ~0.84rem */
    line-height:1.1;
    max-width:70%;          /* évite de couvrir la cover */
    border-radius:10px;
    box-shadow:0 3px 10px rgba(0,0,0,.22);
  }
  /* si jamais plusieurs vignettes sont injectées, on les empile */
  .series-cover .series-badge:nth-of-type(2){ top: calc(6px + 24px); }
  .series-cover .series-badge:nth-of-type(3){ top: calc(6px + 24px*2); }
}

/* ≤ 420px : encore plus discret */
@media (max-width: 420px){
  .series-badge{
    padding:2px 6px;
    font-size:0.66rem;
    max-width:62%;
    text-shadow:0 1px 0 rgba(0,0,0,.25); /* lisible mais léger */
  }
}

/* ≤ 340px : mode micro-chip */
@media (max-width: 340px){
  .series-badge{
    padding:2px 6px;
    font-size:0.62rem;
    max-width:58%;
    letter-spacing:.1px;
  }
}

/* Fin Vignette */