/**
 * DigitalWC - Animations
 * CSS animations and transitions
 */

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */

/* Fade In */
@keyframes dwc-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Up */
@keyframes dwc-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes dwc-fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes dwc-fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes dwc-fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Scale Out */
@keyframes dwc-scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Slide In Up */
@keyframes dwc-slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Slide In Down */
@keyframes dwc-slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Slide In Left */
@keyframes dwc-slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Slide In Right */
@keyframes dwc-slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Bounce */
@keyframes dwc-bounce {
    0%, 20%, 53%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translateY(0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-15px);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-7px);
    }
    80% {
        transform: translateY(0);
    }
    90% {
        transform: translateY(-3px);
    }
}

/* Pulse */
@keyframes dwc-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Shake */
@keyframes dwc-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

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

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

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

/* Gradient Shift */
@keyframes dwc-gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ==========================================================================
   ANIMATION CLASSES
   ========================================================================== */

.dwc-animate-fadeIn {
    animation: dwc-fadeIn 0.3s ease forwards;
}

.dwc-animate-fadeInUp {
    animation: dwc-fadeInUp 0.4s ease forwards;
}

.dwc-animate-fadeInDown {
    animation: dwc-fadeInDown 0.4s ease forwards;
}

.dwc-animate-fadeInLeft {
    animation: dwc-fadeInLeft 0.4s ease forwards;
}

.dwc-animate-fadeInRight {
    animation: dwc-fadeInRight 0.4s ease forwards;
}

.dwc-animate-scaleIn {
    animation: dwc-scaleIn 0.3s ease forwards;
}

.dwc-animate-slideInUp {
    animation: dwc-slideInUp 0.4s ease forwards;
}

.dwc-animate-slideInDown {
    animation: dwc-slideInDown 0.4s ease forwards;
}

.dwc-animate-slideInLeft {
    animation: dwc-slideInLeft 0.4s ease forwards;
}

.dwc-animate-slideInRight {
    animation: dwc-slideInRight 0.4s ease forwards;
}

.dwc-animate-bounce {
    animation: dwc-bounce 1s ease;
}

.dwc-animate-pulse {
    animation: dwc-pulse 2s ease infinite;
}

.dwc-animate-shake {
    animation: dwc-shake 0.5s ease;
}

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

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

/* ==========================================================================
   STAGGER ANIMATIONS
   ========================================================================== */

.dwc-stagger > * {
    opacity: 0;
    animation: dwc-fadeInUp 0.4s ease forwards;
}

.dwc-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.dwc-stagger > *:nth-child(2) { animation-delay: 0.15s; }
.dwc-stagger > *:nth-child(3) { animation-delay: 0.2s; }
.dwc-stagger > *:nth-child(4) { animation-delay: 0.25s; }
.dwc-stagger > *:nth-child(5) { animation-delay: 0.3s; }
.dwc-stagger > *:nth-child(6) { animation-delay: 0.35s; }
.dwc-stagger > *:nth-child(7) { animation-delay: 0.4s; }
.dwc-stagger > *:nth-child(8) { animation-delay: 0.45s; }
.dwc-stagger > *:nth-child(9) { animation-delay: 0.5s; }
.dwc-stagger > *:nth-child(10) { animation-delay: 0.55s; }
.dwc-stagger > *:nth-child(11) { animation-delay: 0.6s; }
.dwc-stagger > *:nth-child(12) { animation-delay: 0.65s; }

/* ==========================================================================
   HOVER ANIMATIONS
   ========================================================================== */

.dwc-hover-lift {
    transition: transform var(--dwc-transition-fast);
}

.dwc-hover-lift:hover {
    transform: translateY(-4px);
}

.dwc-hover-scale {
    transition: transform var(--dwc-transition-fast);
}

.dwc-hover-scale:hover {
    transform: scale(1.05);
}

.dwc-hover-glow {
    transition: box-shadow var(--dwc-transition-fast);
}

.dwc-hover-glow:hover {
    box-shadow: 0 0 20px rgba(var(--dwc-color-primary-rgb), 0.4);
}

.dwc-hover-rotate {
    transition: transform var(--dwc-transition-fast);
}

.dwc-hover-rotate:hover {
    transform: rotate(5deg);
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */

.dwc-loading {
    position: relative;
    pointer-events: none;
}

.dwc-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(var(--dwc-color-primary-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dwc-loading .dwc-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Button loading state */
.dwc-btn--loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.dwc-btn--loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: dwc-spin 0.6s linear infinite;
}

.dwc-btn--loading.dwc-btn--primary::after {
    border-color: rgba(255, 255, 255, 0.3);
    border-right-color: white;
}

/* ==========================================================================
   SCROLL ANIMATIONS
   ========================================================================== */

.dwc-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.dwc-reveal.dwc-revealed {
    opacity: 1;
    transform: translateY(0);
}

.dwc-reveal--left {
    transform: translateX(-30px);
}

.dwc-reveal--right {
    transform: translateX(30px);
}

.dwc-reveal--scale {
    transform: scale(0.9);
}

.dwc-reveal--left.dwc-revealed,
.dwc-reveal--right.dwc-revealed,
.dwc-reveal--scale.dwc-revealed {
    transform: none;
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

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

    .dwc-reveal {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   NOTIFICATION ANIMATIONS
   ========================================================================== */

.dwc-toast {
    animation: dwc-slideInRight 0.3s ease, dwc-fadeIn 0.3s ease;
}

.dwc-toast--exit {
    animation: dwc-slideInRight 0.3s ease reverse, dwc-fadeIn 0.3s ease reverse;
}

/* ==========================================================================
   MENU ANIMATIONS
   ========================================================================== */

.dwc-menu-item {
    opacity: 0;
    transform: translateX(-20px);
}

.dwc-menu--open .dwc-menu-item {
    animation: dwc-fadeInLeft 0.4s ease forwards;
}

.dwc-menu--open .dwc-menu-item:nth-child(1) { animation-delay: 0.1s; }
.dwc-menu--open .dwc-menu-item:nth-child(2) { animation-delay: 0.15s; }
.dwc-menu--open .dwc-menu-item:nth-child(3) { animation-delay: 0.2s; }
.dwc-menu--open .dwc-menu-item:nth-child(4) { animation-delay: 0.25s; }
.dwc-menu--open .dwc-menu-item:nth-child(5) { animation-delay: 0.3s; }
.dwc-menu--open .dwc-menu-item:nth-child(6) { animation-delay: 0.35s; }
.dwc-menu--open .dwc-menu-item:nth-child(7) { animation-delay: 0.4s; }
.dwc-menu--open .dwc-menu-item:nth-child(8) { animation-delay: 0.45s; }

/* ==========================================================================
   IMAGE LOAD ANIMATION
   ========================================================================== */

.dwc-img-loading {
    background: var(--dwc-bg-surface-2);
    animation: dwc-pulse 1.5s ease-in-out infinite;
}

.dwc-img-loaded {
    animation: dwc-fadeIn 0.3s ease;
}

/* ==========================================================================
   RIPPLE EFFECT
   ========================================================================== */

.dwc-ripple {
    position: relative;
    overflow: hidden;
}

.dwc-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.dwc-ripple:active::before {
    width: 200%;
    height: 200%;
    opacity: 1;
    transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
}

/* ==========================================================================
   COUNTER ANIMATION
   ========================================================================== */

.dwc-counter {
    display: inline-block;
    animation: dwc-scaleIn 0.3s ease;
}

.dwc-counter--update {
    animation: dwc-bounce 0.5s ease;
}
