/*
 * 基礎樣式與變數：
 * 使用 CSS 變數來統一管理網站的顏色、字體等，
 * 提升程式碼的可維護性。
 */
:root {
    --primary-color: #336600; /* 主要顏色 (綠色) */
    --secondary-color: #3333CC; /* 次要顏色 (藍色) */
    --text-color: #333; /* 主要文字顏色 */
    --light-bg-color: #f5f5f5; /* 淺色背景 */
    --footer-bg-color: #FFFFCC; /* 頁腳背景 */
    --border-color: #ddd;
    --box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    --font-family: Arial, "Microsoft JhengHei", sans-serif;
    --font-size-base: 16px;
}

/* 樣式重置，適用於所有元素 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 身體樣式 */
body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: white;
    line-height: 1.6;
    scroll-behavior: smooth; /* 平滑滾動 */
}

/* 連結樣式 */
a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s, text-decoration 0.3s;
}

a:hover, a:focus {
    text-decoration: underline;
    outline: none; /* 移除預設的 focus 邊框 */
}

/* 圖片樣式 */

/* 全域圖片樣式 */
img {
    max-width: 100%;
    height: auto;
    margin: 15px auto;   /* 圖片上下留白 + 水平置中 */
    display: block;      /* 預設一張圖獨佔一行 */
}

/* 影片樣式 */
.my-video {
  max-width: 100%;
  height: auto;
  display: block;
}

.video-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* 頁面內容寬度限制 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 響應式圖片 */
.responsive-img {
    width: 100%;
    height: auto;
    display: block;
}

/* === 圖片集（多張並排） === */

.images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.images a {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.images img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
}


/* 頁面內容寬度限制 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 響應式圖片 */
.responsive-img {
    width: 100%;
    height: auto;
    display: block;
}


/* === 主頁幻燈片基本外觀 === */
.hero-slider {
  --h: 450px;
  --radius: 10px;
  --shadow: 0 12px 30px rgba(0,0,0,.18);

  position: relative;
  max-width: 1200px;
  margin: 0 auto 30px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* RWD 高度：小螢幕用比例撐，大螢幕用固定高度 */
.hero-slider { aspect-ratio: 1000 / 450; }
@media (min-width: 900px) { .hero-slider { height: var(--h); aspect-ratio: auto; } }

/* 隱藏 radio */
.hero-slider > input { position: absolute; opacity: 0; pointer-events: none; }

/* === 幻燈片軌道（改用 flex，較直觀） === */
/* slides 的總寬設為 張數 * 100%（此處 3 張 → 300%） */
.slides {
  display: flex;         /* 橫向排列每張 slide */
  width: 300%;           /* 3 張 -> 300%，若改張數要相應調整 */
  height: 100%;
  transition: transform .6s ease;
}

/* 每張 slide 占總寬的 1/3（100% / 張數） */
.slide {
  width: calc(100% / 3); /* 若改成 4 張 -> calc(100% / 4) */
  flex: 0 0 calc(100% / 3);
  height: 100%;
}

/* 圖片設定：填滿容器並保持比例（會裁切） */
.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* === 根據 radio checked 位移：注意百分比是每張的寬度（33.333...%） === */
/* 第一張（不位移）*/
#h1:checked ~ .slides { transform: translateX(0%); }
/* 第二張（左移一張 = 33.333%）*/
#h2:checked ~ .slides { transform: translateX(-33.333333%); }
/* 第三張（左移兩張 = 66.6666%）*/
#h3:checked ~ .slides { transform: translateX(-66.666666%); }

/* === 左右箭頭（先預設隱藏，再顯示對應那組） === */
.arrows label {
  display: none; /* 預設隱藏 */
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px; line-height: 46px;
  text-align: center; font-size: 26px; color: #fff;
  background: rgba(0,0,0,.35);
  border-radius: 50%;
  cursor: pointer; user-select: none;
  opacity: .9; transition: opacity .2s;
}
.arrows label:hover { opacity: 1; }
.prev { left: 14px; }
.next { right: 14px; }

/* 顯示對應那一頁的箭頭 pair（放在一般規則後面以覆蓋 display） */
#h1:checked ~ .arrows .prev-1,
#h1:checked ~ .arrows .next-1,
#h2:checked ~ .arrows .prev-2,
#h2:checked ~ .arrows .next-2,
#h3:checked ~ .arrows .prev-3,
#h3:checked ~ .arrows .next-3 { display: block; }

/* === 圓點（下面中間顯示） === */
.dots {
  position: absolute; left: 0; right: 0; bottom: 12px;
  display: flex; justify-content: center; gap: 10px;
}
/* 圓點外觀 */
.dots label {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,.6); cursor: pointer;
  display: inline-block;
}

