/* Header Section */
.top-header {
  background: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: padding 0.3s ease;
}

/* 內容區塊 */
.content-section {
  max-width: 1350px;
  margin: 0 auto;
  padding: 0;
}

.header-logo-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: transparent;
  transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
  overflow: hidden;
  position: relative;
  gap: 20px;
}

.header-logo-row.hidden {
  opacity: 0;
  max-height: 0;
  padding: 0;
  margin: 0;
  visibility: hidden;
}

.header-logo-row .logo-section {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
  position: relative;
  justify-content: flex-start;
  min-width: 0;
}

.header-logo-row .logo-left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  display: none;
}

.header-logo-row .logo-center {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex: 0 0 auto;
}

/* 導航按鈕區域 */
.header-logo-row .nav-buttons {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: 30px;
  flex-shrink: 0;
}

.header-logo-row .nav-button {
  color: #333;
  text-decoration: none;
  font-size:  1.3rem;
  font-weight: 500;
  padding: 8px 12px;
  transition: color 0.3s ease;
  cursor: pointer;
  white-space: nowrap;
  display: inline-block;
}

.header-logo-row .nav-button:hover {
  color: #6c59ed;
}

.header-logo-row .logo-section img {
  height: 110px;
  width: auto;
  transition: height 0.3s ease, transform 0.3s ease;
  transform-origin: center;
}

.header-logo-row .logo-slogan-wrapper {
  margin-left: 0;
  text-align: left;
}

.header-content {
  background: transparent;
  width: 100%;
  padding: 10px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.header-content.fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: #f9e7e5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  display: flex;
  gap: 20px;
}

/* 滾動時顯示的 Logo */
.header-scroll-logo {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  flex: 0 0 auto;
}

.header-scroll-logo img {
  height: 50px;
  width: auto;
}

/* 當 header-content 固定時顯示 logo */
.header-content.fixed .header-scroll-logo {
  display: block;
  opacity: 1;
}

/* 滾動時顯示的導航按鈕 */
.header-scroll-nav-buttons {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: 20px;
}

/* 當 header-content 固定時顯示導航按鈕 */
.header-content.fixed .header-scroll-nav-buttons {
  display: flex;
  opacity: 1;
}

/* 滾動時顯示的語言切換器 */
.header-scroll-language-switcher {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  flex: 0 0 auto;
  margin-right: 20px;
}

/* 當 header-content 固定時顯示語言切換器 */
.header-content.fixed .header-scroll-language-switcher {
  display: block;
  opacity: 1;
}

/* 調整 fixed header 中的語言切換器樣式 */
.header-content.fixed .header-scroll-language-switcher .language-switcher {
  display: flex;
  gap: 6px;
}

.header-content.fixed .header-scroll-language-switcher .language-btn {
  padding: 5px 10px;
  font-size: 1rem;
}

.header-content.fixed .header-scroll-language-switcher .language-btn.active {
  background: #ff6666;
  color: #ffffff;
}


.header-scroll-nav-buttons .nav-button,
.header-scroll-nav-button {
  color: #000000;
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 500;
  padding: 8px 12px;
  transition: color 0.3s ease;
  cursor: pointer;
  white-space: nowrap;
  display: inline-block;
}

.header-scroll-nav-buttons .nav-button:hover,
.header-scroll-nav-button:hover {
  color: #333333;
}

/* 確保 login-section 在右邊 */
.header-logo-row .login-section {
  flex: 0 0 auto;
  margin-left: auto;
}

.header-content.fixed .login-section {
  margin-left: auto;
}

.logo-section {
  flex: 0 0 auto;
  display: flex;
  align-items: end;
  gap: 15px;
}

.logo-section img {
  height: 90px;
  width: auto;
  transition: height 0.3s ease, transform 0.3s ease;
  transform-origin: center;
}

.logo-slogan-wrapper {
  display: none;
  flex-direction: column;
  gap: 0;
  margin-left: 10px;
}

.header-logo-row .logo-slogan-wrapper {
  margin-left: 0;
  text-align: left;
}

.logo-slogan {
  font-size: 1rem;
  font-weight: 600;
  color: #ff6666;
  white-space: nowrap;
  letter-spacing: 1px;
}

.logo-slogan-subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  color: #666;
  white-space: nowrap;
  letter-spacing: 0.5px;
  line-height: 1.3;
  margin-top: 2px;
}

.login-section {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 15px;
}

/* 登入按鈕（已移除，表單直接顯示） */
.login-btn {
  display: none;
}

/* 手機端登入按鈕 */
.login-toggle-btn-mobile {
  display: none; /* 桌面端隱藏 */
}

/* 表單直接顯示在 header 右上角 */
.top-header .login-form-inline,
.header-logo-row .login-form-inline,
.login-section .login-form-inline {
  display: flex !important;
}

.login-form-inline {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0;
  background: transparent;
}

