/**
 * KalviYogi Student Life OS - Premium Animations Library
 * Smooth, performant animations for all pages
 */

/* ========================================
   KEYFRAME ANIMATIONS
   ======================================== */

/* Fade In Up - Most common reveal animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Scale */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Bounce In */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Float Animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Pulse Glow */
@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.6);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Gradient Shift */
@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Rotate Glow */
@keyframes rotateGlow {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Typewriter Cursor */
@keyframes blink {

    0%,
    50% {
        border-right-color: var(--color-accent);
    }

    50.1%,
    100% {
        border-right-color: transparent;
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Slide In Up (stronger) */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Zoom In */
@keyframes zoomIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Heartbeat */
@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.1);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.1);
    }

    70% {
        transform: scale(1);
    }
}

/* Shake */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* ========================================
   ANIMATION UTILITY CLASSES
   ======================================== */

/* Base animation class */
.animate {
    animation-duration: 0.6s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

.animate-slow {
    animation-duration: 1s;
}

.animate-fast {
    animation-duration: 0.3s;
}

/* Animation Types */
.animate-fadeInUp {
    animation-name: fadeInUp;
}

.animate-fadeInDown {
    animation-name: fadeInDown;
}

.animate-fadeInScale {
    animation-name: fadeInScale;
}

.animate-fadeInLeft {
    animation-name: fadeInLeft;
}

.animate-fadeInRight {
    animation-name: fadeInRight;
}

.animate-bounceIn {
    animation-name: bounceIn;
}

.animate-zoomIn {
    animation-name: zoomIn;
}

.animate-slideInUp {
    animation-name: slideInUp;
}

/* Continuous Animations */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-pulse {
    animation: pulseGlow 2s ease-in-out infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg,
            rgba(212, 175, 55, 0) 0%,
            rgba(212, 175, 55, 0.3) 50%,
            rgba(212, 175, 55, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* ========================================
   STAGGER DELAYS
   ======================================== */

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

.delay-6 {
    animation-delay: 0.6s;
}

.delay-7 {
    animation-delay: 0.7s;
}

.delay-8 {
    animation-delay: 0.8s;
}

.delay-9 {
    animation-delay: 0.9s;
}

.delay-10 {
    animation-delay: 1.0s;
}

/* ========================================
   SCROLL REVEAL (JS Integration)
   ======================================== */

/* Initially hidden for scroll reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Stagger for children */
.stagger-children>* {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-children.revealed>*:nth-child(1) {
    transition-delay: 0.1s;
}

.stagger-children.revealed>*:nth-child(2) {
    transition-delay: 0.2s;
}

.stagger-children.revealed>*:nth-child(3) {
    transition-delay: 0.3s;
}

.stagger-children.revealed>*:nth-child(4) {
    transition-delay: 0.4s;
}

.stagger-children.revealed>*:nth-child(5) {
    transition-delay: 0.5s;
}

.stagger-children.revealed>*:nth-child(6) {
    transition-delay: 0.6s;
}

.stagger-children.revealed>* {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   HOVER ANIMATIONS
   ======================================== */

/* Card Lift */
.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.4), 0 0 30px rgba(212, 175, 55, 0.2);
}

/* Card Glow */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.4);
}

/* Icon Bounce */
.hover-bounce:hover {
    animation: bounceIn 0.5s ease;
}

/* Zoom on Hover */
.hover-zoom {
    transition: transform 0.3s ease;
}

.hover-zoom:hover {
    transform: scale(1.05);
}

/* Rotate Icon */
.hover-rotate:hover svg,
.hover-rotate:hover .icon {
    transform: rotate(15deg);
    transition: transform 0.3s ease;
}

/* Shine Effect */
.hover-shine {
    position: relative;
    overflow: hidden;
}

.hover-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    transform: rotate(30deg) translateX(-100%);
    transition: transform 0.6s ease;
}

.hover-shine:hover::after {
    transform: rotate(30deg) translateX(100%);
}

/* ========================================
   LOADING ANIMATIONS
   ======================================== */

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            var(--color-bg-input) 25%,
            var(--color-bg-card) 50%,
            var(--color-bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: rotateGlow 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* Dots Loading */
.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: bounceIn 0.6s ease infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.1s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.2s;
}

/* ========================================
   SPECIAL EFFECTS
   ======================================== */

/* Gradient Border Animation */
.gradient-border {
    position: relative;
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg,
            var(--color-accent),
            transparent,
            var(--color-accent),
            transparent);
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: gradientShift 4s ease infinite;
}

/* Glow Card */
.glow-card {
    position: relative;
}

.glow-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 30px rgba(212, 175, 55, 0.1);
    pointer-events: none;
}

/* Neon Text */
.neon-text {
    text-shadow:
        0 0 10px rgba(212, 175, 55, 0.5),
        0 0 20px rgba(212, 175, 55, 0.3),
        0 0 40px rgba(212, 175, 55, 0.1);
}

/* Animated Underline */
.animated-underline {
    position: relative;
    display: inline-block;
}

.animated-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.animated-underline:hover::after {
    width: 100%;
}

/* ========================================
   RESPONSIVE MOTION PREFERENCE
   ======================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
    }
}