/* ==================== 1. 基礎美式極簡風格與 RWD 設置 ==================== */
:root { --primary: #003366; --accent: #ff6600; --bg: #f9f9f9; --text: #333; }
html { scroll-behavior: smooth; font-size: 16px; }

/* 核心修正：防止任何元素撐大頁面產生左右滾動條 */
body { 
    font-family: 'Helvetica Neue', Arial, sans-serif; 
    margin: 0; 
    padding: 0; 
    background: var(--bg); 
    color: var(--text); 
    line-height: 1.6; 
    overflow-x: hidden; 
    width: 100%;
    display: flex; 
    flex-direction: column; 
    min-height: 100vh;
}
main { flex: 1; }
.page-title { text-align: center; font-size: clamp(1.8rem, 4vw, 2.5rem); color: var(--primary); margin: 50px 0 20px; padding: 0 5%; }

/* ==================== 2. 頂部導覽列 (RWD) ==================== */
header { 
    background: #fff; 
    padding: 0.8rem 5%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    position: sticky; 
    top: 0; 
    z-index: 1000;
    flex-wrap: wrap;
}
.logo { font-size: 1.5rem; font-weight: bold; color: var(--primary); letter-spacing: 1px; text-decoration: none; }
nav { display: flex; align-items: center; flex-wrap: wrap; }
nav a { margin-left: 20px; text-decoration: none; color: var(--text); font-weight: 500; transition: color 0.3s; font-size: 0.95rem; }
nav a:hover, nav a.active { color: var(--accent); }

/* ==================== 3. 首頁橫幅輪播 (Hero Slider - RWD) ==================== */
.hero-slider { position: relative; width: 100%; height: clamp(350px, 60vh, 700px); overflow: hidden; background: #222; }
.slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1s ease-in-out; background-size: cover; background-position: center; display: block; text-decoration: none; }
.slide.active { opacity: 1; z-index: 1; }
.slider-dots { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 10; }
.dot { width: 12px; height: 12px; background: rgba(255,255,255,0.6); border-radius: 50%; cursor: pointer; border: 2px solid transparent; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.dot.active { background: var(--accent); border-color: white; }

/* ==================== 4. 痛點分析與輪播 (Pain Point - RWD) ==================== */
.pain-point { padding: 60px 5%; display: flex; gap: 40px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #fff; }
.pain-text { flex: 1 1 300px; }
.pain-text h2 { color: var(--primary); font-size: clamp(1.8rem, 4vw, 2.5rem); margin-top: 0; margin-bottom: 20px; line-height: 1.3; }
.pain-slider-container { flex: 1 1 300px; width: 100%; max-width: 600px; position: relative; border-radius: 8px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.1); height: clamp(250px, 40vw, 380px); background: #f0f0f0; margin: 0 auto; }
.pain-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.8s ease-in-out; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; background-size: contain; background-position: center; background-repeat: no-repeat; }
.pain-slide.active { opacity: 1; z-index: 1; }
.pain-caption { width: 100%; background: rgba(0, 0, 0, 0.75); color: white; text-align: center; padding: 10px 5px; font-weight: bold; font-size: clamp(0.85rem, 2.5vw, 1.1rem); letter-spacing: 0.5px; box-sizing: border-box; }
.pain-content { width: 100%; background: rgba(255,255,255,0.75); color:black; text-align: left; padding: 10px 5px; font-size: clamp(0.7rem, 2vw, 0.9rem);box-sizing: border-box; }
.pain-prev, .pain-next { cursor: pointer; position: absolute; top: 50%; transform: translateY(-50%); padding: 12px 15px; color: white; font-weight: bold; font-size: 1.2rem; z-index: 10; background-color: rgba(0,0,0,0.5); border-radius: 4px; user-select: none; }
.pain-prev { left: 10px; } .pain-next { right: 10px; }
.pain-prev:hover, .pain-next:hover { background-color: rgba(0,0,0,0.8); }
.pain-dots { position: absolute; bottom: 45px; width: 100%; text-align: center; z-index: 10; }
.p-dot { display: none; width: 10px; height: 10px; margin: 0 5px; background-color: #bbb; border-radius: 50%; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.p-dot.active { background-color: var(--accent); }

/* ==================== 5. 特色展示與關於我們 (Features & About - RWD) ==================== */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 25px; padding: 60px 5%; background: var(--bg); }
.feature-card { background: white; padding: 30px 20px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); text-align: center; border-bottom: 4px solid var(--accent); }
.feature-card h3 { color: var(--primary); font-size: 1.3rem; margin-top: 0; margin-bottom: 15px; }

.about-section { padding: 60px 5%; background: #fff; text-align: center; }
.about-container { max-width: 1000px; margin: 0 auto; text-align: left; }
.about-container h2 { color: var(--primary); font-size: clamp(1.8rem, 4vw, 2.3rem); text-align: center; margin-top: 0; margin-bottom: 30px; }
.core-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 40px; }
.value-box { background: var(--bg); padding: 25px; border-radius: 8px; border-left: 4px solid var(--primary); margin: 0; }
.highlight-text { font-weight: bold; color: var(--accent); }

/* ===== 新增：生產線專區 (Production Line) ===== */
.production-section { padding: 80px 5%; background: var(--bg); text-align: center; border-top: 1px solid #e0e0e0; }
.production-container { max-width: 1200px; margin: 0 auto; }
.production-container h2 { color: var(--primary); font-size: clamp(1.8rem, 4vw, 2.3rem); margin-top: 0; margin-bottom: 15px; }
.production-container p { max-width: 800px; margin: 0 auto 40px auto; color: #555; font-size: 1.1rem; line-height: 1.8; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.gallery-item { border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.1); background: #fff; }
.gallery-item img { width: 100%; height: 220px; object-fit: cover; display: block; transition: transform 0.4s ease; }
.gallery-item:hover img { transform: scale(1.05); }

/* ==================== 6. 產品目錄與過濾器 (Products - RWD) ==================== */
.products-section { padding: 40px 5% 80px; max-width: 1400px; margin: 0 auto; }
.section-title { text-align: center; font-size: clamp(1.8rem, 4vw, 2.3rem); color: var(--primary); margin-top: 0; margin-bottom: 30px; }
.filter-container { display: flex; justify-content: center; gap: 10px; margin-bottom: 40px; flex-wrap: wrap; }
.filter-btn { padding: 10px 18px; border: 2px solid var(--primary); background: transparent; color: var(--primary); font-weight: bold; border-radius: 30px; cursor: pointer; transition: all 0.3s; font-size: 0.9rem; }
.filter-btn.active, .filter-btn:hover { background: var(--primary); color: white; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 25px; }
.product-card { background: white; padding: 25px 20px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); text-align: center; transition: transform 0.3s; border-top: 4px solid var(--primary); display: flex; flex-direction: column; justify-content: space-between; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.product-card h3 { color: var(--primary); margin-top: 0; margin-bottom: 10px; font-size: 1.1rem; }
.sku-badge { display: inline-block; background: #eee; padding: 6px 12px; font-size: 0.9rem; border-radius: 4px; font-weight: bold; font-family: monospace; color: #333; margin-bottom: 10px; }
.view-btn, .btn { display: inline-block; box-sizing: border-box; margin-top: 15px; padding: 12px 20px; background: var(--accent); color: white; text-decoration: none; cursor: pointer; border: none; border-radius: 4px; font-size: 1rem; width: 100%; transition: background 0.3s; font-weight: bold; text-align: center; }
.view-btn:hover, .btn:hover { background: #e65c00; }

/* ==================== 7. 彈跳視窗 (Modal - RWD 嚴格控制) ==================== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 2000; justify-content: center; align-items: center; padding: 15px; box-sizing: border-box; }
.modal.show { display: flex; }
.modal-content { background: white; padding: 30px 20px; border-radius: 8px; max-width: 500px; width: 100%; position: relative; max-height: 85vh; overflow-y: auto; box-sizing: border-box; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 1.8rem; cursor: pointer; color: #999; line-height: 1; z-index: 20;} /* 提高 z-index 避免被遮擋 */
.close-btn:hover { color: var(--text); }
.modal-tags span { display: inline-block; background: #e0f7fa; color: #006064; padding: 4px 8px; font-size: 0.8rem; border-radius: 4px; margin-right: 5px; margin-bottom: 10px; font-weight: bold; }

/* Modal 內專屬的圖片輪播器 (Product Gallery) */
.modal-gallery-container { position: relative; width: 100%; margin: 10px 0; background: #f4f4f4; border-radius: 8px; border: 1px solid #e0e0e0; overflow: hidden; height: 250px;}
.modal-gallery-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; align-items: center; justify-content: center; }
.modal-gallery-slide.active { display: flex; }
.modal-gallery-slide img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Modal 輪播箭頭 */
.modal-gallery-prev, .modal-gallery-next { cursor: pointer; position: absolute; top: 50%; transform: translateY(-50%); width: auto; padding: 8px 12px; color: white; font-weight: bold; font-size: 18px; transition: 0.3s ease; z-index: 10; user-select: none; background-color: rgba(0,0,0,0.3); border-radius: 4px; }
.modal-gallery-prev { left: 10px; }
.modal-gallery-next { right: 10px; }
.modal-gallery-prev:hover, .modal-gallery-next:hover { background-color: rgba(0,0,0,0.8); }

/* Modal 輪播小圓點 */
.modal-gallery-dots { position: absolute; bottom: 10px; width: 100%; text-align: center; z-index: 10; }
.m-dot { display: inline-block; width: 8px; height: 8px; margin: 0 4px; background-color: #bbb; border-radius: 50%; cursor: pointer; transition: background-color 0.3s; box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.m-dot.active { background-color: var(--accent); }

/* ==================== 8. 聯絡與經銷商頁面專屬 ==================== */
.contact-container { max-width: 800px; margin: 0 auto; padding: 20px 5% 80px; text-align: left; }
.contact-box { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 40px; border-top: 4px solid var(--primary); }
.contact-box h2 { color: var(--primary); margin-bottom: 20px; margin-top: 0; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input, .form-group textarea { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; box-sizing: border-box; }

/* ==================== 9. 文件下載專區專屬 (Documents) ==================== */
.doc-section { padding: 20px 5% 80px; max-width: 900px; margin: 0 auto; }
.doc-list { display: flex; flex-direction: column; gap: 20px; }
.doc-item { background: white; padding: 25px 30px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; border-left: 5px solid var(--primary); flex-wrap: wrap; gap: 15px; transition: transform 0.3s; }
.doc-item:hover { transform: translateX(5px); box-shadow: 0 6px 15px rgba(0,0,0,0.1); }
.doc-info { flex: 1; min-width: 250px; }
.doc-info h3 { margin: 0 0 8px 0; color: var(--primary); font-size: 1.25rem; }
.doc-info p { margin: 0; color: #666; font-size: 0.95rem; }
.doc-item .btn { margin-top: 0; width: auto; padding: 10px 25px; white-space: nowrap; }

footer { background: var(--primary); color: white; text-align: center; padding: 30px 5%; margin-top: 40px; font-size: 0.9rem; }

/* ==================== 10. 手機專屬媒體查詢 (Media Queries) ==================== */
@media screen and (max-width: 768px) {
    header { flex-direction: column; padding: 1rem 3%; text-align: center; }
    .logo { margin-bottom: 10px; font-size: 1.8rem; }
    nav { width: 100%; justify-content: center; gap: 10px; }
    nav a { margin: 5px 8px; font-size: 0.9rem; }
    .pain-point, .feature-grid, .about-section, .products-section, .doc-section, .production-section { padding: 40px 4%; }
    .pain-point { gap: 25px; }
    .filter-btn { padding: 8px 14px; font-size: 0.85rem; flex: 1 1 40%; text-align: center; }
    .product-grid { grid-template-columns: 1fr; }
    .contact-box { padding: 25px; }
    .doc-item { flex-direction: column; align-items: flex-start; }
    .doc-item .btn { width: 100%; }
}
@media screen and (max-width: 480px) {
    nav a { font-size: 0.85rem; margin: 3px 5px; }
    .filter-btn { flex: 1 1 100%; }
}