@import url("//fonts.googleapis.com/earlyaccess/notosanstc.css");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans TC',sans-serif !important;
  background-color: #f5f5f5;
  padding-top: 80px;
}

/* Header */
.header {
  background: linear-gradient(135deg, #ffffff, #ffffff);
  color: #8e44ad;
  padding: 10px 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.header-top {
  text-align: center;
  font-size: 14px;
  flex: 1;
  margin: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  max-height: 60px;
  width: auto;
  margin-right: 15px;
  object-fit: contain;
}

.logo h1 {
  font-size: 32px;
  font-weight: bold;
}

.language-toggle {
  display: flex;
  align-items: center;
  margin-right: 15px;
}

.language-toggle button {
  width: 40px;
  height: 40px;
  background: rgba(142, 68, 173, 0.8);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.language-toggle button:hover {
  background: rgba(142, 68, 173, 1);
  border-color: rgba(255,255,255,0.5);
  transform: scale(1.1);
}

.social-links {
  display: flex;
  gap: 10px;
}

.social-links a {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  transition: all 0.3s;
}

.social-links a:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

/* Navigation */
.nav-bar {
  background: #7d3c98;
  padding: 0;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  position: relative;
}

.nav-item a {
  display: block;
  padding: 15px 10px;
  color: white;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s;
  font-size: 18px;
}

.nav-item a:hover {
  background: rgba(255,255,255,0.1);
}

/* Mobile Menu */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  padding: 15px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.3s;
}

.mobile-menu-toggle:hover {
  background: rgba(255,255,255,0.1);
}

.mobile-nav-items {
  display: flex;
  width: 100%;
}

.mobile-nav-items .nav-item {
  flex: 1;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.mobile-nav-items .nav-item:last-child {
  border-right: none;
}

/* Bootstrap Dropdown 自定義樣式 - 8x2 橫向排列 */
.dropdown-menu {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  border: none;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  padding: 20px;
  width: 100vw;
  max-width: 1200px;
  left: 50% !important;
  right: auto !important;
  margin: 0 !important;
  transform: translateX(-50%) !important;
  position: absolute !important;
  top: 54px !important;
  z-index: 999;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
}

.dropdown-item {
  color: white;
  padding: 12px 12px;
  border-radius: 10px;
  margin: 0;
  transition: all 0.3s ease;
  font-weight: 500;
  text-align: center;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  max-height: 72px;
  font-size: 14px;
  width: 100%;
  height: 100%;
  white-space: normal;
  overflow: hidden;
}

.dropdown-item .dropdown-text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0 4px;
}

.dropdown-item .dropdown-label {
  /* 基本樣式 */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; /* ✅ WebKit 版本（Chrome / Safari / Edge） */

  /* 現代標準語法（部分瀏覽器已支援） */
  line-clamp: 2;
  box-orient: vertical;
}

/* 若瀏覽器支援現代 line-clamp 語法，優先使用它 */
@supports (line-clamp: 2) or (-webkit-line-clamp: 2) {
  .dropdown-item .dropdown-label {
    display: -webkit-box;
  }
}


html[lang="en"] .dropdown-item {
  font-size: 13px;
}

.dropdown-item:hover {
  background: rgba(255,255,255,0.25);
  color: white;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.dropdown-divider {
  display: none; /* 隱藏分隔線，因為我們用網格布局 */
}

/* 懸浮觸發機制 */
.nav-item.dropdown {
  position: relative;
}

.nav-item.dropdown:hover .dropdown-menu {
  display: grid !important;
}


.nav-item.dropdown a {
  color: rgb(255, 255, 255) !important;
}

.dropdown-menu {
  display: none;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .dropdown-menu {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    width: 95vw;
  }
  
  .dropdown-item {
    font-size: 12px;
    padding: 10px 8px;
    min-height: 50px;
    max-height: 64px;
  }

  .dropdown-item .dropdown-label {
    line-height: 1.3;
    max-height: calc(1.3em * 2);
  }
}

@media (max-width: 480px) {
  .dropdown-menu {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 95vw;
  }
  
  .dropdown-item {
    font-size: 11px;
    padding: 8px 6px;
    min-height: 46px;
    max-height: 58px;
  }

  .dropdown-item .dropdown-label {
    line-height: 1.25;
    max-height: calc(1.25em * 2);
  }
}

/* Header scroll effect for mobile */
.header.scrolled {
  padding: 5px 0;
}

.header.scrolled .logo img {
  max-height: 40px;
}

.header.scrolled .header-top {
  font-size: 11px;
}

.header.scrolled .social-links a {
  width: 25px;
  height: 25px;
}

.header.scrolled .social-links img {
  width: 20px;
  height: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-logo {
    padding: 0 15px;
  }

  .header-top {
    font-size: 12px;
    margin: 0 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .logo {
    flex-shrink: 0;
  }

  .logo img {
    max-height: 45px;
  }

  .language-toggle {
    margin-right: 8px;
  }

  .language-toggle button {
    width: 25px;
    height: 25px;
    font-size: 10px;
  }

  .social-links {
    flex-shrink: 0;
    gap: 5px;
  }

  .social-links a {
    width: 25px;
    height: 25px;
  }

  .social-links img {
    width: 25px;
    height: 25px;
  }

  .mobile-menu-toggle {
    display: block;
  }
  
  .mobile-nav-items {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #7d3c98;
    z-index: 999;
    flex-direction: column;
    width: 100%;
  }

  .mobile-nav-items.active {
    display: flex;
  }

  .mobile-nav-items.active .nav-item {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.2);
  }

  .mobile-nav-items.active .nav-item:last-child {
    border-bottom: none;
  }

  .nav-container {
    justify-content: center;
  }

  /* Mobile Dropdown Styles */
  .dropdown-menu {
    position: static;
    width: 100%;
    transform: none;
    left: 0;
    opacity: 1;
    visibility: visible;
    display: none;
  }

  .dropdown-container:hover .dropdown-menu,
  .dropdown-container.active .dropdown-menu {
    display: block;
  }

  .dropdown-content {
    padding: 10px;
  }

  .dropdown-row {
    flex-direction: column;
    gap: 5px;
    margin-bottom: 5px;
  }

  .dropdown-item {
    max-width: none;
    padding: 10px;
    font-size: 13px;
    min-height: 52px;
    max-height: 64px;
  }

  .dropdown-item .dropdown-label {
    line-height: 1.3;
    max-height: calc(1.3em * 2);
  }
}

@media (max-width: 480px) {
  .header-top {
    font-size: 11px;
  }
}