/* 用 for 屬性高亮目前的圓點（更穩定） */
#h1:checked ~ .dots label[for="h1"],
#h2:checked ~ .dots label[for="h2"],
#h3:checked ~ .dots label[for="h3"] {
  background: #fff;
}


/* === 共用動畫效果 === */
.hover-elevate,
.images a,
.product,
.contact-icon,
.footer-icons img {
  transition: var(--transition);
}

.hover-elevate:hover,
.images a:hover,
.product:hover {
  transform: translateY(-8px);
  box-shadow: var(--hover-shadow);
}

.product:hover {
  transform: translateY(-10px);
}

/* === Hero 圖片 === */
.hero-container {
  margin: 30px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-image {
  max-width: 100%;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.hero-image:hover {
  transform: scale(1.02);
  box-shadow: var(--hover-shadow);
}

/* === 新聞表格完整樣式 === */
.news-table {
  width: 100%;
  border-collapse: collapse;
  margin: 30px 0;
  border-radius: 8px; /* 如果沒有CSS變數，可用固定值 */
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* 如果沒有CSS變數 */
}

.news-table th, .news-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.news-table th {
  background-color: #2c3e50; /* 如果沒有CSS變數，可用固定顏色 */
  color: #ffffff;
  font-weight: bold;
}

.news-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

.news-table tr:hover {
  background-color: #f0f7ff;
}

.news-table a {
  color: #3498db; /* 如果沒有CSS變數，可用固定顏色 */
  font-weight: bold;
  text-decoration: none;
}

.news-table a:hover {
  text-decoration: underline;
}

/* 預設只顯示最新的六則新聞 */
.news-table tbody tr:nth-child(n+7) {
    display: none;
}

/* 顯示所有新聞的控制 */
.news-table.show-all tr {
    display: table-row !important;
}



/* === 下載連結 === */
.download-link-group {
  text-align: center;
  margin: 25px 0;
}

.download-link-group a {
  display: inline-block;
  background-color: var(--primary-color);
  color: var(--light-text);
  padding: 12px 25px;
  margin: 10px 0;
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-weight: bold;
  transition: var(--transition);
}

.download-link-group a:hover {
  background-color: var(--secondary-color);
  text-decoration: underline;
}


/* === Featured Section 專用樣式（避免衝突版） === */

/* Featured 區塊圖片樣式 */
#featured .image img {
  width: 100%;
  height: auto;
}

/* Featured 區塊文字容器 */
#featured .text {
  text-align: center;
  padding-top: 1em;
}

/* Featured 區塊段落樣式 */
#featured .text p {
  text-align: justify;
  padding-bottom: 1em;
  line-height: 1.4em;
}

/* Featured 區塊標題樣式 */
#featured .title {
  display: flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 1em;
}

#featured .title.title-left {
  justify-content: flex-start;
}

/* Featured 區塊裝飾線 */
#featured .line {
  width: 3em;
  height: 1px;
  background-color: #000;
  margin-right: 1em;
}

/* Featured 區塊按鈕樣式 */
#featured .btn {
  display: inline-block;
  padding: .5em 1.5em;
  border: solid 1px #090b08;
  transition: all .3s ease-in;
  text-decoration: none;
  color: #090b08;
}

#featured .btn:hover,
#featured .btn:focus {
  transform: translate(0px, -2px);
  box-shadow: 0px 10px 7px -9px rgba(0,0,0,0.75);
  transition: all .3s ease-out;
}

/* Featured 區塊容器樣式 */
#featured .wrapper {
  /* 基本樣式，會在響應式中調整 */
}

/* === 響應式設計 === */

/* 平板尺寸以上 */
@media(min-width: 768px) {
  #featured .wrapper {
    display: flex;
  }
  
  #featured .text {
    text-align: left;
    margin: 0 0 auto 4em;
    flex: 1;
    order: 1;
  }
  
  #featured .image {
    flex: 1 0 12em;
    order: 2;
  }
}

/* 大螢幕尺寸 */
@media(min-width: 992px) {
  #featured .image {
    margin-top: -2em;
  }
}

@media(min-width: 1200px) {
  #featured .image {
    margin-top: -4em;
  }
}


/*
 * 頁首樣式
 * 統一管理 header 內部結構，移除重複的類別。
 */

