/* --- 1. 定義與全域設定 --- */
:root {
    --logo-blue: #1b5cb3;
    --stats-bg-color: #1b5cb3;
    --dark-deep: #121212;
    --soft-gray: #F4F7FA;
    --footer-bg: #1a1a1a;
    --border-color: #e9ecef;
    --lang-border: #d1e1f5;
    /* 定義絲滑動畫曲線 */
    --silky-transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    
}

html {
    scroll-behavior: smooth;
    width: 100%;

}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: #fff;
    color: #333;
    width: 100%;
    overflow-x: hidden;
    line-height: 1.6;
    padding-top: 75px;
}

@media (max-width: 1199.98px) {
    body {
        padding-top: 75px; /* 手機版高度通常較矮，可微調 */
    }
}

/* --- 2. 導覽列 (Navbar) --- */
.navbar {
    padding: 0.8rem 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    background: white !important;
}

.text-logo {
    font-weight: 900;
    letter-spacing: -0.5px;
    transition: var(--silky-transition);
}

.nav-item-bordered {
    padding: 8px 16px !important;
    margin: 0 4px;
    font-weight: 500;
    font-size: 0.95rem;
    color: #444 !important;
    text-decoration: none;
    display: block;
    transition: color 0.3s ease;
}

.nav-item-bordered:hover {
    color: var(--logo-blue) !important;
}

.nav-item-bordered span {
    position: relative;
    display: inline-block;
    padding-bottom: 4px;
}

.nav-item-bordered span::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--logo-blue);
    transform: scaleX(0);
    transition: var(--silky-transition);
    transform-origin: right;
}

.nav-item-bordered:hover span::after {
    transform: scaleX(1);
    transform-origin: left;
}

.lang-dropdown-btn {
    border: 1px solid var(--lang-border) !important;
    color: #555 !important;
    padding: 6px 15px !important;
    border-radius: 50px;
    background: white;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.lang-dropdown-btn:hover {
    border-color: var(--logo-blue) !important;
    background-color: rgba(0, 129, 17, 0.05);
}

.dropdown-menu {
    border: none;
    border-radius: 0px 0px 12px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 10px;
    margin-top: 5px !important;
    animation: fadeInDrop 0.3s ease forwards;
}

@keyframes fadeInDrop {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-toggle::after {
    vertical-align: middle;
    margin-left: 8px;
    opacity: 0.5;
    transition: transform 0.3s;
}

.nav-item.dropdown.show .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-item {
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #555;
    transition: all 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(0, 118, 129, 0.08);
    color: var(--logo-blue);
    /*transform: translateX(5px);*/
}

/* --- 手機選單 (Offcanvas) --- */
.offcanvas {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.offcanvas-end {
    width: 300px !important;
    border-radius: 0 !important;
    border-left: 1px solid #eee;
}

.offcanvas-backdrop {
    transition: opacity 0.6s ease !important;
}

/* --- 3. Hero 與 背景包裹層 --- */
/* Hero Carousel 設定 */
.hero-slide {
    position: relative;
    height: 85vh; /* 設定高度，可依需求調整，例如 600px 或 100vh */
    min-height: 600px;
    background-color: #000; /* 圖片載入前的底色 */
}

/* 背景圖片設定：確保填滿且居中 */
.hero-bg-img {
    height: 100%;
    width: 100%;
    object-fit: cover; /* 重要！裁切圖片以填滿 */
    object-position: center;
}

/* 黑色半透明遮罩：讓白字更明顯 */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.6)); /* 漸層遮罩 */
    z-index: 1;
}

/* 覆蓋原本 Bootstrap caption 的位置設定 */
.hero-caption {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2; /* 確保在遮罩之上 */
    padding-bottom: 3rem; /* 稍微往上提一點，避開指示器 */
}

/* 針對 Logo 與文字的微調 */
.hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
@media (min-width: 768px) {
    .hero-title {
        font-size: 3.5rem;
    }
}
.hero-text-box {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    /*backdrop-filter: blur(8px);*/
    /* 確保區塊本身寬度適當 */
    width: 100%;
    max-width: 900px;
}


/* --- 4. 統計數據與搜尋 --- */
.stats-bar {
    position: relative;
    z-index: 1;
    background: var(--stats-bg-color);
    color: white;
    text-align: center;
    padding: 50px 0 110px 0;
    /*backdrop-filter: blur(5px);*/
    text-shadow: 3px 3px 6px #000000;
}

.stat-item h3 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.stat-item p {
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0;
}

.search-container {
    margin-top: -60px;
    z-index: 10;
    position: relative;
    padding-bottom: 60px;
}

