/* ============================================
   Animations CSS
   Smooth Animations & Transitions
   ============================================ */

/* ===== Scroll Animations ===== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-in {
    animation: fadeIn 0.6s var(--ease-out) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-slide-up {
    animation: slideUp 0.6s var(--ease-out) forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-down {
    animation: slideDown 0.6s var(--ease-out) forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-left {
    animation: slideLeft 0.6s var(--ease-out) forwards;
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-right {
    animation: slideRight 0.6s var(--ease-out) forwards;
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-scale-in {
    animation: scaleIn 0.5s var(--ease-out) forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Stagger animation delays for grid items */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

.stagger-6 {
    animation-delay: 0.6s;
}

.stagger-7 {
    animation-delay: 0.7s;
}

.stagger-8 {
    animation-delay: 0.8s;
}

/* ===== Hover Animations ===== */
.hover-lift {
    transition: transform var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-grow {
    transition: transform var(--duration-fast) var(--ease-out);
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-glow {
    position: relative;
    transition: box-shadow var(--duration-normal) var(--ease-out);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(44, 82, 130, 0.3);
}

/* ===== Loading Animations ===== */
.loading-spinner {
    border: 3px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-dots {
    display: flex;
    gap: var(--space-2);
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: var(--color-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;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg,
            var(--color-gray-200) 0%,
            var(--color-gray-300) 50%,
            var(--color-gray-200) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ===== Ripple Effect ===== */
.ripple {
    position: relative;
    overflow: hidden;
}

.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;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ===== Floating Animation ===== */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* ===== Pulse Animation ===== */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ===== Bounce Animation ===== */
.bounce {
    animation: bounce-anim 1s ease infinite;
}

@keyframes bounce-anim {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ===== Progress Bar Animation ===== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transform-origin: left;
    z-index: var(--z-fixed);
    transition: transform 0.1s ease-out;
}

/* ===== Carousel/Gallery Animations ===== */
.carousel-slide {
    transition: transform var(--duration-slow) var(--ease-in-out),
        opacity var(--duration-slow) var(--ease-in-out);
}

.carousel-slide-enter {
    transform: translateX(100%);
    opacity: 0;
}

.carousel-slide-active {
    transform: translateX(0);
    opacity: 1;
}

.carousel-slide-exit {
    transform: translateX(-100%);
    opacity: 0;
}

/* ===== Modal/Overlay Animations ===== */
.modal-backdrop {
    animation: fadeIn 0.3s var(--ease-out) forwards;
}

.modal-content {
    animation: scaleIn 0.3s var(--ease-out) forwards;
}

/* ===== Icon Animations ===== */
.icon-bounce {
    display: inline-block;
    transition: transform var(--duration-fast) var(--ease-bounce);
}

.icon-bounce:hover {
    transform: scale(1.2);
}

.icon-rotate {
    display: inline-block;
    transition: transform var(--duration-normal) var(--ease-in-out);
}

.icon-rotate:hover {
    transform: rotate(360deg);
}

.icon-shake {
    display: inline-block;
}

.icon-shake:hover {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* ===== Text Animations ===== */
.text-gradient {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-shimmer {
    background: linear-gradient(90deg,
            var(--color-primary) 0%,
            var(--color-accent) 50%,
            var(--color-primary) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

/* ===== Scroll Progress Indicator ===== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--color-gray-200);
    z-index: var(--z-fixed);
}

.scroll-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transform-origin: left;
    transition: transform 0.1s ease-out;
}

/* ===== Notification/Toast Animations ===== */
.toast {
    animation: slideInRight 0.3s var(--ease-out) forwards;
}

.toast.removing {
    animation: slideOutRight 0.3s var(--ease-in) forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ===== Counter Animation (for statistics) ===== */
.counter {
    font-variant-numeric: tabular-nums;
}

/* ===== Page Transition ===== */
.page-transition {
    animation: pageTransition 0.4s var(--ease-out) forwards;
}

@keyframes pageTransition {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Reduced Motion Override ===== */
@media (prefers-reduced-motion: reduce) {

    .animate-on-scroll,
    .animate-fade-in,
    .animate-slide-up,
    .animate-slide-down,
    .animate-slide-left,
    .animate-slide-right,
    .animate-scale-in,
    .float,
    .pulse,
    .bounce,
    .text-shimmer {
        animation: none !important;
        transition: none !important;
    }

    .hover-lift:hover,
    .hover-grow:hover {
        transform: none !important;
    }
}