/*-- 統一色系，若需要直接修改 --*/
@import url('./variables.css');
@import url("https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900");

nav {
  font-size: 1.1rem;
  position: relative;
  max-width: 80vw;
  padding: 1rem 0 ;
}

nav.menu-bg-white .menu-item,
nav.menu-bg-white > ul > li > a {
  color: var(--darkBlack) !important;
  transition: color 0.3s;
}

.background-header .menu-item,
.background-header .menu-items > li > a {
  color: var(--darkBlack) !important;
}

.background-header .menu-item:hover,
.background-header .menu-items > li > a:hover {
  color: var(--light) !important;
}

/* 確保 background-header 不影響 active 樣式 */
.background-header .menu-items li.active {
  background: var(--secondary, #e03000);
}

.background-header .menu-items li.active a {
  color: var(--light) !important;
}

/* 確保 background-header 不影響 active 樣式 */
.background-header .menu-item.active,
.background-header .menu-items li a.active {
  background: var(--secondary, #e03000);
  color: var(--light) !important;
}

.logo {
  flex: 0 0 20%;
  max-width: 19rem;
  max-height: 85px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: absolute;
  top: 1px;
  z-index: 1000;
}

.logo img {
  max-height: 85px;
  width: auto;
  margin: 5px 0;
}

.menu-items {
  flex: 0 0 80%;
  max-width: 100%;
  display: flex;
  justify-content: flex-end;
}

/**-- 主選單排列 --**/
.menu-items li {
  padding: 0.5rem 1rem; /* 統一 li 的內距 */
  transition: background 0.3s ease-in-out;
}

/* 現有滑鼠滑入樣式 */
.menu-items li:hover {
  background-color: var(--secondary); /* 紅色背景 */
}

/* 目前頁面主選單高亮 */
.menu-items li a.active,
.menu-item.active {
  background: var(--secondary, #e03000);
  color: var(--light) !important;
  border-radius: 0px;
  transition: background 0.3s, color 0.3s;
}
/* 確保滑鼠滑入時樣式一致 */
.menu-items li a.active:hover,
.menu-item.active:hover {
  background: var(--secondary, #e03000);
  color: var(--light) !important;
}



.menu-items > li > a,
.menu-item {
  color: var(--light);
  position: relative;
  display: block; /* 確保 <a> 填滿 <li> */
  width: 100%;
  transition: color 0.3s ease;
}


.menu-item:hover,
.menu-items > li > a:hover {
  color: var(--light); /* 滑入時白色文字 */
}

/* 目前頁面主選單高亮 */
.menu-items li.active {
  background: var(--secondary, #e03000); /* 紅色背景應用到 li */
  border-radius: 0px;
  transition: background 0.3s ease-in-out;
}

.menu-items li.active a,
.menu-item.active {
  color: var(--light) !important; /* 白色文字 */
}


/* 確保滑鼠滑入 active 項目時樣式不變 */
.menu-items li.active:hover {
  background: var(--secondary, #e03000);
}

.menu-items li.active:hover a,
.menu-item.active:hover {
  color: var(--light) !important;
}

.menu-item a {
  text-align: right;
}


.dropdown {
  position: relative;
}

.dropdown-menu,
.menu-right {
  position: absolute;
  background: #122331;
  width: 100%;
  top: 50px;
  left: 0;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}


.dropdown:hover .dropdown-menu {
  top: 34px;
  opacity: 1;
  visibility: visible;
}

.dropdown-right:hover .menu-right {
  left: 100%;
  opacity: 1;
  visibility: visible;
}

.mega-menu {
  position: absolute;
  left: 0;
  width: 100%;
  top: 100%;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
}

.menu-items li:hover + .mega-menu,
.menu-items li:hover .mega-menu {
  opacity: 1;
  visibility: visible;
  top: 100%;
}

.mega-menu .content {
  background: var(--light);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1rem;
  width: 100%;
  margin: 2px 0 0 0;
}

.blog .content {
  grid-template-columns: repeat(3, 1fr);
}

.content .col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  line-height: 3rem;
}

.content .col .img-wrapper {
  display: block;
  position: relative;
  width: 100%;
  height: 13vw;
  overflow: hidden;
}

.menu_title {
  text-align: center;
  color: var(--light);
  margin: 1rem 0 0 0;
}



.bg_advertise,
.bg_product {
  background-color: var(--darkGray);
  padding: 1.2rem;
}
.bg_advertise { margin: -17.5px 0 -20px -20px; }
.bg_product { margin: -20px 0 -20px -20px; }

.bg_advertise p,
.bg_product p {
  color: var(--light);
  font-size: 1.1rem;
  line-height: 1.5rem;
  text-align: center;
}
.bg_advertise p { margin: 2rem 0 1rem 0; }
.bg_product p { margin: 1rem 0 1rem 0; }

.bg_advertise a,
.bg_product a {
  color: var(--grassGreen);
}

.bg_advertise a:link,
.bg_product a:link {
  color: var(--grassGreen);
}

.bg_advertise a:hover,
.bg_product a:hover {
  color: var(--light);
}

#menu_news {
  text-align: center;
}

#menu_news a:link {
  color: var(--grassGreen) !important;
}

#menu_news 

:visited {
  color: var(--grassGreen) !important;
}

#menu_news a:hover {
  color: var(--light) !important;
}

#menu_news a:active {
  color: var(--grassGreen) !important;
}

.content .col .img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.content .col img {
  width: 100%;
  transition: transform 0.3s ease-in-out;
}

.content .col .img-wrapper:hover img {
  transform: scale(1.1);
}

.content .col h2 {
  color: var(--secondary);
  font-size: 1.2rem;
  line-height: 3rem;
  font-weight: bold;
}

.content .col p {
  line-height: 1.2rem;
}

.content .col .mega-links {
  border-left: 1px solid var(--deepRed);
}

.content .col .read-more {
  display: inline-block;
  padding-top: 1rem;
  color: #427dad;
  transition: color 0.3s ease;
}

.col .mega-links li {
  padding: 0; /* 移除 li 的 padding */
  list-style: none;
}

.col .mega-links li a {
  display: block; /* 填滿 li 的寬高 */
  padding: 8px 0.5rem; /* 與主選單一致 */
  color: var(--darkBlack) !important; /* 強制未滑入時黑色 */
  text-decoration: none;
  transition: color 0.3s ease, background 0.3s ease;
}

.col .mega-links li:hover a {
  color: var(--white) !important; /* 滑入時白色 */
}

.col .mega-links li a:hover {
  color: var(--white); /* 滑入 a 時白色 */
}

.content .col .read-more:hover {
  color: #ff652f;
}

.col .mega-links li a.active,
.col .mega-links li a.active:hover {
  background: var(--secondary, #e03000);
  color: var(--white) !important; /* 高亮時白色文字 */
  border-radius: 0px;
}

/* 新增：目前頁面選單高亮 */
.menu-items li a.active,
.col .mega-links li a.active {
  background: var(--deepRed, #c00);
  color: #fff !important;
  border-radius: 0px;
}

/* 新增：目前頁面選單高亮（同步滑入效果與顏色） */
.menu-items li a.active,
.col .mega-links li a.active,
.menu-items li a.active:hover,
.col .mega-links li a.active:hover,
.menu-items li a:hover,
.col .mega-links li a:hover {
  background: var(--secondary, #e03000);
  color: #fff !important;
  border-radius: 0px;
  transition: background 0.3s, color 0.3s;

}

/*********/
/* 子選單樣式 */
.mega-menu .col .mega-links li {
  padding: 0;
  list-style: none;
}

.mega-menu .col .mega-links li a {
  display: block;
  padding: 8px 0.5rem;
  color: var(--darkBlack) !important; /* 未滑入時黑色 */
  text-decoration: none;
  transition: color 0.3s ease, background 0.3s ease;
}

.mega-menu .col .mega-links li:hover a {
  color: var(--white) !important; /* 滑入時白色文字 */
  background: transparent !important; /* 明確移除紅色背景 */
}

.mega-menu .col .mega-links li a:hover {
  color: var(--white);
}

.mega-menu .col .mega-links li a.active,
.mega-menu .col .mega-links li a.active:hover {
  background: var(--secondary, #e03000); /* .active 時紅色背景 */
  color: var(--white) !important; /* .active 時白色文字 */
  border-radius: 0px;
}

/* 保護子選單非 .active 項目 */
.mega-menu a:not(.active) {
  color: var(--darkBlack) !important;
}

@media (max-width: 1199px) {
  .menu-items li {
    padding: 0.5rem 0.5rem;
  }
}

@media (max-width: 999px) {
  nav {
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
    display: none;
  }
  .logo {
    position: absolute;
    top: 15px;
    left: 0;
    max-width: 230px;
  }
  .menu-items {
    flex: 0 0 100%;
    justify-content: center;
    margin-top: -1rem;
  }
  .mobile-menu-icon {
    font-size: 28px;
    display: block;
    position: fixed;
    top: 40px;
    right: 25px;
    z-index: 1200;
    color: var(--white);
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
  }
  .mobile-menu-icon:hover {
    transform: scale(1.1);
  }
  .mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: clamp(220px, 65%, 320px);
    height: 100%;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.3);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1300;
    overflow-y: auto;
  }
  .mobile-menu.active {
    display: block;
    right: 0;
  }
  .mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--darkGray);
    font-size: calc(1.3rem + 0.2vw);
  }
  .mobile-menu-logo {
    max-height: 50px;
    width: auto;
  }
  .mobile-menu-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    color: var(--darkBlack); /* 預設黑色 */
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s ease, transform 0.3s ease;
  }
  /* 當前頁面為首頁時，關閉圖標為白色 */
  .home-page .mobile-menu-close {
    color: var(--light);
  }
  .mobile-menu-close:hover {
    color: var(--secondary); /* 滑入時紅色 */
    transform: rotate(90deg); /* 滑入時旋轉90度 */
  }
  .mobile-menu-close:active {
    transform: scale(0.9); /* 點擊時縮小 */
  }
  .mobile-menu-quick-links {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--secondary);
  }
  .quick-link {
    color: var(--light);
    text-decoration: none;
    font-size: calc(1.1rem + 0.2vw);
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.3s ease, transform 0.3s ease;
  }
  .quick-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
  }
  .accordion-menu {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .accordion-menu > li {
    border-bottom: 1px solid #d1d5db;
    margin: 0;
    padding: 0;
    transform: translateY(0);
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .accordion-menu a {
    display: block;
    width: 100%;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--darkBlack); /* 預設：非當前頁面項目為黑色文字 */
    font-size: calc(1.2rem + 0.2vw);
    transform: translateY(0);
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
  }
  /* 非當前頁面項目的滑入效果 */
  .accordion-menu a:hover:not(.active) {
    background: var(--secondary); /* 滑入時紅色背景 */
    color: var(--light); /* 滑入時白色文字 */
    transform: scale(1.05); /* 滑入時輕微放大 */
  }
  /* 當前頁面主選單與子選單項目 */
  .accordion-menu a.active,
  .accordion-menu a.accordion-toggle.active {
    background: var(--secondary); /* 當前頁面紅色背景 */
    color: var(--light) !important; /* 當前頁面白色文字 */
    opacity: 0;
    animation: fadeIn 0.5s ease forwards; /* 淡入動畫 */
  }
  /* 確保當前頁面項目滑入時樣式不變 */
  .accordion-menu a.active:hover,
  .accordion-menu a.accordion-toggle.active:hover {
    background: var(--secondary); /* 維持紅色背景 */
    color: var(--light) !important; /* 維持白色文字 */
    transform: scale(1.05); /* 滑入時輕微放大 */
  }
  .accordion-menu a.accordion-toggle {
    font-weight: bold;
    background-color: #f0f0f0;
    border-left: 4px solid var(--secondary);
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
  }
  .accordion-menu a.accordion-toggle:hover:not(.active) {
    background-color: var(--secondary); /* 非當前頁面滑入時紅色背景 */
    color: var(--light); /* 非當前頁面滑入時白色文字 */
    transform: scale(1.05); /* 滑入時輕微放大 */
  }
  .accordion-content {
    max-height: 0;
    overflow: hidden;
    padding-left: 15px;
    opacity: 0;
    transform: translateY(-10px); /* 初始向上偏移 */
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
  }
  .accordion-content.active {
    max-height: 1000px;
    padding: 10px 15px;
    opacity: 1;
    transform: translateY(0); /* 展開時恢復原位 */
  }
  .accordion-content a {
    padding: 8px 15px;
    font-size: calc(1rem + 0.2vw);
    color: var(--darkBlack); /* 預設：子選單項目為黑色文字 */
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
  }
  /* 非當前頁面子選單項目的滑入效果 */
  .accordion-content a:hover:not(.active) {
    background: var(--secondary); /* 滑入時紅色背景 */
    color: var(--light); /* 滑入時白色文字 */
    transform: scale(1.05); /* 滑入時輕微放大 */
  }
  /* 當前頁面子選單項目 */
  .accordion-content a.active {
    background: var(--secondary); /* 當前頁面紅色背景 */
    color: var(--light) !important; /* 當前頁面白色文字 */
    opacity: 0;
    animation: fadeIn 0.5s ease forwards; /* 淡入動畫 */
  }
  .accordion-content .accordion-content {
    padding-left: 30px;
  }
  .mobile-menu-footer {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
    transition: opacity 0.3s ease;
  }
  .mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.4s ease;
  }
  .mobile-menu-overlay.active {
    display: block;
    opacity: 1;
  }
  .sub-header {
    position: relative;
    z-index: 900;
  }
  .sub-header .left-content {
    text-align: left;
    position: absolute;
    left: 10px;
    top: 5px;
  }
  .sub-header .right-icons {
    text-align: right;
    position: absolute;
    right: 10px;
    top: 5px;
  }
  .sub-header {
    position: relative;
    height: 50px;
  }
  /* 淡入動畫 for active 項目 */
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

@media (max-width: 600px) {
  .mobile-menu {
    width: 90%;
  }
  .accordion-menu a {
    font-size: calc(1.1rem + 0.1vw);
  }
  .accordion-content a {
    font-size: calc(0.95rem + 0.1vw);
  }
  /* 保持小螢幕下的當前頁面與滑入樣式 */
  .accordion-menu a.active,
  .accordion-menu a.accordion-toggle.active {
    background: var(--secondary);
    color: var(--light) !important;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
  }
  .accordion-menu a:hover:not(.active),
  .accordion-menu a.accordion-toggle:hover:not(.active) {
    background: var(--secondary);
    color: var(--light);
    transform: scale(1.05);
  }
  .accordion-content a.active {
    background: var(--secondary);
    color: var(--light) !important;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
  }
  .accordion-content a:hover:not(.active) {
    background: var(--secondary);
    color: var(--light);
    transform: scale(1.05);
  }
  /* 當前頁面為首頁時，關閉圖標為白色 */
  .home-page .mobile-menu-close {
    color: var(--light);
  }
}

@media (min-width: 1000px) {
  .mobile-menu-icon,
  .mobile-menu,
  .mobile-menu-overlay {
    display: none;
  }
}