/* =========================================
   0. 全域變數與重置 (Variables & Reset)
   ========================================= */
:root {
    --primary-blue: #1c355e;   /* 企業主色 (深藍) */
    --accent-red: #d32f2f;     /* 點綴色 (紅色線條) */
    --footer-bg: #b8c1cb;      /* 頁尾灰藍色 */
    --text-dark: #333333;
    --text-light: #ffffff;
    --text-gray: #555555;
    --transition-speed: 0.3s;
    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --border-color: rgba(255, 255, 255, 0.4); 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
    line-height: 1.5;
    color: var(--text-dark);
    background-color: var(--text-light);
}

a {
    text-decoration: none;
    transition: color var(--transition-speed);
}

/* =========================================
   1. 頁首導覽列與語言切換 (共用電腦版)
   ========================================= */
.site-header {
    padding: 15px 0;
    position: sticky;       /* 讓 Header 黏在最上方 */
    top: 0;
    z-index: 1000;
    background-color: var(--primary-blue); /* 預設在最頂端時的深藍色 (完全不透明) */
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease; 
}

/* 狀態 1：往下滑時 -> 往上隱藏 */
.site-header.header-hidden {
    transform: translateY(-100%); 
}

/* 狀態 2：往上滑時 -> 出現且呈現 50% 透明度 */
.site-header.header-scrolled-up {
    background-color: rgba(30, 58, 95, 0.5); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px); 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); 
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo 區塊 */
.logo-block {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon-placeholder {
    width: 75px;
    height: 75px;
    background-color: #ffffff; 
    border: 2px solid var(--accent-red);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; 
}

.logo-text {
    color: var(--text-light);
    font-size: 42px;
    font-weight: bold;
    letter-spacing: 2px;
    border-bottom: 4px solid var(--accent-red); 
}

/* 漢堡按鈕 (預設電腦版隱藏) */
.hamburger-btn {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 100;
}

.hamburger-btn .bar {
    width: 20px;
    height: 2px;
    background-color: var(--text-light);
    transition: all 0.3s ease;
    border-radius: 3px;
}

/* 導覽主區塊 */
.nav-block {
    display: flex;
    align-items: center;
    gap: 40px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 40px;
}

.main-nav a {
    color: var(--text-light); 
    font-size: 24px; 
    font-weight: 500; 
    text-align: center;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
}

.main-nav a:hover,
.main-nav a.active {
    opacity: 0.8;
}

.main-nav a.active {
    border-bottom: 2px solid var(--text-light);
}

/* 語言切換母容器 */
.lang-selector {
    position: relative; 
    z-index: 10010 !important; /* 強制提高層級防止被遮擋 */
}

.lang-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    cursor: pointer;
    padding: 10px 0; 
}

.icon-globe { width: 20px; height: 20px; }
.icon-arrow { width: 16px; height: 16px; }

/* 語言下拉選單 */
.lang-dropdown {
    position: absolute;
    top: 100%; 
    right: -10px; 
    background-color: #172a4d; 
    border-radius: 6px;
    list-style: none;
    width: 110px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); 
    overflow: hidden; 
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px); 
    transition: all 0.3s ease;
    z-index: 10011 !important;
}

.lang-selector:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-dropdown li a {
    display: block;
    padding: 12px 15px;
    color: #ffffff;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    transition: background-color 0.2s ease; 
}

.lang-dropdown li a:hover {
    background-color: #5d6d88; 
}

/* =========================================
   2. 合作夥伴頁面特定樣式 (白色圓角卡片區)
   ========================================= */
.partners-section {
    padding: 60px 0 100px 0;
    background-color: #1c355e;
    text-align: center;
    min-height: 70vh;
}

/* 隱藏預設 H1 文字標題 */
.page-title {
    display: none;
}

/* 區塊分組副標題 (主要客戶 / OEM代工) */
.section-subtitle {
    color: #ffffff;
    font-size: 36px;
    margin: 20px 0;
    letter-spacing: 1.5px;
    font-weight: bold;
}

.partners-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    flex-direction: column;
    gap: 30px; 
}

