/* ==========================================================================
   Animations & Transitions
   Shared animation definitions used across the application
   Replaces duplicate animations in login.css, site.css, etc.
   ========================================================================== */

/* ===== Fade In Animation ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    opacity: 0;
    animation: fadeIn ease-in 1;
    animation-fill-mode: forwards;
    animation-duration: var(--transition-slow, 1s);
}

.fade-in--first {
    animation-delay: 0.4s;
}

.fade-in--second {
    animation-delay: 0.6s;
}

.fade-in--third {
    animation-delay: 0.8s;
}

.fade-in--fourth {
    animation-delay: 1s;
}

/* ===== Fade In Down Animation ===== */
@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translate3d(0, -100%, 0);
    }
    100% {
        opacity: 1;
        transform: none;
    }
}

.fade-in-down {
    animation-name: fadeInDown;
    animation-duration: var(--transition-slow, 1s);
    animation-fill-mode: both;
}

/* ===== Underline Hover Effect ===== */
.underline-hover {
    position: relative;
    text-decoration: none;
}

.underline-hover::after {
    content: "";
    display: block;
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background-color: var(--color-info, #56baed);
    transition: width var(--transition-base, 0.2s);
}

.underline-hover:hover::after {
    width: 100%;
}

.underline-hover:hover {
    color: var(--color-gray-900, #0d0d0d);
}

/* ===== Slide Up Animation ===== */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp var(--transition-base, 0.3s) ease-out;
}

/* ===== Spin Animation (for loaders) ===== */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ===== Pulse Animation ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== Scale Animation ===== */
@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.scale-in {
    animation: scaleIn var(--transition-base, 0.2s) ease-out;
}

/* ===== Utility Classes for Common Transitions ===== */
.transition-all {
    transition: all var(--transition-base, 0.2s);
}

.transition-colors {
    transition: color var(--transition-base, 0.2s),
                background-color var(--transition-base, 0.2s),
                border-color var(--transition-base, 0.2s);
}

.transition-transform {
    transition: transform var(--transition-base, 0.2s);
}

.transition-opacity {
    transition: opacity var(--transition-base, 0.2s);
}

/* ===== Hover Effects ===== */
.hover-lift {
    transition: transform var(--transition-base, 0.2s),
                box-shadow var(--transition-base, 0.2s);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg, 0 4px 8px rgba(0, 0, 0, 0.15));
}

.hover-scale {
    transition: transform var(--transition-base, 0.2s);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-scale-sm:hover {
    transform: scale(1.02);
}

.hover-opacity {
    transition: opacity var(--transition-base, 0.2s);
}

.hover-opacity:hover {
    opacity: 0.8;
}

/* ===== Loading States ===== */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.skeleton {
    animation: shimmer 1.2s ease-in-out infinite;
    background: linear-gradient(
        to right,
        var(--color-gray-200, #e9ecef) 0%,
        var(--color-gray-100, #f5f5f5) 20%,
        var(--color-gray-200, #e9ecef) 40%,
        var(--color-gray-200, #e9ecef) 100%
    );
    background-size: 800px 104px;
}

/* ===== Reduced Motion Support (Accessibility) ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fade-in,
    .fade-in-down,
    .slide-up,
    .scale-in,
    .skeleton {
        animation: none;
    }
}
