/**
 * Animaciones CSS
 * Sistema de Ahorro Programado
 * 
 * Animaciones para popups, alertas, transiciones y efectos visuales
 */

/* ========== ANIMACIONES DE ENTRADA ========== */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease;
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-down {
    animation: fadeInDown 0.6s ease;
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.5s ease;
}

/* Slide In Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.5s ease;
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.4s ease;
}

/* Bounce In */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.bounce-in {
    animation: bounceIn 0.6s ease;
}

/* ========== ANIMACIONES DE SALIDA ========== */

/* Fade Out */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

/* Fade Out Up */
@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-30px);
    }
}

.fade-out-up {
    animation: fadeOutUp 0.5s ease forwards;
}

/* Scale Out */
@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

.scale-out {
    animation: scaleOut 0.4s ease forwards;
}

/* ========== POPUP NOTIFICATIONS ========== */

/* Contenedor de notificaciones */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

/* Notificación base */
.notification {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    animation: slideInRight 0.5s ease;
    position: relative;
    overflow: hidden;
}

.notification::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
}

/* Notificación de éxito */
.notification.success::before {
    background: #2ecc71;
}

.notification.success .notification-icon {
    color: #2ecc71;
}

/* Notificación de error */
.notification.error::before {
    background: #e74c3c;
}

.notification.error .notification-icon {
    color: #e74c3c;
}

/* Notificación de advertencia */
.notification.warning::before {
    background: #f39c12;
}

.notification.warning .notification-icon {
    color: #f39c12;
}

/* Notificación de información */
.notification.info::before {
    background: #3498db;
}

.notification.info .notification-icon {
    color: #3498db;
}

/* Icono de notificación */
.notification-icon {
    font-size: 2rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

/* Contenido de notificación */
.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    color: #2c3e50;
}

.notification-message {
    font-size: 0.95rem;
    color: #7f8c8d;
    line-height: 1.4;
}

/* Botón de cerrar notificación */
.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    transition: color 0.2s ease;
}

.notification-close:hover {
    color: #2c3e50;
}

/* Barra de progreso de auto-cierre */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    animation: progressBar 5s linear forwards;
}

@keyframes progressBar {
    from {
        width: 100%;
    }
    to {
        width: 0;
    }
}

/* ========== POPUP CHECK ANIMADO ========== */

/* Overlay del popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

/* Contenedor del popup */
.popup-check {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    max-width: 400px;
    animation: bounceIn 0.6s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Círculo de check */
.check-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease 0.3s backwards;
}

/* Icono de check */
.check-icon {
    font-size: 4rem;
    color: white;
    animation: checkmark 0.5s ease 0.5s backwards;
}

@keyframes checkmark {
    0% {
        transform: scale(0) rotate(-45deg);
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Título del popup */
.popup-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
    animation: fadeInUp 0.5s ease 0.6s backwards;
}

/* Mensaje del popup */
.popup-message {
    font-size: 1.1rem;
    color: #7f8c8d;
    line-height: 1.6;
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease 0.7s backwards;
}

/* Botón del popup */
.popup-button {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    animation: fadeInUp 0.5s ease 0.8s backwards;
}

.popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(74, 144, 226, 0.3);
}

/* ========== LOADING SPINNER ========== */

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spinner-text {
    position: absolute;
    margin-top: 100px;
    font-size: 1.2rem;
    color: #2c3e50;
    font-weight: 600;
}

/* ========== ANIMACIONES DE HOVER ========== */

/* Pulse */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.hover-pulse:hover {
    animation: pulse 0.5s ease;
}

/* Shake */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease;
}

/* Wobble */
@keyframes wobble {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

.wobble {
    animation: wobble 0.5s ease;
}

/* ========== ANIMACIONES DE PROGRESO ========== */

/* Animación de fill de barra de progreso */
@keyframes progressFill {
    from {
        width: 0%;
    }
}

.progress-bar-animated {
    animation: progressFill 1.5s ease;
}

/* Shimmer effect para loading */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        to right,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s linear infinite;
}

/* ========== CONFETTI ANIMATION ========== */

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #f39c12;
    z-index: 9999;
    animation: confetti-fall 3s linear;
}

/* ========== ANIMACIONES DE CONTADOR ========== */

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

.count-up {
    animation: countUp 0.5s ease;
}

/* ========== RESPONSIVE ANIMATIONS ========== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    .notification-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification {
        padding: 1rem;
    }
    
    .popup-check {
        margin: 1rem;
        padding: 2rem;
    }
    
    .check-circle {
        width: 100px;
        height: 100px;
    }
    
    .check-icon {
        font-size: 3rem;
    }
    
    .popup-title {
        font-size: 1.5rem;
    }
    
    .popup-message {
        font-size: 1rem;
    }
}

/* ========== UTILIDADES DE ANIMACIÓN ========== */

.animate-delay-1 {
    animation-delay: 0.1s;
}

.animate-delay-2 {
    animation-delay: 0.2s;
}

.animate-delay-3 {
    animation-delay: 0.3s;
}

.animate-delay-4 {
    animation-delay: 0.4s;
}

.animate-delay-5 {
    animation-delay: 0.5s;
}

.animate-infinite {
    animation-iteration-count: infinite;
}

.animate-once {
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}