/* === Header 整合版 === */
header {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* 使用固定值，更穩定 */
    position: sticky; /* 使用 sticky，讓 header 固定在頂部 */
    top: 0;
    z-index: 100; /* 使用較高的 z-index，確保在最上層 */
}

.header-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 15px; /* 使用四周都有 padding 的版本 */
    position: relative;
    z-index: 20; /* 保持內容的層級 */
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 整合 h1 和 site-title 的樣式 */
.logo-section h1,
.logo-section .site-title {
    font-size: 1.8rem; /* 基本字體大小 */
    color: var(--primary-color); /* 優先使用 CSS 變數 */
    font-weight: bold;
    margin: 0; /* 移除 h1 預設邊距 */
}

/* site-title 的特殊樣式覆蓋 */
.site-title {
    color: #336699 !important; /* 使用固定顏色覆蓋 */
    font-size: 30px !important; /* 使用較大字體覆蓋 */
}

.logo-section img {
    height: 40px;
    width: auto;
}

/*
 * 導航欄樣式
 * 移除多餘的 margin-top，改用 header-content 的 padding 控制。
 */
.main-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
}

.main-nav li {
    margin: 0 10px;
}

.main-nav a {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    font-weight: bold;
    transition: all 0.3s;
}

.main-nav a:hover, .main-nav a:focus {
    color: var(--primary-color);
    text-decoration: none;
    background-color: var(--light-bg-color);
}

/* 行動版導航開關按鈕 */
.mobile-nav-toggle {
    display: none;
    cursor: pointer;
    padding: 10px;
}

.mobile-nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: all 0.3s;
}

/*
 * 主內容區與通用標題
 * 統一標題樣式，避免重複定義。
 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3, h4 {
  margin-top: 20px;
  margin-bottom: 10px;
}

h1 {
  text-align: center;
  font-size: 2.2rem;
  color: var(--primary-color);
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 15px;
}

h2 {
  text-align: center;
  font-size: 1.6rem;
  color: var(--primary-color);
}

h3 {
  font-size: 1.4rem;
  color: var(--secondary-color);
}

h4 {
  font-size: 1.2rem;
  font-weight: normal;
}

.section-title {
    color: var(--primary-color);
    text-align: center;
    margin: 30px 0;
    font-size: 2em;
}

.highlight {
    color: var(--primary-color);
    text-align: center;
    font-size: 20px;
    margin-bottom: 30px;
}

/* 內文樣式 */
.intro-text, .intro-section p, .content-section p, .company-card p {
    font-size: var(--font-size-base);
    line-height: 2;
}

/* 產品卡片 */
.product-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* 調整為 center 讓單行時居中 */
    gap: 20px;
    margin: 30px 0;
}

