/* admin-ui/css/admin.css - 后台管理样式 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1989fa;
  --primary-dark: #0d6cd6;
  --success: #07c160;
  --warning: #ff976a;
  --danger: #ee0a24;
  --text: #303133;
  --text-secondary: #606266;
  --text-placeholder: #909399;
  --border: #dcdfe6;
  --border-light: #e4e7ed;
  --bg: #f0f2f5;
  --bg-white: #ffffff;
  --radius: 6px;
  --sidebar-w: 220px;
  --header-h: 56px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d6cd6 0%, #1989fa 100%);
}
.login-box {
  width: 380px; background: #fff; border-radius: 12px; padding: 40px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.login-title { text-align: center; font-size: 22px; font-weight: 600; margin-bottom: 8px; color: var(--primary); }
.login-sub { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 32px; }
.login-form .form-item { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); }
.login-form input {
  width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; outline: none; transition: border-color .2s;
}
.login-form input:focus { border-color: var(--primary); }
.login-btn {
  width: 100%; height: 42px; background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius); font-size: 15px; margin-top: 8px; transition: background .2s;
}
.login-btn:hover { background: var(--primary-dark); }
.login-btn:disabled { background: #a0c4f5; }
.login-tip { margin-top: 20px; padding: 12px; background: #fff7e8; border-radius: var(--radius); font-size: 12px; color: var(--warning); text-align: center; }

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

.sidebar {
  width: var(--sidebar-w); background: #001529; color: #fff; flex-shrink: 0;
  position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; z-index: 100;
}
.sidebar-logo {
  height: var(--header-h); display: flex; align-items: center; padding: 0 20px;
  font-size: 16px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px; background: var(--primary); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; margin-right: 10px;
  font-size: 14px; font-weight: 700;
}
.menu { padding: 8px 0; }
.menu-item {
  display: flex; align-items: center; padding: 12px 24px; color: rgba(255,255,255,0.75);
  cursor: pointer; transition: all .2s; font-size: 14px; border-left: 3px solid transparent;
}
.menu-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.menu-item.active { color: #fff; background: var(--primary); border-left-color: #fff; }
.menu-item .icon { width: 20px; margin-right: 10px; text-align: center; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.header {
  height: var(--header-h); background: #fff; box-shadow: 0 1px 4px rgba(0,21,41,0.08);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.header-left { font-size: 16px; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 16px; }
.user-dropdown { position: relative; cursor: pointer; }
.user-info { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.dropdown-menu {
  position: absolute; top: 42px; right: 0; background: #fff; border: 1px solid var(--border-light);
  border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 160px; z-index: 200;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item { padding: 10px 16px; cursor: pointer; font-size: 13px; }
.dropdown-item:hover { background: #f5f7fa; color: var(--primary); }

.content { flex: 1; padding: 20px 24px; }

/* ===== 卡片/面板 ===== */
.card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }

/* ===== 统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--primary);
}
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-placeholder); margin-top: 4px; }

/* ===== 表格 ===== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  background: #fafafa; padding: 12px 16px; text-align: left; font-weight: 600;
  color: var(--text-secondary); border-bottom: 1px solid var(--border-light); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--f0f2f5); color: var(--text); }
.table tbody tr:hover { background: #fafafa; }
.table .text-mono { font-family: Consolas, Monaco, monospace; }
.table .text-muted { color: var(--text-placeholder); }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; line-height: 1.5; }
.tag-primary { background: #e6f4ff; color: var(--primary); }
.tag-success { background: #e7f8ee; color: var(--success); }
.tag-warning { background: #fff3e8; color: var(--warning); }
.tag-danger { background: #ffeceb; color: var(--danger); }
.tag-info { background: #f4f4f5; color: var(--text-placeholder); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: var(--radius); font-size: 13px; transition: all .2s; white-space: nowrap;
}
.btn:hover { color: var(--primary); border-color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #06ad56; color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-text { border: none; background: transparent; padding: 4px 8px; }
.btn-text.primary { color: var(--primary); }
.btn-text.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.form-group { display: flex; align-items: center; gap: 6px; }
.form-group label { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.input, .select {
  height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; outline: none; transition: border-color .2s;
}
.input:focus, .select:focus { border-color: var(--primary); }
.input { width: 200px; }

.form-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.form-row .form-field { flex: 1; min-width: 200px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); }
.form-field .input, .form-field .select, .form-field textarea {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; outline: none;
}
.form-field textarea { height: auto; padding: 8px 12px; min-height: 80px; resize: vertical; }

/* ===== 分页 ===== */
.pagination { display: flex; gap: 4px; justify-content: flex-end; align-items: center; margin-top: 16px; font-size: 13px; }
.pagination .pg-info { margin-right: 12px; color: var(--text-secondary); }
.pagination .btn { min-width: 32px; justify-content: center; }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 40px; color: var(--text-placeholder); }
.empty-icon { font-size: 40px; margin-bottom: 8px; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000;
  display: none; align-items: center; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 8px; width: 560px; max-width: 90vw; max-height: 85vh;
  overflow: hidden; display: flex; flex-direction: column;
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-placeholder); line-height: 1; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-light); text-align: right; }
.modal-footer .btn { margin-left: 8px; }

/* ===== 上传 ===== */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px;
  text-align: center; cursor: pointer; transition: border-color .2s;
}
.upload-area:hover { border-color: var(--primary); }
.upload-icon { font-size: 36px; color: var(--text-placeholder); margin-bottom: 8px; }
.upload-text { color: var(--text-secondary); font-size: 13px; }

/* ===== 趋势图 ===== */
.trend-chart { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding: 16px 0; }
.trend-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trend-bar { width: 100%; max-width: 40px; background: linear-gradient(180deg, var(--primary), #4ba8fa); border-radius: 4px 4px 0 0; min-height: 4px; transition: height .3s; }
.trend-label { font-size: 11px; color: var(--text-placeholder); }
.trend-val { font-size: 11px; color: var(--text-secondary); }

/* ===== 详情 ===== */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
.detail-item { display: flex; }
.detail-label { width: 110px; color: var(--text-secondary); flex-shrink: 0; }
.detail-value { color: var(--text); flex: 1; }

/* ===== 提示 ===== */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-warning { background: #fff7e8; color: var(--warning); }
.alert-info { background: #e6f4ff; color: var(--primary); }

.badge-role { padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.badge-super { background: #ee0a24; color: #fff; }
.badge-admin { background: #1989fa; color: #fff; }

.hidden { display: none !important; }
.loading { text-align: center; padding: 40px; color: var(--text-placeholder); }
.mt16 { margin-top: 16px; } .mb16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
