/* ============================================
   AIJL Employee Management - Animations
   Smooth Transitions and Micro-interactions
   ============================================ */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bounce In */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* Spin */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Pulse */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Skeleton Loading */
@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Shake */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Float */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Glow */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(37, 99, 235, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.8);
    }
}

/* ============================================
   ANIMATION UTILITY CLASSES
   ============================================ */

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease-out;
}

.animate-bounce-in {
    animation: bounceIn 0.6s ease-out;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Stagger animations for lists */
.stagger-animation>* {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.stagger-animation>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-animation>*:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-animation>*:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-animation>*:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-animation>*:nth-child(5) {
    animation-delay: 0.5s;
}

.stagger-animation>*:nth-child(6) {
    animation-delay: 0.6s;
}

.stagger-animation>*:nth-child(7) {
    animation-delay: 0.7s;
}

.stagger-animation>*:nth-child(8) {
    animation-delay: 0.8s;
}

/* ============================================
   HOVER EFFECTS
   ============================================ */

.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

.hover-brightness {
    transition: filter var(--transition-fast);
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

.btn-shimmer {
    position: relative;
    overflow: hidden;
}

.btn-shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transition: left 0.5s;
}

.btn-shimmer:hover::before {
    left: 100%;
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: loading-dots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loading-dots {

    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.loading-bars {
    display: inline-flex;
    gap: 4px;
    align-items: flex-end;
    height: 24px;
}

.loading-bars span {
    width: 4px;
    background: currentColor;
    animation: loading-bars 1s ease-in-out infinite;
}

.loading-bars span:nth-child(1) {
    animation-delay: 0s;
}

.loading-bars span:nth-child(2) {
    animation-delay: 0.1s;
}

.loading-bars span:nth-child(3) {
    animation-delay: 0.2s;
}

.loading-bars span:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes loading-bars {

    0%,
    100% {
        height: 8px;
    }

    50% {
        height: 24px;
    }
}

/* ============================================
   FORM INPUT ANIMATIONS
   ============================================ */

.form-control {
    transition: all var(--transition-fast);
}

.form-control:focus {
    animation: input-focus 0.3s ease-out;
}

@keyframes input-focus {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.01);
    }

    100% {
        transform: scale(1);
    }
}

.form-control.error {
    animation: shake 0.5s ease-out;
}

/* Floating Label Effect */
.form-floating {
    position: relative;
}

.form-floating .form-control {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating label {
    position: absolute;
    top: 0;
    left: 0;
    padding: var(--space-3) var(--space-4);
    pointer-events: none;
    transform-origin: 0 0;
    transition: all var(--transition-fast);
    color: var(--color-neutral-500);
}

.form-floating .form-control:focus~label,
.form-floating .form-control:not(:placeholder-shown)~label {
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    color: var(--color-primary-500);
}

/* ============================================
   MODAL ANIMATIONS
   ============================================ */

.modal-overlay {
    animation: fadeIn 0.3s ease-out;
}

.modal {
    animation: scaleIn 0.3s ease-out;
}

.modal.closing {
    animation: scaleOut 0.2s ease-out forwards;
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* ============================================
   TOAST ANIMATIONS
   ============================================ */

.toast {
    animation: slideInRight 0.3s ease-out;
}

.toast.removing {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ============================================
   PROGRESS BAR ANIMATION
   ============================================ */

.progress-bar {
    height: 4px;
    background: var(--color-neutral-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-accent-500));
    border-radius: var(--radius-full);
    transition: width 0.3s ease-out;
}

.progress-bar-indeterminate {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-accent-500));
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        left: -30%;
    }

    100% {
        left: 100%;
    }
}

/* ============================================
   CARD ENTRANCE ANIMATIONS
   ============================================ */

.card-entrance {
    animation: fadeInUp 0.6s ease-out;
}

.employee-card {
    animation: fadeInUp 0.5s ease-out backwards;
}

/* Stagger card animations */
.employee-list .employee-card:nth-child(1) {
    animation-delay: 0.05s;
}

.employee-list .employee-card:nth-child(2) {
    animation-delay: 0.1s;
}

.employee-list .employee-card:nth-child(3) {
    animation-delay: 0.15s;
}

.employee-list .employee-card:nth-child(4) {
    animation-delay: 0.2s;
}

.employee-list .employee-card:nth-child(5) {
    animation-delay: 0.25s;
}

.employee-list .employee-card:nth-child(6) {
    animation-delay: 0.3s;
}

/* ============================================
   ATTENTION SEEKERS
   ============================================ */

.attention-pulse {
    animation: attention-pulse 2s ease-in-out infinite;
}

@keyframes attention-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.attention-bounce {
    animation: attention-bounce 1s ease-in-out infinite;
}

@keyframes attention-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ============================================
   REDUCE MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}