/* =========================================================================
   ANAC eServices — Module de Gestion de Documents (GED)
   Styles intégrés au système de design ANAC (2026)
   ========================================================================= */

.doc-explorer-wrap {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* En-tête du module */
.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: var(--anac-surface);
    padding: 24px 28px;
    border-radius: 12px;
    border: 1px solid var(--anac-border);
    box-shadow: 0 2px 8px rgba(15, 44, 82, 0.04);
}

.doc-header-title h2 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    color: var(--anac-navy);
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-header-title p {
    margin: 0;
    color: var(--anac-muted);
    font-size: 14px;
}

.doc-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Barre d'outils et recherche */
.doc-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    background: var(--anac-surface);
    padding: 14px 20px;
    border-radius: 10px;
    border: 1px solid var(--anac-border);
}

.doc-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    flex-wrap: wrap;
}

.doc-crumb {
    color: var(--anac-muted-2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-weight: 500;
}

.doc-crumb:hover {
    color: var(--anac-link);
    text-decoration: underline;
}

.doc-crumb.is-active {
    color: var(--anac-ink);
    font-weight: 700;
}

.doc-crumb-sep {
    color: var(--anac-label);
    font-size: 12px;
}

.doc-search-form {
    position: relative;
    min-width: 260px;
}

.doc-search-input {
    width: 100%;
    padding: 8px 36px 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--anac-border-input);
    font-size: 14px;
    background: var(--anac-bg);
    transition: all 0.2s;
}

.doc-search-input:focus {
    background: #fff;
    border-color: var(--anac-link);
    outline: none;
    box-shadow: 0 0 0 3px rgba(29, 90, 158, 0.15);
}

.doc-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--anac-muted);
    cursor: pointer;
}

/* Grille principale : Arborescence à gauche + Contenu à droite */
.doc-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 22px;
    align-items: start;
}

@media (max-width: 991px) {
    .doc-layout {
        grid-template-columns: 1fr;
    }
}

/* Volet arborescence (gauche) */
.doc-sidebar-tree {
    background: var(--anac-surface);
    border: 1px solid var(--anac-border);
    border-radius: 12px;
    padding: 20px 16px;
    box-shadow: 0 2px 8px rgba(15, 44, 82, 0.04);
}

.doc-sidebar-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--anac-label);
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.anac-tree-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.anac-tree-item {
    position: relative;
    margin-bottom: 2px;
}

.anac-tree-row {
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: background 0.15s;
}

.anac-tree-row:hover {
    background: var(--anac-tint);
}

.anac-tree-row.is-active {
    background: rgba(29, 90, 158, 0.08);
}

.anac-tree-toggle {
    background: none;
    border: none;
    color: var(--anac-muted);
    width: 22px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.anac-tree-item.is-open > .anac-tree-row > .anac-tree-toggle {
    transform: rotate(90deg);
}

.anac-tree-spacer {
    width: 22px;
    display: inline-block;
}

.anac-tree-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    color: var(--anac-ink);
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.anac-tree-link.is-active {
    color: var(--anac-link);
    font-weight: 700;
}

.anac-tree-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
}

.anac-tree-badge {
    background: var(--anac-border);
    color: var(--anac-muted-2);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
}

.anac-tree-sub {
    display: none;
    padding-left: 18px;
    margin-top: 2px;
    border-left: 1px dashed var(--anac-border);
    margin-left: 10px;
}

.anac-tree-item.is-open > .anac-tree-sub {
    display: block;
}

/* Zone de contenu principale (droite) */
.doc-content-panel {
    background: var(--anac-surface);
    border: 1px solid var(--anac-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(15, 44, 82, 0.04);
    min-height: 480px;
}

.doc-section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--anac-muted-2);
    margin: 20px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-section-title:first-child {
    margin-top: 0;
}

/* Grille de dossiers */
.doc-folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.doc-folder-card {
    background: var(--anac-bg);
    border: 1px solid var(--anac-border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    position: relative;
}

.doc-folder-card:hover {
    background: #fff;
    border-color: var(--anac-link);
    box-shadow: 0 4px 12px rgba(15, 44, 82, 0.08);
    transform: translateY(-2px);
}

.doc-folder-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    overflow: hidden;
    text-decoration: none !important;
    color: var(--anac-ink);
}

.doc-folder-icon {
    font-size: 26px;
}

.doc-folder-details {
    overflow: hidden;
}

