/* ===== ANIMACIONES ESPECÍFICAS PARA SCROLLREVEAL ===== */

/* Configuración base para ScrollReveal */
.reveal {
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

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

/* Fade In Up */
.fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

/* Fade In Left */
.fade-in-left {
    animation: fadeInLeft 0.8s ease forwards;
}

/* Fade In Right */
.fade-in-right {
    animation: fadeInRight 0.8s ease forwards;
}

/* Fade In Scale */
.fade-in-scale {
    animation: scaleIn 0.8s ease forwards;
}

/* Slide In From Bottom */
.slide-in-bottom {
    animation: slideInBottom 0.8s ease forwards;
}

/* Slide In From Top */
.slide-in-top {
    animation: slideInTop 0.8s ease forwards;
}

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

/* Hover Scale */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Hover Lift */
.hover-lift {
    transition: all 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Hover Glow */
.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* ===== ANIMACIONES DE CARGA ===== */

/* Loading Pulse */
.loading-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* Loading Bounce */
.loading-bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* ===== ANIMACIONES DE TEXTO ===== */

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--accent-primary);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

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

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--accent-primary);
    }
}

/* Text Reveal */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    animation: textReveal 0.8s ease forwards;
    opacity: 0;
    transform: translateY(100%);
}

.text-reveal span:nth-child(1) { animation-delay: 0.1s; }
.text-reveal span:nth-child(2) { animation-delay: 0.2s; }
.text-reveal span:nth-child(3) { animation-delay: 0.3s; }
.text-reveal span:nth-child(4) { animation-delay: 0.4s; }
.text-reveal span:nth-child(5) { animation-delay: 0.5s; }

@keyframes textReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ANIMACIONES DE TARJETAS ===== */

/* Card Flip */
.card-flip {
    perspective: 1000px;
    height: 300px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-flip-front {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.card-flip-back {
    background-color: var(--accent-primary);
    color: white;
    transform: rotateY(180deg);
}

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

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    animation: progressFill 2s ease-out forwards;
}

@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width, 100%);
    }
}

/* ===== ANIMACIONES DE PARTÍCULAS ===== */

/* Floating Particles */
.floating-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: var(--accent-primary);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.floating-particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
}

.floating-particle:nth-child(2) {
    left: 20%;
    animation-delay: 1s;
}

.floating-particle:nth-child(3) {
    left: 30%;
    animation-delay: 2s;
}

.floating-particle:nth-child(4) {
    left: 40%;
    animation-delay: 3s;
}

.floating-particle:nth-child(5) {
    left: 50%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px);
        opacity: 1;
    }
}

/* ===== ANIMACIONES DE BOTONES ===== */

/* Button Ripple */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Button Shake */
.btn-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* ===== ANIMACIONES DE IMÁGENES ===== */

/* Image Parallax */
.parallax-image {
    transform: translateZ(0);
    transition: transform 0.1s ease-out;
}

/* Image Zoom */
.image-zoom {
    overflow: hidden;
    border-radius: 16px;
}

.image-zoom img {
    transition: transform 0.3s ease;
}

.image-zoom:hover img {
    transform: scale(1.1);
}

/* ===== ANIMACIONES DE ICONOS ===== */

/* Icon Bounce */
.icon-bounce {
    animation: iconBounce 2s infinite;
}

@keyframes iconBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
    60% {
        transform: translateY(-4px);
    }
}

/* Icon Rotate */
.icon-rotate {
    transition: transform 0.3s ease;
}

.icon-rotate:hover {
    transform: rotate(360deg);
}

/* Icon Pulse */
.icon-pulse {
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* ===== ANIMACIONES DE NAVEGACIÓN ===== */

/* Menu Item Slide */
.menu-item {
    position: relative;
    overflow: hidden;
}

.menu-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background-color: var(--accent-primary);
    transition: left 0.3s ease;
}

.menu-item:hover::before {
    left: 0;
}

/* ===== ANIMACIONES DE FORMULARIOS ===== */

/* Input Focus */
.input-focus {
    transition: all 0.3s ease;
}

.input-focus:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Form Validation */
.form-valid {
    animation: formValid 0.5s ease;
}

.form-invalid {
    animation: formInvalid 0.5s ease;
}

@keyframes formValid {
    0% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes formInvalid {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* ===== ANIMACIONES DE SCROLL ===== */

/* Scroll Indicator */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--bg-secondary);
    z-index: 1001;
}

.scroll-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 0.1s ease;
}

/* ===== ANIMACIONES DE MODAL ===== */

/* Modal Fade */
.modal-fade {
    animation: modalFade 0.3s ease;
}

@keyframes modalFade {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== ANIMACIONES DE TOOLTIP ===== */

/* Tooltip Fade */
.tooltip {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* ===== ANIMACIONES DE COUNTER ===== */

/* Counter Animation */
.counter {
    display: inline-block;
}

.counter-value {
    animation: counterUp 2s ease-out forwards;
}

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

/* ===== ANIMACIONES DE TIMELINE ===== */

/* Timeline Line */
.timeline-line {
    position: relative;
}

.timeline-line::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
    transform: translateX(-50%);
}

.timeline-item {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s ease;
}

.timeline-item.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ===== ANIMACIONES DE GRADIENTE ===== */

/* Gradient Background */
.gradient-bg {
    background: linear-gradient(-45deg, var(--accent-primary), var(--accent-secondary), var(--accent-success), var(--accent-warning));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ===== ANIMACIONES DE RESPONSIVE ===== */

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active {
    transform: rotate(90deg);
}

/* ===== ANIMACIONES DE ACCESIBILIDAD ===== */

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

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ===== ANIMACIONES DE PERFORMANCE ===== */

/* Hardware Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Smooth Scrolling */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* ===== ANIMACIONES DE ESTADO ===== */

/* Loading State */
.loading-state {
    position: relative;
    pointer-events: none;
}

.loading-state::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--accent-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success State */
.success-state {
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Error State */
.error-state {
    animation: errorShake 0.6s ease;
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}
