:root {
    --primary-blue: #0d5295; 
    --hover-blue: #083d70;
    --text-dark: #333;
    --text-gray: #666;
    --header-height: 80px;
    --mega-width: 800px;  /* mega寬度 */
}

/* * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Noto Sans TC', sans-serif; } */
/* html, body { overflow-x: hidden; width: 100%; } */
/* body { padding-top: var(--header-height); background-color: #fff; } */

.site-header {
    position: fixed; top: 0; left: 0; width: 100%;
    height: var(--header-height); background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 1000; display: flex; align-items: center;
}

.site-header .container {
    display: flex; width: 100%; 
    max-width: 1200px; /* 增加寬度避免導覽列擠壓 */
    margin: 0 auto; padding: 0 15px;
    align-items: center; justify-content: space-between;
}

.logo img { height: 40px; display: block; width: auto; }

/* --- 桌面版選單佈局 --- */
.nav-menu { display: flex; list-style: none; height: var(--header-height); margin: 0; padding: 0; }
.nav-item { position: relative; display: flex; align-items: center; }
.nav-link {
    text-decoration: none; 
    color: var(--text-dark);
    font-weight: 500; 
    padding: 0 10px;
    height: 100%; 
    display: flex; 
    align-items: center;
    transition: 0.3s; font-size: 14px; white-space: nowrap;
}

/* 修復：下拉箭頭與 Hover 效果 */
.has-submenu::after {
    content: ""; display: inline-block; width: 6px; height: 6px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); margin-left: 8px; margin-top: -3px;
    transition: 0.3s; opacity: 0.8;
}

@media (min-width: 1101px) {
    .nav-link:hover { color: var(--primary-blue); }
    /* 【關鍵修復】：確保 Hover 時選單顯示 */
    .nav-item:hover .mega-menu, 
    .nav-item:hover .dropdown-v1 { 
        visibility: visible !important; 
        opacity: 1 !important; 
        transform: translateX(-50%) translateY(0) !important; 
    }
    .nav-item:hover .dropdown-v1 { transform: translateY(0) !important; left: 0 !important; }
    .nav-item:hover .has-submenu::after { transform: rotate(-135deg); margin-top: 3px; }
}

/* 下拉選單基礎設定 (預設隱藏) */
.mega-menu, .dropdown-v1 {
    position: absolute; top: var(--header-height); background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
    visibility: hidden; opacity: 0; 
    transition: all 0.25s ease; border-radius: 0 0 10px 10px; border-top: 1px solid #eee;
    list-style: none; z-index: 1001;
}

.mega-menu {
    left: 50%; transform: translateX(-50%) translateY(10px);
    width: var(--mega-width); display: grid; grid-template-columns: repeat(3, 1fr); padding: 20px 10px;
}
.mega-col { padding: 15px; }
.mega-title { font-weight: 700; color: var(--primary-blue); margin-bottom: 15px; display: block; border-bottom: 1px solid #f0f0f0; padding-bottom: 5px; }
.mega-list { list-style: none; padding: 0; }
.mega-list a { text-decoration: none; color: var(--text-gray); font-size: 0.9rem; display: block; margin-bottom: 10px; }
.mega-list a:hover { color: var(--primary-blue); padding-left: 5px; transition: 0.2s; }

.dropdown-v1 { left: 0; min-width: 180px; transform: translateY(10px); padding: 5px 0; }
.dropdown-v1 a { padding: 12px 20px; display: block; text-decoration: none; color: var(--text-dark); font-size: 0.9rem; transition: 0.2s; }
.dropdown-v1 a:hover { background-color: #f8f9fa; color: var(--primary-blue); }

/* --- 恢復免費諮詢按鈕特效 --- */
.consult-btn {
    background-color: var(--primary-blue); color: white !important;
    text-decoration: none;     padding: 5px 20px;border-radius: 50px;
    font-size: 14px; font-weight: 500; transition: all 0.3s ease;
    white-space: nowrap; display: inline-flex; align-items: center;
    box-shadow: 0 4px 10px rgba(13, 82, 149, 0.15);
}
.consult-btn:hover {
    background-color: var(--hover-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(13, 82, 149, 0.25);
}

/* --- 手機版漢堡選單修正 --- */
@media (max-width: 1100px) {
    .mobile-toggle { display: flex; flex-direction: column; justify-content: space-between; width: 24px; height: 18px; cursor: pointer; margin-left: 15px; }
    .mobile-toggle span { display: block; width: 100%; height: 2px; background: var(--text-dark); transition: 0.3s; }
    .mobile-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .mobile-toggle.active span:nth-child(2) { opacity: 0; }
    .mobile-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .nav-menu {
        position: fixed; top: var(--header-height); left: -100%;
        width: 100%; height: calc(100vh - var(--header-height));
        background: #fff; flex-direction: column; overflow-y: auto; transition: 0.4s; z-index: 999;
    }
    .nav-menu.active { left: 0; }
    .nav-item { display: block; width: 100%; border-bottom: 1px solid #f0f0f0; }
    .nav-link { height: 60px; padding: 0 25px; justify-content: space-between; }
    
    .mega-menu, .dropdown-v1 { 
        position: static; width: 100%; transform: none !important; 
        display: none; visibility: visible; opacity: 1; box-shadow: none; border: none; background: #f9f9f9; 
    }
    .nav-item.active-sub > .mega-menu, 
    .nav-item.active-sub > .dropdown-v1 { display: block; }
    .mega-menu { grid-template-columns: 1fr; padding: 10px 25px; }
}




/* 當前頁面高亮 */
.nav-link.active {
    color: var(--primary-blue) !important;
    font-weight: 700;
}

/* 下拉選單中的當前頁面高亮 */
.dropdown-v1 a.active {
    background-color: #f0f7ff;
    color: var(--primary-blue);
}

/* 桌面版選單底線特效 (選配，增加質感) */
@media (min-width: 1101px) {
    .nav-link.active::after {
        content: "";
        position: absolute;
        bottom: 20px;
        left: 18px;
        right: 18px;
        height: 2px;
        background-color: var(--primary-blue);
    }
}