/* N0W1D Telegram Mini App - Enhanced Professional Animations */

/* === Entrance 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 fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

/* === Slide Animations === */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

/* === Attention Seekers === */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.9;
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14%, 42% {
        transform: scale(1.15);
    }
    28%, 70% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-6px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(6px);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px);
    }
    60% {
        transform: translateY(-7px);
    }
}

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

/* === Loading Animations === */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0px,
        var(--bg-tertiary) 50px,
        var(--bg-secondary) 100px
    );
    background-size: 600px 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 18px;
    margin-bottom: var(--spacing-sm);
}

.skeleton-title {
    height: 28px;
    width: 60%;
    margin-bottom: var(--spacing-md);
}

.skeleton-image {
    height: 220px;
    margin-bottom: var(--spacing-md);
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.4;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.loading-dots {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.loading-dot {
    width: 10px;
    height: 10px;
    background: var(--gradient-primary);
    border-radius: 50%;
    animation: loadingDots 1.6s infinite ease-in-out;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes rotateGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(147, 85, 250, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* === Success Animations === */
@keyframes successCircle {
    0% {
        stroke-dashoffset: 250;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes successCheck {
    0% {
        stroke-dashoffset: 50;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes successScale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.success-checkmark {
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-xl);
}

.success-checkmark circle {
    stroke: var(--success);
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 250;
    animation: successCircle 0.8s ease-in-out,
               successScale 0.8s ease-in-out;
}

.success-checkmark path {
    stroke: var(--success);
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 50;
    animation: successCheck 0.4s ease-in-out 0.4s forwards;
}

/* === Paper Airplane Animation === */
@keyframes paperPlane {
    0% {
        transform: translate(-50%, -50%) rotate(-45deg) scale(0.3);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translate(100%, -200%) rotate(15deg) scale(1.2);
        opacity: 0;
    }
}

@keyframes paperPlaneShadow {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 0.3;
    }
}

.paper-airplane-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    font-size: 72px;
    z-index: var(--z-tooltip);
    filter: drop-shadow(0 4px 12px rgba(147, 85, 250, 0.4));
    animation: paperPlane 2.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Notification Badge === */
.notification-badge {
    animation: badgePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 16px rgba(239, 68, 68, 0.6);
    }
}

/* === Stagger Animations === */
.stagger-item {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }

/* === Hover Effects === */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-2xl);
}

.hover-scale {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(147, 85, 250, 0.4),
                0 8px 24px rgba(147, 85, 250, 0.2);
}

/* === Ripple Effect === */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.ripple:active::before {
    width: 400px;
    height: 400px;
}

/* === Icon Animations === */
@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

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

.icon-animated {
    display: inline-block;
    animation: iconBounce 2s ease-in-out infinite;
}

.icon-spin {
    animation: iconRotate 1.5s linear infinite;
}

/* === Progress Bar Animation === */
@keyframes fillProgress {
    from {
        width: 0%;
    }
}

.progress-fill-animated {
    animation: fillProgress 2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 16px rgba(255, 255, 255, 0.6);
    }
}

/* === Gradient Animation === */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animated {
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

/* === Floating Animation === */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-12px);
    }
}

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

/* === Page Transitions === */
.page-enter {
    animation: fadeInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-exit {
    animation: fadeOut 0.2s ease;
}

/* === Modal Animations === */
@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

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

.modal-overlay-enter {
    animation: modalOverlay 0.3s ease;
}

/* === Button Shine Effect === */
@keyframes buttonShine {
    from {
        left: -100%;
    }
    to {
        left: 200%;
    }
}

.btn-shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: skewX(-25deg);
}

.btn-shine:hover::after {
    animation: buttonShine 0.8s ease-in-out;
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Smooth Scroll */
html:not([data-reduced-motion]) {
    scroll-behavior: smooth;
}
