/* 基礎樣式 - 統一管理 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}
.main-content{
    max-width: 1024px; /* 最大寬度為 1024px，避免過寬 */
    margin: 0 auto; /* 上下 0、左右 auto：讓區塊水平置中 */
    background: #fff; /* 白色背景 */
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1); /* 柔和的陰影，讓區塊有浮起感 */
    padding: 0; /* 無內距 */
    min-height: 100vh; /* 最小高度為視窗高度（全螢幕高度） */}
/* 統一容器樣式 */
.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 通用按鈕樣式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #ff6b6b;
    color: white;
}

.btn-secondary {
    background: #4ecdc4;
    color: white;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.products-section {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin:10px;padding:10px;
}


/* 排行榜區域 */
.ranking-section {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin:10px;padding:10px;
}

/* 排行榜頭部 */
.ranking-section .section-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.layui-tab .layui-tab-title li {
    font-size: 1.4rem;
}

.ranking-section h2 {
    font-size: 18px;
    margin: 0;
    color: #333;
}

.ranking-section .subtitle {
    font-size: 14px;
    color: #ff6b6b;
    margin-left: 10px;
}

/* 排行榜標籤頁 */
.ranking-tabs {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.ranking-tab {
    padding: 5px 10px;
    background-color: #f0f0f0;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.ranking-tab:hover {
    background-color: #e0e0e0;
}

.ranking-tab.active {
    background-color: #ff6b6b;
    color: white;
}

/* 排行榜列表 */
.ranking-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* 排行榜項目 */
.ranking-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.ranking-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* 排名數字 */
.ranking-item .rank-number {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7); /* 默認背景色 */
    color: white;
    width: 40px; /* 增加寬度 */
    height: 40px; /* 增加高度 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px; /* 增加字體大小 */
    font-weight: bold;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* 添加陰影效果 */
}

/* 前三名使用不同顏色 */
.ranking-item .rank-1 {
    background: linear-gradient(135deg, #FFD700, #FFA500); /* 金色漸變 */
    color: #333;
    width: 50px; /* 第一名更大 */
    height: 50px; /* 第一名更大 */
    font-size: 22px; /* 第一名字體更大 */
    border: 2px solid #FFD700;
}

.ranking-item .rank-2 {
    background: linear-gradient(135deg, #C0C0C0, #A9A9A9); /* 銀色漸變 */
    color: #333;
    width: 45px; /* 第二名稍大 */
    height: 45px; /* 第二名稍大 */
    font-size: 20px; /* 第二名字體稍大 */
    border: 2px solid #C0C0C0;
}

.ranking-item .rank-3 {
    background: linear-gradient(135deg, #CD7F32, #8B4513); /* 銅色漸變 */
    color: white;
    width: 40px; /* 第三名稍大 */
    height: 40px; /* 第三名稍大 */
    font-size: 18px; /* 第三名字體稍大 */
    border: 2px solid #CD7F32;
}

/* 圖片下方半透明互動區域的漸層效果 */
.ranking-item .product-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px; /* 增加高度以容納更多按鈕 */
    background: linear-gradient(transparent, rgba(0,0,0,0.7)); /* 增加漸變深度 */
    pointer-events: none;
}

/* 互動按鈕區域 */
.ranking-item .product-actions {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 3;
    flex-wrap: wrap; /* 允許按鈕換行 */
    gap: 5px; /* 按鈕之間的間距 */
}

/* 單個互動按鈕 */
.ranking-item .action-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 12px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    flex: 0 0 auto; /* 不拉伸按鈕 */
}

/* 觀看次數顯示 */
.ranking-item .view-count {
    background: rgba(255,255,255,0.9);
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    margin-left: auto; /* 推到最右側 */
}

/* 產品資訊區域 */
.ranking-item .product-info {
    padding: 12px;
    background: #fff0f5;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

/* 產品資訊頭部 */
.ranking-item .product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

/* 產品名稱 */
.ranking-item .product-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 8px;
}

/* 產品評分區域 */
.ranking-item .product-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* 評分分數 */
.ranking-item .rating-score {
    background: #ff6b6b;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
}

/* 評分文字 */
.ranking-item .rating-text {
    font-weight: 500;
    font-weight: bold;
    color: #666;
}

/* 評論數 */
.ranking-item .comments-count {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.ranking-item .comments-count i {
    font-size: 14px;
    color: #ff6b6b;
}

/* 點擊遮罩 */
.ranking-item .product-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    opacity: 0;
}

/* 更多按鈕樣式 */
.more-btn-wrapper {
    width: 100%;

    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
}

.more-btn-wrapper .layui-btn {
    border-radius: 8px !important;
    transition: all 0.3s ease;
    width: 50% !important;
    height: 50px;
    max-width: 300px;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 500;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    text-align: center !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.more-btn-wrapper .layui-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.more-btn-wrapper .layui-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
}

.more-btn-wrapper .layui-btn:hover::before {
    left: 100%;
}

.more-btn-wrapper .layui-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}



/* 響應式設計 - 平板和小螢幕 */
@media (max-width: 768px) {
    /* 排行榜列表 - 確保在平板上也是網格佈局 */
    .ranking-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 一行兩個 */
        gap: 10px;
    }
    
    /* 排名數字 - 調整大小 */
    .ranking-item .rank-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    /* 前三名使用不同顏色 - 調整大小 */
    .ranking-item .rank-1 {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .ranking-item .rank-2 {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }
    
    .ranking-item .rank-3 {
        width: 29px;
        height: 29px;
        font-size: 14px;
    }
    
    /* 互動按鈕 - 調整大小 */
    .ranking-item .action-btn {
        padding: 3px 6px;
        font-size: 9px;
    }
    
    .ranking-item .action-btn i {
        font-size: 10px;
    }
    
    .ranking-item .action-btn .count {
        font-size: 8px;
    }
    
    .ranking-item .view-count {
        padding: 3px 6px;
        font-size: 9px;
    }
    
    /* 產品資訊區域 - 調整最小高度 */
    .ranking-item .product-info {
        min-height: 100px;
        padding: 10px;
    }
}

/* 響應式設計 - 小螢幕 (例如：手機) */
@media (max-width: 480px) {
    /* 排行榜列表 - 維持兩欄佈局 */
    .ranking-list {
        grid-template-columns: repeat(2, 1fr); /* 一行兩個 */
        gap: 8px;
    }
    
    /* 產品圖片容器 - 調整手機版圖片長寬比 */
    .ranking-item .product-image {
        aspect-ratio: 3 / 4; /* 調整為更適合小手機的比例 */
    }
    
    /* 排行榜項目 - 調整整體樣式 */
    .ranking-item {
        border-radius: 10px;
    }
    
    /* 排名數字 - 進一步調整大小 */
    .ranking-item .rank-number {
        width: 24px;
        height: 24px;
        font-size: 12px;
        top: 6px;
        left: 6px;
    }
    
    /* 前三名使用不同顏色 - 進一步調整大小 */
    .ranking-item .rank-1 {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .ranking-item .rank-2 {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }
    
    .ranking-item .rank-3 {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    /* 互動按鈕區域 - 進一步調整 */
    .ranking-item .product-actions {
        bottom: 6px;
        left: 6px;
        right: 6px;
    }
    
    /* 互動按鈕 - 進一步調整大小 */
    .ranking-item .action-btn {
        padding: 2px 5px;
        font-size: 8px;
        border-radius: 10px;
    }
    
    .ranking-item .action-btn i {
        font-size: 9px;
    }
    
    .ranking-item .action-btn .count {
        font-size: 7px;
    }
    
    .ranking-item .view-count {
        padding: 2px 5px;
        font-size: 8px;
        border-radius: 10px;
    }
    
    /* 產品資訊區域 - 进一步調整 */
    .ranking-item .product-info {
        padding: 8px;
        min-height: 90px;
    }
    
    /* 產品名稱 - 調整字體大小 */
    .ranking-item .product-name {
        font-size: 1rem;
    }
    
    /* 評分分數 - 調整大小 */
    .ranking-item .rating-score {
        padding: 1px 4px;
        font-size: 9px;
    }
    
    /* 評分文字 - 調整大小 */
    .ranking-item .rating-text {
        font-size: 8px;
    }
    
    /* 評論數 - 調整大小 */
    .ranking-item .comments-count {
        font-size: 10px;
        gap: 3px;
    }
    
    .ranking-item .comments-count i {
        font-size: 12px;
    }
}


.layui-carousel {
    margin-top: 100px; /* 根據 fixed 元素的高度調整 */
}

/* 輪播區域樣式 */
.carousel-section {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 10px;
    padding: 0;
    overflow: hidden;


}

/* Layui 輪播組件樣式 */

/* 輪播項目樣式 */
.carousel-item {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;

}

/* 輪播圖片樣式 - 確保自適應寬度 */
.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持比例並填滿容器 */
    object-position: center; /* 圖片居中顯示 */
    display: block;
}

/* 輪播資訊區域 */
.carousel-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 20px;
    text-align: center;
}

/* 響應式設計 - 平板 */
@media (max-width: 768px) {
    .layui-carousel {
        height: 250px; /* 平板版降低高度 */
    }

    .carousel-section {
        margin: 5px;
    }

    .carousel-info {
        padding: 15px;
        font-size: 14px;
    }
}

/* 響應式設計 - 手機 */
@media (max-width: 480px) {
    .layui-carousel {
        height: 200px; /* 手機版進一步降低高度 */
    }

    .carousel-section {
        margin: 5px;
        border-radius: 8px;
    }

    .carousel-info {
        padding: 10px;
        font-size: 12px;
    }
}


/* 狀態遮罩樣式 */
.status-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(128, 128, 128, 0.8); /* 灰色半透明遮罩 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5; /* 確保在其他元素之上 */
}

.status-text {
    background: rgba(255, 0, 0);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 有狀態遮罩的產品卡片樣式調整 */
.product-card.status-overlay, .ranking-item.status-overlay {
    opacity: 0.3;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .status-text {
        font-size: 16px;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .status-text {
        font-size: 14px;
        padding: 8px 16px;
    }
}