/* ✅ 全域重置，移除最上方縫隙 */
/* * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
} */
body {
  padding-top: 0; /* ✅ 移除body的上邊距，讓banner可以從頂部開始 */
}
/* 主選單容器 */
.navbar {
  display: flex;
  align-items: flex-start; /* ✅ 改為頂部對齊，讓選單在最上方 */
  flex-wrap: nowrap; /* ✅ 改為不換行，確保所有元素在同一行 */
  background: transparent; /* ✅ 改為完全透明背景 */
  backdrop-filter: none; /* ✅ 移除毛玻璃效果 */
  height: 64px; /* ✅ 恢復正常高度 */
  padding: var(--navbar-pad); /* ✅ 恢復正常內距 */
  color: #6F498F;
  border-bottom: none; /* ✅ 移除邊框 */
  width: 100%; /* ✅ 改為100%寬度 */
  /*max-width: 1200px;  ✅ 設定最大寬度為1200px */

  /* ✅ 合併定位設定 */
  position: fixed;
  top: 0 !important; /* ✅ 強制貼頂，不留縫隙 */
  left: 50%; /* ✅ 改回50%居中 */
  transform: translateX(-50%); /* ✅ 水平居中 */
  z-index: 999;
  
  /* ✅ 滾動切換效果的過渡動畫 */
  transition: all 0.3s ease;
}

/* Logo 樣式 */
.navbar-logo {
  order: 0; /* ✅ 確保 Logo 在最前面 */
  flex-shrink: 0; /* ✅ 防止被壓縮 */
  z-index: 10; /* ✅ 提高 z-index 確保顯示在背景之上 */
  position: relative;
  padding: 5px;
  border-radius: 5px;
  align-self: flex-start; /* ✅ 確保Logo在頂部對齊 */
}

.navbar-logo img {
  /*height: 60px;*/
  height: var(--logo-h);
  max-width: 220px;
  object-fit: contain;
  /* 新增：向上偏移 */
  position: relative;
  top: -4px;
  /* 调整这个值，往上移动的距离 */
}


/* ✅ 右側功能區塊容器 */
.navbar-right-container {
  margin-left: auto; /* ✅ 推到右邊 */
  order: 10; /* ✅ 確保在最右邊 */
  z-index: 1100; /* ✅ 確保右側功能區塊在選單上方 */
  position: relative; /* ✅ 為 z-index 提供定位上下文 */
}

/* ✅ Table 佈局容器 */
.navbar-right-table {
  display: table;
  width: auto;
  height: 100%;
}

/* ✅ Table cell 通用樣式 */
.table-cell {
  display: table-cell;
  vertical-align: middle;
  height: 64px; /* 與 navbar 高度一致 */
}

/* ✅ 搜尋區塊 */
.navbar-search.table-cell {
  padding-right: 10px; /* ✅ 與社群圖示間距 10px */
  width: auto;
}

/* ✅ 社群圖示區塊 */
.navbar-social.table-cell {
  padding-right: 10px; /* ✅ 與漢堡選單間距 10px */
  width: auto;
  padding-top: 22px; /* ✅ 往下移動22px (原本15px) */
}

/* ✅ 漢堡選單容器 */
.hamburger-container.table-cell {
  width: auto;
  text-align: center;
}

/* 漢堡選單 */
.hamburger {
  font-size: 28px;
  cursor: pointer;
  color: #ffffff; /* ✅ 改為白色，確保在透明背景下可見 */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); /* ✅ 添加文字陰影 */
  display: block; /* ✅ 預設顯示漢堡選單 */
  z-index: 1100; /* ✅ 提高z-index確保在滿版選單之上 */
  position: relative;
  background: none; /* ✅ 移除背景 */
  padding: 0; /* ✅ 移除內邊距 */
  border: none; /* ✅ 移除邊框 */
}
/* 主選單 */
/* 主選單列表 */
#navMenu {
  display: none; /* ✅ 初始狀態：隱藏選單，只能透過漢堡按鈕開啟 */
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0px;
  margin-left: 0; /* ✅ 移除margin-left，讓order控制位置 */
  flex-wrap: nowrap; /* ✅ 防止選單換行 */
  order: 5; /* ✅ 調整順序，讓選單在搜索框和社群圖示後面 */
  flex-shrink: 1; /* ✅ 允許選單在空間不足時適當壓縮 */
  z-index: 10; /* ✅ 提高 z-index 確保顯示在背景之上 */
  position: relative;
  align-self: flex-start; /* ✅ 確保選單在頂部對齊 */
}



