/* Arborescence « C'est pas sorcier » — version moderne (s’appuie sur useful/software.css) */

.doc_public_subtitle {
    white-space: pre-line;
}

.doc_public_subtitle.doc_public_subtitle--html {
    white-space: normal;
}

.useful_title .doc_public_richtext p {
    margin: 0.35em 0;
}

.useful_title .doc_public_richtext p:first-child {
    margin-top: 0;
}

.useful_title .doc_public_richtext p:last-child {
    margin-bottom: 0;
}

.doc_tree_root {
    position: relative;
    margin-bottom: 28px;
    padding: 1.5rem 1.5rem 1.35rem;
    background: linear-gradient(165deg, #ffffff 0%, #f8f9fb 48%, #ffffff 100%);
    border-radius: 20px;
    border: 1px solid rgba(26, 29, 36, 0.06);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 14px 40px rgba(26, 29, 36, 0.07);
}

.doc_tree_root > h3 {
    margin-top: 0;
    margin-bottom: 1.1rem;
    padding-bottom: 0.85rem;
    font-size: 18px;
    font-weight: 700;
    color: #1a1d24;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    letter-spacing: -0.01em;
}

.doc_tree {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.doc_tree__node--branch {
    margin: 0;
    padding: 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(194, 42, 32, 0.1);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.doc_tree__node--branch:hover {
    border-color: rgba(194, 42, 32, 0.22);
    box-shadow: 0 8px 28px rgba(26, 29, 36, 0.06);
}

.doc_tree__folder {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    margin: 0;
    padding: 0.85rem 1rem 0.85rem 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #374151;
    background: linear-gradient(90deg, rgba(194, 42, 32, 0.08) 0%, rgba(194, 42, 32, 0.02) 55%, transparent 100%);
    border-left: 4px solid #c22a20;
}

.doc_tree__folder i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: linear-gradient(145deg, #fff 0%, #fff5f4 100%);
    color: #c22a20;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(194, 42, 32, 0.12);
}

.doc_tree--child {
    margin: 0;
    padding: 0.65rem 0.85rem 0.85rem;
    list-style: none;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

/* Le <li> ne fait qu’encadrer : toute la zone cliquable est le <a.doc_tree__row> */
.doc_tree__node--leaf {
    margin: 0 !important;
    padding: 0;
    list-style: none;
    background: transparent;
    border: none;
}

.doc_tree__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.65rem 0.85rem;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    color: #374151;
    text-decoration: none;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.15s ease;
}

.doc_tree__row:hover,
.doc_tree__row:focus-visible {
    border-color: rgba(194, 42, 32, 0.2);
    box-shadow: 0 6px 20px rgba(26, 29, 36, 0.07);
    transform: translateY(-1px);
    text-decoration: none;
}

.doc_tree__row:focus-visible {
    outline: 2px solid rgba(194, 42, 32, 0.45);
    outline-offset: 2px;
}

.doc_tree__row:hover .doc_tree__row_title,
.doc_tree__row:focus-visible .doc_tree__row_title {
    color: #a3221a;
}

.doc_tree__leaf {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.85em;
}

.doc_tree__row:hover .doc_tree__leaf,
.doc_tree__row:focus-visible .doc_tree__leaf {
    background: rgba(194, 42, 32, 0.1);
    color: #c22a20;
}

.doc_tree__leaf i {
    width: auto;
    text-align: center;
}

.doc_tree__row_title {
    flex: 1;
    min-width: 0;
    color: #c22a20;
    font-weight: 700;
}

.doc_tree__row_title--flex {
    color: #1f2937;
    font-weight: 600;
}

.doc_tree__row:hover .doc_tree__row_title--flex,
.doc_tree__row:focus-visible .doc_tree__row_title--flex {
    color: #111827;
}

.doc_tree__meta {
    margin-left: auto;
    padding: 0.2rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 999px;
}

.doc_tree__row:hover .doc_tree__meta,
.doc_tree__row:focus-visible .doc_tree__meta {
    background: rgba(194, 42, 32, 0.1);
    color: #c22a20;
}

/* Feuille seule (ex. compteur vidéos sans groupes) */
.doc_tree > .doc_tree__node--leaf .doc_tree__row {
    border: 1px solid rgba(194, 42, 32, 0.12);
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

.doc_tree > .doc_tree__node--leaf .doc_tree__leaf {
    background: rgba(194, 42, 32, 0.1);
    color: #c22a20;
}

.doc_tree > .doc_tree__node--leaf .doc_tree__row_title {
    color: #1f2937;
    font-weight: 600;
}

.doc_tree > .doc_tree__node--leaf .doc_tree__row:hover .doc_tree__row_title,
.doc_tree > .doc_tree__node--leaf .doc_tree__row:focus-visible .doc_tree__row_title {
    color: #111827;
}