/* 白色立體圓角列卡片 */
.partner-row-card {
    display: flex;
    justify-content: center; /* 圖片水平置中 */
    align-items: center;     /* 圖片垂直置中 */
    flex-wrap: wrap;         
    gap: 60px;               /* 圖片之間的左右排版間距 */
    background-color: #ffffff;
    border-radius: 16px;
    padding: 40px 20px;      
    margin-bottom: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 卡片 Hover 浮起特效 */
.partner-row-card:hover {
    transform: translateY(-5px); 
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

/* 圖片插槽格子 */
.partner-slot {
    display: flex;
    justify-content: center; 
    align-items: center;
    max-width: 250px;
}

.partner-slot img {
    max-width: 100%;
    height: auto; 
    object-fit: contain; 
}

/* =========================================
   3. 頁尾區塊 (Footer)
   ========================================= */
.site-footer {
    background-color: var(--footer-bg);
    padding: 24px 0;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.contact-header h2 {
    color: var(--text-gray);
    font-size: 30px;
    font-weight: 800;
}

.contact-details {
    color: var(--text-gray);
    font-size: 18px;
    font-weight: bold;
    display: flex;
    gap: 15px;
    align-items: center;
}

.copyright {
    color: var(--text-gray);
    font-size: 14px;
    font-weight: bold;
}

.footer-logo {
    color: var(--primary-blue);
    font-size: 64px;
    font-weight: 900;
    line-height: 1;
}

/* 確保 Email 連結與旁邊的文字看起來一致 */
.footer-email {
    color: var(--text-gray);      /* 保持與 ADD/TEL 相同的顏色 */
    text-decoration: none;        /* 移除底線 */
    cursor: pointer;              /* 滑鼠移入顯示手指指標 */
    transition: opacity 0.2s;
}

/* 當滑鼠移上去時，加上一點視覺反饋 */
.footer-email:hover {
    opacity: 0.7;
    color: #666666;                  /* 滑鼠懸停時微調顏色 */
}

/* =========================================
   4. 專屬英文版特定微調 (html[lang="en"] 電腦版)
   ========================================= */
html[lang="en"] .logo-text {
    font-size: 36px;
    line-height: 1.2;
    margin-top: 4px;
}

html[lang="en"] .footer-info {
    display: flex;
    flex-direction: column;
}

html[lang="en"] .copyright-row {
    display: flex;
    justify-content: space-between; 
    align-items: center;            
    width: 100%;
}

html[lang="en"] .copyright-row .copyright {
    margin: 0; 
}

html[lang="en"] .footer-email {
    color: var(--text-gray);
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
}


/* =========================================================================
   ★ 響應式核心：所有 RWD 媒體查詢樣式集中管理區塊 ★
   ========================================================================= */

/* ----------------=========================
   RWD 1. 平板模式：視窗寬度 1180px 以下
   ----------------========================= */
@media (max-width: 1180px) {
    .header-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .logo-text {
        font-size: 30px;
    }

    .partners-section {
        padding: 40px 0;
    }

    .partners-container {
        padding: 0 20px;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    
    .contact-header {
        justify-content: center;
    }

    /* 專屬英文版平板微調 */
    html[lang="en"] .logo-text {
        font-size: 30px;
    }
}

/* ----------------=========================
   RWD 2. 手機模式：視窗寬度 768px 以下
   ----------------========================= */
@media (max-width: 768px) {
    /* 讓 Logo 保持在左，漢堡按鈕在右 */
    .header-container {
        position: relative;
        flex-direction: row; 
        justify-content: space-between;
        align-items: center; 
        padding: 0 20px;
    }
    
    .logo-block {
        gap: 10px;
    }

    .logo-icon-placeholder {
        width: 45px;
        height: 45px;
    }

    .logo-icon-placeholder img {
        height: 45px !important;
    }

    .logo-text {
        font-size: 18.5px; 
        border-bottom: 2px solid var(--accent-red);
    }

    /* 顯示漢堡按鈕 */
    .hamburger-btn {
        display: flex;
    }

    /* 導覽列轉換為滿版下拉面板 */
    .nav-block {
        display: none; 
        position: absolute;
        top: 100%; 
        left: 0;
        width: 100%;
        background-color: var(--primary-blue);
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        gap: 20px;
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
        z-index: 90;
    }

    .nav-block.active {
        display: flex;
    }

    .main-nav {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .main-nav a {
        font-size: 20px;
    }

    /* 手機版語言選單下拉控制與層級優化 */
    /* 1. 隱藏地球儀與箭頭圖示，減少使用者點擊步驟 */
    .lang-trigger {
        display: none !important;
    }

    /* 2. 讓語言區塊容器滿版，並給予舒適的上下間距 */
    .lang-selector {
        width: 100% !important;
        position: relative !important;
        padding: 5px 50px 0 50px !important;
        z-index: 10010 !important;
    }

    /* 3. 解除原本的滑鼠 Hover 隱藏邏輯，強制變為 Flex 橫向整排顯示 */
    .lang-dropdown {
        position: relative !important;
        top: 0 !important;
        right: 0 !important;
        transform: none !important;
        
        /* 強制永遠顯示並橫向排列 */
        display: flex !important;
        flex-direction: row !important; 
        justify-content: center !important;
        align-items: center !important;
        gap: 3px !important; /* 按鈕彼此之間的左右間距 */
        
        width: 100% !important;
        background-color: transparent !important; /* 拔掉原先的深藍色下拉底色包圍盒 */
        box-shadow: none !important;
        list-style: none !important;
        
        /* 覆蓋掉 Hover 隱藏的開關屬性，讓它直接常駐可見 */
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        padding: 0 !important;
    }

    /* 4. 讓 3 個語言選項平均瓜分整行寬度，並讓內部文字置中 */
    .lang-dropdown li {
        flex: 1 !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        justify-content: center !important; /* 確保內部的 a 標籤置中 */
    }

    /* 5. 移除框線與背景，改為跟首頁導覽列一樣的「純文字 + 預留透明底線」 */
    .lang-dropdown li a {
        display: inline-block !important; /* 讓底線寬度剛剛好包住文字 */
        padding: 8px 2px !important;      /* 縮小左右 padding 讓底線更貼合字數 */
        font-size: 16px !important;       /* 稍微放大字體配合無框線視覺 */
        font-weight: 500 !important;
        color: #ffffff !important;
        white-space: nowrap !important;
        
        /* 移除先前的按鈕樣式 */
        background-color: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        
        /* 預留一條透明的 2px 底線，防止點擊時畫面跳動 */
        border-bottom: 2px solid transparent !important; 
        transition: border-color 0.2s !important;
    }

    /* 6. 當點擊時的反饋效果 */
    .lang-dropdown li a:active {
        border-bottom: 2px solid rgba(255, 255, 255, 0.5) !important;
    }

    /* 7. ★ 核心：讓目前所在語系的按鈕，底線永遠停留保持顯示 ★ */
    /* 當網頁是繁體中文時，底線停留在 [data-lang="tw"] */
    html[lang="zh-Hant"] .lang-dropdown li a[data-lang="tw"],
    /* 當網頁是簡體中文時，底線停留在 [data-lang="cn"] */
    html[lang="zh-Hans"] .lang-dropdown li a[data-lang="cn"],
    /* 當網頁是英文版時，底線停留在 [data-lang="en"] */
    html[lang="en"] .lang-dropdown li a[data-lang="en"] {
        border-bottom: 2px solid var(--text-light) !important;
        font-weight: bold !important; /* (選用) 讓當前語言的字體稍微加粗，視覺更清晰 */
    }

    /* 客戶頁面手機版佈局調整 */
    .partners-section {
        padding: 20px 0;
    }

    .section-subtitle {
        font-size: 24px;
    }

    .partners-container {
        gap: 20px;
    }
    
    /* 白色卡片改為單欄垂直直排 */
    .partner-row-card {
        grid-template-columns: 1fr; 
        padding: 30px 20px;
        gap: 30px; 
    }

    .partner-slot img {
        max-width: 80%;
    }

    /* 頁尾手機版對齊微調 */
    .contact-header h2 {
        font-size: 26px;
    }

    .contact-details {
        font-size: 16px;
        flex-direction: column;
        gap: 5px;
    }

    .copyright {
        font-size: 10px;
    }

    .footer-logo {
        font-size: 40px;
    }

    /* 頁尾第二行 (Copyright + EMAIL) 手機版改垂直堆疊 */
    .copyright-row {
        flex-direction: column-reverse; 
        align-items: flex-start;
        gap: 8px;
        margin-top: -5px;
    }

    /* 英文版微調 */
    html[lang="en"] .logo-text { font-size: 18px; }
    html[lang="en"] .footer-email {
        font-size: 16px;
    }
}