/* 社群區塊 */
.navbar-social {
  display: flex; /* ✅ 改為預設顯示社群圖示 */
  align-items: center;
  gap: 8px; /* ✅ 社群圖示之間的間距 */
  flex-shrink: 0; /* ✅ 防止被壓縮 */
  z-index: 1150; /* ✅ 提高 z-index 確保在選單上方 */
  position: relative; /* ✅ 為 z-index 提供定位上下文 */
}

/* ✅ 滾動後顯示社群圖示 */
.navbar.scrolled .navbar-social {
  display: flex;
}

.navbar-social a img {
  width: 24px;
  height: 24px;
  opacity: 0.8;
  transition: transform 0.3s ease, opacity 0.3s ease;
  filter: grayscale(0%);
}

.navbar-social a:hover img {
  opacity: 1;
  transform: scale(1.2);
  filter: grayscale(0%);
}

/* 項目外框 */
.navbar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 20px;
  align-items: center;
}

/* 單一選項 */
.navbar li {
  position: relative;
  padding-bottom: 10px;
}

/* 項目連結 */
.navbar a {
  color: #6F498F;
  /* 主選單連結顏色 */
  text-decoration: none;
  padding: 10px 10px;
  display: block;
  transition: none;
  font-size: var(--navbar-fs);
  /* ← 新增這行，調整主選單文字大小 NAVBAR_FONTSIZE*/
}

/* nav-title 樣式（沒有連結的選單標題） */
.navbar .nav-title {
  color: #6F498F;
  text-decoration: none;
  padding: 10px 10px;
  display: block;
  font-size: var(--navbar-fs);
  cursor: default;
  transition: none;
}

.navbar .nav-title:hover {
  color: #6F498F;
}

/* 滑入效果 */
.navbar a:hover,
.navbar .active {
  color: #6F498F;
}

/* 子選單樣式 */
.navbar li ul {
  display: none;
  position: absolute;
  top: 100%;
  margin-top: 0px;
  left: -10px;
  min-width: 220px;
  max-width: 320px;
  flex-direction: column;
  background: #ffffff; /* 白色卡片底 */
  border: none;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(20, 20, 40, 0.08);
  transition: opacity 0.2s ease-in-out, transform 0.18s ease;
  z-index: 999;
  gap: 0;
  padding: 6px 0;
  opacity: 0;
  pointer-events: none;
}

.navbar li ul li {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #f0f0f0;
}

.navbar li ul li:last-child {
  border-bottom: none;
}

.navbar li ul a {
  color: #6F498F; /* 主要文字紫色 */
  white-space: nowrap;
  padding: 12px 44px 12px 14px; /* 左文字內距、右側留空給箭頭 */
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between; /* 左文字與右箭頭分開 */
  position: relative;
  background: transparent;
  transition: background 0.18s ease, color 0.18s ease;
  text-align: left;
}

.navbar li ul a::after {
  /* content: '→'; */
  font-size: 16px;
  color: #6F498F;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.navbar li ul a:hover {
  background: rgba(111,73,143,0.08); /* 淡紫色懸停背景 */
  color: #4a2b63; /* 懸停時深色文字 */
}

.navbar li ul a:hover::after {
  opacity: 1;
}

