/* ================================================================
   RegulAI — Animations & Micro-Interactions
   ================================================================ */

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(30px, -30px) rotate(5deg);
    }

    50% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }

    75% {
        transform: translate(20px, 30px) rotate(3deg);
    }
}

@keyframes typing {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }

    50% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes progressGlow {

    0%,
    100% {
        box-shadow: 0 0 10px var(--primary-glow);
    }

    50% {
        box-shadow: 0 0 25px var(--primary-glow);
    }
}

@keyframes borderGlow {

    0%,
    100% {
        border-color: var(--glass-border);
    }

    50% {
        border-color: var(--border-accent);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Animation Classes ───────────────────────────────────── */
.animate-fade-in {
    animation: fadeIn var(--transition-base) ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ── Staggered Animations ────────────────────────────────── */
.stagger>* {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.stagger>*:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger>*:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger>*:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger>*:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger>*:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger>*:nth-child(6) {
    animation-delay: 0.3s;
}

.stagger>*:nth-child(7) {
    animation-delay: 0.35s;
}

.stagger>*:nth-child(8) {
    animation-delay: 0.4s;
}

/* ── Loading Overlay ─────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-6);
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

/* ── Hover Lift ──────────────────────────────────────────── */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ── Ripple Effect ───────────────────────────────────────── */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 10%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

.ripple:active::after {
    transform: translate(-50%, -50%) scale(4);
    opacity: 1;
    transition: transform 0s, opacity 0s;
}

/* ── AI Processing Animation ─────────────────────────────── */
.ai-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-12);
}

.ai-brain {
    width: 80px;
    height: 80px;
    position: relative;
}

.ai-brain::before {
    content: '🧠';
    font-size: 3rem;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s infinite;
}

.ai-brain::after {
    content: '';
    position: absolute;
    inset: -10px;
    border: 2px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

.ai-processing-text {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    animation: pulse 2s infinite;
}

.ai-processing-dots {
    display: flex;
    gap: 6px;
}

.ai-processing-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.ai-processing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-processing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ── Page Transitions ────────────────────────────────────── */
.page-enter {
    animation: fadeInUp 0.4s ease-out;
}

/* ── Number Counter Animation ────────────────────────────── */
.count-up {
    animation: countUp 0.5s ease-out;
}

/* ── Glow on hover ───────────────────────────────────────── */
.glow-hover {
    transition: box-shadow var(--transition-base);
}

.glow-hover:hover {
    box-shadow: var(--shadow-glow);
}

/* ── Gradient Border Effect ──────────────────────────────── */
.gradient-border {
    position: relative;
    border: none !important;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--gradient-primary);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}