/* Enterprise-Level Animations and Transitions */

/* Smooth Page Transitions */
@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 fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes progressBar {
    from {
        width: 0%;
    }
}

/* Animation Classes */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.5s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.5s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Staggered Animations */
.animate-stagger-1 {
    animation-delay: 0.1s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.animate-stagger-2 {
    animation-delay: 0.2s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.animate-stagger-3 {
    animation-delay: 0.3s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.animate-stagger-4 {
    animation-delay: 0.4s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.animate-stagger-5 {
    animation-delay: 0.5s;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* Smooth Transitions */
.transition-all {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-fast {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-slow {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.hover-scale {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(0, 102, 204, 0.4);
}

/* Card Animations */
.card-enter {
    animation: fadeInUp 0.5s ease-out forwards;
}

.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

/* Button Animations */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Progress Bar Animation */
.progress-bar-animated {
    animation: progressBar 1s ease-out forwards;
}

/* Table Row Animations */
.table-row-enter {
    animation: fadeIn 0.3s ease-out forwards;
}

.table-row-hover {
    transition: background-color 0.2s ease;
}

.table-row-hover:hover {
    background-color: rgba(0, 102, 204, 0.05);
    transform: scale(1.01);
}

/* Badge Animations */
.badge-pulse {
    animation: pulse 2s infinite;
}

.badge-bounce {
    animation: bounce 1s infinite;
}

/* Modal Animations */
.modal-enter {
    animation: scaleIn 0.3s ease-out forwards;
}

.modal-backdrop {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Notification Animations */
.notification-enter {
    animation: slideInRight 0.4s ease-out forwards;
}

.notification-exit {
    animation: slideInRight 0.4s ease-out reverse forwards;
}

/* Spinner */
.spinner {
    border: 3px solid rgba(0, 102, 204, 0.1);
    border-top-color: #0066cc;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* Loading Overlay */
.loading-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: 9999;
    animation: fadeIn 0.3s ease-out forwards;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Focus Animations */
.focus-ring {
    transition: box-shadow 0.2s ease;
}

.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);
}

/* Gradient Animations */
.gradient-animate {
    background: linear-gradient(-45deg, #0066cc, #3399ff, #66b5ff, #0066cc);
    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%;
    }
}

/* Number Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up {
    animation: countUp 0.6s ease-out forwards;
}

/* Micro-interactions */
.click-feedback {
    transition: transform 0.1s ease;
}

.click-feedback:active {
    transform: scale(0.95);
}

/* Smooth Opacity Transitions */
.opacity-enter {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.opacity-enter-active {
    opacity: 1;
}

.opacity-exit {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.opacity-exit-active {
    opacity: 0;
}

/* Stagger Children Animation */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ========== SaaS-style: Scroll reveal (AEO / section entrance) ========== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.scroll-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.scroll-reveal .faq-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.3s ease;
}
.scroll-reveal.is-visible .faq-item:nth-child(1) { transition-delay: 0.05s; }
.scroll-reveal.is-visible .faq-item:nth-child(2) { transition-delay: 0.1s; }
.scroll-reveal.is-visible .faq-item:nth-child(3) { transition-delay: 0.15s; }
.scroll-reveal.is-visible .faq-item:nth-child(4) { transition-delay: 0.2s; }
.scroll-reveal.is-visible .faq-item:nth-child(5) { transition-delay: 0.25s; }
.scroll-reveal.is-visible .faq-item {
    opacity: 1;
    transform: translateY(0);
}

/* SaaS card: subtle lift and glow on hover */
.saas-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
}
.saas-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px -12px rgba(0, 102, 204, 0.15);
}

/* Hero / stat number subtle float */
@keyframes floatSubtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.float-subtle {
    animation: floatSubtle 4s ease-in-out infinite;
}

/* Section entrance: use with animate-fade-in-up for above-the-fold */
.section-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.section-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile: show sections immediately so LCP/Speed Index improve (no JS scroll needed) */
@media (max-width: 640px) {
    .section-reveal {
        opacity: 1;
        transform: none;
    }
    /* Hero/content fade-in: show immediately on mobile to improve LCP */
    .fade-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Mobile menu toggle: no blue background */
.mobile-menu-toggle {
    background-color: transparent !important;
    background: none !important;
}

/* API docs code example tabs: inactive = dark readable text, active = white on blue */
.api-docs-responsive .code-example-tab:not(.bg-primary-600) {
    color: #111827 !important;
    background-color: transparent !important;
}

/* Popular questions FAQ: force card style (light bg, dark text) on all pages */
#faq .faq-accordion-item {
    background-color: #f9fafb !important;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
}
#faq .faq-accordion-item button {
    background-color: transparent !important;
    color: #111827 !important;
}
#faq .faq-accordion-item button:hover {
    background-color: rgba(243, 244, 246, 0.8) !important;
    color: #111827 !important;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
