/* ==================== 侧边栏导航布局 ==================== */

/* 整体布局：侧边栏 + 主区域 */
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
  width: 200px;
  min-width: 200px;
  background: #f8f9fb;
  color: #555;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
  z-index: 100;
  border-right: 1px solid #e8e8ec;
}

.sidebar.collapsed {
  width: 56px;
  min-width: 56px;
}

/* 侧边栏头部 */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid #e8e8ec;
}

.sidebar-header .logo {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-header .logo {
  display: none;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
}

.sidebar-toggle:hover {
  color: #333;
  background: #e8e8ec;
}

/* 侧边栏导航区 */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}

/* 分组 */
.nav-group {
  margin-bottom: 4px;
}

.nav-group-title {
  padding: 10px 16px 4px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-group-title {
  display: none;
}

/* 菜单项 */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  user-select: none;
}

.nav-item:hover {
  background: #e8ecf2;
  color: #333;
}

.nav-item.active {
  background: #e3f0fd;
  color: #1565C0;
  border-left-color: #2196F3;
  font-weight: 500;
}

.nav-item .nav-icon {
  font-size: 15px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-item .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .nav-item .nav-label {
  display: none;
}

.sidebar.collapsed .nav-item {
  padding: 10px 18px;
  justify-content: center;
}

/* 侧边栏底部 */
.sidebar-footer {
  padding: 8px 12px;
  border-top: 1px solid #e8e8ec;
  font-size: 11px;
  color: #aaa;
  text-align: center;
}

.sidebar.collapsed .sidebar-footer {
  display: none;
}

/* ==================== 主内容区域 ==================== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ==================== 顶部栏 ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left h1 {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
}

.topbar-left .version {
  font-size: 11px;
  color: #aaa;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  background: none;
  border: 1px solid #e0e0e0;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  color: #666;
  transition: all 0.15s;
}

.topbar-btn:hover {
  border-color: #2196F3;
  color: #2196F3;
  background: #f0f7ff;
}

.topbar-btn.active {
  border-color: #2196F3;
  background: #E3F2FD;
  color: #1565C0;
}

.login-status {
  font-size: 11px;
  color: #888;
}

/* ==================== 内容区 ==================== */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  background: #f5f7fa;
}

/* Tab 内容显示控制 */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 去掉旧版 header 的居中样式（与侧边栏冲突） */
.header {
  text-align: left;
  margin-bottom: 0;
  padding: 0;
}

/* 卡片样式微调 */
.content-area .card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* ==================== 响应式：小屏幕折叠侧边栏 ==================== */
@media (max-width: 768px) {
  .sidebar {
    width: 56px;
    min-width: 56px;
  }
  .sidebar .nav-label,
  .sidebar .nav-group-title,
  .sidebar-header .logo,
  .sidebar-footer {
    display: none;
  }
}
