/* Popup d'attachement de fichiers */
.file-attachment-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.file-attachment-popup.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-attachment-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.file-attachment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.file-attachment-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.file-attachment-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.file-attachment-close:hover {
    background: #f5f5f5;
    color: #333;
}

.file-attachment-body {
    display: flex;
    gap: 2rem;
}

.file-attachment-left, .file-attachment-right {
    flex: 1;
}

.file-attachment-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px dashed #ddd;
    border-radius: 12px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
    font-size: 1rem;
}

.file-upload-btn:hover {
    border-color: #007bff;
    background: #f0f8ff;
    color: #007bff;
}

.file-upload-input {
    display: none;
}

.drop-zone {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: #f9f9f9;
    transition: all 0.3s;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.drop-zone.dragover {
    border-color: #007bff;
    background: #f0f8ff;
    color: #007bff;
}

.drop-zone-icon {
    font-size: 3rem;
    color: #ddd;
}

.drop-zone.dragover .drop-zone-icon {
    color: #007bff;
}

.paste-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: #f9f9f9;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
}

.paste-area:hover {
    border-color: #28a745;
    background: #f0fff4;
    color: #28a745;
}

.paste-icon {
    font-size: 3rem;
    color: #ddd;
}

.paste-area:hover .paste-icon {
    color: #28a745;
}

/* Popup IA pour les tâches */
.ai-tasks-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.ai-tasks-popup.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-tasks-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.ai-tasks-body {
    padding: 0;
    margin: 0;
}

.ai-tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.ai-tasks-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-tasks-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.ai-tasks-close:hover {
    background: #f5f5f5;
    color: #333;
}

.ai-text-input {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    box-sizing: border-box;
    margin-right: 0;
}

.ai-text-input:focus {
    outline: none;
    border-color: #007bff;
}

.ai-generate-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ai-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.ai-generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


.todo-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.todo-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.ai-btn-inside {
    position: absolute;
    left: 8px;
    z-index: 10;
    padding: 2px 6px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    height: 33px;
    margin-top: -24px;
}

.ai-btn-inside:hover {
    background: #5a67d8;
}

.todo-input-wrapper .todo-input {
    padding-left: 60px !important;
}

/* ============================================ */
/* STYLES POUR L'AFFICHAGE DES FICHIERS ATTACHÉS */
/* ============================================ */

/* Badge des fichiers sur les lignes de tâches */
.files-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: auto;
    margin-right: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #bbdefb;
    position: relative;
}

/* Badge des notes - style différent */
.files-badge.type-note {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
    margin-right: 0.3rem; /* Moins d'espace entre notes et fichiers */
}

.files-badge:hover {
    background: #bbdefb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.2);
}

.files-badge.type-note:hover {
    background: #ce93d8;
    box-shadow: 0 2px 4px rgba(123, 31, 162, 0.2);
}

.files-badge i {
    margin-right: 0.3rem;
}

/* Popup de prévisualisation des attachements */
.attachments-preview-popup {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    top: calc(100% + 5px); /* Positionner sous le badge des fichiers */
    left: 0;
    margin-top: 0;
}

/* Popup de prévisualisation des notes */
.notes-preview-popup {
    position: absolute;
    background: white;
    border: 1px solid #ce93d8;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(123, 31, 162, 0.15);
    z-index: 1000;
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    top: calc(100% + 5px);
    left: 0;
    margin-top: 0;
}

.attachments-preview-popup.show,
.notes-preview-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.attachments-preview-header {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    border-radius: 8px 8px 0 0;
}

.notes-preview-popup .attachments-preview-header {
    background: #f3e5f5;
    border-bottom: 1px solid #ce93d8;
    color: #7b1fa2;
}

