/* ============================================================
   伴易诊陪诊师培训管理后台 - 样式
   配色：医疗蓝 #1469B2 / 珊瑚橙 #ED7132 / 米白 #F5F2EE
   ============================================================ */

:root {
  --primary: #1469B2;
  --primary-dark: #0f5290;
  --primary-light: #e8f1f9;
  --accent: #ED7132;
  --accent-light: #fdf0e8;
  --bg: #F5F2EE;
  --white: #ffffff;
  --text: #2b2f36;
  --text-light: #7b8089;
  --border: #e3dfd8;
  --danger: #d64545;
  --success: #2e9e5b;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(20, 105, 178, 0.08);
}

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

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }

/* ============ 通用按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  line-height: 1.4;
  background: var(--primary-light);
  color: var(--primary);
}
.btn:hover { opacity: .88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn-ghost:hover { background: rgba(255,255,255,.15); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ============ 输入控件 ============ */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  color: var(--text-light);
}
.form-group label .req { color: var(--danger); margin-left: 2px; }
input[type="text"], input[type="password"], input[type="number"], input[type="color"],
select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input[type="color"] { height: 38px; padding: 3px; cursor: pointer; }
textarea { resize: vertical; min-height: 72px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.field-tip { font-size: 12px; color: var(--text-light); }

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #1d7cc4 60%, var(--accent) 130%);
  padding: 20px;
}
.login-box {
  width: 400px;
  background: var(--white);
  border-radius: 16px;
  padding: 40px 38px 32px;
  box-shadow: 0 16px 50px rgba(0,0,0,.25);
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  background: var(--primary);
  color: #fff;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.login-title { text-align: center; font-size: 20px; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-light); font-size: 13px; margin-bottom: 26px; }
.login-tip { text-align: center; color: var(--text-light); font-size: 12px; margin-top: 14px; }

/* ============ 顶栏 ============ */
.topbar {
  height: 56px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 100;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(237,113,50,.3);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.current-module { font-size: 13px; opacity: .9; margin-right: 6px; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 210px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  flex-shrink: 0;
}
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.menu-item:hover { background: var(--primary-light); }
.menu-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.menu-item .mi-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; background: var(--accent); vertical-align: middle; }

.content { flex: 1; padding: 22px 26px; min-width: 0; }
.page-title { font-size: 19px; font-weight: 600; margin-bottom: 4px; }
.page-desc { color: var(--text-light); font-size: 13px; margin-bottom: 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

/* ============ 卡片与表格 ============ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
th { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafbfd; }
td .ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 1.6;
  background: var(--primary-light);
  color: var(--primary);
}
.tag-accent { background: var(--accent-light); color: var(--accent); }
.tag-green { background: #e6f5ec; color: var(--success); }
.tag-gray { background: #f0f0f0; color: var(--text-light); }
.tag-red { background: #fdeaea; color: var(--danger); }

/* ============ 空状态 ============ */
.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--text-light);
}
.empty .empty-icon { font-size: 40px; margin-bottom: 10px; opacity: .5; }
.empty p { font-size: 14px; }

/* ============ 模态框 ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 40, 60, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: 12px;
  width: 720px;
  max-width: 100%;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal.modal-lg { width: 900px; }
.modal.modal-sm { width: 480px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 600;
}
.modal-close { border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--text-light); line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============ 选项编辑（题库） ============ */
.opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.opt-label {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 6px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
}
.opt-label.selected { background: var(--primary); color: #fff; }
.opt-row input { flex: 1; }
.opt-del { color: var(--danger); background: none; border: none; cursor: pointer; font-size: 16px; flex-shrink: 0; }
.opt-add { margin-top: 6px; }

/* ============ 列表式（公告/轮播/章节/备用通道） ============ */
.mini-list { display: flex; flex-direction: column; gap: 10px; }
.mini-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fcfcfd;
}
.mini-item .mi-main { flex: 1; min-width: 0; }
.mini-item .mi-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.mini-item .mi-sub { color: var(--text-light); font-size: 12.5px; }
.mini-item .mi-thumb { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; background: var(--primary-light); flex-shrink: 0; }

/* ============ 数据管理 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-box { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--text-light); font-size: 13px; margin-top: 4px; }

/* ============ 图片预览 ============ */
.img-preview {
  max-width: 160px; max-height: 120px;
  border-radius: 6px; border: 1px solid var(--border);
  margin-top: 8px; object-fit: cover; background: var(--primary-light);
}
.color-preview { display: inline-flex; align-items: center; gap: 8px; }
.color-swatch { width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--border); }

/* ============ 登录显示 ============ */
img.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--primary-light); }

/* ============ Toast ============ */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 40, 60, .9); color: #fff;
  padding: 10px 22px; border-radius: 8px; font-size: 14px;
  z-index: 2000;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.toast.success { background: rgba(46, 158, 91, .92); }
.toast.error { background: rgba(214, 69, 69, .92); }

/* ============ 全局设置（标题/价格/图标） ============ */
.price-table td input.price-input {
  width: 100%;
  min-width: 80px;
  padding: 6px 8px;
}
.icon-item { margin-bottom: 12px; }
.icon-item .icon-edit label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  color: var(--text-light);
}
.icon-row { display: flex; align-items: center; gap: 10px; }
.icon-row input[type="text"] { flex: 1; }
.icon-preview {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--primary-light);
  font-size: 26px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.icon-preview.has-img { font-size: 0; }
@media (max-width: 900px) { .icon-row { flex-wrap: wrap; } }

/* ============ 订单管理 ============ */
.ord-note {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.ord-note-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.ord-note-body p { font-size: 13px; line-height: 1.7; color: var(--text-light); }
.ord-note-body b { color: var(--text); font-weight: 600; }
.ord-note-body code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.ord-note-tip {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  color: var(--accent) !important;
}

.ord-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ord-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ord-tab {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-light);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.ord-tab:hover { border-color: var(--primary); color: var(--primary); }
.ord-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.ord-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ord-select,
.ord-search {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
}
.ord-search { width: 240px; }
.ord-search:focus,
.ord-select:focus { outline: none; border-color: var(--primary); }

.ord-no { font-family: Consolas, Monaco, monospace; font-size: 12px; }
.ord-sub { color: var(--text-light); font-size: 12px; margin-top: 2px; }
.ord-amount { font-weight: 600; color: var(--accent); white-space: nowrap; }
.ord-count { margin-top: 12px; font-size: 12px; color: var(--text-light); }

.ord-detail { display: flex; flex-direction: column; gap: 2px; }
.ord-detail-row {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.ord-detail-row:last-child { border-bottom: none; }
.ord-detail-k { width: 92px; flex-shrink: 0; color: var(--text-light); }
.ord-detail-v { flex: 1; word-break: break-all; }

@media (max-width: 900px) {
  .ord-search { width: 100%; }
  .ord-tools { width: 100%; }
}

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .menu { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 16px; }
  .form-row { flex-direction: column; gap: 0; }
}
