/* ==========================================
   DUOLINGO-STYLE ANIMATIONS & EFFECTS
   =========================================== */

/* Keyframe Animations */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes heartBeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(0.95);
    }
    20%, 50%, 80%, 100% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
    }
}

@keyframes prominent-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 12px 35px rgba(76, 175, 80, 0.7);
    }
}

@keyframes super-prominent-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(232, 222, 33, 0.6);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.06);
        box-shadow: 0 8px 25px rgba(232, 222, 33, 0.8);
        filter: brightness(1.1);
    }
    50% {
        transform: scale(1.12);
        box-shadow: 0 15px 40px rgba(232, 222, 33, 1);
        filter: brightness(1.2);
    }
    75% {
        transform: scale(1.06);
        box-shadow: 0 8px 25px rgba(232, 222, 33, 0.8);
        filter: brightness(1.1);
    }
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-2deg);
    }
    75% {
        transform: rotate(2deg);
    }
}

/* Animation Classes */
.animate-slide-in-top {
    animation: slideInFromTop 0.6s ease-out;
}

.animate-slide-in-bottom {
    animation: slideInFromBottom 0.6s ease-out;
}

.animate-slide-in-left {
    animation: slideInFromLeft 0.6s ease-out;
}

.animate-slide-in-right {
    animation: slideInFromRight 0.6s ease-out;
}