.attachments-preview-list {
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.attachment-preview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.attachment-preview-item:hover {
    background: #f8f9fa;
}

/* Éléments de notes dans la preview */
.note-preview-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.note-preview-item:last-child {
    border-bottom: none;
}

.note-preview-item:hover {
    background: #f3e5f5;
}

.note-preview-content {
    flex: 1;
    min-width: 0;
}

.note-preview-text {
    font-size: 0.85rem;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-preview-date {
    font-size: 0.75rem;
    color: #7b1fa2;
    margin-top: 0.25rem;
}

.note-preview-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.note-preview-item:hover .note-preview-actions {
    opacity: 1;
}

.note-preview-action {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    color: #7b1fa2;
    transition: background 0.2s ease;
    font-size: 0.75rem;
}

.note-preview-action:hover {
    background: #ce93d8;
    color: white;
}

.attachment-preview-item i {
    color: #666;
    width: 16px;
    text-align: center;
}

.attachment-filename {
    flex: 1;
    font-size: 0.85rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-filesize {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
}

/* Prévisualisation d'images */
.image-preview-tooltip {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    z-index: 5000;
    opacity: 0;
    transition: opacity 0.2s ease;
    max-width: 300px;
    max-height: 300px;
}

.image-preview-tooltip img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    display: block;
}

/* ============================================ */
/* AMÉLIORATION DE LA POPUP D'ATTACHEMENT */
/* ============================================ */

/* Structure de la popup d'attachement */
.file-attachment-body {
    display: flex;
    gap: 2rem;
    min-height: 400px;
}

.file-attachment-left {
    flex: 1;
    min-width: 300px;
}

.file-attachment-right {
    flex: 1;
    min-width: 300px;
    border-left: 1px solid #e0e0e0;
    padding-left: 2rem;
}

.file-attachment-section-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-upload-section {
    margin-bottom: 1.5rem;
}

/* Liste des fichiers attachés dans la popup */
.attached-files-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.no-files-message {
    text-align: center;
    padding: 2rem;
    color: #999;
}

.no-files-message i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.no-files-message p {
    margin: 0;
    font-size: 0.9rem;
}

.attached-file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    transition: background 0.2s ease;
}

.attached-file-item:hover {
    background: #f8f9fa;
}

.attached-file-item:last-child {
    border-bottom: none;
}

.attached-file-icon {
    color: #666;
    width: 20px;
    text-align: center;
}

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

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

.attached-file-size {
    font-size: 0.8rem;
    color: #888;
}

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

.attached-file-action {
    background: none;
    border: none;
    padding: 0.3rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.attached-file-action:hover {
    background: #e3f2fd;
    color: #1976d2;
}

.attached-file-action.delete:hover {
    background: #ffebee;
    color: #d32f2f;
}

/* Popup de confirmation de suppression */
.delete-confirmation-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.delete-confirmation-popup.show {
    opacity: 1;
    visibility: visible;
}

.delete-confirmation-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.delete-confirmation-icon {
    font-size: 3rem;
    color: #ff5722;
    margin-bottom: 1rem;
}

.delete-confirmation-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.delete-confirmation-message {
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.delete-confirmation-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.delete-confirmation-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-confirmation-btn.cancel {
    background: #f5f5f5;
    color: #333;
}

.delete-confirmation-btn.cancel:hover {
    background: #e0e0e0;
}

.delete-confirmation-btn.confirm {
    background: #d32f2f;
    color: white;
}

.delete-confirmation-btn.confirm:hover {
    background: #b71c1c;
    transform: translateY(-1px);
}

/* ============================================ */
/* POPUP D'ÉDITION DES NOTES */
/* ============================================ */

.note-edit-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50000;
}

.note-edit-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.note-edit-content h3 {
    margin: 0 0 1rem 0;
    color: #7b1fa2;
    font-size: 1.2rem;
}

.note-edit-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid #ce93d8;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

.note-edit-textarea:focus {
    outline: none;
    border-color: #7b1fa2;
}

.note-edit-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.note-edit-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-edit-btn.save {
    background: #7b1fa2;
    color: white;
}

.note-edit-btn.save:hover {
    background: #6a1b9a;
    transform: translateY(-1px);
}

.note-edit-btn.cancel {
    background: #f5f5f5;
    color: #333;
}

.note-edit-btn.cancel:hover {
    background: #e0e0e0;
}


/* Animations pour la popup d'authentification */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scale-in {
    from { 
        opacity: 0; 
        transform: scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

.animate-scale-in {
    animation: scale-in 0.3s ease-out;
}

/* Effet de flou pour le backdrop */
.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
