/* Styles pour le système d'annotations à la sélection */

/* Popup d'annotation */
.annotation-popup {
    position: absolute;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateY(5px) scale(0.95);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.annotation-popup.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.annotation-popup::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
}

.annotation-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.annotation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.annotation-btn:active {
    transform: translateY(0);
}

/* Modal formulaire d'annotation */
.annotation-form-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.annotation-form-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.annotation-form-header {
    padding: 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.annotation-form-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
}

.btn-close-modal {
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-modal:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.annotation-form-body {
    padding: 24px;
}

/* Prévisualisation du texte sélectionné */
.selected-text-preview {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.preview-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-text {
    font-style: italic;
    color: #2c3e50;
    line-height: 1.6;
}

/* Formulaire */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.annotation-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.annotation-form-actions .btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.annotation-form-actions .btn-secondary {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #6c757d;
}

.annotation-form-actions .btn-secondary:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.annotation-form-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

.annotation-form-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Highlights d'annotations existantes */
.annotation-highlight {
    background: linear-gradient(120deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-bottom: 2px solid #667eea;
    cursor: pointer;
    position: relative;
    padding: 2px 0;
    transition: all 0.2s;
}

.annotation-highlight:hover {
    background: linear-gradient(120deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
    border-bottom-width: 3px;
}

/* Flash highlight dans sidebar */
.highlight-flash {
    animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
    0%, 100% {
        background: #f8f9fa;
    }
    50% {
        background: #fff3cd;
    }
}

/* Toast notifications */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10002;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    max-width: 400px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid #28a745;
    color: #155724;
}

.toast-error {
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.toast-info {
    border-left: 4px solid #667eea;
    color: #2c3e50;
}

/* Responsive */
@media (max-width: 768px) {
    .annotation-form-content {
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .annotation-popup {
        left: 50% !important;
        transform: translateX(-50%) translateY(5px) scale(0.95);
    }
    
    .annotation-popup.show {
        transform: translateX(-50%) translateY(0) scale(1);
    }
    
    .toast-notification {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }
}

/* Dark mode support */
body.theme-dark .annotation-popup,
body.theme-dark .annotation-form-content {
    background: #2a2a2a;
    border-color: #404040;
}

body.theme-dark .annotation-form-header h3,
body.theme-dark .preview-text,
body.theme-dark .form-group label {
    color: #e4e4e4;
}

body.theme-dark .selected-text-preview {
    background: #1a1a1a;
}

body.theme-dark .form-group textarea {
    background: #1a1a1a;
    border-color: #404040;
    color: #e4e4e4;
}

body.theme-dark .annotation-form-actions .btn-secondary {
    background: #1a1a1a;
    border-color: #404040;
    color: #e4e4e4;
}

body.theme-dark .toast-notification {
    background: #2a2a2a;
    color: #e4e4e4;
}
