/* Styles pour les documents - Étape 4 */
.document-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.document-section:hover {
    border-color: var(--couleur-secondaire);
    background: #fff;
}

.document-upload-container {
    position: relative;
}

.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.file-upload-area:hover {
    border-color: var(--couleur-principale);
    background: rgba(168, 19, 29, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--couleur-principale) !important;
    background: rgba(168, 19, 29, 0.1) !important;
}
.attFileUploadArea {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.attFileUploadArea:hover {
    border-color: var(--couleur-principale);
    background: rgba(168, 19, 29, 0.05);
}

.attFileUploadArea.dragover {
    border-color: var(--couleur-principale) !important;
    background: rgba(168, 19, 29, 0.1) !important;
}

.uploaded-files-preview {
    margin-top: 1rem;
}

.file-preview-item {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.file-preview-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-preview-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 1rem;
    border: 1px solid #dee2e6;
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 0.8rem;
    color: #666;
}

.file-preview-actions {
    display: flex;
    gap: 0.5rem;
}

.file-preview-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.file-status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    font-size: 0.7rem;
}

.file-status-uploaded {
    background: #d4edda;
    color: #155724;
}

.file-status-error {
    background: #f8d7da;
    color: #721c24;
}

.document-section.border-info {
    border-color: #0dcaf0 !important;
}

.document-section.border-info:hover {
    border-color: #0aa2c0 !important;
}

/* Cropper Modal Styles */
.image-container {
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

#cropperImage {
    max-height: 400px;
}

