/* Animations for 1inch Converter */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animate In Class */
.animate-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Loading Animations */
.hero-content {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.hero-content.loaded {
    opacity: 1;
    transform: translateY(0);
}

.converter-widget {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.6s ease-out;
}

.converter-widget.loaded {
    opacity: 1;
    transform: scale(1);
}

/* Input Group Animations */
.input-group {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-out;
}

.input-group.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Button Animations */
.converter-actions button {
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s ease-out;
}

.converter-actions button.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Result Animation */
.result-animation {
    animation: pulse 0.3s ease-out;
}

/* Copy Button Animation */
.copy-animation {
    animation: bounce 0.3s ease-out;
}

/* Swap Button Animation */
.swap-animation {
    animation: rotate 0.3s ease-out;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(180deg);
    }
}

/* History Item Animation */
.history-item {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-out;
}

.history-item.show {
    opacity: 1;
    transform: translateY(0);
}

/* Notification Animation */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease-out;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification-success {
    background-color: var(--1inch-text-16);
}

.notification-error {
    background-color: #f44336;
}

.notification-info {
    background-color: var(--1inch-text-17);
}

/* Hover Animations */
.feature-card,
.step-card,
.btn-primary,
.btn-secondary,
.nav-list a {
    transition: all 0.3s ease-out;
}

.feature-card.hover,
.step-card.hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.btn-primary.hover,
.btn-secondary.hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-list a.hover {
    color: var(--1inch-text-02);
    transform: translateY(-1px);
}

/* Mobile Menu Animation */
.mobile-menu-toggle {
    transition: all 0.3s ease-out;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* FAQ Animation */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.faq-answer.show {
    max-height: 200px;
}

.faq-icon {
    transition: transform 0.3s ease-out;
}

/* Modal Animation */
.modal {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-out;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.modal.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleInUp {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Rotate Animations */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateIn {
    from {
        transform: rotate(-200deg);
        opacity: 0;
    }
    to {
        transform: rotate(0);
        opacity: 1;
    }
}

/* Loading Spinner */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Typing Animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: var(--1inch-text-02);
    }
}

/* Success Animation */
@keyframes success {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Error Animation */
@keyframes error {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* Apply animations to elements */

/* Hero Section Animations */
.hero-title {
    animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-features {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.converter-widget {
    animation: scaleInUp 0.8s ease-out 0.6s both;
}

/* Feature Cards Animation */
.feature-card {
    animation: fadeInUp 0.6s ease-out;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }
.feature-card:nth-child(4) { animation-delay: 0.4s; }
.feature-card:nth-child(5) { animation-delay: 0.5s; }
.feature-card:nth-child(6) { animation-delay: 0.6s; }

/* Step Cards Animation */
.step-card {
    animation: fadeInUp 0.6s ease-out;
}

.step-card:nth-child(1) { animation-delay: 0.1s; }
.step-card:nth-child(2) { animation-delay: 0.2s; }
.step-card:nth-child(3) { animation-delay: 0.3s; }

/* FAQ Items Animation */
.faq-item {
    animation: fadeInUp 0.5s ease-out;
}

.faq-item:nth-child(1) { animation-delay: 0.1s; }
.faq-item:nth-child(2) { animation-delay: 0.2s; }
.faq-item:nth-child(3) { animation-delay: 0.3s; }
.faq-item:nth-child(4) { animation-delay: 0.4s; }
.faq-item:nth-child(5) { animation-delay: 0.5s; }

/* Button Hover Animations */
.btn-primary:hover {
    animation: pulse 0.3s ease-in-out;
}

.btn-secondary:hover {
    animation: pulse 0.3s ease-in-out;
}

/* Converter Input Focus Animation */
.input-wrapper:focus-within {
    animation: pulse 0.3s ease-in-out;
}

/* Swap Button Animation */
.swap-button button:hover svg {
    animation: rotate 0.3s ease-in-out;
}

/* Success State Animation */
.success-animation {
    animation: success 0.5s ease-out;
}

/* Error State Animation */
.error-animation {
    animation: error 0.5s ease-out;
}

/* Loading State */
.loading {
    animation: spin 1s linear infinite;
}

/* Copy Button Success Animation */
.copy-success {
    animation: success 0.3s ease-out;
}

/* History Item Animation */
.history-item {
    animation: slideInRight 0.3s ease-out;
}

/* Modal Animation */
.modal {
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    animation: scaleIn 0.3s ease-out;
}

/* Scroll-triggered animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animations for lists */
.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-out;
}

.stagger-animation.animated > * {
    opacity: 1;
    transform: translateY(0);
}

.stagger-animation.animated > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-animation.animated > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-animation.animated > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-animation.animated > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-animation.animated > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-animation.animated > *:nth-child(6) { transition-delay: 0.6s; }

/* Hover effects */
.feature-card:hover {
    animation: pulse 0.3s ease-in-out;
}

.step-card:hover {
    animation: pulse 0.3s ease-in-out;
}

.faq-question:hover {
    animation: pulse 0.2s ease-in-out;
}

/* Focus animations for accessibility */
.btn-primary:focus,
.btn-secondary:focus,
.input-wrapper input:focus,
.input-wrapper select:focus {
    animation: pulse 0.2s ease-in-out;
}

/* Loading states */
.converting {
    position: relative;
}

.converting::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--1inch-border-01);
    border-top: 2px solid var(--1inch-text-02);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success message animation */
.success-message {
    animation: slideInUp 0.3s ease-out;
}

/* Error message animation */
.error-message {
    animation: shake 0.5s ease-in-out;
}

/* Tooltip animation */
.tooltip {
    animation: fadeInUp 0.2s ease-out;
}

/* Progress bar animation */
.progress-bar {
    animation: slideInLeft 0.5s ease-out;
}

/* Counter animation */
.counter {
    animation: scaleIn 0.5s ease-out;
}

/* Floating animation for decorative elements */
.floating {
    animation: bounce 2s ease-in-out infinite;
}

.floating-delayed {
    animation: bounce 2s ease-in-out infinite 1s;
}

/* Gradient animation */
.gradient-animation {
    background: linear-gradient(-45deg, var(--1inch-text-02), var(--1inch-text-08), var(--1inch-text-20), var(--1inch-text-02));
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Responsive animations */
@media (max-width: 768px) {
    .hero-title,
    .hero-subtitle,
    .hero-features,
    .converter-widget {
        animation-duration: 0.6s;
    }
    
    .feature-card,
    .step-card,
    .faq-item {
        animation-duration: 0.4s;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll,
    .stagger-animation > * {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
