/**
 * GiftBot Effects & Animations CSS
 * Skeleton loaders, transitions, and micro-animations
 */

/* ========================================
   SKELETON LOADING STATES
   ======================================== */

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 25%,
            rgba(255, 255, 255, 0.12) 50%,
            rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Task Skeleton */
.task-skeleton {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin-bottom: 12px;
}

.task-skeleton .skeleton-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

.task-skeleton .skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-skeleton .skeleton-title {
    height: 16px;
    width: 70%;
}

.task-skeleton .skeleton-subtitle {
    height: 12px;
    width: 40%;
}

.task-skeleton .skeleton-btn {
    width: 70px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* Store Item Skeleton */
.store-skeleton {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    padding: 0;
}

.store-skeleton .skeleton-image {
    width: 100%;
    height: 120px;
}

.store-skeleton .skeleton-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.store-skeleton .skeleton-name {
    height: 18px;
    width: 80%;
}

.store-skeleton .skeleton-price {
    height: 14px;
    width: 50%;
}

.store-skeleton .skeleton-action {
    height: 40px;
    width: 100%;
    border-radius: 10px;
    margin-top: 8px;
}

/* Leaderboard Skeleton */
.lb-skeleton {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 8px;
}

.lb-skeleton .skeleton-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.lb-skeleton .skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.lb-skeleton .skeleton-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lb-skeleton .skeleton-name {
    height: 14px;
    width: 60%;
}

.lb-skeleton .skeleton-stat {
    height: 12px;
    width: 30%;
}

/* ========================================
   PAGE TRANSITIONS
   ======================================== */

.section {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.35s ease-out, transform 0.35s ease-out;
    will-change: opacity, transform;
}

.section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Staggered list entry animation */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: stagger-in 0.4s ease-out forwards;
}

@keyframes stagger-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.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;
}

.stagger-item:nth-child(9) {
    animation-delay: 0.45s;
}

.stagger-item:nth-child(10) {
    animation-delay: 0.5s;
}

/* ========================================
   BUTTON RIPPLE EFFECTS
   ======================================== */

.ripple-btn {
    position: relative;
    overflow: hidden;
}

.ripple-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.25) 10%, transparent 10%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.8s;
}

.ripple-btn:active::after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* ========================================
   CARD HOVER & TAP EFFECTS
   ======================================== */

.card-interactive {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-interactive:active {
    transform: scale(0.98);
}

/* Subtle glow on interactive cards */
.card-glow {
    transition: box-shadow 0.3s ease;
}

.card-glow:active {
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.3);
}

/* ========================================
   LOADING STATES
   ======================================== */

/* Button loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   PULSE ANIMATION (for active elements)
   ======================================== */

.pulse {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(108, 92, 231, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(108, 92, 231, 0);
    }
}

/* ========================================
   SMOOTH NUMBER TRANSITIONS
   ======================================== */

.animate-number {
    transition: transform 0.3s ease;
    display: inline-block;
}

.animate-number.updating {
    transform: scale(1.1);
}

/* ========================================
   ENTRANCE ANIMATIONS
   ======================================== */

.fade-in {
    animation: fade-in 0.4s ease-out forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scale-in {
    animation: scale-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   LAZY LOAD IMAGE PLACEHOLDER
   ======================================== */

.lazy-img {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lazy-img.loaded {
    opacity: 1;
}

.lazy-img-placeholder {
    background: linear-gradient(135deg,
            rgba(108, 92, 231, 0.1) 0%,
            rgba(0, 206, 201, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 24px;
}