/**
 * TitanDefi - 骨架屏样式
 * 在数据加载时显示占位动画
 */

/* 骨架屏基础样式 */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.5rem;
}

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

/* 不同尺寸的骨架元素 */
.skeleton-text {
    height: 1rem;
    width: 60%;
}

.skeleton-text-sm {
    height: 0.75rem;
    width: 40%;
}

.skeleton-text-lg {
    height: 1.5rem;
    width: 80%;
}

.skeleton-title {
    height: 2rem;
    width: 50%;
}

.skeleton-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
}

.skeleton-avatar-lg {
    width: 4rem;
    height: 4rem;
    border-radius: 9999px;
}

.skeleton-button {
    height: 2.5rem;
    width: 100%;
    border-radius: 0.75rem;
}

.skeleton-card {
    height: 6rem;
    width: 100%;
    border-radius: 1rem;
}

.skeleton-stat {
    height: 3rem;
    width: 5rem;
}

/* 骨架屏容器 */
.skeleton-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

/* 闪屏样式 */
#splashScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#splashScreen.hide {
    opacity: 0;
    visibility: hidden;
}

#splashScreen .logo {
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
    animation: splash-pulse 2s infinite;
    /* logo 容器设为圆形，配合透明背景 logo */
    border-radius: 50%;
}

#splashScreen .logo-img {
    width: 100%;
    height: 100%;
    /* 移除 border-radius，logo 本身就是透明背景的圆形设计 */
}

#splashScreen .logo-icon {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #A855F7 100%);
    border-radius: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
}

#splashScreen .logo-text {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
}

@keyframes splash-pulse {
    0%, 100% {
        transform: scale(1);
        /* 使用 drop-shadow 让阴影跟随圆形 logo 形状 */
        filter: drop-shadow(0 10px 20px rgba(99, 102, 241, 0.4));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 15px 30px rgba(139, 92, 246, 0.5));
    }
}

#splashScreen .app-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #6366F1, #A855F7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#splashScreen .app-tagline {
    font-size: 0.875rem;
    color: #94A3B8;
    margin-bottom: 2rem;
}

#splashScreen .loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

#splashScreen .loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #6366F1, #A855F7);
    border-radius: 2px;
    animation: loading-progress 2s ease-in-out;
}

@keyframes loading-progress {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* Pending 交易浮层动画 */
@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

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

/* 页面切换过渡 */
.page-enter {
    opacity: 0;
    transform: translateX(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.page-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* 数据刷新指示器 */
.refresh-indicator {
    position: fixed;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(99, 102, 241, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.refresh-indicator.show {
    opacity: 1;
}

.refresh-indicator .spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 成功/失败状态动画 */
.status-success {
    animation: status-pop 0.3s ease-out;
}

.status-error {
    animation: status-shake 0.4s ease-out;
}

@keyframes status-pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes status-shake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

/* 骨架屏组合模板 */

/* 首页骨架屏 */
.skeleton-home {
    padding: 1rem;
}

.skeleton-home .skeleton-balance {
    height: 4rem;
    width: 70%;
    margin: 0 auto 1.5rem;
}

.skeleton-home .skeleton-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-home .skeleton-countdown {
    height: 5rem;
    margin-bottom: 1.5rem;
}

.skeleton-home .skeleton-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.skeleton-home .skeleton-action {
    height: 4rem;
    border-radius: 0.75rem;
}

/* 抽奖页骨架屏 */
.skeleton-lottery {
    padding: 1rem;
}

.skeleton-lottery .skeleton-pool {
    height: 8rem;
    margin-bottom: 1.5rem;
}

.skeleton-lottery .skeleton-my-info {
    height: 6rem;
    margin-bottom: 1.5rem;
}

.skeleton-lottery .skeleton-history-item {
    height: 4rem;
    margin-bottom: 0.75rem;
}

/* 个人中心骨架屏 */
.skeleton-profile {
    padding: 1rem;
}

.skeleton-profile .skeleton-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-profile .skeleton-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-profile .skeleton-stat-box {
    height: 5rem;
    border-radius: 1rem;
}