.doc-folder-name {
    font-size: 14.5px;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.doc-folder-meta {
    font-size: 12px;
    color: var(--anac-muted);
}

/* Grille de fichiers */
.doc-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.doc-file-card {
    background: #fff;
    border: 1px solid var(--anac-border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.doc-file-card:hover {
    border-color: var(--anac-link);
    box-shadow: 0 6px 16px rgba(15, 44, 82, 0.08);
    transform: translateY(-2px);
}

.doc-file-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.doc-file-icon {
    font-size: 32px;
    color: var(--anac-link);
}

.doc-file-icon.fa-file-pdf-o { color: #E8112B; }
.doc-file-icon.fa-file-word-o { color: #1B58B8; }
.doc-file-icon.fa-file-excel-o { color: #107C41; }
.doc-file-icon.fa-file-image-o { color: #D83B01; }
.doc-file-icon.fa-file-archive-o { color: #7B83EB; }

.doc-file-info {
    overflow: hidden;
    flex: 1;
}

.doc-file-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--anac-ink);
    margin: 0 0 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.doc-file-title a {
    color: inherit;
    text-decoration: none;
}

.doc-file-title a:hover {
    color: var(--anac-link);
    text-decoration: underline;
}

.doc-file-meta {
    font-size: 12px;
    color: var(--anac-muted);
}

.doc-file-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--anac-border);
}

.doc-btn-share {
    background: rgba(29, 90, 158, 0.08);
    color: var(--anac-link);
    border: 1px solid rgba(29, 90, 158, 0.15);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.doc-btn-share:hover {
    background: var(--anac-navy);
    color: #fff;
    border-color: var(--anac-navy);
    text-decoration: none;
}

/* État vide */
.doc-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--anac-muted);
}

.doc-empty-icon {
    font-size: 48px;
    color: #CBD5E1;
    margin-bottom: 12px;
}

.doc-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--anac-ink-soft);
    margin-bottom: 6px;
}

.doc-empty-desc {
    font-size: 14px;
    max-width: 420px;
    margin: 0 auto 18px;
}

/* =========================================================================
   Fenêtre modale de partage
   ========================================================================= */
.anac-doc-modal .modal-content {
    border-radius: 14px;
    border: none;
    box-shadow: 0 16px 40px rgba(15, 44, 82, 0.20);
    overflow: hidden;
}

.anac-doc-modal .modal-header {
    background: var(--anac-navy);
    color: #fff;
    padding: 20px 24px;
    align-items: center;
}

.anac-doc-modal .modal-header .close {
    color: #fff;
    opacity: 0.8;
    text-shadow: none;
}

.anac-doc-modal .modal-header .close:hover {
    opacity: 1;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

.anac-doc-modal .modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.modal-subtitle {
    font-size: 13px;
    color: #B9CBE4;
    margin: 0;
}

.share-doc-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.share-doc-badge {
    background: var(--anac-tint);
    border: 1px solid var(--anac-tint-border);
    color: var(--anac-navy);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.share-doc-size {
    font-size: 13px;
    color: var(--anac-muted);
}

.share-link-group {
    display: flex;
    border: 1px solid var(--anac-border-input);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 8px;
}

.share-link-input {
    flex: 1;
    border: none;
    padding: 10px 14px;
    font-size: 13.5px;
    color: var(--anac-ink);
    background: transparent;
    outline: none;
}

.share-copy-btn {
    background: var(--anac-navy);
    color: #fff;
    border: none;
    padding: 0 18px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.share-copy-btn:hover {
    background: var(--anac-navy-hover);
}

.share-copy-btn.is-copied {
    background: var(--anac-green) !important;
}

.copy-alert {
    background: #E8F5E9;
    color: #2E7D32;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
}

.share-sep {
    text-align: center;
    position: relative;
    margin: 18px 0;
}

.share-sep::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--anac-border);
}

.share-sep span {
    position: relative;
    background: #fff;
    padding: 0 12px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--anac-label);
}

/* Grille des canaux */
.share-channels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

@media (max-width: 575px) {
    .share-channels-grid {
        grid-template-columns: 1fr;
    }
}

.share-channel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    color: #fff !important;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.share-channel-btn:hover {
    opacity: 0.9;
}

.share-channel--whatsapp { background: #25D366; }
.share-channel--mail { background: var(--anac-navy); }
.share-channel--telegram { background: #0088CC; }
.share-channel--native { background: #4B5563; }

/* QR Code */
.share-qr-wrap {
    background: var(--anac-bg);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    margin-bottom: 14px;
}

.share-qr-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--anac-muted-2);
    margin-bottom: 8px;
}

.share-qr-box {
    display: inline-block;
    padding: 8px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.share-security-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--anac-muted);
    background: #FFF8E1;
    border: 1px solid #FFE082;
    padding: 8px 12px;
    border-radius: 6px;
}

/* Modale permissions */
.perm-add-card {
    background: var(--anac-bg);
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid var(--anac-border);
}

.perm-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--anac-navy);
    margin-bottom: 12px;
}

/* Page de consultation directe du fichier */
.doc-view-page {
    max-width: 1040px;
    margin: 30px auto;
    padding: 0 20px;
}

.doc-view-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--anac-border);
    box-shadow: 0 8px 24px rgba(15, 44, 82, 0.08);
    overflow: hidden;
}

.doc-view-header {
    background: var(--anac-navy);
    color: #fff;
    padding: 24px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.doc-view-title h1 {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
    word-break: break-word;
}

.doc-view-meta-line {
    font-size: 13.5px;
    color: #C4D2E4;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.doc-view-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.doc-view-body {
    padding: 30px;
}

.doc-preview-container {
    background: #F8FAFC;
    border: 1px solid var(--anac-border);
    border-radius: 8px;
    overflow: hidden;
    min-height: 540px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-preview-frame {
    width: 100%;
    height: 650px;
    border: none;
}

.doc-preview-img {
    max-width: 100%;
    max-height: 650px;
    object-fit: contain;
}

.doc-preview-unsupported {
    text-align: center;
    padding: 50px 20px;
}

.doc-preview-unsupported i {
    font-size: 64px;
    color: var(--anac-link);
    margin-bottom: 16px;
}
