@charset "utf-8";

/* ========================================== */
/* 1. 全域與基礎樣式                            */
/* ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}


/* Header 負責整條滿版背景 */
header.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: transparent;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  z-index: 11000;
  padding-top: 10px;
  padding-bottom: 10px;
}

header.main-headeralt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 1);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  z-index: 11000;
  padding-top: 10px;
  padding-bottom: 10px;
}

header.main-header.scrolled {
  background-color: #000000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.nav-container {
  max-width: 1680px; 
  margin: 0 auto;    
  padding: 0 20px;   
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  height: 60px;
  width: 100%;
}

.halt {
  background: #000000;
}

.nav-logo {
  display: flex;
  align-items: center;
}

.nav-logo img {
  display: block;
  position: relative;
  width: 220px;
  height: auto;
}

.main-nav, .nested-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav a {
  color: white;
  text-decoration: none;
  display: block;
  transition: background 0.2s, color 0.2s;
}

/* 預設隱藏行動版漢堡按鈕 */
.hamburger-btn {
  display: none;
  position: relative;
  flex-direction: column;
  justify-content: space-between;
  width: 50px;
  height: 40px;
  cursor: pointer;
  padding: 10px 8px;
  border: none;
  background: #606060;
  border-radius: 3px;
  z-index: 3000; 
}

.hamburger-btn span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: white;
  border-radius: 3px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ========================================== */
/* 2. 桌機版網頁樣式 (螢幕寬度 > 1200px)       */
/* ========================================== */
@media (min-width: 1201px) {
  .hamburger-btn {
    display: none !important;
  }

  .nav-menu-wrapper {
    margin-left: auto; 
    display: flex;
    align-items: center;
  }

  .main-nav {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .main-nav > li {
    position: relative !important; 
    display: block;
  }

  .main-nav a {
    padding: 10px 15px;
    font-size: 1.2em; 
    border-bottom: solid 2px transparent;
  }

  .main-nav > li > a:hover {
    color: #1FACCC;
    border-bottom: solid 2px #1FACCC;
  }

  .accordion-toggle-btn {
    display: none !important;
  }

  /* 桌機版三條線項目 */
  .desktop-hamburger-item {
    background: #606060;
    border-radius: 5px;
    display: block;
  }

  .desktop-hamburger-icon {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 25px;
    height: 22px;
    padding: 0 !important;
    margin: 15px !important;
    border-bottom: none !important;
  }

  .desktop-hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #fff;
  }

  /* 下拉選單基礎設定 */
  .nested-submenu {
    position: absolute;
    top: 100%;                  
    left: 50%;                  
    background-color: #1FACCC;
    padding: 5px 0;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    min-width: 200px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 10px);
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out, visibility 0.2s;
    z-index: 1002;
  }

  .main-nav > li:hover > .nested-submenu {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
  }

  .desktop-hamburger-item .nested-submenu {
    left: 0 !important;
    transform: translate(0, 10px) !important;
  }
  
  .desktop-hamburger-item:hover .nested-submenu {
    transform: translate(0, 0) !important;
  }

  .nav-divider {
    width: 1px;
    height: 20px;
    background-color: #FFF;
    margin: 0 10px;
    padding: 0 !important; 
  }

  .lang-switch a {
    padding: 10px 10px !important; 
    display: flex;
    align-items: center;
    border-bottom: none !important;
  }

  .earth-icon-mock {
    display: inline-block;
    position: relative;
    line-height: 1;
  }

  .earth-icon-mock img {
    display: block;
    width: 20px;
    height: auto;
  }

  .lang-switch .nested-submenu {
    left: auto !important;                  
    right: 0 !important;                    
    min-width: 130px;            
    transform: translate(0, 10px) !important;
  }
  
  .lang-switch:hover .nested-submenu {
    transform: translate(0, 0) !important;
  }

  .nested-submenu a {
    color: #FFF !important;
    padding: 10px 15px;
    font-size: 1.1em;              
    border-bottom: solid 1px rgba(255, 255, 255, 0.2) !important;
    text-align: center;
  }

  .nested-submenu li:last-child a {
    border-bottom: none !important;
  }

  .nested-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.2) !important; 
    border-radius: 2px;               
  }
}

/* 響應式容器寬度調整 */
@media (max-width: 1920px) {
  .nav-container {
    max-width: 90%; 
    margin: 0 auto;
    padding: 0 20px;  
  }
}

