/* 
 * Apple-Style Navigation
 * 仿 Apple 官网的高级导航栏样式
 * Inspired by https://www.apple.com.cn/
 */

/* ===================================
 * 1. Header 基础样式 - Apple 风格
 * ================================= */

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 0;
  z-index: 9999;
  transition: background-color 0.3s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

.header.active {
  background-color: rgba(0, 0, 0, 0.92);
}

.header .container {
  max-width: 1000px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 22px;
  gap: 20px;
}

/* ===================================
 * 2. Logo 样式
 * ================================= */

.header .logo {
  display: flex;
  align-items: center;
  padding: 0;
  transition: opacity 0.2s ease;
}

.header .logo:hover {
  opacity: 0.7;
}

.header .logo img {
  height: 44px;
  width: auto;
}

/* ===================================
 * 3. 导航列表 - Apple 风格
 * ================================= */

.navbar {
  position: static;
  background: transparent;
  flex: 1;
  display: flex;
  justify-content: center;
}

.navbar-list {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.navbar-item {
  position: static;
  animation: none;
  opacity: 1;
}

/* ===================================
 * 4. 导航链接 - 极简风格
 * ================================= */

.navbar-link {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 0;
  transition: color 0.2s ease;
  position: relative;
}

.navbar-link:hover,
.navbar-link.active {
  color: rgba(255, 255, 255, 1);
  background-color: transparent;
  transform: none;
}

/* 移除之前的下划线动画 */
.navbar-link::after {
  display: none;
}

/* ===================================
 * 5. Mega Menu - Apple 风格全宽下拉
 * ================================= */

.navbar-item.has-dropdown {
  position: static;
}

.mega-menu {
  position: fixed;
  top: 48px;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 40px 0 60px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 9998;
}

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

/* Mega Menu 内容容器 */
.mega-menu-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 22px;
}

/* Mega Menu 标题 */
.mega-menu-title {
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

/* Mega Menu 网格布局 */
.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

/* Mega Menu 项 */
.mega-menu-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mega-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 400;
  border-radius: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.mega-menu-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 1);
}

/* Mega Menu 图标 */
.mega-menu-link ion-icon {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.64);
  flex-shrink: 0;
}

.mega-menu-link:hover ion-icon {
  color: rgba(255, 255, 255, 0.88);
}

/* Mega Menu 文字区域 */
.mega-menu-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mega-menu-text strong {
  font-weight: 600;
  color: rgba(255, 255, 255, 1);
}

.mega-menu-text small {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.56);
}

/* ===================================
 * 6. 语言切换器 - Apple 风格
 * ================================= */

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
}

.lang-switch button {
  height: 48px;
  padding: 0 12px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  border-radius: 0;
  transition: color 0.2s ease;
  letter-spacing: 0;
}

.lang-switch button:hover {
  color: rgba(255, 255, 255, 1);
}

.lang-switch button.active {
  background: transparent;
  color: rgba(255, 255, 255, 1);
  box-shadow: none;
}

.lang-switch span {
  display: inline;
  color: rgba(255, 255, 255, 0.32);
  font-size: 12px;
}

/* ===================================
 * 7. 移动端菜单按钮 - Apple 风格
 * ================================= */

.nav-open-btn {
  display: none;
  background: transparent;
  border: none;
  width: 48px;
  height: 48px;
  padding: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 20px;
  transition: color 0.2s ease;
}

.nav-open-btn:hover {
  color: rgba(255, 255, 255, 1);
  background: transparent;
  transform: none;
}

/* ===================================
 * 8. 搜索图标（可选）
 * ================================= */

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  width: 48px;
  padding: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.search-btn:hover {
  color: rgba(255, 255, 255, 1);
}

/* ===================================
 * 9. 响应式 - 移动端
 * ================================= */

@media (max-width: 991px) {
  
  .header .container {
    padding: 0 16px;
  }

  .nav-open-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .navbar {
    position: fixed;
    top: 48px;
    right: -100%;
    width: 100%;
    max-width: 375px;
    height: calc(100vh - 48px);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 20px 0;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -1px 0 0 rgba(255, 255, 255, 0.1);
  }

  .navbar.active {
    right: 0;
  }

  .navbar-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .navbar-item {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .navbar-link {
    height: 56px;
    padding: 0 22px;
    font-size: 14px;
    justify-content: space-between;
  }

  /* 移动端 Mega Menu */
  .mega-menu {
    position: static;
    top: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: max-height 0.3s ease, padding 0.3s ease;
  }

  .navbar-item.has-dropdown.active .mega-menu {
    max-height: 1000px;
    padding: 20px 0;
  }

  .navbar-item.has-dropdown > .navbar-link::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid rgba(255, 255, 255, 0.64);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.64);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.3s ease;
  }

  .navbar-item.has-dropdown.active > .navbar-link::after {
    transform: rotate(-135deg) translateY(2px);
  }

  .mega-menu-content {
    padding: 0 22px;
  }

  .mega-menu-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .mega-menu-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .mega-menu-item:last-child {
    border-bottom: none;
  }

  .mega-menu-link {
    padding: 16px 0;
  }

  .mega-menu-title {
    padding: 0 22px;
    margin-bottom: 12px;
  }

  /* 语言切换移动端 */
  .lang-switch {
    padding: 20px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
  }

  .lang-switch button {
    height: 40px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
  }

  .lang-switch button.active {
    background: rgba(255, 255, 255, 0.16);
  }
}

/* ===================================
 * 10. 遮罩层 - 移动端
 * ================================= */

@media (max-width: 991px) {
  .overlay {
    position: fixed;
    top: 48px;
    left: 0;
    width: 100%;
    height: calc(100vh - 48px);
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    z-index: 9997;
  }

  .navbar.active ~ .overlay {
    opacity: 1;
    visibility: visible;
  }
}

/* ===================================
 * 11. 隐藏不需要的元素
 * ================================= */

/* 隐藏原导航栏的社交链接（移动端） */
.navbar-top,
.social-list {
  display: none !important;
}

/* 隐藏"立即预约"按钮 */
.header .btn {
  display: none !important;
}

/* ===================================
 * 12. 平滑滚动优化
 * ================================= */

html {
  scroll-padding-top: 48px;
}

body {
  padding-top: 48px;
}

/* ===================================
 * 13. 性能优化
 * ================================= */

/* GPU 加速 */
.navbar,
.mega-menu,
.navbar-link {
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* ===================================
 * 14. 打印样式
 * ================================= */

@media print {
  .header {
    position: static;
    background: white;
    box-shadow: none;
  }

  .navbar-link,
  .lang-switch button {
    color: black;
  }

  .mega-menu,
  .nav-open-btn,
  .search-btn {
    display: none;
  }
}

/* ===================================
 * 15. 高对比度模式支持
 * ================================= */

@media (prefers-contrast: high) {
  .header {
    background-color: rgba(0, 0, 0, 1);
  }

  .navbar-link,
  .lang-switch button {
    color: rgba(255, 255, 255, 1);
  }
}

/* ===================================
 * 16. 减少动画（用户偏好）
 * ================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

