/* ==========================================
   Animations & Transitions
   ========================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Staggered children animation */
.stagger-children>* {
    animation: fadeInUp 0.4s ease both;
}

.stagger-children>*:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-children>*:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-children>*:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-children>*:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger-children>*:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-children>*:nth-child(6) {
    animation-delay: 0.3s;
}

.stagger-children>*:nth-child(7) {
    animation-delay: 0.35s;
}

.stagger-children>*:nth-child(8) {
    animation-delay: 0.4s;
}

/* Page transition */
.page-enter {
    animation: fadeInUp 0.35s ease;
}

/* Hover micro-interactions */
.hover-lift {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.hover-glow {
    transition: box-shadow var(--transition-fast);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
}

/* Ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
    top: 50%;
    left: 50%;
    transform: scale(0);
    opacity: 1;
    transition: none;
}

.ripple:active::after {
    transform: scale(4);
    opacity: 0;
    transition: transform 0.5s, opacity 0.8s;
}

/* Typing animation for generated output */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: var(--sp-2);
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--text-tertiary);
    animation: pulse 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Smooth theme transition */
[data-theme] * {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.15s ease;
}

/* Exceptions */
[data-theme] .btn-generate,
[data-theme] .module-hero,
[data-theme] .user-avatar,
[data-theme] .module-icon,
[data-theme] .premium-badge,
[data-theme] .sidebar-upgrade {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
