/**
 * WS Karriere Animation Styles
 *
 * @package WS_Karriere
 */

/* ==========================================================================
   Animation Variables
   ========================================================================== */

:root {
    --ws-animation-duration: 0.4s;
    --ws-animation-duration-fast: 0.2s;
    --ws-animation-duration-slow: 0.6s;
    --ws-animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
    --ws-animation-easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Fade Animations
   ========================================================================== */

@keyframes ws-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes ws-fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes ws-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ws-fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ws-fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes ws-fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==========================================================================
   Scale Animations
   ========================================================================== */

@keyframes ws-scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ws-scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes ws-zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ws-zoomInBounce {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Slide Animations
   ========================================================================== */

@keyframes ws-slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes ws-slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes ws-slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes ws-slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ==========================================================================
   Bounce Animations
   ========================================================================== */

@keyframes ws-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

@keyframes ws-bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* ==========================================================================
   Pulse Animations
   ========================================================================== */

@keyframes ws-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes ws-pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
}

/* ==========================================================================
   Shake Animation
   ========================================================================== */

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

/* ==========================================================================
   Spinner Animations
   ========================================================================== */

@keyframes ws-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ws-spinPulse {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* ==========================================================================
   Stagger Animation Classes
   ========================================================================== */

.ws-animate {
    animation-fill-mode: both;
    animation-duration: var(--ws-animation-duration);
    animation-timing-function: var(--ws-animation-easing);
}

.ws-animate-fast {
    animation-duration: var(--ws-animation-duration-fast);
}

.ws-animate-slow {
    animation-duration: var(--ws-animation-duration-slow);
}

/* Animation Types */
.ws-animate-fadeIn {
    animation-name: ws-fadeIn;
}

.ws-animate-fadeInUp {
    animation-name: ws-fadeInUp;
}

.ws-animate-fadeInDown {
    animation-name: ws-fadeInDown;
}

.ws-animate-fadeInLeft {
    animation-name: ws-fadeInLeft;
}

.ws-animate-fadeInRight {
    animation-name: ws-fadeInRight;
}

.ws-animate-scaleIn {
    animation-name: ws-scaleIn;
}

.ws-animate-zoomIn {
    animation-name: ws-zoomIn;
}

.ws-animate-zoomInBounce {
    animation-name: ws-zoomInBounce;
}

.ws-animate-slideInUp {
    animation-name: ws-slideInUp;
}

.ws-animate-slideInDown {
    animation-name: ws-slideInDown;
}

.ws-animate-slideInLeft {
    animation-name: ws-slideInLeft;
}

.ws-animate-slideInRight {
    animation-name: ws-slideInRight;
}

.ws-animate-bounce {
    animation-name: ws-bounce;
}

.ws-animate-bounceIn {
    animation-name: ws-bounceIn;
}

.ws-animate-pulse {
    animation-name: ws-pulse;
    animation-iteration-count: infinite;
}

.ws-animate-shake {
    animation-name: ws-shake;
}

/* ==========================================================================
   Stagger Delays for Grid Items
   ========================================================================== */

.ws-stagger-item {
    opacity: 0;
}

.ws-stagger-item.ws-animate {
    opacity: 1;
}

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

/* ==========================================================================
   Hover Animations
   ========================================================================== */

.ws-hover-lift {
    transition: transform var(--ws-animation-duration) var(--ws-animation-easing),
                box-shadow var(--ws-animation-duration) var(--ws-animation-easing);
}

.ws-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.ws-hover-scale {
    transition: transform var(--ws-animation-duration) var(--ws-animation-easing);
}

.ws-hover-scale:hover {
    transform: scale(1.02);
}

.ws-hover-glow {
    transition: box-shadow var(--ws-animation-duration) var(--ws-animation-easing);
}

.ws-hover-glow:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

/* ==========================================================================
   Loading States
   ========================================================================== */

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

.ws-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid transparent;
    border-top-color: var(--ws-karriere-primary);
    border-radius: 50%;
    animation: ws-spin 0.8s linear infinite;
}

.ws-loading > * {
    opacity: 0.5;
}

/* Skeleton Loading */
.ws-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: ws-skeleton-loading 1.5s infinite;
    border-radius: var(--ws-karriere-radius-sm);
}

@keyframes ws-skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.ws-skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.ws-skeleton-title {
    height: 24px;
    width: 70%;
    margin-bottom: 12px;
}

.ws-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.ws-skeleton-card {
    padding: 24px;
    background: var(--ws-karriere-white);
    border-radius: var(--ws-karriere-radius-lg);
}

/* ==========================================================================
   Transition Classes for JS
   ========================================================================== */

.ws-transition-enter {
    opacity: 0;
    transform: translateY(10px);
}

.ws-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--ws-animation-duration) var(--ws-animation-easing),
                transform var(--ws-animation-duration) var(--ws-animation-easing);
}

.ws-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.ws-transition-exit-active {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity var(--ws-animation-duration) var(--ws-animation-easing),
                transform var(--ws-animation-duration) var(--ws-animation-easing);
}

/* ==========================================================================
   Success Checkmark Animation
   ========================================================================== */

.ws-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: var(--ws-karriere-success);
    stroke-miterlimit: 10;
    margin: 0 auto 20px;
    box-shadow: inset 0 0 0 var(--ws-karriere-success);
    animation: ws-checkmark-fill 0.4s ease-in-out 0.4s forwards,
               ws-checkmark-scale 0.3s ease-in-out 0.9s both;
}

.ws-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke-miterlimit: 10;
    stroke: var(--ws-karriere-success);
    fill: none;
    animation: ws-checkmark-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.ws-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: ws-checkmark-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes ws-checkmark-stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes ws-checkmark-scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes ws-checkmark-fill {
    100% {
        box-shadow: inset 0 0 0 40px rgba(34, 197, 94, 0.1);
    }
}

/* ==========================================================================
   Counter Animation
   ========================================================================== */

.ws-counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Progress Bar Animation
   ========================================================================== */

.ws-progress {
    height: 8px;
    background-color: var(--ws-karriere-border);
    border-radius: 4px;
    overflow: hidden;
}

.ws-progress-bar {
    height: 100%;
    background-color: var(--ws-karriere-primary);
    border-radius: 4px;
    transition: width var(--ws-animation-duration-slow) var(--ws-animation-easing);
}

.ws-progress-bar-animated {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: ws-progress-stripes 1s linear infinite;
}

@keyframes ws-progress-stripes {
    from {
        background-position: 1rem 0;
    }
    to {
        background-position: 0 0;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

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

    .ws-animate,
    .ws-stagger-item {
        animation: none !important;
        opacity: 1 !important;
    }

    .ws-hover-lift:hover,
    .ws-hover-scale:hover {
        transform: none !important;
    }
}
