/* 基本重置和全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 移除移動端點擊高亮 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f4f4f4; /* 背景色類似拼多多 */
    font-size: 14px;
    color: #333;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block; /* 防止圖片下方出現空隙 */
}

.app-container {
    max-width: 600px; /* 在 PC 上限制最大寬度，模擬手機屏幕 */
    margin: 0 auto;
    background-color: #fff;
    padding-bottom: 65px; /* 為底部導航欄留出空間 */
    min-height: 100vh; /* 確保內容不足時也能撐滿屏幕 */
}

/* 頂部搜索欄 */
.top-search-bar {
    position: sticky; /* 吸頂效果 */
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(to right, #e61e41, #ff4d4f); /* 漸變背景色 */
    color: #fff;
}

.search-box {
    flex-grow: 1;
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 5px 10px;
    margin-right: 10px;
}

.search-icon {
    color: #999;
    margin-right: 8px;
}

.search-box input {
    flex-grow: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
}

.search-box input::placeholder {
    color: #aaa;
}

.message-icon {
    font-size: 20px;
    cursor: pointer;
}


/* 主要內容區域 */
.main-content {
    padding: 0 10px;
}

/* 輪播圖/橫幅 */
.banner-carousel {
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    /* 實際使用時需要 JS 實現輪播 */
}
.banner-carousel img {
    width: 100%;
    aspect-ratio: 4 / 1; /* 控制圖片比例 (原為 3 / 1) */
    object-fit: cover;
}

/* 分類導航 */
.category-nav {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 15px 0;
    background-color: #fff;
    margin-bottom: 10px;
    border-radius: 8px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    color: #555;
    width: 20%; /* 均分寬度 */
}

.category-item .icon-bg {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
    color: #fff;
    font-size: 20px;
}
/* 為不同分類設置不同背景色 */
.category-nav a:nth-child(1) .icon-bg { background-color: #ff7f50; } /* 維修 */
.category-nav a:nth-child(2) .icon-bg { background-color: #4caf50; } /* DIY */
.category-nav a:nth-child(3) .icon-bg { background-color: #2196f3; } /* 周邊 */
.category-nav a:nth-child(4) .icon-bg { background-color: #9c27b0; } /* 回收 */
.category-nav a:nth-child(5) .icon-bg { background-color: #ffc107; } /* 全部分類 */


/* 推薦商品/服務 */
.recommendations {
    padding: 10px 0;
}

.recommendations h2 {
    font-size: 16px;
    margin-bottom: 10px;
    padding-left: 5px;
    color: #e61e41;
}
.recommendations h2 i {
    margin-right: 5px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 兩列佈局 */
    gap: 10px; /* 網格間距 */
}

.product-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1; /* 正方形圖片 */
    object-fit: cover;
}

.product-info {
    padding: 8px;
    flex-grow: 1; /* 使內容填滿卡片剩餘空間 */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* 內容垂直分佈 */
}

.product-title {
    font-size: 13px;
    line-height: 1.4;
    /* 最多顯示兩行，超出部分省略號 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
    min-height: 36px; /* 預留兩行的高度 */
}

.price-tag {
    margin-top: auto; /* 將價格推到底部 */
    margin-bottom: 5px;
    display: flex;
    align-items: baseline;
}

.current-price {
    color: #e61e41;
    font-size: 16px;
    font-weight: bold;
    margin-right: 5px;
}
.current-price::before {
    content: '¥';
    font-size: 12px;
}

.original-price {
    color: #999;
    font-size: 12px;
    text-decoration: line-through;
}

.sales-info {
    font-size: 11px;
    color: #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-buy { /* 拼團標籤樣式 */
    background-color: #ffebee;
    color: #e61e41;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
}

/* 底部導航欄 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px; /* 配合 app-container 的最大寬度 */
    margin: 0 auto; /* 居中 */
    display: flex;
    justify-content: space-around;
    background-color: #fff;
    border-top: 1px solid #eee;
    padding: 5px 0;
    z-index: 100;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
    padding: 5px;
    flex-grow: 1;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 3px;
}

.nav-item.active {
    color: #e61e41; /* 選中狀態的顏色 */
}

/* 響應式設計 (雖然主要是移動端，但可以加個簡單的斷點) */
@media (min-width: 600px) {
    .app-container {
        /* 在較大屏幕上可以稍微調整佈局，例如左右留白 */
         /* box-shadow: 0 0 10px rgba(0,0,0,0.1); */
    }
    .bottom-nav {
        left: 50%;
        transform: translateX(-50%); /* 在寬屏上依然居中 */
    }
} 