/* 
 * skeleton.css - 統一骨架屏樣式
 * 適用於 Category 和 Product 頁面
 */

/* === 基礎骨架屏樣式 === */
.skeleton-wrapper, 
.product-skeleton-wrapper {
    display: block !important;
    opacity: 1 !important;
    font-family: 'Mulish', -apple-system, BlinkMacSystemFont, sans-serif;
    animation: skeletonFadeIn 0.3s ease-in;
}

.skeleton-fade-out,
.product-skeleton-fade-out {
    animation: skeletonFadeOut 0.3s ease-out forwards;
}

@keyframes skeletonFadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes skeletonFadeOut { 
    from { opacity: 1; } 
    to { opacity: 0; } 
}

/* === 統一的 Shimmer 動畫 === */
.skeleton-shimmer,
.skeleton-subtitle,
.skeleton-title,
.skeleton-circle,
.skeleton-category-name,
.skeleton-product-image,
.skeleton-product-title,
.skeleton-color-dot,
.skeleton-product-price,
.main-image,
.thumbnail,
.title,
.rating,
.code,
.price,
.color-item,
.size-item,
.qty-btn,
.qty-input,
.add-cart-btn,
.wishlist-btn,
.shipping-icon,
.shipping-text,
.reviews-title,
.review-title,
.review-date,
.review-stars,
.review-content {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* === CATEGORY 頁面骨架屏樣式 === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.mt-3 { 
    margin-top: 20px; 
}

.skeleton-section { 
    margin-bottom: 40px; 
}

.skeleton-header {
    margin-bottom: 25px;
    text-align: center;
}

.skeleton-subtitle {
    height: 16px;
    width: 100px;
    margin: 0 auto 10px auto;
    border-radius: 4px;
}

.skeleton-title {
    height: 32px;
    width: 200px;
    margin: 0 auto;
    border-radius: 4px;
}

.skeleton-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    justify-items: center;
    margin-bottom: 40px;
}

.skeleton-category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.skeleton-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 10px;
}

.skeleton-category-name {
    height: 16px;
    width: 60px;
    border-radius: 4px;
}

.skeleton-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    justify-items: center;
}