.navbar li:hover>ul {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* 給有子選單的主選單加上箭頭 */
.navbar li.has-submenu>a::after {
  content: " ▾";
  /* 你也可以用 " ▼"、" ⯆"、SVG */
  font-size: 0.75em;
  margin-left: 6px;
  color: #ccc;
  transition: transform 0.3s ease;
}

/* hover 時旋轉圖示（可選） */
.navbar li.has-submenu:hover>a::after {
  transform: rotate(180deg);
}

.navbar li:has(ul)>a::after {
  content: " ▾";
  font-size: 0.75em;
  margin-left: 6px;
  /* color: #ffa500; */
  transition: transform 0.3s;
}

/* 當滑入展開時旋轉箭頭 */
.navbar li:hover>a::after {
  transform: rotate(180deg);
}

/* 子選單動畫 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


.navbar-search {
  display: flex; /* ✅ 改為預設顯示搜索框 */
  align-items: center;
  min-width: 0;
  width: auto;
  max-width: 120px; /* 原本180px，改更小 */
  background: rgba(255, 255, 255, 0.2); /* ✅ 改為半透明背景 */
  backdrop-filter: blur(5px); /* ✅ 添加毛玻璃效果 */
  border: 1px solid rgba(255, 255, 255, 0.3); /* ✅ 半透明邊框 */
  border-radius: 15px;
  padding: 2px 4px; /* padding也可略縮 */
  box-shadow: 0 1px 4px rgba(0,0,0,0.2); /* ✅ 增強陰影 */
  flex-shrink: 0; /* ✅ 防止被壓縮 */
  z-index: 1150; /* ✅ 提高 z-index 確保在選單上方 */
  position: relative; /* ✅ 為 z-index 提供定位上下文 */
}

/* ✅ 滾動後顯示搜索框 */
.navbar.scrolled .navbar-search {
  display: flex;
}

.search-input {
  border: 1px solid #ddd;
  background: white;
  padding: 4px 8px;
  font-size: 1em;
  outline: none;
  min-width: 30px;
  max-width: 120px;
  width: 100%;
  border-radius: 4px;
}

.search-btn {
  border: none;
  background: none; /* ✅ 移除背景 */
  cursor: pointer;
  padding: 6px 8px; /* ✅ 增加內邊距 */
  display: flex;
  align-items: center;
  border-radius: 8px; /* ✅ 添加圓角 */
  transition: all 0.3s ease; /* ✅ 平滑過渡效果 */
  margin-right: 8px; /* ✅ 與社群圖示保持間距 */
  z-index: 1150; /* ✅ 確保搜尋按鈕在選單上方 */
  position: relative; /* ✅ 為 z-index 提供定位上下文 */
}

.search-btn:hover {
  background: none; /* ✅ hover時也不要背景 */
  transform: scale(1.1); /* ✅ 輕微放大效果 */
}









