/* ========================================== */
/* SYSTÈME DE DOSSIERS VIRTUELS (folders.css) */
/* À ajouter à la fin de style.css            */
/* ========================================== */

/* --- PANNEAU ARBRE (dans le profil) --- */
.folders-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.folders-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.folders-panel-title {
    margin: 0;
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 600;
}

#btn-create-folder {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

#btn-create-folder:hover {
    background: var(--gold);
    color: var(--bg-color);
}

/* --- NŒUDS DE L'ARBRE --- */
#folder-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.folder-node {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 36px;
}

.folder-node:hover {
    background: var(--panel-light);
}

.folder-node.active {
    background: rgba(197, 160, 89, 0.12);
    border-left: 3px solid var(--gold);
}

.folder-node-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.folder-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.folder-name {
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-node.active .folder-name {
    color: var(--gold);
    font-weight: 600;
}

.folder-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--panel-light);
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
    flex-shrink: 0;
}

/* --- ACTIONS DES DOSSIERS (visibles au hover) --- */
.folder-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.folder-node:hover .folder-actions {
    opacity: 1;
}

.folder-action-btn {
    background: none;
    border: none;
    padding: 2px 5px;
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.folder-action-btn:hover {
    background: var(--border-color);
}

/* --- DROP HOVER (quand on drag une archive) --- */
.folder-drop-hover {
    background: rgba(197, 160, 89, 0.2) !important;
    border: 1px dashed var(--gold);
    border-radius: 6px;
}

/* --- MODALE "DÉPLACER VERS" --- */
#move-folder-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.move-folder-list {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.move-folder-option {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-main);
    transition: background 0.15s;
}

.move-folder-option:last-child {
    border-bottom: none;
}

.move-folder-option:hover {
    background: var(--panel-light);
}

.move-folder-option.current {
    background: rgba(197, 160, 89, 0.1);
    color: var(--gold);
    font-weight: 600;
}

/* --- BREADCRUMB --- */
.folder-breadcrumb {
    padding: 8px 12px;
    margin-bottom: 12px;
    background: var(--panel-light);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb-path {
    font-weight: 500;
}

/* --- TAGS SUR LES ARCHIVES --- */
.archive-tags {
    display: flex;
    gap: 5px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.archive-tag {
    background: rgba(197, 160, 89, 0.15);
    color: var(--gold);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* --- COTE / SOURCE (l'ADN archivistique) --- */
.archive-cote {
    display: inline-block;
    background: var(--panel-light);
    color: var(--text-muted);
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 8px;
    border: 1px solid var(--border-color);
    font-style: italic;
}

/* --- STATUS BADGES (nettoyage) --- */
.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-progress {
    background-color: #f39c12;
    color: white;
}

.status-error {
    background-color: #e74c3c;
    color: white;
}

/* --- ARCHIVE CARD : état draggable --- */
.archive-item[draggable="true"] {
    cursor: grab;
}

.archive-item[draggable="true"]:active {
    cursor: grabbing;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 850px) {
    .folders-panel {
        margin-bottom: 15px;
    }

    .folder-actions {
        opacity: 1; /* Toujours visible sur mobile (pas de hover) */
    }

    .folder-node {
        padding: 10px 12px;
    }

    /* Le panneau dossiers passe au-dessus de la liste */
    .profile-main-with-folders {
        display: flex;
        flex-direction: column;
    }
}

/* --- LAYOUT PROFIL AVEC DOSSIERS --- */
@media (min-width: 851px) {
    .profile-main-with-folders {
        display: grid;
        grid-template-columns: 240px 1fr;
        gap: 20px;
    }

    .folders-panel {
        position: sticky;
        top: 20px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
}

/* ========================================== */
/* MODALE DOSSIERS (Créer, Renommer, Supprimer)*/
/* Remplace les prompt() et confirm() natifs  */
/* ========================================== */

.folder-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 37, 58, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.folder-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.folder-modal-box {
    background: var(--panel-bg, #FFFFFF);
    border-radius: 16px;
    border: 1px solid var(--border-color, #E5E0D8);
    padding: 28px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(11, 37, 58, 0.2);
    position: relative;
    transform: translateY(-20px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.folder-modal-overlay.visible .folder-modal-box {
    transform: translateY(0) scale(1);
}

.folder-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted, #245B6D);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
}

.folder-modal-close:hover {
    background: var(--panel-light, #F0F4F7);
}

.folder-modal-title {
    font-family: 'Georgia', serif;
    font-size: 1.2rem;
    color: var(--text-main, #0B253A);
    margin: 0 0 16px 0;
    font-weight: 600;
}

.folder-modal-message {
    font-size: 0.95rem;
    color: var(--text-muted, #245B6D);
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.folder-modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color, #E5E0D8);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main, #0B253A);
    background: var(--bg-color, #F9F8F6);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.folder-modal-input:focus {
    border-color: var(--gold, #C5A059);
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.15);
}

.folder-modal-input::placeholder {
    color: var(--text-muted, #245B6D);
    opacity: 0.6;
}

.folder-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.folder-modal-btn {
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    border: none;
}

.folder-modal-cancel {
    background: var(--panel-light, #F0F4F7);
    color: var(--text-muted, #245B6D);
    border: 1px solid var(--border-color, #E5E0D8);
}

.folder-modal-cancel:hover {
    background: var(--border-color, #E5E0D8);
}

.folder-modal-confirm {
    background: var(--gold, #C5A059);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
}

.folder-modal-confirm:hover {
    background: var(--gold-hover, #b08d4a);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(197, 160, 89, 0.4);
}

.folder-modal-confirm.danger {
    background: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.folder-modal-confirm.danger:hover {
    background: #c0392b;
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}