.product-card {
    width: calc(33.333% - 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 5px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-card img {
    width: 130px;
    height: 147px;
    object-fit: cover;
    margin-bottom: 15px;
}

.product-info {
    text-align: center;
}

.product-info h3 {
    margin-bottom: 10px;
    font-size: 1.2em;
}

/* 購物平台區塊 */
.shopping-platforms {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.shopping-platforms a {
    display: block;
    width: 100px;
    height: 100px;
}

.shopping-platforms img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 頁腳樣式 */
footer {
    background-color: var(--footer-bg-color);
    padding: 30px 0;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.slogan {
    margin-bottom: 20px;
    font-size: 1.125em;
    color: var(--primary-color);
    font-weight: bold;
}

.footer-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.footer-nav li {
    margin: 0 10px;
}

.footer-nav a {
    color: var(--text-color);
    font-size: 14px;
}

.copyright {
    font-size: 14px;
    color: var(--text-color);
}

.gcse-search {
    margin: 20px auto;
    max-width: 600px;
}

        /* Q&A 頁面專用樣式 */
        .qa-section {
            margin-bottom: 40px;
        }

        .qa-item {
            margin-bottom: 20px;
        }

        .qa-item dt, .qa-item p {
            font-size: 16px;
            line-height: 2;
        }

        .qa-item dt {
            font-weight: bold;
            color: var(--secondary-color);
            margin-bottom: 5px;
        }

        .qa-intro-text {
            text-align: center;
            margin-bottom: 30px;
        }

        .center-img {
            text-align: center;
        }

        /* 聯絡我們頁面專用樣式 */
        .contact-info {
            line-height: 2;
            margin-bottom: 30px;
        }

        .contact-info p {
            font-size: 16px;
            font-weight: normal;
            line-height: 1.8;
            margin-bottom: 5px;
        }
        
        .contact-info .contact-highlight {
            color: var(--secondary-color);
            font-weight: bold;
        }

        .contact-map {
            margin-bottom: 30px;
            position: relative;
            padding-bottom: 56.25%; /* 16:9 比例 */
            height: 0;
            overflow: hidden;
        }

        .contact-map iframe {
            position: absolute;
            top: 0;
            left: 0;
            width: 100% !important;
            height: 100% !important;
            border: 0;
        }

        /* 產品目錄 */
        .product-nav {
            max-width: 400px;
            margin: 20px auto;
            padding: 20px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            background-color: var(--light-bg-color);
        }

        .product-nav h3 {
            text-align: center;
            border-bottom: 2px solid var(--primary-color);
            padding-bottom: 10px;
            margin-bottom: 15px;
        }

        .product-nav ul {
            list-style: none;
        }

        .product-nav li {
            margin: 10px 0;
        }

        .product-nav a {
            display: block;
            color: var(--text-color);
            padding: 5px 10px;
            transition: background-color 0.3s;
        }
        
        .product-nav a:hover {
            background-color: #e0e0e0;
            text-decoration: none;
        }

        /* 產品介紹頁面專用樣式 */
        .product-section h3 {
            text-align: left;
        }
        
        .product-content {
            padding: 0 20px;
        }
        
        .product-content p {
            line-height: 2;
            font-size: var(--font-size-base);
            margin-bottom: 1em;
        }
        
        .product-content ul, .product-content ol {
            padding-left: 20px;
            margin-bottom: 1em;
        }

        .product-content li {
            line-height: 1.8;
            font-size: var(--font-size-base);
        }
        
        .product-download-link {
            text-align: center;
            margin: 20px 0;
        }
        
        .product-download-link a {
            font-size: 1.25rem;
            color: var(--primary-color);
            font-weight: bold;
        }

/*
 * 返回頂部按鈕
 * 樣式簡潔且功能明確。
 */
.back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.back-to-top-btn.active {
    opacity: 1;
    visibility: visible;
}

.back-to-top-btn:hover, .back-to-top-btn:focus {
    background-color: #2a5500;
    transform: translateY(-3px);
    outline: none;
}

/*
 * 公司簡介頁面專用樣式
 * 確保這些樣式不會影響其他頁面。
 */
.page-banner {
    margin-bottom: 30px;
}

.breadcrumb {
    padding: 15px 0;
    font-size: var(--font-size-base);
    color: #666;
}

.breadcrumb a {
    color: var(--primary-color);
}

.intro-section {
    margin-bottom: 40px;
    text-align: center;
}

.content-section {
    margin-bottom: 50px;
}

.business-items {
    list-style-type: none;
    padding-left: 20px;
}

.business-items li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
    line-height: 2;
}

.business-items li::before {
    content: "•";
    color: var(--primary-color);
    font-size: 20px;
    position: absolute;
    left: 0;
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 20px;
}

.timeline-item h3 {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 10px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid white;
}

.related-companies {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.company-card {
    flex: 1;
    min-width: 300px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-shadow: var(--box-shadow);
}

.company-card h3 {
    color: var(--secondary-color);
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.125em;
}

/*
 * 響應式設計 (Media Queries)
 * 針對不同螢幕尺寸調整樣式，確保跨裝置的良好體驗。
 */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .logo-section {
        justify-content: center;
        width: 100%;
        margin-bottom: 15px;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: white;
        z-index: 100;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    .main-nav.active {
        display: block;
    }
    
    .main-nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    .main-nav li {
        margin: 5px 0;
        width: 100%;
        text-align: center;
    }

    .main-nav a {
        padding: 15px;
    }
    
    .mobile-nav-toggle {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
    }

  video {
    max-width: 100%;
    margin: 0 auto;
  }
    
    .product-card {
        width: calc(50% - 10px);
    }
    
    .back-to-top-btn {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }
    
    .back-to-top-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .related-companies {
        flex-direction: column;
        gap: 20px;
    }
    
    .company-card {
        min-width: 100%;
    }
    
    .timeline {
        padding-left: 20px;
    }
    
    .timeline::before {
        left: 5px;
    }
    
    .timeline-item {
        padding-left: 15px;
    }

    .timeline-item::before {
        left: 2px;
        top: 8px;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        padding: 10px;
    }

    .logo-section {
        gap: 10px;
        margin-bottom: 10px;
    }

    .logo-section img {
        height: 35px;
    }

    .logo-section .site-title {
        font-size: 1.5rem;
    }
    
    .product-card {
        width: 100%;
    }
    
    .shopping-platforms a {
        width: 80px;
        height: 80px;
    }

    h1 {
        font-size: 1.8rem;
    }
}