/**
 * Home Page Skeleton Loader Styles
 * 首頁骨架屏載入動畫樣式
 */

/* Skeleton Container */
.skeleton-container {
    padding: 40px 0;
    background: #f8f9fa;
}

/* Skeleton Card */
.skeleton-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    height: 250px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

.skeleton-card::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: skeleton-shimmer 1.5s infinite;
}

/* Skeleton Chart (較高的骨架屏) */
.skeleton-chart {
    height: 350px;
}

/* Shimmer Animation */
@keyframes skeleton-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Loading Animation */
@keyframes skeleton-loading {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Skeleton Elements (內部元素) */
.skeleton-text {
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-text-title {
    width: 60%;
    height: 24px;
}

.skeleton-text-line {
    width: 100%;
    height: 16px;
}

.skeleton-text-line-short {
    width: 80%;
    height: 16px;
}

.skeleton-circle {
    background: #e0e0e0;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
}

/* Fade In Animation (主內容載入後) */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#main-content {
    animation: fadeIn 0.5s ease-in;
}

/* Card Animation (卡片進入動畫) */
.card.animate-in,
.stat-card.animate-in {
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ripple Effect (波紋效果) */
.ripple-container {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 992px) {
    .skeleton-container {
        padding: 30px 0;
    }

    .skeleton-card {
        height: 200px;
        margin-bottom: 20px;
    }

    .skeleton-chart {
        height: 280px;
    }
}

@media (max-width: 768px) {
    .skeleton-container {
        padding: 20px 0;
    }

    .skeleton-card {
        height: 180px;
        margin-bottom: 15px;
    }

    .skeleton-chart {
        height: 250px;
    }
}

/* Dark Mode Support (可選) */
@media (prefers-color-scheme: dark) {
    .skeleton-container {
        background: #1a1a1a;
    }

    .skeleton-card {
        background: #2d2d2d;
    }

    .skeleton-text,
    .skeleton-circle {
        background: #404040;
    }

    .skeleton-card::before {
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.05) 50%,
            transparent 100%
        );
    }
}

/* Accessibility - Reduce Motion */
@media (prefers-reduced-motion: reduce) {
    .skeleton-card::before,
    .skeleton-card,
    #main-content,
    .card.animate-in,
    .stat-card.animate-in,
    .ripple {
        animation: none;
    }

    .skeleton-card {
        opacity: 0.7;
    }
}

/* Lazy Loading Images */
img[data-src] {
    transition: opacity 0.3s ease-in;
    opacity: 0.7;
}

img[data-src].loaded {
    opacity: 1;
}

img[data-src].error {
    opacity: 0.5;
    border: 2px dashed #dc3545;
}
