/* ========== 全局基础样式 ========== */
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Microsoft YaHei", sans-serif;
  user-select: none;
  overflow-x: hidden;
  overflow-y: hidden; /* 修复页面纵向滚动问题 */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ========== 顶部导航栏 ========== */
.top-header {
  background-color: #1a237e;
  color: #fff;
  display: flex;
  justify-content: flex-start; /* 修复：内容靠左对齐 */
  align-items: center;
  padding: 12px 20px;
  height: 60px;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.logo {
  font-size: 18px;
  font-weight: bold;
  white-space: nowrap; /* 防止文字换行 */
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  position: relative;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  flex-shrink: 0; /* 防止头像被压缩 */
}

.user-detail {
  line-height: 1.4;
  text-align: right; /* 文字右对齐 */
}

.username {
  font-weight: bold;
}

.role {
  font-size: 12px;
  opacity: 0.8;
}

/* ========== 修复：下拉菜单向右偏移10px，完全显示不被切割 ========== */
.user-dropdown {
  position: absolute !important;
  top: 100% !important;
  left: 10px !important; /* 关键：向右移动10像素，左边不再被切 */
  width: auto !important;
  max-width: 160px !important;
  min-width: 140px !important;
  background: #91c1c6 !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  z-index: 999999 !important;
  display: none !important;
  margin-top: 8px !important;
  padding: 0 !important;
}

.user-dropdown.show {
  display: block !important;
}

.user-dropdown a {
  display: block !important;
  width: 100% !important;
  padding: 10px 15px !important;
  color: #333 !important;
  text-decoration: none !important;
  font-size: 14px !important;
  transition: background 0.2s !important;
  white-space: nowrap !important;
}

.user-dropdown a:hover {
  background: #5b52b2 !important;
}
/* ========== 主容器 ========== */
.container {
  display: flex;
  width: 100%;
  height: calc(100vh - 60px);
  margin-top: 60px;
  overflow: hidden;
  position: relative;
}

/* ========== 左侧边栏 ========== */
.sidebar {
  width: 220px;
  background-color: #283593;
  color: #fff;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto; /* 允许侧边栏纵向滚动 */
  overflow-x: hidden;
  transition: width 0.3s ease;
  position: relative;
  z-index: 90;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed .menu-text {
  display: none;
}

.sidebar.collapsed .menu-btn {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.menu-toggle {
  padding: 15px;
  background-color: #3949ab;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-list {
  list-style: none;
}

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

.menu-btn {
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  z-index: 91;
  transition: background 0.2s;
}

.menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ========== 子菜单展开收起 ========== */
.submenu {
  list-style: none;
  background-color: #1a237e;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.submenu.open {
  max-height: 500px; /* 增加最大高度，防止内容被截断 */
}

.submenu-btn {
  width: 100%;
  padding: 12px 15px 12px 40px;
  background: none;
  border: none;
  color: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.submenu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ========== 三级菜单：查看数据设置的子选项（标准缩进） ========== */
.view-radio-item {
  width: 100%;
  padding: 12px 15px 12px 60px;
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-radio-item input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.view-radio-item label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== 右侧主内容区域 ========== */
.main-content {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f5f7fa;
}

.main-iframe {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #f5f7fa; /* 给iframe加默认背景，防止加载时显示黑色 */
}

/* 红色角标（待审核数量提示） */
.badge-num {
  display: inline-block;
  background: red;
  color: #fff;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 5px;
  line-height: 1.2;
}

/* 侧边栏展开/收缩按钮 - 手机端修复版 */
.sidebar-toggle {
  position: fixed !important;
  top: 50% !important;
  left: 0 !important;
  transform: translateY(-50%) !important;
  width: 36px !important;
  height: 50px !important;
  background: #0000fc !important;
  border-radius: 0 8px 8px 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  color: #fff !important;
  font-size: 18px !important;
  font-weight: bold !important;
  z-index: 999999 !important;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3) !important;
  transition: all 0.3s !important;
  touch-action: manipulation !important;
  -webkit-touch-callout: none !important;
}

.sidebar-toggle:hover {
  background: #1a1aff !important;
}

/* 侧边栏基础样式 */
.sidebar {
  position: relative;
  transition: all 0.3s ease;
}

/* 侧边栏隐藏样式 */
.sidebar-hidden {
  width: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
}

/* 侧边栏显示时，按钮位置调整 */
.sidebar-visible .sidebar-toggle {
  left: auto !important;
  right: 0 !important;
  border-radius: 8px 0 0 8px !important;
}

/* ========== 头像样式 ========== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #519999 !important; /* 头像默认底色，改成你想要的颜色 */
  background-size: cover;
  background-position: center;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden; /* 防止图片溢出 */
}

/* 通用弹窗样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  width: 500px;
  max-width: 90%;
  padding: 20px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #000;
}

.modal-title {
  margin-bottom: 15px;
  font-size: 18px;
  color: #333;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.modal-body {
  color: #666;
  line-height: 1.6;
}

/* ========== 手机端专属优化 ========== */
@media (max-width: 768px) {
  .sidebar-toggle {
    width: 42px !important;
    height: 56px !important;
    font-size: 20px !important;
  }

  .sidebar {
    position: fixed !important;
    left: 0;
    top: 60px;
    z-index: 99999 !important;
    height: calc(100vh - 60px);
  }

  .logo {
    font-size: 16px; /* 手机端缩小logo字体 */
  }

  .user-detail {
    display: none; /* 手机端隐藏用户详情文字，只显示头像 */
  }
}