/* Document validation states */
.document-section.valid {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

.document-section.invalid {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

/* Progress indicator for file uploads */
.upload-progress {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.upload-progress-bar {
    height: 100%;
    background: var(--couleur-principale);
    transition: width 0.3s ease;
}

/* File type icons */
.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.file-icon.pdf {
    background: #ff4757;
    color: white;
}

.file-icon.image {
    background: #2ecc71;
    color: white;
}

/* Drag and drop states */
.file-upload-area.drag-active {
    border-color: var(--couleur-principale);
    background: rgba(168, 19, 29, 0.1);
    transform: scale(1.02);
}
.attFileUploadArea.drag-active {
    border-color: var(--couleur-principale);
    background: rgba(168, 19, 29, 0.1);
    transform: scale(1.02);
}

/* Section "Vos documents" - Version pleine largeur */
.uploaded-document-card-full {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.uploaded-document-card-full:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--couleur-principale);
}

.uploaded-document-header-full {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.uploaded-document-icon-full {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
    color: white;
    background: var(--couleur-principale);
}

.uploaded-document-info-full {
    flex: 1;
}

.uploaded-document-info-full h6 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.document-count-badge-full {
    background: var(--couleur-principale);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.uploaded-document-files-full {
    min-height: 60px;
}

.uploaded-file-item-full {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.uploaded-file-item-full:last-child {
    margin-bottom: 0;
}

.uploaded-file-item-full:hover {
    background: #fff;
    border-color: var(--couleur-secondaire);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-info-section {
    display: flex;
    align-items: center;
    flex: 1;
}

.uploaded-file-thumbnail-full {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    margin-right: 1rem;
    font-size: 1.2rem;
    background: #fff;
    border: 1px solid #dee2e6;
}

.file-details {
    flex: 1;
}

.uploaded-file-name-full {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.file-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: left;
}

.file-meta-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.uploaded-file-size-full {
    color: #6c757d;
    font-size: 0.85rem;
}

.uploaded-file-date-full {
    color: #6c757d;
    font-size: 0.75rem;
    font-style: italic;
}

.identity-type-badge,
.dl-type-badge {
    display: inline-block;
    background: var(--couleur-principale);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: capitalize;
}

.file-actions-section {
    display: flex;
    gap: 0.5rem;
}

.btn-preview-individual,
.btn-reupload-individual,
.btn-delete-individual,
.btn-download-individual {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    padding: 0;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.btn-preview-individual {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
}

.btn-download-individual {
    background: #b8dcff;
    color: #000;
    border-color: #dee2e6;
}
.btn-download-individual:hover {
    background: #38699b;
    color: #ffffff;
    border-color: #dee2e6;
}

.btn-preview-individual:hover {
    background: #e9ecef;
    color: #495057;
    border-color: #adb5bd;
}

.btn-reupload-individual {
    background: var(--bleu-marine);
    color: white;
}

.btn-reupload-individual:hover {
    background: #0a2a42;
    transform: translateY(-1px);
}

.btn-delete-individual {
    background: #dc3545;
    color: white;
}

.btn-delete-individual:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.no-files-message {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
}

.btn-upload-first {
    background: var(--couleur-principale);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-upload-first:hover {
    background: var(--rouge-eclaire);
    transform: translateY(-1px);
}

/* Zone d'upload toujours présente */
.upload-zone-always,
.upload-zone-always-identity-proof {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.upload-zone-always-identity-proof {
    margin-top: 0.5rem;
}

.file-upload-area.compact {
    padding: 1rem;
    border: 1px dashed #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone-always-identity-proof .file-upload-area.compact {
    padding: 0.5rem;
    background: #ffffff;
}

.file-upload-area.compact:hover {
    border-color: var(--couleur-principale);
    background: rgba(168, 19, 29, 0.05);
}

.file-upload-area.compact p {
    margin: 0;
    font-size: 0.9rem;
}

.file-upload-area.compact small {
    font-size: 0.75rem;
}
.attFileUploadArea.compact {
    padding: 1rem;
    border: 1px dashed #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.attFileUploadArea.compact:hover {
    border-color: var(--couleur-principale);
    background: rgba(168, 19, 29, 0.05);
}

.attFileUploadArea.compact p {
    margin: 0;
    font-size: 0.9rem;
}

.attFileUploadArea.compact small {
    font-size: 0.75rem;
}

.uploaded-document-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.uploaded-document-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1.2rem;
    color: white;
    background: var(--couleur-principale);
}

.uploaded-document-info h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.uploaded-document-status {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

.uploaded-document-status.complete {
    color: #28a745;
}

.uploaded-document-status.incomplete {
    color: #dc3545;
}

.uploaded-document-files {
    margin-bottom: 1rem;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.uploaded-file-item:last-child {
    margin-bottom: 0;
}

.uploaded-file-thumbnail {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 3px;
    margin-right: 0.5rem;
    border: 1px solid #dee2e6;
}

.uploaded-file-name {
    flex: 1;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uploaded-file-size {
    color: #666;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.uploaded-document-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-preview,
.btn-reupload {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

.btn-preview {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #333;
}

.btn-preview:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-reupload {
    background: var(--couleur-principale);
    border: 1px solid var(--rouge-cma);
    color: white;
}

.btn-reupload:hover {
    background: var(--rouge-eclaire);
    border-color: var(--couleur-secondaire);
}

.document-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--couleur-principale);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Document preview modal */
.document-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.document-preview-item {
    text-align: center;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

.document-preview-item img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.document-preview-item .file-name {
    font-size: 0.8rem;
    color: #666;
    word-break: break-word;
}

/* Badges de statut de validation */
.validation-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    width: fit-content;
}

.validation-status-badge.status-validated {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.validation-status-badge.status-rejected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.validation-status-badge.status-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Identity Type Selection Modal */
.identity-type-option,
.dl-type-option {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
}

.identity-type-option:hover,
.dl-type-option:hover {
    border-color: var(--couleur-principale);
    background: rgba(168, 19, 29, 0.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.identity-type-option:last-child,
.dl-type-option:last-child {
    margin-bottom: 0;
}

.identity-type-icon,
.dl-type-icon {
    width: 50px;
    height: 50px;
    background: var(--couleur-principale);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.identity-type-info,
.dl-type-info {
    flex: 1;
}

.identity-type-info h6,
.dl-type-info h6 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.identity-type-arrow,
.dl-type-arrow {
    color: #6c757d;
    font-size: 1.2rem;
}

.identity-type-option:hover .identity-type-arrow,
.dl-type-option:hover .dl-type-arrow {
    color: var(--rouge-cma);
    transform: translateX(5px);
}

/* Identity Modal Steps */
.identity-modal-step,
.dl-modal-step {
    min-height: 200px;
}

.identity-upload-zone,
.dl-upload-zone {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.identity-upload-area,
.dl-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.identity-upload-area:hover,
.dl-upload-area:hover {
    border-color: var(--couleur-principale);
    background: rgba(168, 19, 29, 0.05);
}

.identity-upload-area.dragover,
.dl-upload-area.dragover {
    border-color: var(--couleur-principale) !important;
    background: rgba(168, 19, 29, 0.1) !important;
}

.identity-preview,
.dl-preview {
    margin-top: 0.5rem;
}

.identity-preview-item,
.dl-preview-item {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.identity-preview-thumbnail,
.dl-preview-thumbnail {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 3px;
    margin-right: 0.5rem;
    border: 1px solid #dee2e6;
}

.identity-preview-info,
.dl-preview-info {
    flex: 1;
    font-size: 0.85rem;
}

.identity-preview-name,
.dl-preview-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
}

.identity-preview-size,
.dl-preview-size {
    color: #6c757d;
    font-size: 0.75rem;
}

.identity-preview-actions,
.dl-preview-actions {
    display: flex;
    gap: 0.25rem;
}

.identity-preview-actions .btn,
.dl-preview-actions .btn {
    padding: 0.25rem;
    font-size: 0.75rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== STYLES POUR L'ÉDITEUR D'IMAGE AMÉLIORÉ ========== */

/* Amélioration de la mise en page de l'éditeur */
#imageEditorModal .modal-body {
    padding: 1rem;
}

#imageEditorModal .image-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.5rem;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Agrandir l'image dans la modale dès l'ouverture */
#cropperImage {
    max-width: 100% !important;
    max-height: 300px !important;
    width: auto !important;
    height: auto !important;
}

/* Styles pour les groupes de boutons */
.btn-group-vertical .btn {
    border-radius: 0;
}

.btn-group-vertical .btn:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.btn-group-vertical .btn:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Canvas de dessin */
#drawingCanvas {
    border: 2px solid var(--rouge-cma);
    border-radius: 4px;
}

/* Contrôles de dessin */
#drawingControls {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

#drawingControls .form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.25rem;
}

#brushColor {
    height: 32px;
}

#brushSize {
    margin-bottom: 0;
}

/* Bouton de crop spécialisé */
.btn-success.btn-sm {
    background: #28a745;
    border-color: #28a745;
    font-weight: 500;
}

.btn-success.btn-sm:hover {
    background: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

/* Bouton de dessin spécialisé */
.btn-warning.btn-sm {
    background: #ffc107;
    border-color: #ffc107;
    color: #212529;
    font-weight: 500;
}

.btn-warning.btn-sm:hover {
    background: #e0a800;
    border-color: #d39e00;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

/* État actif du bouton dessiner */
.btn-danger.btn-sm {
    font-weight: 500;
}

.btn-danger.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* Amélioration des boutons de rotation et zoom */
.btn-outline-primary.btn-sm {
    transition: all 0.2s ease;
}

.btn-outline-primary.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

/* Titre des outils */
#imageEditorModal .fw-bold {
    color: var(--bleu-marine);
    border-bottom: 2px solid var(--rouge-cma);
    padding-bottom: 0.5rem;
}

/* ========== STYLES POUR LA MESSAGERIE AVEC DÉCALAGE ========== */

/* Messages CMA à gauche */
.message-cma-left {
    display: flex;
    justify-content: flex-start;
    margin-right: 20%;
}

/* Messages utilisateur à droite */
.message-user-right {
    display: flex;
    justify-content: flex-end;
    margin-left: 20%;
}
@media (max-width: 991px) {
    .uploaded-file-item-full {
        flex-direction: column;
        text-align: center;
        gap: 1rem;

        .uploaded-file-name-full {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 250px;
        }

        .file-info-section {
            flex-direction: column;
        }

        .file-details {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;

            .file-meta {
                align-items: center;
            }
        }
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .document-section {
        padding: 1rem;
    }

    .file-upload-area {
        padding: 1.5rem 1rem;
    }
    .attFileUploadArea {
        padding: 1.5rem 1rem;
    }

    .file-preview-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-preview-thumbnail {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .file-preview-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
    }

    .uploaded-document-actions {
        flex-direction: column;
    }

    .uploaded-document-card {
        padding: 0.75rem;
    }

    #imageEditorModal {
        .image-container {
            padding-inline: 0;
            margin-inline: -12px;
            min-height: unset !important;
        }
        .modal-footer {
            padding: 0.5rem;
        }
        .modal-header {
            padding: 1rem;
        }
    }
}
