/* bibliotheque.css — Écran Bibliothèque (audit §10 : sorti du <style> inline) */

.lib2-wrap { max-width: 1200px; margin: 0 auto; padding: 24px 20px 80px; }
.lib2-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:18px; }
.lib2-head h1 { font-family: var(--font-head); font-size: 26px; font-weight: 700; }
.lib2-tabs { display:flex; gap:4px; background:var(--glass-bg); -webkit-backdrop-filter:var(--glass-blur); backdrop-filter:var(--glass-blur); border:1px solid var(--glass-border); box-shadow:var(--glass-inner); border-radius:12px; padding:4px; }
.lib2-tab { padding:8px 16px; border-radius:8px; font-size:13px; color:var(--text2); font-weight:500; position:relative; transition:color var(--transition), background var(--transition); }
.lib2-tab:hover { color:var(--text); }
.lib2-tab.active { background:var(--accent); color:#fff; box-shadow:0 1px 3px color-mix(in srgb, var(--accent) 40%, transparent); }
/* Compteur discret sur un onglet (Téléchargements) */
.lib2-tab .tab-count { display:inline-block; margin-left:6px; font-size:11px; font-weight:700; background:var(--bg4); color:var(--text2); padding:1px 6px; border-radius:9px; }
.lib2-tab.active .tab-count { background:rgba(255,255,255,.25); color:#fff; }
.lib2-toolbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:18px; }
.lib2-search { flex:1; min-width:200px; background:var(--bg3); border:1px solid var(--border2); color:var(--text); padding:9px 14px; border-radius:9px; font-size:13px; }
.lib2-search:focus { outline:none; border-color:var(--orange); }
.lib2-sort { background:var(--bg3); border:1px solid var(--border2); color:var(--text); padding:9px 12px; border-radius:9px; font-size:12.5px; }

/* Bascule Grille / Liste */
.lib2-view { display:inline-flex; background:var(--bg3); border:1px solid var(--border2); border-radius:9px; padding:2px; gap:2px; }
.lib2-view button { display:inline-flex; align-items:center; justify-content:center; width:32px; height:30px; border:none; background:none; color:var(--text2); border-radius:7px; cursor:pointer; transition:color var(--transition), background var(--transition); }
.lib2-view button:hover { color:var(--text); }
.lib2-view button.on { background:var(--accent); color:#fff; box-shadow:0 1px 3px color-mix(in srgb, var(--accent) 40%, transparent); }

.lib2-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(140px,1fr)); gap:16px; }
.lib2-grid.lib2-grid--compact { grid-template-columns:repeat(auto-fill, minmax(96px,1fr)); gap:10px; }
.lib2-grid--compact .lib2-title { font-size:11px; }
.lib2-grid--compact .lib2-sub, .lib2-grid--compact .lib2-cat { display:none; }
.lib2-card { position:relative; cursor:pointer; transition:transform .28s var(--ease-out); }
.lib2-cover { aspect-ratio:3/4; border-radius:var(--radius); overflow:hidden; background:var(--bg4); position:relative; box-shadow:var(--shadow-1); transition:box-shadow .28s var(--ease-out); }
.lib2-cover img { width:100%; height:100%; object-fit:cover; transition:transform .5s var(--ease-out); }
.lib2-grid .lib2-card:hover { transform:translateY(-4px); }
.lib2-grid .lib2-card:hover .lib2-cover { box-shadow:var(--shadow-3); }
.lib2-grid .lib2-card:hover .lib2-cover img { transform:scale(1.06); }
.lib2-badge { position:absolute; top:8px; left:8px; background:var(--hanko); color:#fff; font-size:11px; font-weight:700; padding:3px 8px; border-radius:20px; box-shadow:0 2px 8px rgba(0,0,0,.4); z-index:4; }
/* si un badge de statut occupe déjà le coin haut-gauche, on descend le compteur */
.lib2-status + .lib2-badge, .lib2-status ~ .lib2-badge { top:34px; }
.lib2-pin { position:absolute; bottom:8px; right:8px; width:30px; height:30px; border-radius:9px; border:none; background:rgba(0,0,0,.55); color:#fff; cursor:pointer; opacity:0; transform:translateY(4px); transition:opacity .14s, transform .14s, background .14s; backdrop-filter:blur(2px); display:flex; align-items:center; justify-content:center; }
.lib2-card:hover .lib2-pin { opacity:.9; transform:translateY(0); }
.lib2-pin:hover { background:rgba(0,0,0,.8); }
.lib2-pin.on { opacity:1; transform:translateY(0); background:var(--orange); box-shadow:0 2px 8px rgba(0,0,0,.4); }
.lib2-del { position:absolute; bottom:8px; right:44px; width:30px; height:30px; border-radius:9px; border:none; background:rgba(0,0,0,.55); color:#fff; font-size:13px; line-height:1; cursor:pointer; opacity:0; transform:translateY(4px); transition:opacity .14s, transform .14s, background .14s; backdrop-filter:blur(2px); }
.lib2-card:hover .lib2-del { opacity:.9; transform:translateY(0); }
.lib2-del:hover { background:#ef4444; opacity:1; }
/* Signet : indicateur qu'un passage est marqué (audit §10.3) */
.lib2-bm { position:absolute; top:6px; right:8px; color:#fbbf24; filter:drop-shadow(0 1px 2px rgba(0,0,0,.6)); pointer-events:none; }
.lib2-badge + .lib2-bm { top:36px; }
.ic-btn { display:inline-flex; align-items:center; gap:6px; }
.ic-btn svg { flex-shrink:0; }
.lib2-progress { position:absolute; left:0; right:0; bottom:0; height:4px; background:rgba(0,0,0,.45); }
.lib2-progress-fill { height:100%; background:var(--orange); transition:width .3s; }
.lib2-title { font-size:12.5px; font-weight:500; margin-top:7px; line-height:1.3; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.lib2-sub { font-size:11px; color:var(--text3); margin-top:2px; }
.lib2-empty { text-align:center; padding:70px 20px; color:var(--text3); }
.lib2-empty .ico { font-size:48px; margin-bottom:10px; }

/* Filtres (statuts / catégories) */
.lib2-filters { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; align-items:center; width:100%; }
.lib2-chip { padding:6px 13px; border-radius:20px; font-size:12.5px; background:var(--bg3); border:1px solid var(--border2); color:var(--text2); cursor:pointer; font-weight:500; transition:all .12s; }
.lib2-chip:hover { color:var(--text); border-color:var(--text3); }
.lib2-chip.on { background:var(--accent); border-color:var(--accent); color:#fff; box-shadow:0 1px 3px color-mix(in srgb, var(--accent) 38%, transparent); }
.lib2-chip .cnt { opacity:.85; margin-left:5px; font-size:11px; }
/* Audit QUAL-05 : sur une pastille active le fond devient l'accent ; l'opacité
   ramenait le compteur à 3,79:1. Sur ce fond-là, le blanc plein (4,65:1). */
.lib2-chip.on .cnt, .lib2-chip.active .cnt,
.lib2-kind.on .cnt, .lib2-kind.active .cnt { opacity:1; color:#fff; }
.lib2-chip-add { color:var(--text3); border-style:dashed; }
.lib2-status { position:absolute; top:8px; left:8px; font-size:9px; font-weight:700; padding:2px 7px; border-radius:5px; text-transform:uppercase; letter-spacing:.03em; color:#fff; }
.lib2-kind-badge { position:absolute; bottom:8px; left:8px; font-size:8.5px; font-weight:800; padding:2px 6px; border-radius:5px; letter-spacing:.04em; color:#fff; background:var(--ai); box-shadow:0 2px 6px rgba(0,0,0,.4); }
.lib2-cat { font-size:10px; color:var(--text3); margin-top:1px; }

/* Segment Mangas / Romans */
.lib2-kinds { display:inline-flex; background:var(--bg3); border:1px solid var(--border2); border-radius:20px; padding:3px; gap:2px; margin-right:6px; }
.lib2-kind { padding:5px 14px; border-radius:18px; font-size:12.5px; font-weight:600; color:var(--text2); background:none; border:none; cursor:pointer; transition:all .12s; }
.lib2-kind:hover { color:var(--text); }
.lib2-kind.on { background:var(--accent); color:#fff; box-shadow:0 1px 3px color-mix(in srgb, var(--accent) 38%, transparent); }
.lib2-kind .cnt { opacity:.85; margin-left:5px; font-size:11px; }

/* Rangée « Reprendre où j'en étais » (audit §10.3) */
.lib2-resume { margin-bottom:22px; }
.lib2-section-head { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.lib2-section-head h2 { font-family:var(--font-head); font-size:15px; font-weight:700; color:var(--text); }
.lib2-section-head .bar { width:3px; height:16px; background:var(--orange); border-radius:2px; }
.lib2-resume-row { display:flex; gap:12px; overflow-x:auto; padding-bottom:6px; scrollbar-width:thin; }
.lib2-resume-card { flex:0 0 118px; width:118px; position:relative; }
.lib2-resume-card .lib2-cover { border-radius:9px; }
.lib2-resume-card .lib2-title { font-size:11.5px; -webkit-line-clamp:1; margin-top:5px; }
.lib2-resume-card .lib2-sub { font-size:10px; }

/* Vue Liste (symétrique du catalogue) — réutilise le même DOM de carte que la grille */
.lib2-list { display:flex; flex-direction:column; gap:8px; }
.lib2-list .lib2-card { display:flex; align-items:center; gap:14px; padding:9px 12px; background:var(--bg2); border:1px solid var(--border); border-radius:11px; }
.lib2-list .lib2-card:hover { border-color:var(--orange); }
.lib2-list .lib2-cover { width:46px; height:62px; flex:0 0 46px; border-radius:7px; }
.lib2-list .lib2-info { flex:1; min-width:0; }
.lib2-list .lib2-title { margin-top:0; -webkit-line-clamp:1; font-size:14px; }
.lib2-list .lib2-sub, .lib2-list .lib2-cat { display:block; }

/* Mode sélection multiple + barre d'actions groupées (audit §10.3) */
.lib2-card.selectable { cursor:pointer; }
.lib2-check { position:absolute; top:8px; left:8px; width:22px; height:22px; border-radius:6px; border:2px solid #fff; background:rgba(0,0,0,.45); z-index:2; display:flex; align-items:center; justify-content:center; color:#fff; font-size:14px; }
.lib2-card.selected .lib2-cover { outline:3px solid var(--orange); outline-offset:-1px; }
.lib2-card.selected .lib2-check { background:var(--orange); border-color:var(--orange); }
.lib2-bulkbar { position:fixed; left:50%; transform:translateX(-50%); bottom:18px; z-index:50; display:flex; align-items:center; gap:10px; background:var(--glass-bg); -webkit-backdrop-filter:var(--glass-blur); backdrop-filter:var(--glass-blur); border:1px solid var(--glass-border); box-shadow:var(--glass-inner), var(--shadow-3); border-radius:16px; padding:10px 14px; }
.lib2-bulkbar .count { font-weight:700; font-size:13px; }
.lib2-bulkbar.hidden { display:none; }

/* Updates list (partagée avec Signets / Téléchargements) */
.upd-row { display:flex; align-items:center; gap:14px; padding:12px; background:var(--bg2); border:1px solid var(--border); border-radius:11px; margin-bottom:10px; transition:border-color .15s; }
.upd-row:hover { border-color:var(--orange); }
.upd-cover { width:52px; height:70px; border-radius:7px; overflow:hidden; flex-shrink:0; background:var(--bg4); }
.upd-cover img { width:100%; height:100%; object-fit:cover; }
.upd-info { flex:1; min-width:0; }
.upd-name { font-size:14px; font-weight:600; }
.upd-meta { font-size:12px; color:var(--text2); margin-top:3px; }
.upd-new { background:rgba(34,197,94,.15); color:var(--green); font-size:10.5px; font-weight:700; padding:2px 8px; border-radius:5px; }


/* ── MOB-01 / MOB-02 : la bibliothèque au doigt ──────────────
   Aucune media query n'existait dans ce fichier. Les onglets de vue
   (Bibliothèque · Mises à jour · Signets · Téléchargements) forment une
   rangée de 406 px : sur un écran de 375, la page débordait de 51 px.
   Ils défilent désormais au lieu d'élargir la page — la même réponse que
   pour les onglets du profil, et la seule qui garde les quatre vues
   ATTEIGNABLES. */
@media (max-width: 640px) {
  .lib2-tabs {
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
  }
  .lib2-tabs::-webkit-scrollbar { display: none; }
  .lib2-tab {
    white-space: nowrap;
    flex: 0 0 auto;
    min-height: 44px;      /* MOB-02 : 34 px auparavant */
    display: flex; align-items: center;
  }
  .lib2-head { flex-wrap: wrap; gap: 10px; }
}

/* ══ Échelle de colonnes TACTILE (audit IX.5) ═══════════
   `auto-fill minmax(140px, 1fr)` donne DEUX colonnes sur un écran de 375 px.
   La bibliothèque est justement l'écran où l'on cherche une série qu'on
   possède déjà : plus il en tient à l'œil, plus vite on la trouve. */
@media (hover: none) and (max-width: 420px) {
  .lib2-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .lib2-grid.lib2-grid--compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .lib2-list, .lib2-grid.lib2-list { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) and (min-width: 421px) and (max-width: 767px) {
  .lib2-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .lib2-grid.lib2-grid--compact { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .lib2-list, .lib2-grid.lib2-list { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) and (min-width: 768px) and (max-width: 1024px) {
  .lib2-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
  .lib2-list, .lib2-grid.lib2-list { grid-template-columns: minmax(0, 1fr); }
}

/* ── Filtres actifs de la bibliothèque ───────────────────────
   Même geste que le bloc « Filtres actifs » du catalogue : deux pages qui
   filtrent doivent se filtrer de la même façon, sinon on réapprend à chaque
   écran. Masqué tant que rien ne filtre. */
.lib2-resume {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 0 0 10px;
}
.lib2-resume-label {
  font-size: 11.5px; color: var(--text3); text-transform: uppercase;
  letter-spacing: .04em; margin-right: 2px;
}
.lib2-resume-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  background: color-mix(in srgb, var(--orange) 12%, transparent);
  border: 1px solid var(--orange); border-radius: 999px;
  color: var(--orange); font: inherit; font-size: 12px; cursor: pointer;
}
.lib2-resume-chip:hover { background: var(--orange); color: #fff; }
.lib2-resume-tout {
  background: none; border: none; padding: 4px 6px;
  color: var(--text3); font: inherit; font-size: 12px;
  text-decoration: underline; cursor: pointer;
}
.lib2-resume-tout:hover { color: var(--text); }

@media (pointer: coarse) {
  .lib2-resume-chip, .lib2-resume-tout { min-height: 38px; padding: 8px 12px; }
}