.login-form-inline form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ff6666;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.login-label-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.login-form-inline input[type="text"],
.login-form-inline input[type="password"] {
  padding: 8px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  width: 180px;
  transition: all 0.3s ease;
  background: #fafafa;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.login-form-inline input[type="text"]:hover,
.login-form-inline input[type="password"]:hover {
  border-color: #ff7800;
  background: white;
  box-shadow: 0 4px 8px rgba(255, 120, 0, 0.15);
  transform: translateY(-1px);
}

.login-form-inline input[type="text"]:focus,
.login-form-inline input[type="password"]:focus {
  outline: none;
  border-color: #ff7800;
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 120, 0, 0.15);
}

.login-form-inline input[type="text"]::placeholder,
.login-form-inline input[type="password"]::placeholder {
  color: #999;
  font-size: 0.9rem;
}

.login-submit-group {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 6px;
}

.login-form-inline input[type="submit"] {
  background: #ff6f06;
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  height: 45px;
  box-sizing: border-box;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s;
  white-space: nowrap;
}

.login-form-inline input[type="submit"]:hover {
  background: #ff8f00;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(255, 111, 6, 0.3);
}

/* 忘記密碼按鈕 */
.forgot-password-btn {
  background: transparent;
  color: #666;
  border: none;
  padding: 4px 0;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.3s;
  height: auto;
  box-sizing: border-box;
  white-space: nowrap;
  text-decoration: underline;
  display: inline-block;
}

.forgot-password-btn:hover {
  color: #ff6666;
  text-decoration: underline;
}

.login-form-inline .error-msg {
  display: none;
}

/* 使用者資訊區域（登入後顯示） */
.user-info-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-name-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-name-display i {
  font-size: 1.2rem;
  color: #ff6666;
}

.user-name-display span {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.enter-platform-btn {
  background: #7b7bff;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s;
  white-space: nowrap;
  display: inline-block;
}

.enter-platform-btn:hover {
  background: #d4d4ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(230, 230, 255, 0.3);
  color: #333;
  text-decoration: none;
}

.logout-btn {
  background: #ff6f06;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s;
  white-space: nowrap;
  display: inline-block;
}

.logout-btn:hover {
  background: #ff8f00;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(255, 111, 6, 0.3);
  color: white;
  text-decoration: none;
}

/* 快速導航按鈕區 */
.quick-nav-section {
  background: #ffffff;
  padding: 0;
  width: 100%;
  transition: all 0.3s ease;
}

/* 当滚动后变成 fixed 的样式 */
.quick-nav-section.fixed {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 998;
  padding: 15px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quick-nav-container {
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.quick-nav-btn {
  background: transparent;
  border: none;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  border-radius: 6px;
}

.quick-nav-btn:hover {
  opacity: 0.8;
}

.quick-nav-btn:active {
  opacity: 0.6;
}

.quick-nav-btn i {
  font-size: 1.8rem;
  color: #ff6666;
  transition: transform 0.3s ease;
}

.quick-nav-btn:hover i {
  transform: scale(1.05);
}

.quick-nav-btn span {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: #000000;
  white-space: normal;
  text-align: center;
  line-height: 1;
}

/* Media Queries for Header */
@media (max-width: 768px) {
  .header-logo-row {
    padding: 10px 15px;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .header-logo-row .logo-section {
    width: 100%;
  }

  .header-logo-row .nav-buttons {
    display: none; /* 手機版隱藏導航按鈕 */
  }

  .header-logo-row .login-section {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  
  /* 手機端：隱藏登入表單 */
  .login-section .login-form-inline {
    display: none !important;
  }
  
  /* 手機端：顯示登入按鈕 */
  .login-toggle-btn-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ff6f06;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
  }
  
  .login-toggle-btn-mobile:hover {
    background: #ff8f00;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 111, 6, 0.3);
  }
  
  .login-toggle-btn-mobile i {
    font-size: 1rem;
  }
  
  .login-toggle-btn-mobile span {
    font-size: 1rem;
  }

  .header-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 10px 15px;
  }

  .header-content.fixed .login-section {
    width: auto;
    margin-left: auto;
  }
  
  /* 滾動時也隱藏表單 */
  .header-content.fixed .login-section .login-form-inline {
    display: none !important;
  }
  
  .header-content.fixed .login-toggle-btn-mobile {
    display: flex;
  }

  .header-scroll-logo img {
    height: 40px;
  }

  .header-scroll-nav-buttons {
    gap: 15px;
    margin-left: 15px;
  }

  .header-scroll-nav-buttons .nav-button,
  .header-scroll-nav-button {
    font-size: 1.2rem;
    padding: 6px 10px;
  }

  .header-scroll-language-switcher {
    margin-right: 10px;
  }

  .header-content.fixed .header-scroll-language-switcher .language-btn {
    padding: 4px 8px;
    font-size: .8rem;
  }

  .quick-nav-section {
    display: none; /* 手機版隱藏快速導航 */
  }

  .quick-nav-container {
    gap: 10px;
    padding: 0 15px;
  }

  .quick-nav-btn {
    padding: 12px 18px;
    min-width: 100px;
    gap: 6px;
  }

  .quick-nav-btn i {
    font-size: 1.3rem;
  }

  .quick-nav-btn span {
    font-size: 0.85rem;
  }
}
