/* 部落冲突部落联赛管理系统 — 全局样式 */
:root {
  --primary: #409eff;
  --success: #67c23a;
  --warning: #e6a23c;
  --danger: #f56c6c;
  --info: #909399;
  --bg: #f0f2f5;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: #a8b2c1;
  --sidebar-active: #409eff;
  --header-h: 56px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #303133;
  background: var(--bg);
}
a {
  color: inherit;
  text-decoration: none;
}

/* ====== 登录页 ====== */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-card {
  width: 400px;
  padding: 36px 32px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.login-title {
  text-align: center;
  font-size: 22px;
  color: #1a1a2e;
  margin-bottom: 4px;
  letter-spacing: 2px;
}
.login-sub {
  text-align: center;
  color: var(--info);
  margin-bottom: 24px;
}

/* ====== 布局 ====== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.layout-aside {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s;
  overflow-y: auto;
  overflow-x: hidden;
}
.logo {
  height: var(--header-h);
  line-height: var(--header-h);
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  overflow: hidden;
}
.aside-menu {
  padding: 10px 0;
  flex: 1;
}
.aside-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.aside-menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.aside-menu a.active {
  background: rgba(64, 158, 255, 0.15);
  color: var(--sidebar-active);
  border-left-color: var(--sidebar-active);
}
.aside-menu a .el-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.layout-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.layout-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid #e4e7ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}
.layout-header .title {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
}
.layout-header .user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--info);
  font-size: 13px;
}

.layout-content {
  flex: 1;
  padding: 16px;
  overflow: auto;
}
.page-card {
  background: #fff;
  border-radius: 6px;
  padding: 20px;
  min-height: 100%;
}

/* ====== 工具栏 ====== */
.coc-toolbar {
  margin-bottom: 16px;
}

/* ====== 看板卡片 ====== */
.dash-cards {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dash-card {
  flex: 1;
  min-width: 160px;
  max-width: 260px;
  background: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.dash-card .k {
  font-size: 13px;
  color: var(--info);
  margin-bottom: 8px;
}
.dash-card .v {
  font-size: 28px;
  font-weight: 700;
  color: #303133;
}
.dash-card.green .v {
  color: var(--success);
}
.dash-card.orange .v {
  color: var(--warning);
}
.dash-card.red .v {
  color: var(--danger);
}

.chart-row {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}
.chart-box {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.chart-box .chart {
  width: 100%;
  height: 360px;
}

/* ====== 标签页 ====== */
.coc-tabs .el-tabs__header {
  margin-bottom: 16px;
}
.coc-tabs .el-tab-pane {
  min-height: 300px;
}

/* ====== 滚动条美化 ====== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: #c0c4cc;
  border-radius: 3px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ====== Element Plus 微调 ====== */
.el-dialog {
  border-radius: 8px !important;
}
.el-button--small {
  border-radius: 4px;
}
.el-table th {
  background: #fafafa !important;
}

/* 表格行 hover 时背景色加深，使行高亮更明显 */
.el-table {
  --el-table-row-hover-bg-color: #e8eef7;
}
.el-table--enable-row-hover .el-table__body tr:hover > td {
  background-color: var(--el-table-row-hover-bg-color) !important;
}

/* ====== 响应式（PC + 移动端） ====== */
/* 手机端导航开关（汉堡按钮）：默认隐藏，仅移动端显示 */
.nav-toggle {
  display: none;
  font-size: 20px;
  cursor: pointer;
  color: #303133;
  margin-right: 12px;
}
.header-left {
  display: flex;
  align-items: center;
  min-width: 0;
}
/* 移动端抽屉遮罩：默认隐藏 */
.layout-mask {
  display: none;
}

@media (max-width: 900px) {
  /* 顶部显示汉堡按钮 */
  .nav-toggle { display: inline-flex; }

  /* 侧边栏改为可滑出的抽屉（默认隐藏在屏幕左侧外） */
  .layout-aside {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.25);
  }
  .layout.nav-open .layout-aside { transform: translateX(0); }

  /* 抽屉打开时的半透明遮罩（仅在 nav-open 时显示） */
  .layout.nav-open .layout-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
  }

  /* 抽屉内显示完整菜单文字 */
  .aside-menu a span:not(.el-icon) { display: inline; }
  .logo { font-size: 18px; letter-spacing: 2px; }

  /* 内容区留白收窄 */
  .layout-content { padding: 10px; }
  .page-card { padding: 14px; }
  .layout-header { padding: 0 12px; }
  .layout-header .user > span { display: none; } /* 移动端隐藏"欢迎，xxx" */

  /* 看板卡片单列铺满 */
  .dash-cards > * { max-width: 100%; flex: 1 1 100%; }
  .chart-row { flex-direction: column; }

  /* 弹窗在移动端占满可用宽度 */
  .el-dialog { width: 92vw !important; max-width: 92vw !important; }
  .el-message-box { width: 88vw !important; }

  /* 搜索工具栏换行，控件占满整行 */
  .coc-toolbar .el-form-item { margin-right: 0; width: 100%; }
  .coc-toolbar .el-select,
  .coc-toolbar .el-input,
  .coc-toolbar .el-date-editor { width: 100% !important; }

  /* 分页器允许横向滚动，避免溢出 */
  .coc-pager {
    justify-content: flex-start !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .coc-pager .el-pagination { flex: none; white-space: nowrap; }
}

/* 超小屏进一步压缩留白 */
@media (max-width: 480px) {
  .layout-content { padding: 8px; }
  .page-card { padding: 10px; }
  .dash-card { padding: 14px 16px; }
  .dash-card .v { font-size: 24px; }
}

/* ============ MenuTree 组件（菜单管理 - 树视图） ============ */
.coc-menu-tree {
  padding: 12px 0;
}
.coc-mt-toolbar {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 8px;
}
.coc-mt-tip {
  margin-left: 12px;
  color: #909399;
  font-size: 12px;
}
.coc-mt-wrap {
  padding: 12px 16px;
  border: 1px solid #ebeef5;
  border-radius: 6px;
  background: #fafbfc;
  max-height: calc(100vh - 260px);
  overflow: auto;
}
.coc-mt-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 8px;
  border-radius: 4px;
}
.coc-mt-node:hover {
  background: #f0f5ff;
}
.coc-mt-label {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  flex: 1;
}
.coc-mt-actions {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  opacity: 0.85;
}
.coc-mt-actions .el-button {
  padding: 0 6px;
}
.coc-mt-path,
.coc-mt-perm {
  color: #909399;
  font-size: 12px;
  margin-left: 6px;
  font-family: Menlo, Consolas, monospace;
}

/* ============ 字典管理（二级树） ============ */
.dict-manage {
  padding: 4px 0;
}
.dict-toolbar {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 8px;
  flex-wrap: wrap;
}
.dict-tip {
  margin-left: 12px;
  color: #909399;
  font-size: 12px;
}
.dict-tree-body {
  padding: 12px 16px;
  border: 1px solid #ebeef5;
  border-radius: 6px;
  background: #fafbfc;
  max-height: calc(100vh - 260px);
  overflow: auto;
}
.dict-tree-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 8px;
  border-radius: 4px;
}
.dict-tree-node:hover {
  background: #f0f5ff;
}
.dict-tree-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.dict-tree-label .dict-name {
  font-weight: 500;
  margin: 0 4px;
}
.dict-tree-label .dict-code {
  color: #909399;
  font-size: 12px;
  font-family: Menlo, Consolas, monospace;
}
.dict-tree-label .dict-sort {
  color: #909399;
  font-size: 12px;
}
.dict-tree-actions {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  opacity: 0.85;
}
.dict-tree-actions .el-button {
  padding: 0 6px;
}

/* ============ 一键计算战斗力 - 公式展示 ============ */
.calc-formula-box {
  background: #f7f8fa;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  color: #303133;
}
.calc-formula-title {
  font-weight: 600;
  color: #303133;
  margin-bottom: 10px;
  font-size: 13px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}
.calc-formula-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px;
  padding: 5px 0;
  line-height: 1.7;
}
.calc-formula-k {
  display: inline-block;
  min-width: 64px;
  margin-right: 8px;
  color: var(--primary);
  font-weight: 600;
}
.calc-formula-row.calc-formula-result {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #dcdfe6;
  font-weight: 600;
}
.calc-formula-note {
  color: var(--info);
  font-size: 12px;
  margin-left: 4px;
}
.calc-formula-ref {
  margin-top: 10px;
  color: var(--info);
  font-size: 12px;
}
