/* ════════════════════════════════════════════════════════════════════════
   Liseuse v2 — views.css : vues outils (stats, flashcards, reco, découvrir,
   maintenance). Cohérence absolue avec v2.css : tokens :root uniquement.
   « Bibliothèque de verre » — les cartes sont du verre profond violet.
   ════════════════════════════════════════════════════════════════════════ */

/* ───────────────── en-tête commun de vue ───────────────── */
.vhead {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px;
}
.vhead__titles { flex: 1; min-width: 0; }
.vhead__title {
  font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.1; margin: 0;
}
.vhead__sub { color: var(--text-2); font-size: 14.5px; margin: 5px 0 0; }
.vhead__refresh { flex-shrink: 0; }
.vhead__refresh svg { width: 18px; height: 18px; }

.vbody { display: flex; flex-direction: column; gap: 26px; }

/* ───────────────── états (chargement / vide / erreur / hors ligne) ───────────────── */
.vloading {
  display: grid; place-items: center; gap: 14px; padding: 54px 20px;
  color: var(--text-2); font-size: 14px; text-align: center;
}
.vloading__spin {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(139, 92, 246, .2); border-top-color: var(--acc);
  animation: spin .9s linear infinite;
}
.vloading__spin--inline { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: -3px; }

.vskel { display: grid; gap: 14px; }
.vskel__card {
  height: 84px; border-radius: var(--r-m); position: relative; overflow: hidden;
  background: var(--glass-1); border: 1px solid var(--stroke);
}
.vskel__card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .05) 50%, transparent 70%);
  animation: shimmer 1.6s infinite;
}

.vstate {
  display: grid; place-items: center; gap: 14px; text-align: center;
  padding: 52px 24px; border-radius: var(--r-l);
  background: var(--glass-1); border: 1px solid var(--stroke);
  color: var(--text-2); font-size: 14.5px;
}
.vstate__ico {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--acc-soft); color: var(--acc);
}
.vstate__ico svg { width: 26px; height: 26px; }
.vstate p { margin: 0; max-width: 42ch; line-height: 1.55; }
.vstate p b { color: var(--text); font-size: 16px; }
.vstate--err .vstate__ico { background: rgba(248, 113, 113, .14); color: var(--err); }
.vstate--offline .vstate__ico { background: rgba(251, 191, 36, .14); color: var(--warn); }
.vstate--empty .vstate__ico { background: var(--acc-soft); color: var(--acc); }

