/* Styles généraux */
.docm-container {
    max-width: 1400px;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* En-tête principal - reste inchangé (dégradé bordeaux) */
.docm-header {
    padding: 25px 30px;
    border-radius: 16px;
    margin-bottom: 25px;
    background: linear-gradient(135deg, #8B0000, #4a0000) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.docm-header h2 {
    color: white !important;
    margin: 0 !important;
    font-size: 24px;
}

.docm-stats {
    display: flex;
    gap: 15px;
}

.docm-stat {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    color: white;
    font-size: 13px;
}

/* Grille */
.docm-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.docm-grid.columns-1 { grid-template-columns: 1fr; }
.docm-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }
.docm-grid.columns-3 { grid-template-columns: repeat(3, 1fr); }
.docm-grid.columns-4 { grid-template-columns: repeat(4, 1fr); }

/* Carte */
.docm-card {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.docm-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.docm-card-info {
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.docm-card-icon svg {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.docm-card-details {
    flex: 1;
}

.docm-card-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
    color: #1a2a3a;
}

.docm-card-meta {
    display: flex;
    gap: 15px;
    font-size: 11px;
    align-items: center;
    flex-wrap: wrap;
}

.docm-card-desc {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

/* Badges */
.docm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

.docm-badge-pdf { background: #e74c3c; color: white; }
.docm-badge-xls, .docm-badge-xlsx { background: #27ae60; color: white; }
.docm-badge-csv { background: #3498db; color: white; }

/* Bouton - reste inchangé */
.docm-view-button {
    width: 100%;
    border: none;
    padding: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: white;
    transition: opacity 0.2s;
    background-color: #8B0000 !important;
}

.docm-view-button:hover {
    opacity: 0.85;
}

/* Modal */
.docm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 999999;
    display: none;
    align-items: center !important;
    justify-content: center !important;
}

.docm-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(3px);
    z-index: 1;
}

.docm-modal-inner {
    position: fixed;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 2;
    animation: docmSlideIn 0.3s ease;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

@keyframes docmSlideIn {
    from { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* MODAL HEADER - Fond noir, titre blanc */
.docm-modal-header {
    padding: 18px 25px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000000 !important;
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
}

.docm-modal-header h3 {
    margin: 0;
    color: white !important;
    font-size: 18px;
    font-weight: 600;
}

/* Bouton fermer - carré rouge bordeaux avec X blanc au milieu */
.docm-modal-close {
    background-color: #8B0000 !important;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 20px;
    font-weight: bold;
    color: white !important;  /* Le X est blanc */
    line-height: 1;
}

.docm-modal-close:hover {
    background-color: #6a0000 !important;
    transform: scale(1.05);
}

/* Supprimer le pseudo-élément qui créait un deuxième X */
.docm-modal-close::before {
    display: none;
}

.docm-modal-content {
    padding: 25px;
    flex: 1;
    overflow: auto;
}

/* Toolbar PDF */
.docm-toolbar-pdf {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding: 5px 0;
}

/* Toolbar Excel */
.docm-toolbar-excel {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding: 5px 0;
}

.docm-toolbar-pdf button, .docm-toolbar-excel button {
    padding: 8px 16px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.docm-toolbar-pdf button:hover:not(:disabled),
.docm-toolbar-excel button:hover:not(:disabled) {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.docm-toolbar-pdf button:disabled,
.docm-toolbar-excel button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.docm-toolbar-pdf span {
    padding: 8px 0;
    font-size: 14px;
    color: #333;
}

.docm-toolbar-pdf > span {
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 500;
}

/* PDF */
#pdfCanvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: #f5f5f5;
    margin: 0 auto;
    display: block;
}

#pdfViewerArea {
    text-align: center;
    overflow: auto;
    max-height: 65vh;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 10px;
}

/* Excel/CSV */
.excel-table-container {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.excel-controls {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8e8e8;
}

.excel-sheet-select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.excel-table-wrapper, .csv-table-wrapper {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.excel-table th {
    background: #8B0000;
    color: white;
    padding: 10px 12px;
    border: 1px solid #a02020;
    font-weight: 600;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.excel-table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.excel-table tr:nth-child(even) {
    background: #f9f9f9;
}

.excel-table tr:hover {
    background: #f0f0f0;
}

/* Loader */
.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8B0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.docm-empty {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 12px;
}

#docLoading {
    text-align: center;
    padding: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .docm-grid.columns-2,
    .docm-grid.columns-3,
    .docm-grid.columns-4 {
        grid-template-columns: 1fr;
    }
    
    .docm-header {
        padding: 20px;
        flex-direction: column;
        text-align: center;
    }
    
    .docm-modal-inner {
        width: 95%;
        max-height: 85vh;
        max-width: 95%;
    }
    
    .docm-modal-header {
        padding: 12px 18px;
    }
    
    .docm-modal-content {
        padding: 15px;
    }
    
    .docm-toolbar-pdf button, .docm-toolbar-excel button {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .docm-toolbar-pdf button span {
        display: none;
    }
    
    .docm-toolbar-pdf button {
        gap: 0;
    }
    
    .excel-table {
        font-size: 11px;
    }
    
    .excel-table th, .excel-table td {
        padding: 5px 8px;
    }
    
    #pdfViewerArea {
        max-height: 55vh;
    }
    
    .docm-modal-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}