/* ==========================================================================
   KERAH AI Landing Page - Animations
   ========================================================================== */

/* ==========================================================================
   1. SCROLL-TRIGGERED ANIMATIONS (AOS-like)
   ========================================================================== */

/* Base state for animated elements */
[data-aos] {
    opacity: 0;
    transition-property: opacity, transform;
    transition-duration: 600ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated state */
[data-aos].aos-animate {
    opacity: 1;
}

/* Fade Up */
[data-aos="fade-up"] {
    transform: translateY(30px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
}

/* Fade Down */
[data-aos="fade-down"] {
    transform: translateY(-30px);
}

[data-aos="fade-down"].aos-animate {
    transform: translateY(0);
}

/* Fade Left */
[data-aos="fade-left"] {
    transform: translateX(30px);
}

[data-aos="fade-left"].aos-animate {
    transform: translateX(0);
}

/* Fade Right */
[data-aos="fade-right"] {
    transform: translateX(-30px);
}

[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

/* Zoom In */
[data-aos="zoom-in"] {
    transform: scale(0.9);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

/* Zoom Out */
[data-aos="zoom-out"] {
    transform: scale(1.1);
}

[data-aos="zoom-out"].aos-animate {
    transform: scale(1);
}

/* Flip Up */
[data-aos="flip-up"] {
    transform: perspective(1000px) rotateX(20deg);
}

[data-aos="flip-up"].aos-animate {
    transform: perspective(1000px) rotateX(0);
}

/* Delay Utilities */
[data-aos-delay="100"] { transition-delay: 100ms; }
[data-aos-delay="200"] { transition-delay: 200ms; }
[data-aos-delay="300"] { transition-delay: 300ms; }
[data-aos-delay="400"] { transition-delay: 400ms; }
[data-aos-delay="500"] { transition-delay: 500ms; }
[data-aos-delay="600"] { transition-delay: 600ms; }
[data-aos-delay="700"] { transition-delay: 700ms; }
[data-aos-delay="800"] { transition-delay: 800ms; }

/* Duration Utilities */
[data-aos-duration="300"] { transition-duration: 300ms; }
[data-aos-duration="400"] { transition-duration: 400ms; }
[data-aos-duration="500"] { transition-duration: 500ms; }
[data-aos-duration="600"] { transition-duration: 600ms; }
[data-aos-duration="800"] { transition-duration: 800ms; }
[data-aos-duration="1000"] { transition-duration: 1000ms; }

/* ==========================================================================
   2. KEYFRAME ANIMATIONS
   ========================================================================== */

/* Pulse Glow Animation */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 4s ease-in-out infinite;
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Spin Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-spin-slow {
    animation: spin 3s linear infinite;
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* Ping Animation (for notifications) */
@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* Shimmer Animation (for loading states) */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        var(--glass-bg) 0%,
        var(--glass-bg-hover) 50%,
        var(--glass-bg) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Gradient Shift Animation */
@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 5s ease infinite;
}

/* Wave Animation */
@keyframes wave {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.5);
    }
}

/* Voice Waveform Animation */
.voice-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 40px;
}

.voice-wave-bar {
    width: 4px;
    height: 100%;
    background: var(--accent-blue);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.voice-wave-bar:nth-child(1) { animation-delay: 0s; }
.voice-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-wave-bar:nth-child(4) { animation-delay: 0.3s; }
.voice-wave-bar:nth-child(5) { animation-delay: 0.4s; }

/* Typing Animation */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

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

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

/* Fade In Animation */
@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fade-in 0.5s ease-out;
}

/* Slide In From Bottom */
@keyframes slide-in-bottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in-bottom {
    animation: slide-in-bottom 0.5s ease-out;
}

/* Slide In From Top */
@keyframes slide-in-top {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in-top {
    animation: slide-in-top 0.5s ease-out;
}

/* Scale In Animation */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scale-in 0.3s ease-out;
}

/* ==========================================================================
   3. HERO SPECIFIC ANIMATIONS
   ========================================================================== */

/* Hero Title Animation */
@keyframes hero-title-reveal {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.hero-title {
    animation: hero-title-reveal 0.8s ease-out;
}

/* Hero Stats Counter Animation */
@keyframes count-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-stat {
    animation: count-up 0.6s ease-out backwards;
}

.hero-stat:nth-child(1) { animation-delay: 0.3s; }
.hero-stat:nth-child(2) { animation-delay: 0.4s; }
.hero-stat:nth-child(3) { animation-delay: 0.5s; }

/* Hero Visual Orbit Animation */
@keyframes orbit {
    from {
        transform: rotate(0deg) translateX(120px) rotate(0deg);
    }
    to {
        transform: rotate(360deg) translateX(120px) rotate(-360deg);
    }
}

.orbit-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -24px;
    margin-left: -24px;
    width: 48px;
    height: 48px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: orbit 20s linear infinite;
}

.orbit-icon:nth-child(1) { animation-delay: 0s; }
.orbit-icon:nth-child(2) { animation-delay: -5s; }
.orbit-icon:nth-child(3) { animation-delay: -10s; }
.orbit-icon:nth-child(4) { animation-delay: -15s; }

.orbit-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

/* ==========================================================================
   4. CARD HOVER ANIMATIONS
   ========================================================================== */

/* Card Lift on Hover */
.card-hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

/* Card Glow on Hover */
.card-hover-glow {
    transition: box-shadow 0.3s ease;
}

.card-hover-glow:hover {
    box-shadow: var(--shadow-glow-blue);
}

/* Card Border Glow */
.card-hover-border {
    position: relative;
    overflow: hidden;
}

.card-hover-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-hover-border:hover::before {
    opacity: 1;
}

/* ==========================================================================
   5. BUTTON ANIMATIONS
   ========================================================================== */

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

.btn-ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.btn-ripple:active::after {
    transform: scale(4);
    opacity: 1;
    transition: 0s;
}

/* Button Shine Effect */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-shine:hover::before {
    left: 100%;
}

/* ==========================================================================
   6. LOADING STATES
   ========================================================================== */

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--glass-bg) 25%,
        var(--glass-bg-hover) 50%,
        var(--glass-bg) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 80%;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    padding: var(--space-6);
    background: var(--glass-bg);
    border-radius: var(--radius-xl);
}

/* Loading Dots */
@keyframes loading-dots {
    0%, 20% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    animation: loading-dots 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ==========================================================================
   7. NOTIFICATION ANIMATIONS
   ========================================================================== */

/* Toast Slide In */
@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-enter {
    animation: toast-slide-in 0.3s ease-out;
}

.toast-exit {
    animation: toast-slide-out 0.3s ease-in forwards;
}

/* ==========================================================================
   8. MODAL ANIMATIONS
   ========================================================================== */

/* Modal Overlay Fade */
@keyframes modal-overlay-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    animation: modal-overlay-fade 0.2s ease-out;
}

/* Modal Content Scale */
@keyframes modal-content-scale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content {
    animation: modal-content-scale 0.3s ease-out;
}

/* ==========================================================================
   9. REDUCED MOTION
   ========================================================================== */

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

    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
}
