/* Bibliothek: Dokumentkarten, Vorschaubilder, Sammlungen, Themen, Fächer, Auswahl und Arbeitsblatt-Korb
   Teil der App-Oberfläche; Reihenfolge der Dateien siehe templates/_head.html. Aus app.css nach Bereichen aufgeteilt. */


/* ── layout ── */
.topics{flex:1;overflow-y:auto;margin:0 -4px;padding:0 4px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.12) transparent;}
.topic-link .dot{width:7px;height:7px;border-radius:50%;flex-shrink:0;}
.topic-link.side-ausgeblendet{margin-top:6px;opacity:.75;font-style:italic;}

/* ── filters ── */
.toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:14px;}
.filter-input i{color:var(--faint);font-size:17px;}
.seg button i{font-size:16px;}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:16px;}
.chip .dot{width:7px;height:7px;border-radius:50%;}

/* ── doc cards ── */
.docs{display:grid;grid-template-columns:repeat(auto-fill,minmax(310px,1fr));gap:14px;}
.docs.list{grid-template-columns:1fr;gap:8px;}
.doc{position:relative;display:flex;flex-direction:column;padding:16px 16px 14px;cursor:pointer;transition:transform .15s,box-shadow .15s,border-color .15s;}
.doc-head{display:flex;align-items:flex-start;gap:12px;}
.ftype{width:40px;height:48px;border-radius:7px 12px 7px 7px;display:flex;align-items:flex-end;justify-content:center;padding-bottom:6px;font-size:9.5px;font-weight:700;letter-spacing:.04em;flex-shrink:0;position:relative;text-transform:uppercase;}
.ftype::before{content:'';position:absolute;top:0;right:0;width:12px;height:12px;border-bottom-left-radius:5px;background:rgba(255,255,255,.55);}
.doc-titles{flex:1;min-width:0;}
.doc-title{font-weight:600;font-size:14px;color:var(--ink);line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.doc-file{font-size:11.5px;color:var(--faint);margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sel-btn i{font-size:16px;}
.doc-summary{font-size:12.8px;color:var(--muted);line-height:1.55;margin:11px 0 12px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;max-height:calc(1.55em * 3);}
.doc .tags{margin-top:auto;}
.doc-summary.pending{font-style:italic;color:var(--faint);}
.tags{display:flex;flex-wrap:wrap;gap:5px;}
.tag .dot{width:6px;height:6px;border-radius:50%;}
.doc-foot{display:flex;align-items:center;gap:6px;margin-top:12px;padding-top:11px;border-top:1px dashed var(--line);}
.doc-foot .date{font-size:11.5px;color:var(--faint);margin-right:auto;}
.mini i{font-size:15px;}
.docs.list .doc{flex-direction:row;align-items:center;gap:14px;padding:11px 14px;}
.docs.list .doc-head{flex:1;min-width:0;align-items:center;}
.docs.list .ftype{width:32px;height:38px;font-size:8.5px;padding-bottom:4px;}
.docs.list .doc-summary{display:none;}
.docs.list .doc-foot{margin:0;padding:0;border:none;}
.docs.list .tags{flex-wrap:nowrap;}
.docs.list .doc-title{-webkit-line-clamp:1;}
.docs.list .sel-btn{order:-1;}
.skeleton{background:linear-gradient(90deg,var(--bg-2) 0%,var(--surface-2) 50%,var(--bg-2) 100%);background-size:200% 100%;animation:sk 1.3s linear infinite;border-radius:var(--r);height:168px;border:1px solid var(--line);}

/* ── themes ── */
.themes{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px;}
.theme .bar{position:absolute;left:0;top:0;bottom:0;width:4px;}
.theme .big{font-family:var(--serif);font-size:34px;font-weight:400;line-height:1;color:var(--ink);font-variant-numeric:tabular-nums;}
.theme h4{font-family:var(--serif);font-weight:500;font-size:15.5px;color:var(--ink);margin-top:auto;padding-top:14px;line-height:1.25;}
.theme p{font-size:11.5px;color:var(--muted);margin-top:4px;}
.theme .mini-bars{display:flex;gap:3px;margin-top:8px;height:5px;border-radius:99px;overflow:hidden;background:var(--bg-2);}
.theme .mini-bars span{height:100%;}

/* ── generator ── */
.src .ftype{width:26px;height:31px;font-size:7.5px;padding-bottom:3px;}

/* ── selection tray ── */
.tray{position:fixed;left:50%;bottom:22px;transform:translate(-50%,calc(100% + 40px));visibility:hidden;z-index:40;display:flex;align-items:center;gap:10px;padding:8px 8px 8px 18px;border-radius:16px;background:var(--ink);color:var(--bg);box-shadow:var(--shadow-lg);transition:transform .3s cubic-bezier(.2,.9,.3,1.2),visibility .3s;max-width:calc(100vw - 32px);}
.tray.show{transform:translate(-50%,0);visibility:visible;}
.tray .count{font-size:13.5px;white-space:nowrap;}
.tray .count b{font-family:var(--serif);font-size:18px;margin-right:2px;}

/* ── responsive ── */
@media (max-width:860px){
  .docs{grid-template-columns:1fr;}
  .docs.list .tags{display:none;}
}
@media (max-width:520px){
  .tray{padding-left:14px;gap:6px;}
  .tray .hide-s{display:none;}
}
/* ═════════ v2 additions ═════════ */

/* thumbnails */
.thumb{position:relative;margin:-16px -16px 14px;height:150px;border-radius:var(--r) var(--r) 0 0;overflow:hidden;background:var(--bg-2);border-bottom:1px solid var(--line);}
.thumb img{width:100%;height:100%;object-fit:cover;object-position:top center;display:block;transition:transform .4s ease;}
.doc:hover .thumb img{transform:scale(1.03);}
.thumb.noimg{display:none;}
.thumb::after{content:'';position:absolute;inset:auto 0 0 0;height:36px;background:linear-gradient(transparent,color-mix(in srgb,var(--surface) 70%,transparent));pointer-events:none;}
.docs.list .thumb{display:none;}
.doc .ftype-sm{display:none;}
.doc.has-thumb .doc-head .ftype{width:32px;height:38px;font-size:8.5px;padding-bottom:4px;}
.star i{font-size:17px;}
.doc .actions{display:flex;gap:4px;flex-shrink:0;}
.tag-fav{background:var(--gold-soft);color:var(--gold-ink);}
.note-dot{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;color:var(--muted);}
.banner i{font-size:20px;}
.banner .grow{flex:1;}
.banner-gold{background:var(--gold-soft);color:var(--text);}
.banner-gold i{color:var(--gold-ink);}
.mode-chip{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;padding:3px 9px;border-radius:99px;background:var(--accent-soft);color:var(--accent);font-weight:500;}

/* collections */
.colls{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px;}
.coll{padding:18px;cursor:pointer;transition:all .18s;position:relative;overflow:hidden;text-align:left;display:flex;flex-direction:column;min-height:150px;}
.coll .stack{display:flex;margin-bottom:14px;height:46px;}
.coll .stack span{width:36px;height:46px;border-radius:6px 10px 6px 6px;border:2px solid var(--surface);margin-right:-12px;background-size:cover;background-position:top;box-shadow:var(--shadow-sm);}
.coll h4{font-family:var(--serif);font-weight:500;font-size:16.5px;color:var(--ink);}
.coll p{font-size:12px;color:var(--muted);margin-top:3px;}
.coll .bar{position:absolute;left:0;right:0;top:0;height:4px;}
.coll-new:hover{border-color:var(--accent);color:var(--accent);}
.coll-new i{font-size:26px;}
.coll-head{display:flex;align-items:flex-start;gap:14px;margin-bottom:18px;flex-wrap:wrap;}
.coll-head .sw{width:14px;height:14px;border-radius:4px;margin-top:9px;}
.coll-head h3{font-family:var(--serif);font-weight:500;font-size:24px;color:var(--ink);}
.coll-head p{font-size:13px;color:var(--muted);margin-top:2px;}
.coll-head .acts{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap;}

/* drawer v2 */
@media (max-width:860px){
  .thumb{height:130px;}
}
.docs > *{min-width:0;}
@media (max-width:860px){
  .docs{grid-template-columns:minmax(0,1fr);}
}
.coll .stack span{width:40px;height:52px;}
.coll .stack{height:52px;}

/* ═════════ v3: Fächer, Generator, Export ═════════ */
.tag-fach i{font-size:12px;}
.tag-fach small{opacity:.6;font-weight:500;margin-left:2px;}
.fach-chips{display:flex;flex-wrap:wrap;gap:6px;}
.fach-group + .fach-group{margin-top:22px;}
.fach-group .section-title h3{display:flex;align-items:center;gap:8px;}

/* Admin */
.tag-admin{background:var(--ink);color:var(--bg);font-size:10.5px;padding:1px 7px;}

/* Suche v5 */
.less-relevant .docs{margin-top:10px;opacity:.85;}

/* v6: Fokus, Schnellstart, mobile Aktionsleiste */
.nav-item:focus-visible,.topic-link:focus-visible{outline-color:#FFFFFF;}

/* v7: ein Fach / mehrere Fächer */
.ein-fach .doc-fach, .ein-fach #fFach{display:none!important;}
.lib-group{display:flex;align-items:center;gap:10px;margin:14px 0 2px;padding-bottom:8px;border-bottom:1px solid var(--line);}
.lib-group:first-child{margin-top:0;}
.lib-group i{font-size:20px;}
.lib-group h4{font-family:var(--serif);font-weight:500;font-size:18px;color:var(--ink);}
.lib-group .btn{margin-left:auto;}
.fach-fix{height:46px;display:flex;align-items:center;gap:12px;padding:0 14px;border:1px solid var(--line);border-radius:10px;background:var(--surface-2);font-size:14.5px;}
.fach-fix-name{display:flex;align-items:center;gap:8px;font-weight:500;color:var(--ink);}
.fach-fix .linkish{margin-left:auto;font-size:13px;}

/* Einstufung (KI) */
.tag-einst{background:var(--accent-soft);color:var(--accent);}
.tag-einst i{font-size:12px;}

/* Seitenleiste */
.topics{scrollbar-color:var(--line-2) transparent;}
.topic-link .dot{width:10px;height:10px;}

/* Dokumentkarten */
.docs{gap:20px;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));}
.doc{padding:18px 18px 14px;border-radius:var(--r);}
.doc-title{font-weight:700;font-size:15px;}
.sel-btn,.star{border-radius:999px;}
.sel-btn:hover{color:var(--accent);border-color:var(--accent);}
.tag{border-radius:999px;font-weight:600;font-size:11.5px;padding:4px 10px;}
.tag-niv{background:var(--accent-soft);color:var(--accent-deep);}
.tag-einst{background:var(--lilac);color:var(--sticker-ink);}
.doc-foot{border-top:1px solid var(--line);}
.ftype{border-radius:8px 12px 8px 8px;}
.theme,.coll{border-radius:var(--r);}
.theme .big{font-weight:600;}
.theme h4{font-family:var(--sans);font-weight:700;}

/* Galerie, Lightbox, Menüs, Dialoge */
.tray{border-radius:999px;background:var(--ink);color:var(--surface);}

/* ═════════ v12: Galerie für alle Materialien, Dokumentansicht, Fächer aufräumen ═════════ */
.fach-acts{display:inline-flex;gap:6px;margin-left:auto;flex-wrap:wrap;}
.fach-admin{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px;}
.fach-admin li{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 12px;border:1px solid var(--line);border-radius:14px;}
.fach-del-opts{margin:12px 0 10px;}

/* ═════════ v16: Unsortiert ═════════ */
.unsort-hint{display:flex;gap:12px;align-items:flex-start;background:var(--bg-2);border:1px dashed var(--line);border-radius:14px;padding:14px 16px;margin-bottom:4px;}
.unsort-hint > i{font-size:22px;color:var(--muted);margin-top:2px;}
.unsort-hint p{margin:4px 0 10px;color:var(--muted);font-size:13px;}
.unsort-hint .row{display:flex;gap:8px;flex-wrap:wrap;}

/* ── v18: Einfacher: Hilfe & Funktionen, „Mehr“ in der Navigation, Filter auf Wunsch ── */
#library .toolbar:not(.mehr) .xf{display:none;}

/* ── v19: Schule: Banner, Branding, Funktionsschalter ── */
.ohne-generator .nav-item[data-page="generator"],.ohne-generator .feat[data-arg="generator"],.ohne-generator .sel-btn,.ohne-generator #tray,.ohne-generator [data-sel],.ohne-generator .jetzt-gen,
.ohne-schulpool .nav-item[data-page="pool"],.ohne-schulpool .feat[data-arg="pool"]{display:none !important;}

/* ── v23: Aufgeräumte Infospalte der Dokumentansicht ── */
.share-pop .s{font-size:12.5px;color:var(--muted);margin-top:8px;}

/* Arbeitsblatt-Korb in der Kopfzeile */
.korb-btn{position:relative;display:inline-flex;align-items:center;gap:7px;height:38px;padding:0 14px 0 12px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--text);font:inherit;font-size:13px;font-weight:700;cursor:pointer;transition:border-color .15s,background .15s;}
.korb-btn:hover{border-color:var(--line-2);background:var(--surface-2);}
.korb-btn .ti{font-size:18px;color:var(--accent-strong);}
.korb-n{min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:var(--accent);color:var(--accent-ink);font-size:12px;font-weight:800;display:inline-grid;place-items:center;font-variant-numeric:tabular-nums;}
.korb-btn.bump{animation:korbBump .45s ease;}
@media (prefers-reduced-motion: reduce){
  .korb-btn.bump{animation:none;}
}
@media (max-width:640px){
  .korb-btn{padding:0 10px;}
  .korb-l{display:none;}
}
.tray .count .ti{color:var(--accent-strong);font-size:16px;vertical-align:-2px;}