/* ═══════════════════════ STATISTIQUES ═══════════════════════ */
.stat-cards {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat-card {
  padding: 20px; border-radius: var(--r-l);
  background: var(--glass-2); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur-1); -webkit-backdrop-filter: var(--blur-1);
  box-shadow: var(--shadow-1);
}
.stat-card__ico {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--acc-soft); color: var(--acc); margin-bottom: 14px;
}
.stat-card__ico svg { width: 21px; height: 21px; }
.stat-card__val { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.stat-card__lbl { color: var(--text-3); font-size: 13px; margin-top: 7px; }

.stat-sec__title {
  font-family: var(--display); font-size: 20px; font-weight: 600; margin: 0 0 16px;
}
.topbooks { display: grid; gap: 15px; }
.topbook__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.topbook__title {
  font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbook__time { flex-shrink: 0; color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.topbook__bar { display: block; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.topbook__bar i {
  display: block; height: 100%; border-radius: 999px; background: var(--grad-acc);
  box-shadow: 0 0 10px rgba(139, 92, 246, .3);
}

.sess-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sess {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border-radius: var(--r-s);
  transition: background .15s var(--ease);
}
.sess:hover { background: var(--glass-1); }
.sess__title { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess__meta { flex-shrink: 0; color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ═══════════════════════ FLASHCARDS ═══════════════════════ */
.fc-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.fc-bar .btn svg { width: 18px; height: 18px; }

.fc-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.fc-card {
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px; border-radius: var(--r-l);
  background: var(--glass-2); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur-1); -webkit-backdrop-filter: var(--blur-1);
  box-shadow: var(--shadow-1); transition: all .2s var(--ease);
}
.fc-card:hover { border-color: var(--stroke-lit); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.fc-card__title {
  font-family: var(--display); font-size: 18px; font-weight: 600; line-height: 1.25; margin: 0 0 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fc-card__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; font-size: 13px; color: var(--text-3); }
.fc-card__due {
  padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 12px;
  background: var(--acc-soft); color: #d6c9ff; border: 1px solid rgba(139, 92, 246, .4);
}
.fc-card__ok { color: var(--ok); font-weight: 600; }
.fc-card__actions { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.fc-card__actions .btn { flex: 1; justify-content: center; }
.fc-card__actions .btn svg { width: 17px; height: 17px; }

/* création de deck depuis un livre */
.fc-creator {
  padding: 18px; border-radius: var(--r-l);
  background: var(--glass-2); border: 1px solid var(--stroke-lit); box-shadow: var(--shadow-2);
}
.fc-creator__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fc-creator__head b { flex: 1; font-family: var(--display); font-size: 16px; font-weight: 600; }
.fc-creator__label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; }
.fc-creator__label select { display: block; width: 100%; margin-top: 7px; min-height: 44px; }
.fc-creator__actions { display: flex; gap: 10px; }
.fc-creator__actions .btn svg { width: 18px; height: 18px; }
.fc-creator__status:not(:empty) { margin-top: 16px; }

/* mode révision plein panneau */
.fc-review {
  display: flex; flex-direction: column; gap: 20px;
  min-height: min(70vh, 560px);
}
.fc-review__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fc-review__count { color: var(--text-3); font-size: 14px; font-variant-numeric: tabular-nums; }
.fc-review__quit { min-height: 40px; }
.fc-review__stage { flex: 1; display: grid; gap: 16px; align-content: center; }
.fc-face {
  padding: clamp(24px, 5vw, 44px); border-radius: var(--r-xl); text-align: center;
  background: var(--glass-2); border: 1px solid var(--stroke-lit); box-shadow: var(--shadow-2);
}
.fc-face p { margin: 0; }
.fc-face--q p { font-family: var(--display); font-size: clamp(21px, 3.4vw, 28px); font-weight: 600; line-height: 1.35; }
.fc-face--a { background: var(--glass-1); animation: pop .18s var(--spring) both; }
.fc-face__lbl {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--acc); margin-bottom: 12px;
}
.fc-face--a p { font-family: var(--serif); font-size: clamp(17px, 2.6vw, 21px); line-height: 1.6; color: var(--text); }

.fc-review__foot { display: grid; gap: 12px; }
.fc-reveal { justify-content: center; min-height: 52px; font-size: 15.5px; }
.fc-grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fc-grade { justify-content: center; min-height: 52px; font-weight: 600; }
.fc-grade--again { border-color: rgba(248, 113, 113, .45); color: #fca5a5; }
.fc-grade--again:hover { background: rgba(248, 113, 113, .12); }
.fc-grade--good { border-color: rgba(139, 92, 246, .45); color: #c4b5fd; }
.fc-grade--good:hover { background: var(--acc-soft); }
.fc-grade--easy { border-color: rgba(52, 211, 153, .45); color: #6ee7b7; }
.fc-grade--easy:hover { background: rgba(52, 211, 153, .12); }

.fc-recap {
  display: grid; place-items: center; gap: 12px; text-align: center;
  margin: auto; padding: 40px 24px;
}
.fc-recap__ico {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: rgba(52, 211, 153, .14); color: var(--ok); margin-bottom: 6px;
}
.fc-recap__ico svg { width: 30px; height: 30px; }
.fc-recap h2 { font-family: var(--display); font-size: 26px; font-weight: 600; margin: 0; }
.fc-recap p { color: var(--text-2); margin: 0; }
.fc-recap__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 10px; }

/* ═══════════════════════ POUR VOUS (reco) ═══════════════════════ */
.reco-intro { color: var(--text-2); font-size: 14.5px; line-height: 1.6; max-width: 62ch; margin: -8px 0 22px; }
.reco-gen { min-height: 50px; }
.reco-gen svg { width: 18px; height: 18px; }

.reco-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.passage-card {
  position: relative; padding: 22px 20px 18px; border-radius: var(--r-l);
  background: var(--glass-2); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur-1); -webkit-backdrop-filter: var(--blur-1);
  box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 14px;
  transition: all .2s var(--ease);
}
.passage-card:hover { border-color: var(--stroke-lit); box-shadow: var(--shadow-2); }
.passage-card__mark { color: var(--acc); opacity: .55; }
.passage-card__mark svg { width: 22px; height: 22px; }
.passage-card__text {
  margin: 0; flex: 1; font-family: var(--serif); font-size: 15.5px; line-height: 1.65; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden;
}
.passage-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.passage-card__book {
  font-size: 12.5px; color: var(--text-3); font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.passage-card__open { flex-shrink: 0; min-height: 40px; padding: 0 14px; }
.passage-card__open svg { width: 16px; height: 16px; }

/* ═══════════════════════ RÉSUMÉS & POINTS FORTS ═══════════════════════ */
.resume-list { display: flex; flex-direction: column; gap: 10px; }
.resume-item {
  border-radius: var(--r-m);
  background: var(--glass-2); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur-1); -webkit-backdrop-filter: var(--blur-1);
  transition: border-color .2s var(--ease);
  overflow: hidden;
}
.resume-item:hover, .resume-item.is-open { border-color: var(--stroke-lit); }
.resume-item__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 14px 16px; background: none; border: none; cursor: pointer;
  text-align: left; color: var(--text); font: inherit;
}
.resume-item__title { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.resume-item__chevron { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3); transition: transform .2s var(--ease); }
.resume-item__head[aria-expanded="true"] .resume-item__chevron { transform: rotate(180deg); color: var(--acc); }
.resume-item__body { padding: 0 16px 16px; }
.resume-item__body p {
  margin: 0; font-family: var(--serif); font-size: 14.5px; line-height: 1.65; color: var(--text-2);
  white-space: pre-line;
}

/* ═══════════════════════ DÉCOUVRIR ═══════════════════════ */
.discover-sec + .discover-sec { margin-top: 4px; }
.discover-sec__head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.discover-sec__ico {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: var(--acc-soft); color: var(--acc);
}
.discover-sec__ico svg { width: 21px; height: 21px; }
.discover-sec__head h2 { font-family: var(--display); font-size: 20px; font-weight: 600; margin: 0; }
.discover-sec__head p { color: var(--text-3); font-size: 13px; margin: 3px 0 0; }

.discover-grid {
  display: grid; gap: 20px 14px;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.discover-card { display: block; text-align: left; width: 100%; }
.discover-card__cover {
  position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-1); transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.discover-card:hover .discover-card__cover,
.discover-card:focus-visible .discover-card__cover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-2), 0 18px 40px rgba(139, 92, 246, .16);
}
.discover-card__title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-family: var(--display); font-size: 14px; font-weight: 600; line-height: 1.3; margin: 10px 2px 2px;
}
.discover-card__author {
  display: block; color: var(--text-3); font-size: 12px; margin: 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════════════════════ MAINTENANCE ═══════════════════════ */
.maint-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.maint-bar .btn svg { width: 17px; height: 17px; }

.maint-list { display: grid; gap: 10px; }
.maint-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--r-m);
  background: var(--glass-2); border: 1px solid var(--stroke);
  transition: opacity .25s var(--ease), border-color .2s;
}
.maint-row:hover { border-color: var(--stroke-lit); }
.maint-row__ico {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: rgba(251, 191, 36, .14); color: var(--warn);
}
.maint-row__ico svg { width: 19px; height: 19px; }
.maint-row__info { flex: 1; min-width: 0; }
.maint-row__file {
  display: block; font-size: 14.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.maint-row__reason { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.maint-row__dismiss { flex-shrink: 0; min-height: 40px; padding: 0 16px; }

/* ═══════════════════════ RESPONSIVE ═══════════════════════ */
@media (max-width: 640px) {
  .vhead__title { font-size: 24px; }
  .fc-grid, .reco-grid { grid-template-columns: 1fr; }
  .discover-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 16px 11px; }
  .fc-grades { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr; }
}