@media (max-width: 1440px) {
  .nav-container {
    max-width: 95%; 
    margin: 0 auto;    
    padding: 0 10px; 
  }
  .nav-logo img {
    width: 200px;
  }
}

@media (max-width: 1280px) {
  .main-nav a {
    font-size: 1.1em;
    padding: 10px 15px;
  }
}

/* ========================================== */
/* 3. 行動裝置網頁樣式 (螢幕寬度 <= 1200px)       */
/* ========================================== */
@media (max-width: 1200px) {

/* 當手機版加上 .scrolled 時，背景變成半透明（可依需求調整 rgba 的透明度 0.8 或 0.5） */
  header.main-headeralt.scrolled {
    background-color: rgba(0, 0, 0, 0.85); /* 85% 黑底半透明 */
    /* 如果想要更現代的毛玻璃質感，可加上這行： */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 1);
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
  }


/* 預設（未滾動時）：在手機版隱藏 Logo */
  .main-headeralt .nav-logo {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  /* 滾動後（加上 .scrolled 時）：顯示 Logo 並帶有漸顯動畫 */
  .main-headeralt.scrolled .nav-logo {
    opacity: 1;
    visibility: visible;
  }

  /* 滾動後讓 Header 背景變半透明或黑底（配合您前面想要的效果） */
  .main-headeralt.scrolled {
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
  }



header.main-headeralt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  z-index: 11000;
  padding-top: 10px;
  padding-bottom: 10px;
}


  .accordion-toggle-btn {
    display: none !important;
  }

  .nav-container {
    max-width: 100%; 
    margin: 0 auto;    
    padding: 0 20px; 
  }

  .navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    min-height: 60px;
    width: 100%;
  }

  .nav-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
  }

  /* 行動漢堡按鈕 */
  .hamburger-btn {
    display: flex;
    margin-left: auto;
    position: relative;
    z-index: 1002;
    order: 2;
  }

  .hamburger-btn.active span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
  }
  .hamburger-btn.active span:nth-child(2) {
    opacity: 0;
  }
  .hamburger-btn.active span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
  }

  /* 關鍵修正：允許內頁獨立滑動，預防最後一項（語言）點擊不到 */
  .nav-menu-wrapper {
    position: absolute;
    top: 100%;
    left: -20px;  
    right: -20px; 
    background-color: #222;
    display: flex;
    flex-direction: column;
    padding: 0;
    max-height: 0;
    overflow-y: auto; /* 允許滾動 */
    overflow-x: hidden;
    transition: max-height 0.35s ease-in-out, padding 0.35s ease-in-out;
    z-index: 1000;
  }

  .nav-menu-wrapper.active {
    /* 設定最大高度限制為螢幕扣除 Header 剩餘高度 */
    max-height: calc(100vh - 80px);
    padding: 15px 0 30px 0; /* 底部多留 30px 邊距方便手持點擊 */
  }

  .main-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .main-nav > li {
    width: 100%;
    position: relative;
  }

  /* 桌機漢堡轉文字 */
  .desktop-hamburger-icon {
    display: block !important;
    height: auto !important;
    width: auto !important;
    margin: 0 !important;
  }
  .desktop-hamburger-icon span {
    display: none;
  }
  .desktop-hamburger-icon::before {
    content: '其他服務';
    color: white;
  }

  .nav-divider {
    display: none;
  }

  .earth-icon-mock {
    display: inline-block;
  }
  .lang-switch a::before {
    content: '選擇語言';
    color: white;
    margin-right: auto;
  }

  /* 手風琴開關配置 */
  .has-accordion > a {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 14px 20px;
  }

  .has-accordion > a::after {
    content: '＋';
    font-size: 1.2em;
    color: #fff;
    padding: 0 10px;
    transition: transform 0.3s;
  }

  .has-accordion.open > a::after {
    content: '一';
  }

  /* 關鍵修正：子選單開合樣式 */
  .nested-submenu {
    width: 100%;
    background-color: #2b2b2b;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
  }
  
  .has-accordion.open .nested-submenu {
    max-height: 500px; /* 足夠撐開子選單的高度 */
  }
  
  .nested-submenu a {
    padding: 14px 40px;
    font-size: 1em;
    color: #ddd;
    border-bottom: 1px solid #3a3a3a;
  }

  .main-nav a:hover, .nested-submenu a:hover {
    background-color: #333;
  }
}