.search-card {
    background: #fff;
    border-radius: 12px;
    padding: 35px;
    box-shadow: 0 20px 20px rgba(0, 0, 0, 0.12);
}

/* --- 5. 展覽卡片 --- */
.expo-card {
    border: 1px solid #f0f0f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
}

.expo-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
    border-color: var(--logo-blue);
}

.img-zoom {
    overflow: hidden;
    height: 220px;
    background: #f8f9fa;
}

.img-zoom img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.expo-card:hover .img-zoom img {
    transform: scale(1.1);
}

.badge-status {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 2;
    padding: 6px 12px;
    font-weight: 600;
    border-radius: 4px;
}

.industry-tag {
    color: var(--logo-blue);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: block;
}

/* --- 6. 其它區塊與 Footer --- */
/* --- 1. 定義視差容器 (視窗) --- */
.parallax-section {
    position: relative;
    padding: 120px 0;
    color: white;
    text-align: center;
    overflow: hidden;

    /* 這裡負責裁切，讓 fixed 的背景只顯示在這個區塊內 */
    -webkit-clip-path: inset(0);
    clip-path: inset(0);

    background: transparent;
    z-index: 1;
}

/* --- 2. 電腦版：使用 Clip-Path + Fixed 實現完美視差 --- */
.parallax-section::before {
    content: '';
    position: fixed;
    /* 圖片固定在螢幕上 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 電腦版高度跟隨視窗即可 */

    background: linear-gradient(rgba(0, 129, 17, 0.85), rgba(0, 74, 153, 0.85)),
        url('https://images.unsplash.com/photo-1540575861501-7cf05a4b125a?auto=format&fit=crop&q=80&w=1600');
    background-size: cover;
    background-position: center center;

    z-index: -1;
    will-change: transform;
    /* 優化渲染 */
    pointer-events: none;
}

#btn-back-to-top {
    position: fixed;
    bottom: 80px;
    right: 10px;
    display: none;
    z-index: 999;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: var(--logo-blue);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* 1. 讓 Footer 整體高度縮減，不要留白太多 (原本是 padding: 80px 0 30px 0) */
footer {
    background: var(--footer-bg);
    color: #999;
    padding: 50px 0 20px 0; /* 修改這裡：縮小上下內距 */
}


/* 2. 確保社群 Icon 有漂亮的 hover 效果 */
.hover-white:hover {
    color: white !important;
    transform: translateY(-3px); /* 微微浮起 */
}

.transition-icon {
    transition: all 0.3s ease;
}

footer h5 {
    color: white;
    border-left: 3px solid var(--logo-blue);
    padding-left: 15px;
    margin-bottom: 25px;
    font-weight: 700;
}

.footer-link {
    color: #999;
    text-decoration: none;
    display: block;
    margin-bottom: 12px;
    transition: 0.3s;
}

.footer-link:hover {
    color: white;
    transform: translateX(5px);
}

/* --- 7. 響應式調整 --- */
@media (max-width: 1199px) {
    .nav-item-bordered {
        padding: 10px 15px !important;
        margin: 5px 0;
    }

    .nav-item-bordered span::after {
        display: none;
    }
}

@media (max-width: 768px) {
    .parallax-section {
        padding: 80px 0;
    }

    .parallax-section::before {
        /* [關鍵 1] 強制設定為比螢幕還高，忽略網址列的伸縮 */
        height: 120vh;
        min-height: 120vh;

        /* [關鍵 2] 往上拉 10%，讓多出來的高度平均分配 */
        top: -10vh;

        /* 確保寬度填滿 */
        width: 100%;

        /* [關鍵 3] 在手機上保持 fixed，配合父層 clip-path 依然有視差感，但不會抖動 */
        position: fixed;
    }

    /* 確保手機文字排版 */
    .stats-text-group span {
        display: block;
        margin-bottom: 10px;
    }

    .stats-divider {
        display: none;
    }

    /* 手機版字體縮小 */
    .hero-title {
        font-size: 2rem;
    }

    /* 手機版黑色區塊：內容置中、間距縮小 */
    .hero-text-box {
        padding: 30px 20px !important;
        text-align: center;
        /* 讓文字置中 */
        width: auto;
        margin: 0 15px;
        /* 左右留一點邊距，不要貼死 */
    }

    /* 手機版 Logo 調整 */
    .hero-brand-logo {
        margin-right: 0 !important;
        margin-bottom: 15px;
    }

    .hero-brand-logo img {
        margin: 0 auto;
        /* 圖片置中 */
        height: 80px !important;
        /* 稍微縮小一點 */
    }

    .stat-item h3 {
        font-size: 1.8rem;
    }

    .search-card {
        padding: 20px;
    }

    .stat-item {
        margin-bottom: 25px;
    }
}

