/* 全域重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-bottom: 70px; /* 給底部導航留空間 */
    background: #f5f5f5;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* 頂部導航 */
.top-bar {
    position: fixed;
    top: 0;
    width: 100%;
    background: #2c3e50;
    color: white;
    padding: 12px 20px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-bar .left h1 { font-size: 20px; margin: 0; }
.top-bar .right a { color: #ecf0f1; text-decoration: none; margin: 0 5px; }

/* 搜尋欄 */
.search-section {
    margin-top: 70px;
    padding: 20px 0;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.search-box {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}
.search-box input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
}
.search-box select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 25px;
    background: white;
}
.search-box button {
    padding: 12px 30px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
}

/* 輪播圖 */
.carousel-section { padding: 20px 0; }
.carousel { position: relative; overflow: hidden; border-radius: 10px; }
.carousel-wrapper { display: flex; transition: transform 0.5s; }
.carousel-item {
    min-width: 100%;
    display: none;
    position: relative;
}
.carousel-item.active { display: block; }
.carousel-item img { width: 100%; height: 400px; object-fit: cover; }
.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: rgba(0,0,0,0.6);
    color: white;
    text-align: center;
}
.carousel-prev, .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    font-size: 24px;
    z-index: 10;
}
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

/* 廣告區塊 */
.ad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}
.ad-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}
.ad-item:hover { transform: translateY(-5px); }
.ad-item img { width: 100%; height: 180px; object-fit: cover; }
.ad-item .ad-title {
    padding: 10px;
    text-align: center;
    font-weight: bold;
}
.ad-item .badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: white;
}
.ad-item .badge.paid { background: #e74c3c; }
.ad-item .badge { background: #2ecc71; }

/* 產品與廠商 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}
.product-card {
    background: white;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.product-card img { width: 100%; height: 120px; object-fit: contain; }
.product-name { font-weight: bold; margin: 5px 0; }
.product-price { color: #e74c3c; font-size: 18px; }
.product-company { color: #7f8c8d; font-size: 14px; }

.company-list { display: flex; flex-direction: column; gap: 10px; }
.company-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.company-item img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.company-name { font-weight: bold; }
.company-type { color: #7f8c8d; font-size: 14px; }

/* 底部導航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s;
}
.nav-item.active { color: #3498db; }
.nav-item .icon { font-size: 24px; }
.nav-item .label { font-size: 12px; margin-top: 2px; }

/* RWD */
@media (max-width: 768px) {
    .top-bar .left h1 { font-size: 16px; }
    .search-box { flex-wrap: wrap; }
    .search-box input { flex: 1 1 100%; }
    .ad-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