/* ✅ 桌機版在滾動後隱藏漢堡選單 */
/*@media screen and (min-width: 769px) {
  .navbar.scrolled .hamburger {
    display: none;
  }
  
  /* ✅ 滾動後右側容器調整 */
  .navbar.scrolled .navbar-right-table {
    display: table;
  }
  
  .navbar.scrolled .table-cell {
    height: 60px; /* ✅ 滾動後高度調整 */
  }
  
  /* ✅ 滾動後社群圖示區塊位置調整 */
  .navbar.scrolled .navbar-social.table-cell {
    padding-top: 18px; /* ✅ 滾動後往下移動18px (原本12px) */
  }
  
  /* ✅ 桌機版滾動後自動顯示選單 */
  .navbar.scrolled #navMenu {
    display: flex !important; /* ✅ 自動顯示選單 */
    flex-direction: row !important; /* ✅ 水平排列 */
    order: 5 !important; /* ✅ 選單順序 */
    margin-left: 0 !important; /* ✅ 重置margin */
    align-items: center !important; /* ✅ 垂直居中 */
  }
  
    /* ✅ 桌機版漢堡選單點擊時顯示滿版選單 */
  .navbar.scrolled, #navMenu.show {
    display: flex !important; /* ✅ 桌機版顯示為水平選單 */
    flex-direction: row !important; /* ✅ 桌機版水平排列 */
    position: fixed !important; /* ✅ 固定定位 */
    top: 0 !important; /* ✅ 貼頂 */
    left: 50% !important; /* ✅ 居中定位 */
    transform: translateX(-50%) !important; /* ✅ 水平居中 */
    width: 100%;
   /* width: 1200px !important;  ✅ 固定寬度1200px，與滾輪選單完全一致 */
   /* max-width: 1200px !important;  ✅ 最大寬度1200px */
   /*  min-width: 1200px !important; ✅ 最小寬度1200px */
    height: 80px !important; /* ✅ 固定高度，與滾輪選單一致 */
    background: rgba(255,255,255,0.95) !important; /* ✅ 半透明背景，與滾輪選單一致 */
    border-radius: 0 !important; /* ✅ 無圓角 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important; /* ✅ 陰影，與滾輪選單一致 */
    z-index: 500 !important; /* ✅ 層級與滾輪選單一致，避免跳動 */
    max-height: none !important; /* ✅ 無高度限制 */
    overflow: visible !important; /* ✅ 可見溢出 */
    padding: 12px 20px !important; /* ✅ 內邊距，與滾輪選單一致 */
    margin: 0 auto !important; /* ✅ 水平置中，與滾輪選單一致 */
    justify-content: center !important; /* ✅ 選單項目置中，與滾輪選單一致 */
    align-items: center !important; /* ✅ 垂直居中 */
    order: unset !important; /* ✅ 重置order */
    margin-left: 0 !important; /* ✅ 重置margin-left */
    flex-shrink: 0 !important; /* ✅ 重置flex-shrink */
  }  /* ✅ 桌機版漢堡選單的logo，現在由JavaScript動態創建可點擊版本 */
  /* #navMenu.show::before {
    content: '';
    background: url('../images/benq/logo.png') no-repeat center/contain;
    width: 220px;
    height: 80px;
    display: block;
    flex-shrink: 0;
    order: -1;
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
  } */
  
  /* ✅ 動態創建的可點擊logo樣式 */
  .menu-logo-link {
    display: block !important;
    flex-shrink: 0 !important;
    text-decoration: none !important;
    transition: opacity 0.3s ease !important;
  }
  
  .menu-logo-link:hover {
    opacity: 0.8 !important;
  }
  
  /* ✅ 移除選單項目的推送設定，讓其自然置中 */
  #navMenu.show > li:first-of-type {
    margin-left: 0; /* ✅ 移除自動推送，與滾輪選單一致 */
  }
  
  /* ✅ 桌機版漢堡選單項目樣式 */
  #navMenu.show li a {
    color: #6F498F !important; /* ✅ 選單文字顏色 */
    padding: 8px 16px !important; /* ✅ 適當的內邊距 */
    border-radius: 4px !important; /* ✅ 輕微圓角 */
    transition: all 0.3s ease !important; /* ✅ 平滑過渡 */
  }
  
  /* ✅ 桌機版漢堡選單項目懸停效果 */
  #navMenu.show li a:hover {
    background-color: #f5f5f5 !important; /* ✅ 懸停時的灰色背景 */
    color: #ff6600 !important; /* ✅ 懸停時的橙色文字 */
  }
  


  /* ✅ 選單項目正常顯示 */
  .navbar.scrolled #navMenu > li {
    display: block; /* ✅ 重置為正常顯示 */
    flex-shrink: 0; /* ✅ 防止被壓縮 */
  }
  
  /* ✅ 桌機版滾動後選單項目樣式 */
  .navbar.scrolled #navMenu li a {
    color: #6F498F !important; /* ✅ 選單文字顏色 */
    padding: 8px 16px; /* ✅ 適當的內邊距 */
    border-radius: 4px; /* ✅ 輕微圓角 */
    transition: all 0.3s ease; /* ✅ 平滑過渡 */
  }
  
  /* ✅ 桌機版滾動後選單項目懸停效果 */
  .navbar.scrolled #navMenu li a:hover {
    background-color: #f5f5f5; /* ✅ 懸停時的灰色背景 */
    /* color: #ff6600 !important; ✅ 懸停時的橙色文字 */
  }
  
  /* ✅ 桌機版漢堡選單位置調整 */
  .hamburger {
    margin-right: 15px; /* ✅ 桌機版往左多一點 */
    margin-top: 5px; /* ✅ 桌機版往上移動，從15px改為5px */
    font-size: 32px; /* ✅ 桌機版稍微大一點 */
    color: white !important; /* ✅ 桌機版漢堡選單白色 */
  }
  
  /* ✅ 桌機版漢堡選單在滿版選單顯示時的樣式 */

/*} */

/* ✅ 桌機版滾動時隱藏漢堡選單 */
@media screen and (min-width: 769px) {
  .navbar.scrolled .hamburger {
    display: none !important;
  }
  
  .navbar.scrolled .hamburger-container {
    display: none !important;
  }
}

