/* Colonne de droite : onglets, résultat du calcul, fiche de l'anime, affiche en grand. */

/* ---------- Onglets ---------- */

.side.card { display: flex; flex-direction: column; min-width: 0; padding: 0; }
@media (min-width: 900px) {
  /* Collée en haut de l'écran ; le contenu de l'onglet défile s'il dépasse. */
  .side.card { position: sticky; top: 20px; max-height: calc(100vh - 40px); }
  .tab-panel { overflow-y: auto; }
}

.tabs { display: flex; flex: none; padding: 0 8px; border-bottom: 1px solid var(--color-border); }
.tabs [role="tab"] {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  padding: 14px 12px;
  font: inherit;
  font-weight: 500;
  color: var(--color-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tabs [role="tab"]:hover { color: var(--color-text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.tab-panel { min-height: 0; padding: 20px; }

.empty-state { margin: 8px 0; color: var(--color-muted); }
.empty-state i { margin-right: 6px; }

/* ---------- Résultat ---------- */

.result h2 { margin: 0; color: var(--color-muted); font-size: 15px; font-weight: 500; }
.result-count {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin: 6px 0 4px;
}
.result-count strong {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: clamp(56px, 12vw, 88px);
  line-height: 1;
}
.result-count span { font-size: 20px; }
.result-range { margin: 0 0 16px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.stat { padding: 10px 12px; background: var(--color-surface-alt); border-radius: 10px; }
.stat b { display: block; font-family: var(--font-mono); font-size: 18px; }
.stat b i { margin-right: 6px; color: var(--color-accent); font-size: 14px; }
.stat small { color: var(--color-muted); font-size: 12px; }

/* Frise des épisodes */
.timeline {
  display: flex;
  height: 22px;
  overflow: hidden;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
.timeline-episode { display: flex; min-width: 2px; background: var(--color-accent); border-right: 2px solid var(--color-surface); }
.segment-opening { background: var(--color-opening); }
.segment-content { flex: 1; }
.segment-ending { background: var(--color-ending); }
.timeline-margin {
  background: repeating-linear-gradient(45deg, var(--color-accent-soft), var(--color-accent-soft) 4px, transparent 4px, transparent 8px);
}

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 16px; color: var(--color-muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.legend-opening { background: var(--color-opening); }
.legend-content { background: var(--color-accent); }
.legend-ending { background: var(--color-ending); }
.legend-margin { border: 1px solid var(--color-border); }

/* Liste des épisodes */
.episode-list { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.episode-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--color-border);
}
.episode-list li:last-child { border-bottom: 0; }
.episode-list time { color: var(--color-muted); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.episode-list .episode-list-gap { justify-content: center; color: var(--color-muted); }
.season-tag {
  margin-left: 6px;
  padding: 1px 6px;
  color: var(--color-muted);
  font-size: 11px;
  background: var(--color-surface-alt);
  border-radius: 4px;
}

.note { margin: 14px 0 0; color: var(--color-muted); font-size: 14px; }
.note-done { color: var(--color-success); font-weight: 500; }

@media (prefers-reduced-motion: no-preference) {
  .result h2 { animation: rise .25s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } }
}

/* ---------- Fiche de l'anime ---------- */

.details-head { display: flex; align-items: flex-start; gap: 16px; }
.details-head h3 { margin: 0 0 4px; font-size: 18px; }
.cover-button { flex: none; padding: 0; background: none; border: 0; border-radius: 8px; cursor: zoom-in; }
.cover-button img {
  display: block;
  width: 96px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--color-surface-alt);
  border-radius: 8px;
}
.original-titles { margin: 0 0 8px; color: var(--color-muted); font-size: 13px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li { padding: 2px 8px; color: var(--color-muted); font-size: 12px; background: var(--color-surface-alt); border-radius: 999px; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 16px 0;
}
.facts div { padding: 8px 10px; background: var(--color-surface-alt); border-radius: 10px; }
.facts dt { color: var(--color-muted); font-size: 12px; }
.facts dt i { margin-right: 4px; color: var(--color-accent); }
.facts dd { margin: 0; font-weight: 500; }

.seasons-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.seasons-table th, .seasons-table td { padding: 6px 4px; text-align: left; border-bottom: 1px dashed var(--color-border); }
.seasons-table th { color: var(--color-muted); font-size: 12px; font-weight: 500; }
.seasons-table td:not(:first-child), .seasons-table th:not(:first-child) { text-align: right; white-space: nowrap; }

.source-note { margin: 10px 0 0; color: var(--color-muted); font-size: 12px; }
.source-note a { color: inherit; }

/* Synopsis : français ou original */
.synopsis-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 8px; }
.synopsis-head h4 { margin: 0; color: var(--color-muted); font-size: 14px; font-weight: 500; }
.synopsis { margin: 0 0 12px; font-size: 14px; white-space: pre-line; }
.synopsis-note { margin: -4px 0 12px; color: var(--color-muted); font-size: 12px; }

.language-toggle {
  display: inline-flex;
  padding: 2px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}
.language-toggle button {
  padding: 4px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--color-muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.language-toggle button[aria-pressed="true"] { background: var(--color-accent-soft); color: var(--color-accent); font-weight: 700; }

/* ---------- Affiche en grand ---------- */

.cover-modal {
  max-width: min(92vw, 520px);
  max-height: 92vh;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
}
.cover-modal::backdrop { background: rgba(10, 8, 14, .78); }
.cover-modal img {
  display: block;
  max-width: 100%;
  max-height: 92vh;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  cursor: zoom-out;
}
.cover-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
}
.cover-close:hover { color: var(--color-accent); }
