/**
 * ZonaTech NG - Animations
 * OPTIMIZED for blazing fast performance
 */

/* GPU acceleration for all animations */
.animate-on-scroll,
.animate-card,
.fade-in,
.fade-in-up,
.fade-in-down,
.fade-in-left,
.fade-in-right,
.float,
.pulse,
.glow,
.shimmer,
.hover-lift {
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--zona-gradient-purple);
    z-index: 9999;
    transition: width 0.05s linear;
    will-change: width;
}

/* Button Animations - OPTIMIZED */
.btn-animated {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

.btn-animated span {
    display: inline-block;
    transition: transform 0.15s ease-out;
}

.btn-animated:hover span {
    animation: buttonTextSlide 0.2s ease;
}

@keyframes buttonTextSlide {
    0% { transform: translateY(0); }
    50% { transform: translateY(-100%); opacity: 0; }
    51% { transform: translateY(100%); }
    100% { transform: translateY(0); opacity: 1; }
}

/* Swift Color Button Animation - OPTIMIZED */
.btn-swift {
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    transform: translateZ(0);
}

.btn-swift::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.25s ease-out;
}

.btn-swift:hover::before {
    left: 100%;
}

.btn-swift:hover {
    transform: translateY(-2px) scale(1.01) translateZ(0);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

/* Color Shift Button - OPTIMIZED */
.btn-color-shift {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed, #6d28d9, #7c3aed, #8b5cf6);
    background-size: 200% 200%;
    animation: colorShift 1.5s ease infinite;
    color: #ffffff !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transform: translateZ(0);
}

@keyframes colorShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Rainbow Border Button */
.btn-rainbow {
    position: relative;
    background: transparent;
    color: #ffffff !important;
    border: none;
    z-index: 1;
}

.btn-rainbow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #8b5cf6, #7c3aed, #a78bfa, #8b5cf6);
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -2;
    animation: rainbowBorder 3s ease infinite;
}

.btn-rainbow::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: var(--zona-black-light);
    border-radius: inherit;
    z-index: -1;
}

@keyframes rainbowBorder {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 0.5;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Card Entrance Animations - FASTER */
.animate-card {
    opacity: 0;
    transform: translateY(20px) translateZ(0);
    animation: cardEntrance 0.3s ease-out forwards;
}

.animate-card:nth-child(1) { animation-delay: 0.05s; }
.animate-card:nth-child(2) { animation-delay: 0.1s; }
.animate-card:nth-child(3) { animation-delay: 0.15s; }
.animate-card:nth-child(4) { animation-delay: 0.2s; }
.animate-card:nth-child(5) { animation-delay: 0.25s; }
.animate-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes cardEntrance {
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

/* Fade In Animations - FASTER */
.fade-in {
    animation: fadeIn 0.25s ease-out forwards;
}

.fade-in-up {
    animation: fadeInUp 0.25s ease-out forwards;
}

.fade-in-down {
    animation: fadeInDown 0.25s ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.25s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.25s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-15px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-15px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateZ(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(15px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateZ(0);
    }
}

/* Pulse Animation - FASTER */
.pulse {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1) translateZ(0); }
    50% { transform: scale(1.03) translateZ(0); }
    100% { transform: scale(1) translateZ(0); }
}

/* Glow Animation - FASTER */
.glow {
    animation: glow 1s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    }
    to {
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.6);
    }
}

/* Shimmer Effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* Floating Animation */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Bounce Animation */
.bounce {
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* Rotate Animation */
.rotate {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Scale Animation */
.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Success Animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    position: relative;
}

.success-checkmark .check-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-sizing: border-box;
    background: var(--zona-success);
    position: relative;
    animation: successScale 0.5s ease;
}

.success-checkmark .check-icon::after {
    content: '';
    position: absolute;
    left: 28px;
    top: 16px;
    width: 16px;
    height: 32px;
    border: solid white;
    border-width: 0 4px 4px 0;
    transform: rotate(45deg);
    animation: checkmarkDraw 0.3s ease 0.3s forwards;
    opacity: 0;
}

@keyframes successScale {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes checkmarkDraw {
    to { opacity: 1; }
}

/* Counter Animation */
.counter-animate {
    display: inline-block;
}

/* Progress Bar Animation */
.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--zona-gradient-purple);
    border-radius: var(--radius-full);
    transition: width 1s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Typing Animation */
.typing {
    display: inline-block;
    overflow: hidden;
    border-right: 2px solid var(--zona-purple);
    white-space: nowrap;
    animation: 
        typing 3s steps(30, end),
        blinkCursor 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blinkCursor {
    from, to { border-color: transparent; }
    50% { border-color: var(--zona-purple); }
}

/* Slide Animations for Modals */
.slide-up {
    animation: slideUp 0.3s ease forwards;
}

.slide-down {
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Notification Animation */
.notification-enter {
    animation: notificationEnter 0.3s ease forwards;
}

.notification-exit {
    animation: notificationExit 0.3s ease forwards;
}

@keyframes notificationEnter {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes notificationExit {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Hover Lift Effect */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Text Gradient Animation */
.text-gradient-animate {
    background: linear-gradient(
        270deg,
        var(--zona-purple),
        var(--zona-purple-light),
        var(--zona-white),
        var(--zona-purple)
    );
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Border Animation */
.border-animate {
    position: relative;
}

.border-animate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: inherit;
    background: linear-gradient(45deg, var(--zona-purple), transparent, var(--zona-purple)) border-box;
    -webkit-mask: 
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderRotate 4s linear infinite;
}

@keyframes borderRotate {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}