/**
 * Docs — styles contenu uniquement (modales, listings, jamdown, drag-drop).
 * Layout, header, thème clair/sombre : staff shell (staff-shell.css).
 */

/* Arborescence docs — dans settings-tabs (pas de double encadré) */
.docs-tree-panel {
    padding: 4px 0;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.docs-tree-panel .tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-tree-panel .tree li {
    position: relative;
    padding-left: 20px;
}
.docs-tree-panel .tree li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    opacity: 0.5;
}
.docs-tree-panel .tree li:last-child::before {
    height: 50%;
}
.docs-tree-panel .tree li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 12px;
    height: 1px;
    background: var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    opacity: 0.5;
}
.docs-tree-panel .tree ul {
    position: relative;
    margin: 0;
    padding: 0;
    padding-left: 20px;
}
.docs-tree-panel .tree ul::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    opacity: 0.5;
}
.docs-tree-panel .tree a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--clairval-glass-text-muted, #a0a0a0);
    text-decoration: none;
    font-size: 13px;
    margin-left: -20px;
    padding-left: 28px;
}

.docs-tree-panel .tree a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--clairval-glass-text, #e8dcc8);
}

.docs-tree-panel .tree .active > a,
.docs-tree-panel .tree a.active {
    background: rgba(196, 117, 90, 0.15);
    color: var(--clairval-glass-accent, #c4755a);
}

.docs-tree-panel .tree a.folder-item {
    font-weight: 600;
}

.docs-tree-panel .tree a.doc-item {
    font-weight: 400;
    opacity: 0.9;
}

nav.breadcrumb {
    font-size: 13px;
    color: var(--clairval-glass-text-muted, #a0a0a0);
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}
nav.breadcrumb a {
    color: var(--clairval-glass-accent, #c4755a);
    text-decoration: none;
}

.list {
    border: 1px solid var(--clairval-glass-border, rgba(196, 117, 90, 0.18));
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}
.row {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    background: var(--clairval-glass-bg-solid, rgba(30, 29, 35, 0.5));
}
.row:last-child {
    border-bottom: none;
}
.row .title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.row .meta {
    color: var(--clairval-glass-text-muted, #a0a0a0);
    font-size: 12px;
}

.listing {
    border: 1px solid var(--clairval-glass-border, rgba(196, 117, 90, 0.18));
    border-radius: 10px;
    background: var(--clairval-glass-bg-solid, rgba(30, 29, 35, 0.5));
    width: 100%;
    box-sizing: border-box;
}
.listing .head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
}
.listing .items {
    margin: 0;
    padding: 6px 0;
    list-style: none;
}
.listing .items li {
    margin: 0;
}
.listing .items a {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    padding: 10px 12px;
    color: inherit;
    text-decoration: none;
}
.listing .items a:hover {
    background: rgba(255, 255, 255, 0.06);
}
.listing .items .t {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.listing .items .tag {
    color: var(--clairval-glass-text-muted, #a0a0a0);
    font-size: 12px;
}
.listing .items a.doc-link .t {
    color: var(--clairval-glass-text-muted, #a0a0a0);
    font-weight: 400;
}
.listing .items a.folder-link .t {
    color: var(--clairval-glass-text, #e8dcc8);
    font-weight: 600;
}

.search-results {
    margin-bottom: 24px;
}
.search-results h2 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
}
.search-count {
    color: var(--clairval-glass-text-muted, #a0a0a0);
    font-size: 13px;
    margin-bottom: 16px;
}

.doc-content {
    padding: 16px;
    background: var(--clairval-glass-bg-solid, rgba(30, 29, 35, 0.5));
    border: 1px solid var(--clairval-glass-border, rgba(196, 117, 90, 0.18));
    border-radius: 8px;
    margin-top: 12px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.doc-content .jamdown-content {
    font-size: 14px;
    line-height: 1.6;
    width: 100%;
    box-sizing: border-box;
}
.doc-content .jamdown-content p {
    margin: 0 0 1em 0;
}
.doc-content .jamdown-content p:last-child {
    margin-bottom: 0;
}
.doc-content .jamdown-content ul,
.doc-content .jamdown-content ol {
    margin: 1em 0;
    padding-left: 2em;
}
.doc-content .jamdown-content h1,
.doc-content .jamdown-content h2,
.doc-content .jamdown-content h3,
.doc-content .jamdown-content h4,
.doc-content .jamdown-content h5,
.doc-content .jamdown-content h6 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
}
.doc-content .jamdown-content h1:first-child,
.doc-content .jamdown-content h2:first-child,
.doc-content .jamdown-content h3:first-child,
.doc-content .jamdown-content h4:first-child,
.doc-content .jamdown-content h5:first-child,
.doc-content .jamdown-content h6:first-child {
    margin-top: 0;
}
.doc-content .jamdown-content blockquote {
    margin: 1em 0;
    padding-left: 1em;
    border-left: 3px solid var(--clairval-glass-accent, #c4755a);
    color: var(--clairval-glass-text-muted, #a0a0a0);
}
.doc-content .jamdown-content hr {
    margin: 1.5em 0;
    border: none;
    border-top: 1px solid var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
}

/* Drag & drop */
.draggable-item,
.draggable-node {
    cursor: move;
    user-select: none;
}
.draggable-item.dragging,
.draggable-node.dragging {
    opacity: 0.5;
    background: rgba(196, 117, 90, 0.12) !important;
}
.draggable-item:hover,
.draggable-node:hover {
    background: rgba(196, 117, 90, 0.06);
}
.draggable-list > .draggable-item:not(.dragging),
.draggable-tree > .draggable-node:not(.dragging) {
    transition: background 0.2s;
}

/* Authentification header docs */
#auth-header,
#mobile-auth-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.auth-visitor {
    display: flex;
    align-items: center;
    gap: 12px;
}
.visitor-text {
    color: var(--clairval-glass-text-muted, #a0a0a0);
    font-size: 13px;
}
.auth-btn,
.auth-user .logout-btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid;
    font-family: inherit;
    box-sizing: border-box;
    white-space: nowrap;
    line-height: 1;
}
.auth-btn {
    background: var(--clairval-glass-accent, #c4755a);
    color: #fff;
    border-color: var(--clairval-glass-accent, #c4755a);
}
.auth-btn:hover {
    filter: brightness(1.1);
}
.auth-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}
.auth-user span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.auth-user .pseudo {
    font-weight: 600;
    color: var(--clairval-glass-accent, #c4755a);
}
.auth-user .logout-btn {
    background: transparent;
    border-color: var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    color: var(--clairval-glass-text-muted, #a0a0a0);
}
.auth-user .logout-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--clairval-glass-text, #e8dcc8);
}

/* Modale de connexion docs */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.login-modal.active {
    display: flex;
}
.login-modal-content {
    background: var(--clairval-glass-bg-solid, rgba(30, 29, 35, 0.95));
    border: 1px solid var(--clairval-glass-border, rgba(196, 117, 90, 0.18));
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--clairval-glass-shadow, 0 4px 32px rgba(0, 0, 0, 0.35));
}
.login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.login-modal-header h2 {
    margin: 0;
    font-size: 20px;
}
.login-modal-close {
    background: none;
    border: none;
    color: var(--clairval-glass-text-muted, #a0a0a0);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}
.login-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--clairval-glass-text, #e8dcc8);
}
.login-form-group {
    margin-bottom: 16px;
}
.login-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
}
.login-form-group input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.login-form-group input:focus {
    outline: none;
    border-color: var(--clairval-glass-accent, #c4755a);
    box-shadow: 0 0 0 2px rgba(196, 117, 90, 0.2);
}
.login-error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    display: none;
}
.login-error.active {
    display: block;
}
.login-submit {
    width: 100%;
    padding: 12px;
    background: var(--clairval-glass-accent, #c4755a);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.login-submit:hover {
    filter: brightness(1.1);
}
.login-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile — barre de recherche repliable */
.mobile-search-bar {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    padding: 12px;
    background: var(--clairval-glass-bg-solid, rgba(30, 29, 35, 0.95));
    border-bottom: 1px solid var(--clairval-glass-border, rgba(196, 117, 90, 0.18));
    z-index: 998;
    display: none;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}
.mobile-search-bar.active {
    display: block;
    transform: translateY(0);
}
.mobile-search-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
.mobile-search-input:focus {
    border-color: var(--clairval-glass-accent, #c4755a);
    box-shadow: 0 0 0 2px rgba(196, 117, 90, 0.2);
}
.mobile-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.2s;
    color: inherit;
}
.mobile-auth-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}
.logout-btn-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: var(--clairval-glass-text-muted, #a0a0a0);
    transition: all 0.2s;
}
.logout-btn-mobile:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--clairval-glass-text, #e8dcc8);
}
.docs-settings-extra {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--clairval-glass-border-subtle, rgba(196, 117, 90, 0.12));
}
