/* Reset CSS */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
}

img {
  height: auto;
  border-style: none;
}

ul,
ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

a {
  background-color: transparent;
  text-decoration: none;
}

/* Custom Top Navigation - 避免所有命名衝突 */
nav.custom-topnav {
  display: flex;
  color: white;
  align-items: center;
  padding: 0 6px;
  height: 50px;
  background: linear-gradient(135deg, #92bfff 0%, #214f7c 100%);
}

@media (min-width: 1024px) {
  nav.custom-topnav {
    padding: 0 28px 0 0;
    /* [UI 修正] 移除左側內距，使產品選單精準對齊 250px 的側邊欄分隔線 */
    height: 72px;
  }
}

nav.custom-topnav .topnav-logo-container {
  width: auto;
  display: flex;
  align-items: center;
}

/* [RWD 修復] 手機版專用漢堡選單按鈕 */
.mobile-hamburger-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-right: 4px;
}

/* [RWD 修復] 確保桌機版絕對隱藏，防止被其他全域 button 樣式覆寫 */
@media (min-width: 769px) {
  .mobile-hamburger-btn {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .mobile-hamburger-btn {
    display: flex !important;
    align-items: center;
  }
}

@media (min-width: 1024px) {
  nav.custom-topnav .topnav-logo-container {
    width: 250px;
  }
}

nav.custom-topnav .topnav-logo-desktop {
  display: none;
}

@media (min-width: 1024px) {
  nav.custom-topnav .topnav-logo-desktop {
    display: block;
  }
}

nav.custom-topnav .topnav-logo-mobile {
  display: block;
  margin-left: 1.25rem;
}

@media (min-width: 1024px) {
  nav.custom-topnav .topnav-logo-mobile {
    display: none;
  }
}

/* [RWD 修復] 在手機極小螢幕下隱藏 Logo，釋放空間給產品選單與漢堡按鈕 */
@media (max-width: 768px) {
  nav.custom-topnav .topnav-logo-mobile {
    display: none !important;
  }
}

nav.custom-topnav .topnav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  /* [RWD 修復] 允許手機版產品選單橫向滑動，不擠壓 Logo */
  -webkit-overflow-scrolling: touch;
}

/* 隱藏 Navbar 滾動條保持美觀 */
nav.custom-topnav .topnav-content::-webkit-scrollbar {
  display: none;
}

nav.custom-topnav .topnav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav.custom-topnav .topnav-menu li {
  margin: 0;
}

nav.custom-topnav .topnav-link {
  padding: 0 1rem;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 68px;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

nav.custom-topnav .topnav-link:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

nav.custom-topnav .topnav-link.active {
  background-color: rgba(255, 255, 255, 0.3);
}

@media (min-width: 1024px) {
  nav.custom-topnav .topnav-link {
    height: 72px;
    font-size: 20px;
  }
}

nav.custom-topnav .topnav-user-menu {
  position: relative;
  height: 50px;
  display: flex;
  align-items: center;
  width: 50px;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

nav.custom-topnav .topnav-user-menu:hover {
  background-color: #7494b7;
}

@media (min-width: 1024px) {
  nav.custom-topnav .topnav-user-menu {
    height: 72px;
    width: 72px;
  }
}

nav.custom-topnav .topnav-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: #7494b7;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

nav.custom-topnav .custom-topnav-usermenu-dropdown {
  position: absolute !important;
  right: 0 !important;
  top: 80px !important;
  transition: all 0.3s ease-in-out !important;
  opacity: 0 !important;
  transform: scale(0.95) !important;
  pointer-events: none !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.5rem !important;
  padding: 0.5rem 1rem !important;
  color: black !important;
  border-radius: 10px !important;
  width: 254px !important;
  background-color: #ffffff !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  cursor: default !important;
  z-index: 9999 !important;
}

nav.custom-topnav .custom-topnav-usermenu-dropdown.show {
  opacity: 1 !important;
  transform: scale(1) !important;
  pointer-events: auto !important;
}

nav.custom-topnav .topnav-user-info {
  display: flex;
  align-items: center;
}

nav.custom-topnav .topnav-user-avatar-small {
  width: 34px;
  height: 34px;
  margin-right: 0.5rem;
  font-weight: bold;
}

nav.custom-topnav .topnav-dropdown-item {
  padding: 0.25rem 0 0.25rem 2.5rem;
  background-color: #ffffff;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
}

nav.custom-topnav .topnav-dropdown-item:hover {
  background-color: #f7f8f9;
}

nav.custom-topnav .topnav-dropdown-item.user-management:hover {
  color: #92bfff;
}

nav.custom-topnav .topnav-dropdown-item.account-settings:hover {
  color: #92bfff;
}

nav.custom-topnav .topnav-dropdown-item.logout:hover {
  color: #de6565;
}