@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-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.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;
  object-fit: contain;
}

.logo h1 {
  font-size: 32px;
  font-weight: bold;
}

.language-toggle {
  display: flex;
  align-items: center;
  margin-right: 0;
}

.language-toggle button,
.header-schedule-link {
  min-width: 150px;
  height: 40px;
  padding: 0 18px;
  background: rgba(142, 68, 173, 0.8);
  border: 1px solid rgba(142, 68, 173, 0.8);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s;
}

.header-schedule-link {
  min-width: 110px;
  gap: 7px;
  text-decoration: none;
}

.header-team-menu {
  position: relative;
  flex: 0 0 auto;
  text-align: left;
}

.header-team-menu > .header-schedule-link {
  display: flex;
  padding: 0 18px;
  color: white !important;
  font-size: 14px;
  line-height: 1;
  margin: 0;
}

.header-team-menu > .dropdown-menu {
  position: fixed !important;
  top: 80px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
}

/* Keep the desktop dropdown open while the pointer crosses the small gap
   between the team trigger and the fixed-position menu. */
@media (min-width: 769px) {
  .header-team-menu > .dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -16px;
    height: 16px;
  }
}

.header-button-icon {
  font-size: 18px;
  line-height: 1;
}

.language-toggle button:hover,
.header-schedule-link:hover {
  background: rgba(142, 68, 173, 1);
  border-color: rgba(142, 68, 173, 1);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
}

.language-toggle button:focus-visible,
.header-schedule-link:focus-visible {
  outline: 3px solid rgba(142, 68, 173, 0.28);
  outline-offset: 3px;
}

.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-brand-group {
    gap: 8px;
  }

  .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: 0;
  }

  .language-toggle button,
  .header-schedule-link {
    min-width: 112px;
    height: 32px;
    padding: 0 12px;
    font-size: 11px;
  }

  .header-schedule-link {
    min-width: 82px;
    gap: 5px;
  }

  .header-team-menu > .header-schedule-link {
    min-width: 82px;
    height: 32px;
    padding: 0 12px;
    font-size: 11px;
  }

  .header-team-menu > .dropdown-menu {
    position: fixed !important;
    top: 64px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-height: calc(100vh - 74px);
    overflow-y: auto;
    transform: none !important;
  }

  .header-button-icon {
    font-size: 14px;
  }

  .social-links {
    flex-shrink: 0;
    gap: 5px;
    display: none;
  }

  .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: 600px) {
  .header-logo {
    gap: 6px;
    padding: 0 10px;
  }

  .header-brand-group {
    gap: 4px;
  }

  .logo img {
    max-width: 110px;
    max-height: 32px;
  }

  .language-toggle button {
    min-width: 90px;
    height: 30px;
    padding: 0 8px;
    font-size: 10px;
  }

  .header-action-link,
  .header-team-menu > .header-action-link {
    width: 32px;
    min-width: 32px;
    height: 30px;
    padding: 0;
  }

  .header-action-text {
    display: none;
  }

  .header-top {
    display: none;
  }

  .header-team-menu > .dropdown-menu {
    top: 54px !important;
  }
}

@media (max-width: 480px) {
  .header-logo {
    gap: 6px;
    padding: 0 10px;
  }

  .header-brand-group {
    gap: 4px;
  }

  .logo img {
    max-width: 100px;
    max-height: 30px;
  }

  .language-toggle button {
    min-width: 84px;
    height: 30px;
    padding: 0 7px;
    font-size: 10px;
  }

  .header-schedule-link {
    min-width: 68px;
    height: 30px;
    padding: 0 7px;
    font-size: 10px;
  }

  .header-action-link,
  .header-team-menu > .header-action-link {
    width: 32px;
    min-width: 32px;
    height: 30px;
    padding: 0;
  }

  .header-action-text {
    display: none;
  }

  .header-team-menu > .dropdown-menu {
    top: 50px !important;
  }

  .social-links {
    display: none;
  }

  .header-top {
    display: none;
  }
}

/*
 * Desktop full-width presentation
 *
 * The site was originally designed around a 1200px canvas. Scale that canvas
 * with the desktop viewport so a 1920px display at the browser's default 100%
 * zoom has the same full-width composition as the former 150% browser view.
 * Keeping this out of the mobile breakpoints preserves the existing mobile
 * navigation and responsive content flow.
 */
@media screen and (min-width: 1280px) and (max-width: 1439.98px) {
  body {
    zoom: 1.1;
  }
}

@media screen and (min-width: 1440px) and (max-width: 1599.98px) {
  body {
    zoom: 1.2;
  }
}

@media screen and (min-width: 1600px) and (max-width: 1799.98px) {
  body {
    zoom: 1.333333;
  }
}

@media screen and (min-width: 1800px) {
  body {
    zoom: 1.5;
  }
}

/* Header 中央純文字導覽 */
.header-logo {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
}

.header-logo > .logo {
  justify-self: start;
}

.header-logo > .header-brand-group {
  grid-column: 2;
  align-self: stretch;
  width: min(620px, calc(100vw - 420px));
  justify-self: center;
  gap: 0;
}

.header-logo > .header-top {
  display: none;
}

.header-logo > .social-links {
  grid-column: 3;
  justify-self: end;
}

.header-brand-group > :not(:last-child) {
  position: relative;
}

.header-brand-group > :not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 1px;
  height: 66.666%;
  background: rgba(107, 59, 128, 0.38);
  transform: translateY(-50%);
  pointer-events: none;
}

.header-brand-group > * {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  text-align: center;
}

.language-toggle button,
.header-schedule-link,
.nav-item.dropdown.header-team-menu > .header-schedule-link {
  width: 100%;
  min-width: 0;
  height: 60px;
  padding: 0 20px;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #6b3b80 !important;
  font-size: 14px;
  line-height: 1;
  box-shadow: none;
  transform: none;
}

.header.scrolled .language-toggle button,
.header.scrolled .header-schedule-link,
.header.scrolled .nav-item.dropdown.header-team-menu > .header-schedule-link {
  height: 40px;
}

.language-toggle button:hover,
.header-schedule-link:hover,
.nav-item.dropdown.header-team-menu > .header-schedule-link:hover {
  color: #8e44ad !important;
  background: rgba(142, 68, 173, 0.07);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.language-toggle button:focus-visible,
.header-schedule-link:focus-visible {
  outline: 2px solid rgba(142, 68, 173, 0.45);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  body {
    padding-top: 88px;
  }

  .header-logo {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 0;
    padding: 0 8px;
  }

  .header-logo > .logo {
    width: 100%;
    justify-content: center;
  }

  .header-logo > .logo img {
    max-width: 120px;
    max-height: 32px;
  }

  .header-logo > .header-brand-group {
    width: 100%;
    align-self: auto;
    justify-content: center;
  }

  .header-logo > .social-links {
    display: none;
  }

  .language-toggle button,
  .header-action-link,
  .header-team-menu > .header-action-link {
    display: flex;
    width: auto;
    min-width: 0;
    height: 28px;
    padding: 0 9px;
    font-size: 10px;
  }

  .header-action-text {
    display: inline;
  }

  .header-team-menu > .dropdown-menu {
    top: 88px !important;
  }
}
