/* ═══════════════════════════════════════════════════════════════════════════
   ZOOK AI WEB BUILDER - ANIMATION SYSTEM
   Complete animation utilities for modern, polished UI
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Animation durations */
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;

    /* Easing functions */
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CORE ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Fade In */
@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fade-in var(--duration-normal) var(--ease-out);
}

/* Slide Up */
@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slide-up var(--duration-normal) var(--ease-out);
}

/* Slide Down */
@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-down {
    animation: slide-down var(--duration-normal) var(--ease-out);
}

/* Scale In */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scale-in var(--duration-normal) var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Skeleton Pulse */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.skeleton-pulse {
    animation: skeleton-pulse 2s var(--ease-in-out) infinite;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-shimmer {
    animation: skeleton-shimmer 2s linear infinite;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
}

/* Spinner */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTON & INTERACTION ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Smooth Bounce (for CTAs) */
@keyframes smooth-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

.animate-bounce {
    animation: smooth-bounce 2s var(--ease-in-out) infinite;
}

/* Button Transitions */
button, .btn, a.btn-cta, a.btn-outline {
    transition: all var(--duration-fast) var(--ease-out);
}

button:hover, .btn:hover, a.btn-cta:hover, a.btn-outline:hover {
    transform: translateY(-2px);
}

button:active, .btn:active, a.btn-cta:active, a.btn-outline:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARD ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Card Elevate on Hover */
.card-hover {
    transition: all var(--duration-normal) var(--ease-out);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3),
                0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL & DIALOG ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Backdrop Fade In */
@keyframes backdrop-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.backdrop-fade {
    animation: backdrop-fade-in var(--duration-normal) var(--ease-out);
}

/* Modal Scale In */
@keyframes modal-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-enter {
    animation: modal-scale-in var(--duration-normal) var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Input Focus */
input, textarea, select {
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

/* Error Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake-error {
    animation: shake 0.5s var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR & NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sidebar Link Slide Background */
.sidebar-link {
    position: relative;
    overflow: hidden;
    transition: color var(--duration-fast) var(--ease-out);
}

.sidebar-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(124, 58, 237, 0.1);
    transition: left var(--duration-normal) var(--ease-out);
    z-index: -1;
}

.sidebar-link:hover::before,
.sidebar-link.active::before {
    left: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST & NOTIFICATION ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Toast Slide In from Top */
@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateY(-100%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-enter {
    animation: toast-slide-in var(--duration-normal) var(--ease-bounce);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATE INDICATORS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Success Flash */
@keyframes success-flash {
    0% { background-color: transparent; }
    50% { background-color: rgba(34, 197, 94, 0.2); }
    100% { background-color: transparent; }
}

.success-flash {
    animation: success-flash 0.6s var(--ease-out);
}

/* Error Flash */
@keyframes error-flash {
    0% { background-color: transparent; }
    50% { background-color: rgba(239, 68, 68, 0.2); }
    100% { background-color: transparent; }
}

.error-flash {
    animation: error-flash 0.6s var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS & LOADING STATES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Progress Bar Fill */
@keyframes progress-fill {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

.progress-animate {
    animation: progress-fill var(--duration-slow) var(--ease-out);
    transform-origin: left;
}

/* Pulse Glow (for active indicators) */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
    }
    50% {
        box-shadow: 0 0 20px 4px rgba(124, 58, 237, 0.2);
    }
}

.pulse-glow,
.animate-pulse-glow {
    animation: pulse-glow 2s var(--ease-in-out) infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STAGGER ANIMATIONS (for lists/grids)
   ═══════════════════════════════════════════════════════════════════════════ */

.stagger-item {
    opacity: 0;
    animation: slide-up var(--duration-normal) var(--ease-out) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 50ms; }
.stagger-item:nth-child(3) { animation-delay: 100ms; }
.stagger-item:nth-child(4) { animation-delay: 150ms; }
.stagger-item:nth-child(5) { animation-delay: 200ms; }
.stagger-item:nth-child(6) { animation-delay: 250ms; }
.stagger-item:nth-child(7) { animation-delay: 300ms; }
.stagger-item:nth-child(8) { animation-delay: 350ms; }
.stagger-item:nth-child(9) { animation-delay: 400ms; }
.stagger-item:nth-child(10) { animation-delay: 450ms; }

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY - RESPECT REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */

.transition-fast { transition: all var(--duration-fast) var(--ease-out); }
.transition-normal { transition: all var(--duration-normal) var(--ease-out); }
.transition-slow { transition: all var(--duration-slow) var(--ease-out); }

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }

/* Button Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0;
}

/* Loading Overlay (for full sections) */
.loading-overlay {
    position: relative;
}

.loading-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: fade-in 0.2s ease-out;
}

.loading-overlay::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid rgba(124, 58, 237, 0.2);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 11;
}
