/* 益泰智研 · Layout — 页面骨架：base reset, nav, sidebar, page structure, mobile nav */

/* 防止移动端水平溢出 */
html {
  overflow-x: hidden;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

/* Utilities */
.text-brand { color: var(--brand); }
.text-brand-500 { color: var(--brand-500); }
.text-title { color: var(--text-title); }
.text-body { color: var(--text-body); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-orange { color: var(--accent-orange); }
.text-red { color: var(--accent-red); }
.text-success { color: var(--success); }

.bg-brand { background: var(--brand); }
.bg-brand-light { background: var(--brand-50); }
.bg-brand-100 { background: var(--brand-100); }
.bg-page { background: var(--bg-page); }
.bg-module { background: var(--bg-module); }
.bg-white { background: var(--white); }

.border-brand { border-color: var(--brand); }
.border-light { border-color: var(--border-light); }

/* Top navigation — removed (sso.js provides unified sso-header, old .top-nav was AI-nav fingerprint) */

/* Page layout */
.page-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-height));
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--border-light);
  padding: 12px 0;
  flex-shrink: 0;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 0 10px;
  font-size: 14px;
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.2s var(--ease-out), background 0.2s var(--ease-out);
  background: var(--bg-page);
  color: var(--text-title);
}

.sidebar-menu li a.active {
  background: var(--brand-50);
  color: var(--brand);
  font-weight: 600;
}

.sidebar-menu li a i {
  font-size: 18px;
  color: currentColor;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  padding: 24px;
  overflow: auto;
  background: var(--bg-page);
}

/* Section spacing helpers */
.section-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* 移动端导航组件 (~190行) — 后续可考虑抽取为 pages/nav-mobile.css */
/* ===================== 移动端导航 ===================== */

/* 汉堡菜单按钮 */
.nav-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  min-width: 44px;
  border: none;
  background: transparent;
  color: var(--text-title);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius);
  transition: background-color 150ms var(--ease-out);
  z-index: 999;
  flex-shrink: 0;
}

.nav-hamburger:hover {
  background: var(--bg-page);
  color: var(--brand);
}

/* 移动端抽屉导航 */
.nav-mobile-drawer {
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 250ms var(--ease-out);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.nav-mobile-drawer.open {
  transform: translateX(0);
}

/* 抽屉遮罩层 */
.nav-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.40);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms var(--ease-out), visibility 250ms var(--ease-out);
}

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

/* 移动端底部 Tab 栏 */
.mobile-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  z-index: 998;
  padding: 4px 0 env(safe-area-inset-bottom, 4px);
  border-top: 1px solid var(--border-light);
  background: var(--white);
}

.mobile-tab-bar .tab-item {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 150ms var(--ease-out), background-color 150ms var(--ease-out);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-tab-bar .tab-item i {
  font-size: 20px;
  line-height: 1;
}

.mobile-tab-bar .tab-item.active {
  color: var(--brand);
  font-weight: 600;
}

.mobile-tab-bar .tab-item:hover {
  color: var(--brand);
  background: var(--brand-50);
}

/* 移动端抽屉导航 - 头部 */
.nav-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--white);
  flex-shrink: 0;
}

.nav-mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-title);
}

.nav-mobile-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background-color 150ms var(--ease-out);
}

.nav-mobile-close:hover {
  background: var(--bg-page);
  color: var(--text-title);
}

/* 移动端抽屉导航 - 内容区 */
.nav-mobile-content {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}

.nav-mobile-content .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 15px;
  color: var(--text-body);
  text-decoration: none;
  min-height: 44px;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
  border-bottom: 1px solid var(--brand-50);
}

.nav-mobile-content .nav-link i {
  font-size: 18px;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-mobile-content .nav-link:hover,
.nav-mobile-content .nav-link:active {
  background: var(--brand-50);
  color: var(--brand);
}

.nav-mobile-content .nav-link:hover i,
.nav-mobile-content .nav-link:active i {
  color: var(--brand);
}

/* 桌面端默认隐藏移动端导航（无 !important，让 @media 768 可覆盖） */
.nav-hamburger,
.nav-mobile-drawer,
.nav-mobile-overlay,
.mobile-tab-bar {
  display: none;
}

/* Responsive — Layout */
@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }

}

@media (max-width: 768px) {
  /* 移动端导航：显示汉堡菜单和底部 Tab，隐藏桌面端导航 */
  .nav-hamburger,
  .mobile-tab-bar {
    display: flex;
  }

  .nav-mobile-drawer,
  .nav-mobile-overlay {
    display: flex;
  }

  .sidebar {
    display: none !important;
  }

  .main-content {
    padding: 16px;
  }
}