/* --- 商情部落格優化 --- */
#news-section .carousel-inner {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    /* 增加陰影提升質感 */
}

.news-carousel-card {
    position: relative;
    width: 100%;
    background: #000;
    /* 圖片載入前的背景色 */
}

.news-carousel-img {
    width: 100%;
    height: 480px;
    /* 電腦版固定高度，不會再無限撐大 */
    object-fit: cover;
    /* 關鍵：確保圖片填滿且不變形 */
    opacity: 0.9;
    /* 稍微壓暗一點點圖片，讓文字更清楚 */
    transition: transform 0.8s ease;
}

/* 滑鼠滑過時圖片微放大 */
.news-carousel-card:hover .news-carousel-img {
    transform: scale(1.05);
}

/* 文字區域優化：加入底部漸層黑 */
.news-overlay-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 80px 40px 40px 40px;
    /* 上方留空間給漸層 */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
    text-align: left;
    /* 改為靠左對齊，較現代 */
}

/* 輪播控制鈕微調 */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    opacity: 0.7;
}

/* --- 手機版調整 --- */
@media (max-width: 768px) {
    .news-carousel-img {
        height: 320px;
        /* 手機版高度縮小，避免佔據太多畫面 */
    }

    .news-overlay-content {
        padding: 60px 20px 20px 20px;
    }

    .news-overlay-content h3 {
        font-size: 1.4rem;
        /* 標題字體縮小 */
    }
}

/* --- 8. 電腦版下拉選單改為 Hover 觸發 --- */
/* 設定 min-width: 1200px 是為了配合您的 navbar-expand-xl 
   只有在電腦版 (大於 1200px) 時才啟用 Hover，手機版維持點擊操作
*/
@media (min-width: 1200px) {
    
    /* 1. 滑鼠移入 .dropdown 區域時，強制顯示選單 */
    .dropdown:hover > .dropdown-menu {
        display: block;
        /* 繼承您原本定義的動畫 */
        animation: fadeInDrop 0.3s ease forwards; 
    }

    /* 2. 修正間距問題 (重要！) */
    /* 原本您設定了 margin-top: 5px !important，這會導致滑鼠
       從按鈕移到選單中間有空隙，造成選單消失。
       這裡在電腦版將其歸零或設為負值以確保連接順暢。
    */
    .dropdown:hover > .dropdown-menu {
        margin-top: 0 !important;
    }

    /* 3. 讓箭頭在 Hover 時也要轉向 */
    .dropdown:hover > .dropdown-toggle::after {
        transform: rotate(180deg);
    }
}

/* --- 9. 手機版 Footer 美化與對齊修正 --- */
@media (max-width: 991px) {
    
    /* 1. 讓 Footer 內的所有文字置中 */
    footer {
        text-align: center !important;
    }

    /* 2. 修正 Logo 區域 */
    footer .text-logo {
        justify-content: center !important;
        margin-bottom: 1.5rem;
    }

    /* 3. 標題樣式大改 (解決藍色直線分家問題) */
    footer h5 {
        border-left: none !important; /* 1. 移除左邊那條線 */
        padding-left: 0 !important;   /* 2. 移除左邊留白 */
        
        position: relative;
        display: inline-block;        /* 讓區塊隨文字寬度縮放 */
        margin-bottom: 25px;
        font-size: 1.25rem;           /* 字體稍微加大一點點 */
    }

    /* 4. 使用偽元素製作精緻的「下方短底線」 */
    footer h5::after {
        content: '';
        display: block;
        width: 50px;                 /* 設定線條寬度 (固定長度比較整齊) */
        height: 3px;                 /* 線條粗細 */
        background-color: var(--logo-blue);
        margin: 10px auto 0 auto;    /* 上距10px，左右自動置中 */
        border-radius: 2px;          /* 讓線條有點圓角 */
    }

    /* 5. 聯絡窗口標題特殊處理 */
    /* 因為上方已經有大分隔線了，這裡的標題就不要再加短底線，避免線條太多 */
    .contact-title-mobile::after {
        display: none !important;    /* 隱藏短底線 */
    }
    .contact-title-mobile {
        margin-bottom: 15px !important;
        opacity: 0.9;
    }

    /* 6. 修正聯絡資訊 Icon 與文字的對齊 */
    footer .small.mb-0 {
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 10px !important; /* 手機版增加一點行距 */
    }
    
    footer .bi-geo-alt,
    footer .bi-envelope {
        margin-right: 8px !important; 
    }
}

section[id] {
    scroll-margin-top: 90px;
}

/* 增加平滑捲動效果，提升 UX 體驗 */
html {
    scroll-behavior: smooth;
}