/* Styles pour le système de sauvegarde automatique */

/* Indicateur de sauvegarde automatique */
.autosave-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(40, 167, 69, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.autosave-indicator.show {
    opacity: 1;
    transform: translateX(0);
}

.autosave-indicator.saving {
    background: rgba(255, 193, 7, 0.9);
    color: #333;
}

.autosave-indicator i {
    font-size: 10px;
}

/* Animation de pulsation pour l'icône de sauvegarde */
.autosave-indicator .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Styles pour les champs avec erreur lors de la restauration */
.field-error {
    border-color: #dc3545 !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Styles pour les champs restaurés */
.field-restored {
    border-color: #28a745 !important;
    background-color: rgba(40, 167, 69, 0.05) !important;
    transition: all 0.3s ease;
}

.field-restored:focus {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Animation pour les champs restaurés */
@keyframes restored-highlight {
    0% {
        background-color: rgba(40, 167, 69, 0.2);
        border-color: #28a745;
    }
    100% {
        background-color: rgba(40, 167, 69, 0.05);
        border-color: #28a745;
    }
}

.field-restored {
    animation: restored-highlight 2s ease-out;
}

/* Styles pour les notifications de sauvegarde */
.autosave-notification {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(23, 162, 184, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9998;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.autosave-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.autosave-notification.success {
    background: rgba(40, 167, 69, 0.95);
}

.autosave-notification.error {
    background: rgba(220, 53, 69, 0.95);
}

.autosave-notification.warning {
    background: rgba(255, 193, 7, 0.95);
    color: #333;
}

/* Badge de données sauvegardées */
.saved-data-badge {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(108, 117, 125, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 500;
    z-index: 9997;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.saved-data-badge:hover {
    opacity: 1;
    background: rgba(108, 117, 125, 1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .autosave-indicator {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .autosave-notification {
        bottom: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        text-align: center;
    }
    
    .saved-data-badge {
        top: 50px;
        right: 10px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .recovery-modal {
        margin: 10px;
        width: calc(100% - 20px);
    }
}

/* Animation d'entrée pour le modal de récupération */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Animation de sortie pour le modal de récupération */
@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
}

/* Amélioration de l'accessibilité */
.recovery-modal-overlay {
    backdrop-filter: blur(2px);
}

.recovery-modal:focus-within {
    outline: 2px solid #004080;
    outline-offset: 2px;
}

/* Styles pour les éléments interactifs */
.btn-recovery-restore:focus,
.btn-recovery-new:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Indicateur de progression de sauvegarde */
.autosave-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.autosave-progress.active {
    opacity: 1;
}

.autosave-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #004080, #0056b3);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 64, 128, 0.5);
}

/* Styles pour les données expirées */
.expired-data-warning {
    background: rgba(255, 193, 7, 0.95) !important;
    color: #333 !important;
}

.expired-data-warning .recovery-header {
    background: linear-gradient(135deg, #ffc107, #fd7e14) !important;
    color: #333 !important;
}

/* Amélioration des animations */
.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Styles pour les tooltips */
.autosave-tooltip {
    position: relative;
    cursor: help;
}

.autosave-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10002;
}

.autosave-tooltip:hover::after {
    opacity: 1;
}

/* Styles pour l'état de sauvegarde en cours */
.form-saving {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.form-saving::after {
    content: "Sauvegarde en cours...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 9999;
}