/*
 * Apple Style Header CSS
 * 苹果风格Header样式
 */

/* Header基础样式 */
.apple-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(29, 29, 31, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.13);
  transition: all 0.3s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.apple-header.scrolled {
  background: rgba(29, 29, 31, 0.88);
  border-bottom-color: rgba(255, 255, 255, 0.18);
}

/* 导航容器 */
.apple-nav {
  height: 44px;
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 22px;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  position: relative;
}

/* 品牌Logo区域 */
.nav-brand {
  flex-shrink: 0;
  z-index: 2;
}

.brand-link {
  color: #f5f5f7;
  text-decoration: none;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.022em;
  transition: opacity 0.3s ease;
}

.brand-link:hover {
  opacity: 0.8;
}

.brand-text {
  display: inline-block;
}

.custom-logo img {
  height: 30px;
  width: auto;
  transition: opacity 0.3s ease;
}

.custom-logo:hover img {
  opacity: 0.8;
}

/* 主导航 */
.nav-main {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

.apple-nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.apple-nav-menu li {
  position: relative;
}

.apple-nav-menu a {
  display: flex;
  align-items: center;
  padding: 0 18px;
  height: 44px;
  color: #f5f5f7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.01em;
  border-radius: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.apple-nav-menu a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

/* 下拉菜单 */
.has-dropdown {
  position: relative;
}

.dropdown-arrow {
  margin-left: 4px;
  font-size: 8px;
  transition: transform 0.3s ease;
}

.has-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: blur(20px);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 0.5px solid rgba(255, 255, 255, 0.13);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.28, 0.11, 0.32, 1);
  z-index: 1000;
}

.has-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li {
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.dropdown-menu li:last-child {
  border-bottom: none;
}

.dropdown-menu a {
  padding: 12px 16px;
  height: auto;
  font-size: 11px;
  border-radius: 0;
}

.dropdown-menu li:first-child a {
  border-radius: 8px 8px 0 0;
}

.dropdown-menu li:last-child a {
  border-radius: 0 0 8px 8px;
}

/* 右侧操作区域 */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  z-index: 2;
}

/* 搜索按钮 */
.search-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #f5f5f7;
  cursor: pointer;
  border-radius: 22px;
  transition: all 0.3s ease;
}

.search-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.search-icon {
  width: 18px;
  height: 18px;
}

/* 联系按钮 */
.contact-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  color: #f5f5f7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  border-radius: 16px;
  transition: all 0.3s ease;
  border: 0.5px solid rgba(255, 255, 255, 0.23);
  background: transparent;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.contact-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

.contact-btn:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.contact-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.98);
}

.contact-text {
  white-space: nowrap;
}

/* Header中的联系按钮图标 */
.contact-btn .contact-icon {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0;
  background: none !important;
  border-radius: 0 !important;
  font-size: inherit !important;
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 22px;
  transition: background 0.3s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hamburger-line {
  width: 17px;
  height: 1px;
  background: #f5f5f7;
  margin: 2px 0;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(3px, 3px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(3px, -3px);
}

/* 搜索覆盖层 */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.search-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 120px 20px 40px;
}

.search-form-wrapper {
  position: relative;
  margin-bottom: 40px;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.search-field {
  flex: 1;
  padding: 16px 20px;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 18px;
  outline: none;
}

.search-field::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.search-submit {
  padding: 16px 20px;
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  transition: color 0.3s ease;
}

.search-submit:hover {
  color: #0071e3;
}

.search-close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 18px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.search-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 搜索建议 */
.quick-search-results {
  animation: fadeInUp 0.5s ease-out 0.2s both;
}

.search-suggestions h4 {
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-tag {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  text-decoration: none;
  border-radius: 20px;
  font-size: 12px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-tag:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* 移动端覆盖层 */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 375px;
  height: 100%;
  background: rgba(29, 29, 31, 0.95);
  backdrop-filter: blur(20px);
  padding: 0;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.mobile-nav-overlay.active .mobile-nav-content {
  transform: translateX(0);
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 44px;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.13);
}

.mobile-brand {
  color: #f5f5f7;
  font-size: 17px;
  font-weight: 600;
}

.mobile-nav-close {
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: #f5f5f7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  transition: background 0.3s ease;
}

.mobile-nav-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-menu {
  list-style: none;
  margin: 0;
  padding: 20px 0;
}

.mobile-nav-menu li {
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.mobile-nav-menu a {
  display: block;
  padding: 16px 20px;
  color: #f5f5f7;
  text-decoration: none;
  font-size: 17px;
  font-weight: 400;
  transition: all 0.3s ease;
}

.mobile-nav-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.mobile-nav-footer {
  position: absolute;
  bottom: 40px;
  left: 20px;
  right: 20px;
}

.mobile-contact-btn {
  display: block;
  width: 100%;
  padding: 16px;
  background: #0071e3;
  color: #ffffff;
  text-decoration: none;
  text-align: center;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 500;
  transition: background 0.3s ease;
}

.mobile-contact-btn:hover {
  background: #0077ed;
  color: #ffffff;
}

/* 响应式断点 */
@media (max-width: 833px) {
  .nav-main {
    display: none;
  }

  .contact-btn {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .apple-nav {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .mobile-nav-content {
    width: 100%;
    max-width: none;
  }

  .search-container {
    padding: 80px 16px 20px;
  }

  .search-field {
    font-size: 16px;
  }
}

/* 动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 无障碍支持 */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

/* Focus样式 */
.apple-nav-menu a:focus-visible,
.search-toggle:focus-visible,
.mobile-menu-toggle:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 2px;
}

/* 联系按钮的focus样式单独处理 */
.contact-btn:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .apple-header {
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid #ffffff;
  }

  .apple-nav-menu a,
  .brand-link,
  .search-toggle,
  .contact-btn {
    color: #ffffff;
  }

  .dropdown-menu {
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #ffffff;
  }
}

/* 减少动效模式 */
@media (prefers-reduced-motion: reduce) {

  .apple-header,
  .apple-nav-menu a,
  .dropdown-menu,
  .search-overlay,
  .mobile-nav-overlay,
  .mobile-nav-content {
    transition: none;
  }
}