/* ══════════════════════════════════════════════════
   自学平台 — 平台级导航栏（共享样式）
   所有页面统一引用此文件，避免样式重复
   ══════════════════════════════════════════════════ */

/* ==================== 平台顶部返回导航 ==================== */
.top-nav {
  background: var(--bg2, #faf3e2);
  border-bottom: 1px solid var(--rule, #d7b98c);
  position: sticky;
  top: 0;
  z-index: 101;
}

.top-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.2rem 1.2rem;
}

.top-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui, 'Lora', 'PingFang SC', sans-serif);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft, rgba(43,29,21,0.62));
  text-decoration: none;
  padding: 0.2rem 0.6rem;
  border-radius: 0.3rem;
  transition: all 180ms ease;
  opacity: 0.75;
}

.top-nav-back:hover {
  color: var(--accent, #9f2d20);
  background: var(--accent-soft, rgba(159,45,32,0.06));
  opacity: 1;
}

.top-nav-back-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.top-nav-back-text {
  line-height: 1;
}

/* 移动端适配 */
@media (max-width: 640px) {
  .top-nav-inner {
    padding: 0.15rem 0.8rem;
  }
  .top-nav-back {
    font-size: 0.72rem;
  }
}

/* ==================== 顶部跨学科导航（旧版，保留样式兼容） ==================== */
.top-nav-toggle {
  display: none;
}

.top-nav-links {
  display: none;
}

.top-nav-divider {
  display: none;
}

.top-nav-user {
  display: none;
}

.top-nav-badge {
  display: none;
}

/* === 学科内下拉导航(2026-08-08) === */
.sub-nav-dropdown {
  position: relative;
  display: inline-block;
}
.sub-nav-dropdown > a.has-dropdown::after {
  content: ' \25BC';
  font-size: 0.6rem;
  vertical-align: middle;
  opacity: 0.6;
}
.sub-nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0.4rem;
  padding: 0.5rem;
  background: var(--card-front-bg, #faf6f0);
  border: 1px solid var(--rule, #d7b98c);
  border-radius: 0.8rem;
  box-shadow: 0 12px 32px var(--shadow, rgba(43,29,21,0.16));
  z-index: 30;
  min-width: 160px;
  white-space: nowrap;
}
.sub-nav-dropdown:hover .sub-nav-dropdown-menu,
.sub-nav-dropdown:focus-within .sub-nav-dropdown-menu {
  display: block;
}
.sub-nav-dropdown-menu a {
  display: block;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  text-align: center;
  font-family: var(--font-ui, sans-serif);
  color: var(--ink-soft, rgba(43,29,21,0.72));
  transition: all 180ms ease;
}
.sub-nav-dropdown-menu a:hover {
  background: var(--accent-soft, rgba(159,45,32,0.1));
  color: var(--accent, #9f2d20);
}
.sub-nav-dropdown-menu a.active {
  color: var(--accent, #9f2d20);
  background: var(--accent-soft, rgba(159,45,32,0.1));
  font-weight: 700;
}
@media (max-width: 640px) {
  .sub-nav-dropdown {
    display: block;
    width: 100%;
  }
  .sub-nav-dropdown > a {
    text-align: center;
    font-weight: 700;
    color: var(--accent, #9f2d20);
    padding: 0.6rem 0.8rem;
  }
  .sub-nav-dropdown > a.has-dropdown::after {
    display: none;
  }
  .sub-nav-dropdown-menu {
    display: block !important;
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    min-width: auto;
  }
  .sub-nav-dropdown-menu a {
    text-align: center;
    padding: 0.5rem 0.8rem;
  }
}

/* === 个人中心直链 (2026-08-08) === */
.nav-links a.nav-profile-link {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  font-family: var(--font-ui, sans-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent, #9f2d20);
  border: 1px solid var(--accent, #9f2d20);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 180ms ease;
  margin-left: 0.3rem;
}
.nav-links a.nav-profile-link:hover {
  background: var(--accent, #9f2d20);
  color: var(--card-front-bg, #faf6f0);
}
@media (max-width: 640px) {
  .nav-links a.nav-profile-link {
    display: block;
    width: 100%;
    text-align: center;
    margin: 0.3rem 0;
    padding: 0.6rem 0.8rem;
  }
}