/* ── Dokumente & Übersicht: Papierkorb auf Karten, großer Arbeitsblatt-Knopf, aufgeräumter Drawer ── */
.doc .sel-btn{width:auto;min-width:44px;height:44px;padding:0 16px;gap:7px;border-radius:999px;border:1.5px solid var(--accent);background:var(--accent-soft);color:var(--accent-deep);font:inherit;font-size:13.5px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;}
.doc .sel-btn i{font-size:19px;color:inherit;}
.doc .sel-btn:hover{background:var(--accent);color:var(--accent-ink);}
.doc.sel .sel-btn{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);}
.doc .doc-foot{flex-wrap:wrap;}
.doc .doc-foot .sel-btn{margin-left:auto;}
.doc .doc-foot .date{margin-right:0;}
.doc .doc-foot .mini{min-height:44px;}
.doc-del{width:36px;height:36px;border-radius:999px;border:1px solid transparent;background:none;display:grid;place-items:center;cursor:pointer;color:var(--faint);flex-shrink:0;transition:all .15s;}
.doc-del i{font-size:18px;}
.doc-del:hover,.doc-del:focus-visible{color:var(--red,#C0392B);background:var(--bg-2);}
@media (pointer: coarse){
  .doc-del,.doc .star{width:44px;height:44px;}
}
@media (max-width:640px){
  .doc .sel-txt{display:none;}
  .doc .sel-btn{width:44px;padding:0;}
  .doc .doc-foot .mini-t{display:none;}
  .doc .doc-foot .mini{width:44px;padding:0;justify-content:center;}
  .docs.list .doc{flex-wrap:wrap;}
}
.docs.list .doc .doc-foot{flex-wrap:nowrap;}
.docs.list .sel-btn{order:0;}

/* ── Fortschrittsstreifen (Hochladen/Einlesen) ── */
.st-doc .sel-btn{min-width:44px;min-height:44px;flex:none;}

/* ── Trefferkarte kompakt, „Daraus erstellen“ im Drawer ── */
.doc .doc-meta{font-size:11.5px;color:var(--muted);margin-top:auto;padding-top:10px;line-height:1.4;}
.doc .doc-foot{flex-wrap:nowrap;margin-top:8px;gap:8px;}
.doc .doc-foot .sel-btn{margin-left:auto;min-height:44px;}
@media (max-width:640px){
  .doc .sel-txt{display:inline;}
  .doc .sel-btn{width:auto;padding:0 16px;}
}

/* ── Assistent „Erstelle …“: Satz zum Anpassen + Material-Karten ── */
.doc .doc-foot .sel-btn{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);}
.doc .doc-foot .sel-btn:hover{background:var(--accent-strong);border-color:var(--accent-strong);}
.doc.sel .doc-foot .sel-btn{background:var(--accent-soft);color:var(--accent-deep);}