.skeleton-product-card {
    width: 100%;
    max-width: 280px;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.skeleton-product-image {
    width: 100%;
    height: 300px;
}

.skeleton-product-content {
    padding: 15px;
}

.skeleton-product-title {
    height: 18px;
    width: 80%;
    margin-bottom: 12px;
    border-radius: 4px;
}

.skeleton-product-colors {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.skeleton-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
}

.skeleton-product-price {
    height: 20px;
    width: 60%;
    border-radius: 4px;
}

/* === PRODUCT 頁面骨架屏樣式 === */
.skeleton-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* === 桌面版 (>= 1024px) === */
@media (min-width: 1024px) {
    .desktop-layout {
        display: flex;
        gap: 40px;
    }
    .mobile-layout { 
        display: none; 
    }

    /* 圖片區域 */
    .image-section { 
        flex: 1; 
    }
    
    .main-image {
        width: 100%;
        height: 600px;
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .thumbnails {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .thumbnail { 
        height: 120px; 
        border-radius: 6px; 
    }

    /* 產品資訊區域 */
    .info-section {
        flex: 1;
        padding-left: 20px;
    }

    .title { 
        height: 32px; 
        width: 80%; 
        margin-bottom: 15px; 
        border-radius: 4px; 
    }
    
    .rating { 
        height: 20px; 
        width: 120px; 
        margin-bottom: 15px; 
        border-radius: 4px; 
    }
    
    .code { 
        height: 16px; 
        width: 150px; 
        margin-bottom: 20px; 
        border-radius: 4px; 
    }
    
    .price { 
        height: 36px; 
        width: 200px; 
        margin-bottom: 30px; 
        border-radius: 4px; 
    }

    /* 選項區域 */
    .option { 
        margin-bottom: 25px; 
    }
    
    .option-label { 
        height: 18px; 
        width: 60px; 
        margin-bottom: 12px; 
        border-radius: 4px; 
    }

    .colors { 
        display: flex; 
        gap: 12px; 
        margin-bottom: 8px; 
    }
    
    .color-item {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 2px solid #e0e0e0;
    }

    .sizes { 
        display: flex; 
        gap: 10px; 
        flex-wrap: wrap; 
    }
    
    .size-item {
        width: 45px;
        height: 45px;
        border-radius: 6px;
        border: 1px solid #e0e0e0;
    }

    /* 數量控制 */
    .quantity {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 25px;
    }

    .qty-control {
        display: flex;
        border: 1px solid #e0e0e0;
        border-radius: 6px;
        overflow: hidden;
    }

    .qty-btn { 
        width: 40px; 
        height: 40px; 
        background: #f8f9fa; 
    }
    
    .qty-input { 
        width: 60px; 
        height: 40px; 
        border-left: 1px solid #e0e0e0; 
        border-right: 1px solid #e0e0e0; 
    }

    /* 按鈕區域 */
    .actions {
        display: flex;
        gap: 15px;
        margin-bottom: 30px;
    }

    .add-cart-btn {
        flex: 1;
        height: 50px;
        border-radius: 6px;
        background: #000;
        opacity: 0.1;
    }

    .wishlist-btn {
        width: 50px;
        height: 50px;
        border-radius: 6px;
        border: 1px solid #e0e0e0;
    }

    /* 運送資訊 */
    .shipping {
        border-top: 1px solid #e9ecef;
        padding-top: 20px;
    }

    .shipping-item {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 15px;
    }

    .shipping-icon { 
        width: 24px; 
        height: 24px; 
        border-radius: 4px; 
    }
    
    .shipping-text { 
        height: 16px; 
        width: 180px; 
        border-radius: 4px; 
    }
}

/* === 手機版 (< 1024px) === */
@media (max-width: 1023px) {
    .desktop-layout { 
        display: none; 
    }
    
    .mobile-layout { 
        display: block; 
    }

    .skeleton-container { 
        padding: 10px; 
    }

    /* 手機版圖片輪播 */
    .mobile-carousel {
        width: 100%;
        height: 400px;
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .mobile-info {
        padding: 0 15px;
        margin-bottom: 80px;
    }

    /* 手機版產品資訊 */
    .title { 
        height: 28px; 
        width: 90%; 
        margin-bottom: 12px; 
        border-radius: 4px; 
    }
    
    .rating { 
        height: 18px; 
        width: 100px; 
        margin-bottom: 12px; 
        border-radius: 4px; 
    }
    
    .code { 
        height: 14px; 
        width: 120px; 
        margin-bottom: 15px; 
        border-radius: 4px; 
    }
    
    .price { 
        height: 32px; 
        width: 180px; 
        margin-bottom: 25px; 
        border-radius: 4px; 
    }

    .option {
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid #f0f0f0;
    }

    .option-label { 
        height: 16px; 
        width: 50px; 
        margin-bottom: 10px; 
        border-radius: 4px; 
    }

    .colors { 
        display: flex; 
        gap: 10px; 
        flex-wrap: wrap; 
    }
    
    .color-item {
        width: 35px;
        height: 35px;
        border-radius: 50%;
        border: 2px solid #e0e0e0;
    }

    .sizes {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        gap: 8px;
        max-width: 300px;
    }

    .size-item {
        height: 40px;
        border-radius: 4px;
        border: 1px solid #e0e0e0;
    }

    .quantity {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }

    .qty-control {
        display: flex;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        overflow: hidden;
    }

    .qty-btn { 
        width: 35px; 
        height: 35px; 
        background: #f8f9fa; 
    }
    
    .qty-input { 
        width: 50px; 
        height: 35px; 
        border-left: 1px solid #e0e0e0; 
        border-right: 1px solid #e0e0e0; 
    }

    /* 手機版固定按鈕 */
    .mobile-fixed-buttons {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 10px 15px;
        border-top: 1px solid #e0e0e0;
        display: flex;
        gap: 10px;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    .mobile-add-cart {
        flex: 1;
        height: 45px;
        border-radius: 6px;
        background: #000;
        opacity: 0.1;
    }

    .mobile-wishlist {
        width: 45px;
        height: 45px;
        border-radius: 6px;
        border: 1px solid #e0e0e0;
    }

    /* Category 頁面手機版調整 */
    .container { 
        padding: 0 15px; 
    }

    .skeleton-categories {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .skeleton-circle { 
        width: 60px; 
        height: 60px; 
    }
    
    .skeleton-category-name { 
        width: 50px; 
        height: 14px; 
    }

    .skeleton-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .skeleton-product-card { 
        max-width: none; 
    }
    
    .skeleton-product-image { 
        height: 200px; 
    }
    
    .skeleton-product-content { 
        padding: 12px; 
    }
}

/* === 評論區域 === */
.reviews {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.reviews-title { 
    height: 28px; 
    width: 120px; 
    margin-bottom: 25px; 
    border-radius: 4px; 
}

.review-item {
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.review-title { 
    height: 18px; 
    width: 200px; 
    border-radius: 4px; 
}

.review-date { 
    height: 14px; 
    width: 80px; 
    border-radius: 4px; 
}

.review-stars { 
    height: 16px; 
    width: 100px; 
    margin-bottom: 12px; 
    border-radius: 4px; 
}

.review-content { 
    height: 14px; 
    margin-bottom: 8px; 
    border-radius: 4px; 
}

.review-content.line1 { width: 95%; }
.review-content.line2 { width: 80%; }
.review-content.line3 { width: 60%; }

/* === 小屏手機調整 (< 480px) === */
@media (max-width: 480px) {
    .skeleton-categories { 
        grid-template-columns: repeat(2, 1fr); 
    }
    
    .skeleton-products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .skeleton-product-image { 
        height: 250px; 
    }
}