/* 小螢幕 RWD */
@media screen and (max-width: 768px) {
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100% !important; /* ✅ 手機版覆蓋桌機版固定寬度 */
    height: 60px !important; /* ✅ 設定固定高度 */
    transform: none !important; /* ✅ 手機版取消居中變換 */
    z-index: 999;
    padding: 10px 15px !important;
    display: flex;
    align-items: center;
    justify-content: space-between; /* ✅ 左右分佈 */
   /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.95);  ✅ 添加半透明背景 */
  }

  /* ✅ 手機版滾動時隱藏整個導航列 */
  .navbar.scrolled {
    display: none !important;
  }

  /* ✅ 手機版 Logo 容器 */
  .mobile-logo {
    flex-shrink: 0;
    height: 80px;
    display: flex;
    align-items: center;
    z-index:1000
  }

  .mobile-logo img {
    height: 80px;
    width: auto;
    object-fit: contain;
    z-index:1000
  }

  /* 手機版永遠顯示漢堡選單 */
  .hamburger {
    display: block !important;
    font-size: 24px;
    color: #333;
    background: none;
    border: none;
    padding: 5px 15px 5px 0;
    /*  border:1px solid red */
  }

  /* ✅ 手機版右側容器簡化 */
  .navbar-right-container {
    margin-left: auto;
    display: flex;
    align-items: center;
  }

  .navbar-right-table {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  /* ✅ 手機版搜索和社群圖示隱藏 */
  .navbar-search.table-cell,
  .navbar-social.table-cell {
    display: none;
  }

  /* ✅ 手機版漢堡選單容器 */
  .hamburger-container.table-cell {
    display: flex;
    align-items: center;
  }

  /* 手機版選單樣式 */
  #navMenu {
    display: none;
    flex-direction: column;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    position: fixed; /* 改為固定定位，覆蓋整個螢幕 */
    top: 60px; /* 從導航列下方開始 */
    left: 0;
    right: 0;
    bottom: 0; /* 延伸到螢幕底部 */
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    z-index: 1000;
    padding-top: 0px; /* 頂部留一些空間 */
    overflow-y: auto; /* 允許滾動 */
  }

  #navMenu.show {
    display: flex !important;
  }

  /* 選單項目樣式 */
  #navMenu > li {
    border-bottom: 1px solid #f0f0f0;
    width: 100%;
  }

  #navMenu > li > a {
    position: relative;
    font-weight: 600;
    padding: 20px 20px;
    font-size: 14px;
    color: #6F498F;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border-radius: 0;

  }

  #navMenu > li > a:hover {
    background-color: #f8f9fa;
    /* color: #ff6600; */
  }

  /* 手機版 nav-title 樣式 */
  #navMenu > li > .nav-title {
    position: relative;
    font-weight: 600;
    padding: 20px 20px;
    font-size: 14px;
    color: #6F498F;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border-radius: 0;
    cursor: default;
  }

  #navMenu > li > .nav-title:hover {
    background-color: #f8f9fa;
    /* color: #ff6600; */
  }

  /* 箭頭樣式 */
  #navMenu > li.has-submenu > a::after {
    content: "▶";
    font-size: 14px;
    color: #999;
    transition: transform 0.3s ease;
  }

  #navMenu > li.expanded > a::after {
    content: "▼";
    transform: rotate(0deg);
  }

  /* 子選單樣式 */
  #navMenu li ul {
    max-height: 0;
    overflow: hidden;
    flex-direction: column;
    background: #f8f9fa;
    transition: max-height 0.3s ease;
    width: 100%;
  }

  #navMenu li.expanded > ul {
    max-height: 400px;
  }

  #navMenu li ul li {
    width: 100%;
    border-bottom: 1px solid #e9ecef;
  }

  #navMenu li ul li a {
    font-size: 16px;
    color: #6F498F;
    padding: 16px 40px;
    background: #f8f9fa;
    font-weight: 400;
    transition: all 0.3s ease;
  }

  #navMenu li ul li a:hover {
    background-color: #e9ecef;
    color: #ff6600;
    padding-left: 45px; /* 懸停時輕微縮進效果 */
  }
}