/* ============================================================
   Skeleton Loading 骨架載入動畫
   ============================================================ */

/* 基礎骨架樣式 */
.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 0%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.03) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* 淺色主題 */
[data-theme="light"] .skeleton {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.06) 0%,
            rgba(0, 0, 0, 0.12) 50%,
            rgba(0, 0, 0, 0.06) 100%);
    background-size: 200% 100%;
}

/* 骨架元素類型 */
.skeleton-text {
    height: 16px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-title {
    height: 24px;
    width: 40%;
    border-radius: 6px;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-avatar.large {
    width: 80px;
    height: 80px;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
}

.skeleton-image.square {
    aspect-ratio: 1;
}

.skeleton-button {
    width: 120px;
    height: 42px;
    border-radius: 8px;
}

.skeleton-card {
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 圖片網格骨架 */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.skeleton-grid-item {
    aspect-ratio: 1;
    border-radius: 12px;
}

/* 列表骨架 */
.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-list-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.skeleton-list-item .skeleton-avatar {
    flex-shrink: 0;
}

.skeleton-list-item .skeleton-content {
    flex: 1;
}

/* ============================================================
   Loading Spinner 載入動畫
   ============================================================ */

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary, #6366f1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.large {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 脈沖載入點 */
.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary, #6366f1);
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================
   進度條
   ============================================================ */

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #6366f1), #a855f7);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-bar.indeterminate .progress-bar-fill {
    width: 30%;
    animation: progressIndeterminate 1.5s ease-in-out infinite;
}

@keyframes progressIndeterminate {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(400%);
    }
}

/* ============================================================
   Placeholder 空狀態
   ============================================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--muted, #888);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text, #fff);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    max-width: 300px;
    line-height: 1.6;
}

.empty-state-action {
    margin-top: 24px;
}

/* ============================================================
   頁面切換動畫
   ============================================================ */

.page-transition {
    animation: pageIn 0.3s ease-out;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in up 動畫類 */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

.fade-in-up:nth-child(1) {
    animation-delay: 0.1s;
}

.fade-in-up:nth-child(2) {
    animation-delay: 0.2s;
}

.fade-in-up:nth-child(3) {
    animation-delay: 0.3s;
}

.fade-in-up:nth-child(4) {
    animation-delay: 0.4s;
}

.fade-in-up:nth-child(5) {
    animation-delay: 0.5s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   響應式
   ============================================================ */

@media (max-width: 640px) {
    .skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .empty-state {
        padding: 40px 16px;
    }

    .empty-state-icon {
        font-size: 48px;
    }
}