/* =========================================================
   THOMATHS — CARTE FEUILLE (liste des feuilles)
   Même langage visuel que la carte exercice : badge de type
   coloré, badge ID, titre serif, méta légère, actions à droite.
   Chargé après theme.css : surcharge l'ancien style de carte.
   Consomme uniquement les tokens (tokens.css).
   ========================================================= */

/* ---------- Carte ---------- */
.sheet-card {
    position: relative;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    margin-bottom: 12px;
    transition: border-color 0.12s, background 0.12s;
}
.sheet-card:hover { border-color: var(--border); }
.sh-body { padding: 14px 18px 12px; }

/* Poignée de déplacement : même agencement que .exo-drag-handle /
   .doc-block-drag-handle (bande sur tout le bord droit, icône 6 points). */
.sheet-card-drag-handle {
    position: absolute;
    right: -16px;
    top: 0;
    bottom: 0;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    cursor: grab;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s, background 0.12s;
    z-index: 1;
}
.sheet-card:hover .sheet-card-drag-handle { opacity: 1; }
.sheet-card-drag-handle:hover { color: var(--text); background: var(--surface-3); }
.sheet-card-drag-handle:active { cursor: grabbing; }
.sheet-card.dragging { opacity: 0.4; }

/* Neutralise l'ancien layout (editable-header n'existe plus dans la carte) */
.sheet-card .sheet-detail-chapter-row,
.sheet-card .sheet-footer { display: none; }

/* ---------- En-tête ---------- */
.sh-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Badge de type — couleur sémantique par kind */
.sh-kind {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    cursor: pointer;
    background: var(--surface-3);
    color: var(--text-muted);
}
.sh-kind-icon { width: 14px; height: 14px; object-fit: contain; flex: 0 0 auto; }
.sh-kind-cours    { background: var(--kind-cours-bg);       color: var(--kind-cours); }
.sh-kind-td       { background: var(--kind-td-bg);          color: var(--kind-td); }
.sh-kind-resume   { background: var(--kind-resume-bg);      color: var(--kind-resume); }
.sh-kind-dm       { background: var(--content-exercise-bg); color: var(--content-exercise); }
.sh-kind-ds       { background: rgba(217, 83, 79, 0.1);     color: var(--danger); }
.sh-kind-colle    { background: var(--kind-colle-bg);       color: var(--kind-colle); }
.sh-kind-programme-colle { background: var(--kind-programme-colle-bg); color: var(--kind-programme-colle); }
.sh-kind-oral     { background: var(--kind-oral-bg);        color: var(--kind-oral); }
.sh-kind-probleme { background: var(--kind-probleme-bg);    color: var(--kind-probleme); }
.sh-kind-banque   { background: var(--kind-banque-bg);      color: var(--kind-banque); }

/* Titre serif, comme la carte exercice */
.sh-title {
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    min-width: 0;
}

.sh-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.sh-flag {
    font-size: 0.68rem;
    color: var(--text-faint);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    white-space: nowrap;
}
.sh-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Boutons icône (TeX, Notes) — compacts */
.sh-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 0;   /* annule le min-width global de form.css */
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sh-icon-btn svg { width: 15px; height: 15px; }
.sh-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.sheet-notes-icon svg { color: var(--content-exercise); }

/* Flèche « ouvrir » */
.sheet-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sheet-open-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- Méta : chapitre + dates ---------- */
.sh-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-faint);
}
.sh-chapter {
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    cursor: pointer;
}
.sh-chapter:hover { border-color: var(--border); color: var(--text); }
.sh-chapter.sheet-chapter-empty { font-style: italic; color: var(--text-faint); }
.sh-dates { white-space: nowrap; }

/* Notes repliées (bloc existant, léger lifting) */
.sheet-card .sheet-notes-block { margin-top: 10px; }

/* Mode élève : rien d'éditable sur la carte feuille */
body.mode-eleve .sheet-title-edit,
body.mode-eleve .sh-chapter,
body.mode-eleve .sheet-chapter-inline-edit { pointer-events: none; }
body.mode-eleve .sh-kind { pointer-events: none; cursor: default; }
