/* Navbar Dropdown Styles - Desktop */
.nav-dropdown {
  position: fixed;
  top: 64px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
}

.nav-dropdown-inner {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 12px 20px;
  min-width: 260px;
  max-width: 320px;
  border-top: 1px solid rgba(56, 189, 248, 0.08);
  box-shadow: 0 8px 24px rgba(14, 116, 144, 0.06);
  border-radius: 0 0 12px 12px;
}

.nav-dropdown-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.06);
  color: #0EA5E9;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.nav-dropdown-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav-item:hover > .nav-dropdown-visible .nav-dropdown-icon {
  background: rgba(14, 165, 233, 0.1);
}

/* ============================================
   Mobile Bottom Navigation (6 items)
   ============================================ */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 60px;
  max-width: 540px;
  margin: 0 auto;
  padding: 0 4px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px 4px;
  color: #94A3B8;
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 10px;
  min-width: 0;
  flex: 1;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:active {
  transform: scale(0.9);
}

.bottom-nav-item.active {
  color: #0EA5E9;
}

.bottom-nav-item.active svg {
  filter: drop-shadow(0 2px 4px rgba(14, 165, 233, 0.3));
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

/* ============================================
   Scroll to Top Button
   ============================================ */
.scroll-to-top {
  position: fixed;
  bottom: 84px;
  right: 16px;
  z-index: 800;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0EA5E9;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:active {
  transform: scale(0.9);
}

/* ============================================
   Mobile Layout Adjustments
   ============================================ */
@media (max-width: 1023px) {
  body {
    padding-bottom: 72px;
  }

  /* 隐藏 hero 背景区域，直接显示内容 */
  .hero-gradient,
  .hero-bg,
  .query-hero,
  .register-hero {
    display: none !important;
  }

  /* scores.html: 隐藏背景图，保留表单 */
  #step-setup img[alt="咨询中心"] {
    display: none !important;
  }

  /* scores.html: 表单容器在移动端重排 */
  #step-setup > section {
    min-height: auto !important;
  }

  #step-setup > section > div.absolute {
    position: relative !important;
    inset: auto !important;
    padding: 24px 16px !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
  }

  /* scores.html: 表单在移动端全宽展示 */
  #step-setup .apple-glass {
    position: relative !important;
    inset: auto !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    transform: none !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: saturate(180%) blur(20px) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08) !important;
  }

  /* scores.html: 聊天界面移动端适配 */
  #step-chat {
    padding-top: 0 !important;
  }

  /* 聊天头部移动端简化 */
  #step-chat > .bg-white.border-b {
    position: sticky;
    top: 64px;
    z-index: 40;
    padding: 10px 12px !important;
  }

  #step-chat > .bg-white.border-b .flex.items-center.gap-3 {
    gap: 8px !important;
  }

  #step-chat #conn-status {
    display: none !important;
  }

  /* 聊天输入区域移动端固定底部 */
  #step-chat > div:last-child.bg-white.border-t {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    padding: 8px 12px !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
  }

  /* 聊天消息区域移动端调整 */
  #step-chat > div.flex-1.overflow-y-auto {
    padding-bottom: 140px !important;
  }

  /* 聊天输入区域移动端优化 */
  #step-chat textarea {
    font-size: 16px !important;
    padding: 10px 12px !important;
  }

  #step-chat .flex.items-end.gap-3 {
    gap: 8px !important;
  }

  /* 隐藏输入区域下方的提示文字 */
  #step-chat > div:last-child.bg-white.border-t > .max-w-4xl.mt-1\.5 {
    display: none !important;
  }

  /* excellent_members.html: 隐藏顶部动画背景 */
  #bg-canvas {
    display: none !important;
  }
}

/* ============================================
   Desktop Navbar - Single Line Text
   确保导航项文字单行显示不换行
   ============================================ */
.navbar-main .nav-item {
  white-space: nowrap;
  flex-shrink: 0;
}

.navbar-main .nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hide scrollbar on desktop nav */
.lg\:flex.items-center::-webkit-scrollbar {
  display: none;
}
.lg\:flex.items-center {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Safe area for iPhone notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .scroll-to-top {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}
