/* ===================================
   ANIMACIONES GENERALES
   =================================== */

/* Fade In desde abajo */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In desde la izquierda */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In desde la derecha */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zoom In */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bounce */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Pulse */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(254, 102, 0, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(254, 102, 0, 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(254, 102, 0, 0.4);
    }
}

/* Shake */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Float Animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* Rotate */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Glow */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(254, 102, 0, 0.5), 0 0 10px rgba(254, 102, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(254, 102, 0, 0.8), 0 0 30px rgba(254, 102, 0, 0.5);
    }
}

/* ===================================
   APLICACIÓN DE ANIMACIONES
   =================================== */

/* Hero Section */
.hero-content {
    animation: fadeInLeft 1s ease-out;
}

.hero-content h1 {
    animation: fadeInUp 1s ease-out 0.2s backwards;
}

.hero-content p {
    animation: fadeInUp 1s ease-out 0.4s backwards;
}

.hero-content .btn {
    animation: fadeInUp 1s ease-out 0.6s backwards;
}

/* Calculator Widget */
.calculator-widget {
    animation: fadeInRight 1s ease-out 0.3s backwards;
}

/* Responsive animations */
@media (max-width: 900px) {
    .hero-content {
        animation: fadeInUp 1s ease-out;
    }

    .calculator-widget {
        animation: fadeInUp 1s ease-out 0.4s backwards;
    }
}

/* Slider con animación suave */
.slider {
    transition: all 0.3s ease;
}

/* Botón principal con hover animado */
.btn-accent {
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.btn-accent::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-accent:hover::before {
    width: 300px;
    height: 300px;
}

/* Steps con animación escalonada */
.step {
    animation: fadeInUp 0.8s ease-out backwards;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.step:nth-child(1) {
    animation-delay: 0.2s;
}

.step:nth-child(2) {
    animation-delay: 0.4s;
}

.step:nth-child(3) {
    animation-delay: 0.6s;
}

.step i {
    transition: all 0.4s ease;
}

.step:hover i {
    transform: scale(1.2) rotate(10deg);
    animation: bounce 1s ease;
}

.step:hover {
    transform: translateY(-15px) scale(1.02);
}

/* Testimonials con animación */
.testimonial-card {
    animation: zoomIn 0.8s ease-out backwards;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.testimonial-card:nth-child(1) {
    animation-delay: 0.2s;
}

.testimonial-card:nth-child(2) {
    animation-delay: 0.4s;
}

.testimonial-card:nth-child(3) {
    animation-delay: 0.6s;
}

.testimonial-card:hover {
    transform: translateY(-10px) rotate(1deg);
}

/* Logo animación */
.logo img {
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.logo img:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Navigation Links */
.main-nav a {
    position: relative;
    transition: all 0.3s ease;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.main-nav a:hover::after {
    width: 100%;
}

/* Trust Bar Icons */
.trust-bar i {
    transition: all 0.3s ease;
    display: inline-block;
}

.trust-bar:hover i {
    animation: bounce 0.8s ease;
}

/* Botón flotante de tema */
.theme-toggle-floating {
    animation: fadeInUp 1s ease-out 1s backwards;
}

.theme-toggle-floating i {
    transition: transform 0.5s ease;
}

.theme-toggle-floating:active i {
    animation: rotate 0.6s ease;
}

/* Amount Display Animation */
#loan-amount-value {
    transition: all 0.3s ease;
}

/* Detail Items Hover */
.detail-item {
    transition: all 0.3s ease;
}

.detail-item:hover {
    transform: translateX(5px);
}

.detail-item:hover i {
    animation: bounce 0.5s ease;
}

/* Secciones con animación de entrada */
.how-it-works h2,
.testimonials h2 {
    animation: fadeInUp 0.8s ease-out backwards;
}

/* Calculator Float Effect */
.calculator-widget {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calculator-widget:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(254, 102, 0, 0.2);
}

/* Footer con fade in */
.main-footer {
    animation: fadeInUp 0.8s ease-out backwards;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Animación para cuando aparecen elementos en viewport */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Delay escalonado para elementos en grupo */
.animate-on-scroll:nth-child(1).visible {
    transition-delay: 0.1s;
}

.animate-on-scroll:nth-child(2).visible {
    transition-delay: 0.2s;
}

.animate-on-scroll:nth-child(3).visible {
    transition-delay: 0.3s;
}

/* Loading Animation para inputs */
input:focus,
textarea:focus,
select:focus {
    animation: glow 1.5s ease-in-out;
}

/* Responsive: Reducir animaciones en móvil */
@media (max-width: 768px) {
    .hero-image img {
        animation: none;
    }

    .step:hover,
    .testimonial-card:hover {
        transform: translateY(-5px);
    }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}