.animate-bounce-in {
    animation: slideInFromBottom 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-heart-beat {
    animation: heartBeat 1.3s ease-in-out;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-prominent-pulse {
    animation: prominent-pulse 1.5s ease-in-out infinite;
    transition: none !important;
}

.animate-prominent-pulse:hover {
    animation: prominent-pulse 1.5s ease-in-out infinite !important;
    transform: scale(1.08) !important;
    box-shadow: 0 12px 35px rgba(76, 175, 80, 0.7) !important;
}

.btn-hero.animate-super-prominent-pulse {
    animation: super-prominent-pulse 2s ease-in-out infinite !important;
    transition: none !important;
    opacity: 1 !important;
    transform: scale(1) !important;
    box-shadow: 0 4px 15px rgba(232, 222, 33, 0.6) !important;
    filter: brightness(1) !important;
}

.btn-hero.animate-super-prominent-pulse:hover {
    animation: super-prominent-pulse 2s ease-in-out infinite !important;
    transform: scale(1.12) !important;
    box-shadow: 0 15px 40px rgba(232, 222, 33, 1) !important;
    filter: brightness(1.2) !important;
    opacity: 1 !important;
}

/* Force animation with highest specificity */
a.btn-hero.animate-super-prominent-pulse {
    animation: super-prominent-pulse 2s ease-in-out infinite !important;
    transition: none !important;
    opacity: 1 !important;
}

a.btn-hero.animate-super-prominent-pulse:hover {
    animation: super-prominent-pulse 2s ease-in-out infinite !important;
    opacity: 1 !important;
}

.animate-wiggle {
    animation: wiggle 0.5s ease-in-out;
}

/* Staggered Animations for Lists */
.animate-stagger > * {
    opacity: 0;
    animation: slideInFromBottom 0.6s ease-out forwards;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.3s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.4s; }
.animate-stagger > *:nth-child(6) { animation-delay: 0.5s; }
.animate-stagger > *:nth-child(n+7) { animation-delay: 0.6s; }

/* ==========================================
   INTERACTIVE BUTTON & CARD EFFECTS
   =========================================== */

/* Button Scale Effect */
.btn {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.2);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 5px 10px rgba(76, 175, 80, 0.15);
}

/* Ripple Effect for Buttons */
.btn::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;
    pointer-events: none;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* Card Hover Effects */
.card {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(76, 175, 80, 0.15);
}

.step-card {
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.step-card:hover {
    border-color: hsl(152 60% 40%);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(76, 175, 80, 0.2);
}

/* ==========================================
   LOADING & SKELETON ANIMATIONS
   =========================================== */

.skeleton {
    animation: shimmer 2s infinite;
    background: linear-gradient(
        90deg,
        hsl(210 40% 96%) 25%,
        hsl(210 40% 90%) 50%,
        hsl(210 40% 96%) 75%
    );
    background-size: 200% 100%;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
}

.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.skeleton-button {
    height: 2.5rem;
    border-radius: 0.375rem;
}

/* Loading Spinner */
.loader {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(76, 175, 80, 0.2);
    border-radius: 50%;
    border-top-color: hsl(152 60% 40%);
    animation: spin 0.8s linear infinite;
}

/* ==========================================
   PAGE TRANSITION ANIMATIONS
   =========================================== */

.page-enter {
    animation: slideInFromBottom 0.4s ease-out;
}

.page-exit {
    animation: slideInFromBottom 0.4s ease-out reverse;
}

/* ==========================================
   MOBILE RESPONSIVE ANIMATIONS
   =========================================== */

@media (max-width: 768px) {
    /* Reduce animation duration on mobile for better UX */
    .animate-slide-in-top,
    .animate-slide-in-bottom,
    .animate-slide-in-left,
    .animate-slide-in-right,
    .animate-bounce-in,
    .animate-fade-in {
        animation-duration: 0.4s;
    }

    /* Disable some animations on low-power devices */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }

    /* Optimize card animations for touch */
    .card {
        transition: all 0.2s ease;
    }

    .card:active {
        transform: translateY(-3px);
    }
}

/* ==========================================
   SUCCESS & ERROR ANIMATIONS
   =========================================== */

.success-animation {
    animation: heartBeat 0.6s ease-in-out;
}

.error-shake {
    animation: wiggle 0.5s ease-in-out;
}

/* Confetti-like celebration */
@keyframes confetti {
    0% {
        opacity: 1;
        transform: translateY(0) rotateZ(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) rotateZ(360deg);
    }
}

.celebrate {
    animation: confetti 0.8s ease-out forwards;
}

/* ==========================================
   TEXT ANIMATIONS
   =========================================== */

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* .animate-typewriter {
    overflow: hidden;
    border-right: 3px solid hsl(152 60% 40%);
    animation: typewriter 3s steps(40, end);
} */

.animate-typewriter {
    display: inline-block;
    width: max-content;
    overflow: hidden;
    white-space: nowrap;
    animation: typewriter 3s steps(40, end);
}


/* Gradient text animation */
@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.animate-gradient-text {
    background: linear-gradient(
        90deg,
        hsl(152 60% 40%),
        hsl(190 85% 45%),
        hsl(152 60% 40%)
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

/* ==========================================
   SCROLL ANIMATIONS
   =========================================== */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   BADGES & STATUS INDICATORS
   =========================================== */

.badge-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.badge-glow {
    animation: glow 2s ease-in-out infinite;
}

.status-online {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    background-color: #10b981;
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================
   NOTIFICATION ANIMATIONS
   =========================================== */

@keyframes slideInNotification {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutNotification {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification {
    animation: slideInNotification 0.3s ease-out;
}

.notification.hide {
    animation: slideOutNotification 0.3s ease-out forwards;
}

/* ==========================================
   PARALLAX SCROLLING
   =========================================== */

.parallax {
    perspective: 1000px;
}

.parallax-layer {
    will-change: transform;
}

/* ==========================================
   MODAL & OVERLAY ANIMATIONS
   =========================================== */

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleInModal {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-overlay {
    animation: fadeInOverlay 0.3s ease-out;
}

.modal-content {
    animation: scaleInModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================
   CONFETTI & STAT HIGHLIGHT STYLES
   =========================================== */

.confetti-container {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    transform-origin: center;
    will-change: transform, opacity;
    animation-name: confetti-fall;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
    animation-fill-mode: forwards;
}

@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) translateX(0); }
    100% { opacity: 0; transform: translateY(400px) rotate(720deg) translateX(120px); }
}


/* STAT HIGHLIGHT */
.stat-value {
    font-weight: 800;
    font-size: 2.5rem;
    color: var(--color-secondary, #E8DE21);
    transition: transform 0.35s ease, text-shadow 0.35s ease;
}

.stat-value.animate-gradient {
    background: linear-gradient(90deg, #E8DE21, #02A9CA, #F59E0B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-item:hover .stat-value {
    transform: translateY(-6px) scale(1.05);
    text-shadow: 0 8px 24px rgba(2,169,202,0.12);
}

.stat-item { padding: 1rem 0; }

/* Match dashboard card appearance for homepage stats */
.stat-item.card {
    background: var(--color-card-light, #ffffff);
    border-radius: 0.75rem;
    box-shadow: 0 8px 30px rgba(2,8,23,0.06);
    border: 1px solid rgba(14, 165, 233, 0.06);
}

.stat-label { color: var(--color-text-subtle, #6B7280); font-size: 0.95rem; }

/* Dashboard-accented stat card */
.stat-item.card.accent-primary {
    background: linear-gradient(180deg, rgba(2,169,202,0.03), rgba(255,255,255,0));
    border-left: 4px solid var(--color-primary, #02A9CA);
    box-shadow: 0 10px 30px rgba(2,169,202,0.04);
}

.stat-item.card.accent-primary .stat-value {
    color: var(--color-secondary, #E8DE21);
}

/* Override gradient to ensure yellow-first appearance on accent stat cards */
.stat-item.card.accent-primary .stat-value.animate-gradient {
    background: linear-gradient(90deg, #FDE68A 0%, #F59E0B 50%, #E8DE21 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

@keyframes popScale {
    0% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-6px) scale(1.12); }
    100% { transform: translateY(0) scale(1.03); }
}

.stat-value.pop-scale {
    animation: popScale 600ms cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

.stat-value.counting {
    transform-origin: center;
}


