/* =========================================
   CSEC Animation Library
   Premium animations and micro-interactions
   ========================================= */

/* =========================================
   Keyframe Definitions
   ========================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(11, 58, 106, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(11, 58, 106, 0.8);
    }
}

/* =========================================
   Scroll Reveal Animations
   ========================================= */

.reveal {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
}

.reveal-fade {
    animation: fadeIn 0.8s ease-out forwards;
}

.reveal-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.reveal-down {
    animation: fadeInDown 0.8s ease-out forwards;
}

.reveal-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.reveal-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

.reveal-zoom {
    animation: zoomIn 0.8s ease-out forwards;
}

/* Stagger delays for multiple elements */
.reveal-delay-1 {
    animation-delay: 0.1s;
}

.reveal-delay-2 {
    animation-delay: 0.2s;
}

.reveal-delay-3 {
    animation-delay: 0.3s;
}

.reveal-delay-4 {
    animation-delay: 0.4s;
}

.reveal-delay-5 {
    animation-delay: 0.5s;
}

.reveal-delay-6 {
    animation-delay: 0.6s;
}

/* =========================================
   Hover Effects
   ========================================= */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-glow:hover {
    animation: glow 1.5s ease-in-out infinite;
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-shine {
    position: relative;
    overflow: hidden;
}

.hover-shine::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 ease;
}

.hover-shine:hover::before {
    left: 100%;
}

/* =========================================
   Button Animations
   ========================================= */

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

.btn-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.btn-bounce {
    animation: bounce 2s ease-in-out infinite;
}

/* =========================================
   Loading Animations
   ========================================= */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(11, 58, 106, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.skeleton {
    background: linear-gradient(90deg,
            var(--slate-100) 0%,
            var(--slate-200) 50%,
            var(--slate-100) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* =========================================
   Page Transitions
   ========================================= */

.page-transition {
    animation: fadeIn 0.5s ease-in-out;
}

/* =========================================
   Utility Classes
   ========================================= */

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-spin {
    animation: rotate 1s linear infinite;
}

/* =========================================
   Reduced Motion Support
   ========================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}