/* ============================================
   CAMPUS LANE HOLDINGS - ENHANCED ANIMATIONS
   Advanced animation library with smooth effects
   ============================================ */

/* ===== KEYFRAME ANIMATIONS ===== */

/* Fade Animations */
@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);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleUp {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.05);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Slide Animations */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Rotate Animations */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

/* Bounce Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

@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);
    }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--clh-primary), 0 0 10px var(--clh-primary);
    }
    50% {
        box-shadow: 0 0 20px var(--clh-primary), 0 0 30px var(--clh-primary);
    }
}

/* Shimmer/Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Ripple Animation */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Progress Bar Animation */
@keyframes progressBar {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* Typing Animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* ===== UTILITY ANIMATION CLASSES ===== */

.animate-fade-in {
    animation: fadeIn 0.6s var(--clh-ease-out) forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s var(--clh-ease-out) forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s var(--clh-ease-out) forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s var(--clh-ease-out) forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s var(--clh-ease-out) forwards;
}

.animate-scale-in {
    animation: scaleIn 0.4s var(--clh-ease-out) forwards;
}

.animate-bounce-in {
    animation: bounceIn 0.8s var(--clh-ease-out) forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s var(--clh-ease-out) forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s var(--clh-ease-out) forwards;
}

.animate-rotate-in {
    animation: rotateIn 0.6s var(--clh-ease-out) forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-shake {
    animation: shake 0.5s;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* ===== SCROLL ANIMATIONS ===== */

.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--clh-ease-out),
                transform 0.8s var(--clh-ease-out);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s var(--clh-ease-out),
                transform 0.8s var(--clh-ease-out);
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s var(--clh-ease-out),
                transform 0.8s var(--clh-ease-out);
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s var(--clh-ease-out),
                transform 0.8s var(--clh-ease-out);
}

.scroll-reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Stagger animations for children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--clh-ease-out),
                transform 0.6s var(--clh-ease-out);
}

.stagger-children.revealed > * {
    opacity: 1;
    transform: translateY(0);
}

.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 > *:nth-child(7) { transition-delay: 0.7s; }
.stagger-children.revealed > *:nth-child(8) { transition-delay: 0.8s; }

/* ===== HOVER ANIMATIONS ===== */

.hover-lift {
    transition: transform var(--clh-transition-base),
                box-shadow var(--clh-transition-base);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--clh-shadow-xl);
}

.hover-grow {
    transition: transform var(--clh-transition-base);
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-shrink {
    transition: transform var(--clh-transition-base);
}

.hover-shrink:hover {
    transform: scale(0.95);
}

.hover-rotate {
    transition: transform var(--clh-transition-base);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: box-shadow var(--clh-transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(var(--clh-primary-rgb), 0.5);
}

.hover-brighten {
    transition: filter var(--clh-transition-base);
}

.hover-brighten:hover {
    filter: brightness(1.1);
}

.hover-blur-bg {
    position: relative;
    overflow: hidden;
}

.hover-blur-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    filter: blur(0);
    transition: filter var(--clh-transition-base);
    z-index: -1;
}

.hover-blur-bg:hover::before {
    filter: blur(8px);
}

/* ===== LOADING ANIMATIONS ===== */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--clh-border-primary);
    border-top-color: var(--clh-primary);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

.loading-dots {
    display: flex;
    gap: var(--clh-space-2);
    justify-content: center;
    align-items: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--clh-primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-skeleton {
    background: linear-gradient(
        90deg,
        var(--clh-bg-secondary) 0%,
        var(--clh-bg-tertiary) 50%,
        var(--clh-bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--clh-radius-md);
}

.loading-progress {
    width: 100%;
    height: 4px;
    background: var(--clh-bg-secondary);
    border-radius: var(--clh-radius-full);
    overflow: hidden;
    position: relative;
}

.loading-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: var(--clh-primary);
    border-radius: var(--clh-radius-full);
    animation: progressBar 1.5s ease-in-out infinite;
}

/* ===== PAGE TRANSITIONS ===== */

.page-transition-fade {
    animation: fadeIn 0.5s var(--clh-ease-out);
}

.page-transition-slide-up {
    animation: fadeInUp 0.6s var(--clh-ease-out);
}

/* ===== MICRO INTERACTIONS ===== */

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::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%);
    pointer-events: none;
}

.ripple-effect:active::after {
    width: 300px;
    height: 300px;
    animation: ripple 0.6s ease-out;
}

.button-press {
    transition: transform 0.1s ease;
}

.button-press:active {
    transform: scale(0.95);
}

/* ===== PARALLAX EFFECT ===== */

.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* ===== GRADIENT ANIMATIONS ===== */

.gradient-animated {
    background: linear-gradient(
        -45deg,
        var(--clh-primary),
        var(--clh-secondary),
        var(--clh-accent),
        var(--clh-primary-light)
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* ===== TEXT ANIMATIONS ===== */

.text-gradient {
    background: linear-gradient(
        135deg,
        var(--clh-primary),
        var(--clh-secondary),
        var(--clh-accent)
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 8s ease infinite;
}

.text-reveal {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--clh-primary);
    animation: typing 3.5s steps(40) 1s forwards,
               blink 0.75s step-end infinite;
}

/* ===== CARD ANIMATIONS ===== */

.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ===== ATTENTION SEEKERS ===== */

.wiggle {
    animation: shake 0.5s ease;
}

.heartbeat {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ===== SMOOTH SCROLL ===== */

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* ===== ANIMATION DELAYS ===== */

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* ===== ANIMATION DURATIONS ===== */

.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 1.5s; }
