/* ============================================================
   茶舍总后台 CSS —— 绿叶茶风，专业简洁
   ============================================================ */
:root {
  --green: #1a7a4f;
  --green-light: #2a9d6e;
  --green-bg: #e8f5ee;
  --orange: #e67e22;
  --red: #e74c3c;
  --blue: #2980b9;
  --gray: #7f8c8d;
  --bg: #f0f4f0;
  --card-bg: #fff;
  --border: #dde8de;
  --shadow: 0 2px 8px rgba(26,122,79,0.10);
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 14px; color: #333; background: var(--bg); }

/* ---- helpers ---- */
.hidden { display: none !important; }
.muted { color: var(--gray); font-size: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-orange { background: #fef3e2; color: var(--orange); }
.badge-red { background: #fdecea; color: var(--red); }
.badge-blue { background: #e8f3fc; color: var(--blue); }
.badge-gray { background: #f0f0f0; color: var(--gray); }
.badge-tea { background: #e8f5e9; color: #2e7d32; }

/* ---- 登录页 ---- */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, #1a7a4f, #2a9d6e); }
.login-box { background: #fff; border-radius: var(--radius); padding: 40px 36px; width: 360px; box-shadow: var(--shadow); text-align: center; }
.login-box h2 { margin-bottom: 24px; color: var(--green); }
.login-box input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; margin-bottom: 12px; outline: none; transition: border-color .2s; }
.login-box input:focus { border-color: var(--green); }
.btn-primary { display: block; width: 100%; padding: 12px; background: var(--green); color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--green-light); }
.err-msg { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---- 主框架 ---- */
#admin header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--green); color: #fff; position: sticky; top: 0; z-index: 100; }
#admin header span { font-size: 16px; font-weight: 600; }
.nav-user { font-size: 13px; opacity: .85; margin-right: 12px; }
.btn-ghost-sm { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; padding: 4px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-ghost-sm:hover { background: rgba(255,255,255,.15); }

.layout { display: flex; min-height: calc(100vh - 52px); }

/* ---- 侧边导航 ---- */
#nav { width: 180px; background: #fff; border-right: 1px solid var(--border); padding: 12px 0; flex-shrink: 0; }
.nav-btn { display: block; width: 100%; text-align: left; padding: 11px 20px; background: none; border: none; border-left: 3px solid transparent; font-size: 14px; color: #555; cursor: pointer; transition: all .15s; }
.nav-btn:hover { background: var(--green-bg); color: var(--green); }
.nav-btn.active { background: var(--green-bg); color: var(--green); border-left-color: var(--green); font-weight: 600; }
.nav-btn .badge-count { float: right; background: var(--red); color: #fff; border-radius: 10px; padding: 1px 6px; font-size: 11px; }

/* ---- 主内容 ---- */
#content { flex: 1; padding: 20px 24px; overflow-x: auto; }
.page-title { font-size: 18px; font-weight: 600; color: var(--green); margin-bottom: 16px; }

/* ---- KPI 卡片 ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--card-bg); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.kpi-label { font-size: 12px; color: var(--gray); margin-bottom: 6px; }
.kpi-val { font-size: 22px; font-weight: 700; color: var(--green); }
.kpi-val.orange { color: var(--orange); }
.kpi-val.red { color: var(--red); }
.kpi-val.blue { color: var(--blue); }
.kpi-sub { font-size: 11px; color: var(--gray); margin-top: 2px; }

/* ---- 卡片 ---- */
.card { background: var(--card-bg); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 12px; background: var(--green-bg); color: var(--green); font-weight: 600; font-size: 13px; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafcfa; }
.td-img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.td-actions { white-space: nowrap; }

/* ---- 按钮 ---- */
.btn { display: inline-block; padding: 5px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; border: 1px solid transparent; transition: all .15s; margin: 2px; }
.btn-primary2 { background: var(--green); color: #fff; }
.btn-primary2:hover { background: var(--green-light); }
.btn-ghost { background: transparent; border: 1px solid var(--green); color: var(--green); }
.btn-ghost:hover { background: var(--green-bg); }
.btn-warn { background: transparent; border: 1px solid var(--orange); color: var(--orange); }
.btn-warn:hover { background: #fef3e2; }
.btn-danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- 表单 ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-full { grid-column: 1 / -1; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: #555; margin-bottom: 5px; font-weight: 500; }
.form-label .required { color: var(--red); }
.form-control { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; transition: border-color .2s; }
.form-control:focus { border-color: var(--green); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--gray); margin-top: 3px; }

/* ---- 图片上传 ---- */
.img-uploader { display: flex; flex-wrap: wrap; gap: 8px; }
.img-item { position: relative; width: 72px; height: 72px; }
.img-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.img-item .del-img { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; background: var(--red); color: #fff; border-radius: 50%; font-size: 12px; text-align: center; line-height: 18px; cursor: pointer; }
.img-add { width: 72px; height: 72px; border: 1.5px dashed var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--gray); cursor: pointer; }
.img-add:hover { border-color: var(--green); color: var(--green); }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal-box { background: #fff; border-radius: var(--radius); width: 680px; max-width: 95vw; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,.18); }
.modal-box.wide { width: 860px; }
.modal-hd { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--green-bg); font-weight: 600; font-size: 15px; color: var(--green); }
.modal-close { font-size: 22px; cursor: pointer; color: var(--gray); line-height: 1; }
.modal-close:hover { color: var(--red); }
.modal-bd { padding: 20px; overflow-y: auto; flex: 1; }
.modal-ft { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 22px; border-radius: 24px; font-size: 14px; z-index: 9999; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

/* ---- 折线图（纯 SVG） ---- */
.chart-wrap { background: var(--card-bg); border-radius: var(--radius); padding: 16px; border: 1px solid var(--border); }
.chart-title { font-size: 14px; font-weight: 600; color: #333; margin-bottom: 12px; }
.chart-svg { width: 100%; height: 160px; }

/* ---- Tabs ---- */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab-btn { padding: 8px 18px; border: none; background: none; cursor: pointer; font-size: 14px; color: var(--gray); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }

/* ---- 统计列表 ---- */
.stat-list { display: grid; gap: 8px; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 6px; background: var(--green-bg); font-size: 13px; }
.stat-row .val { font-weight: 600; color: var(--green); }

/* ---- 搜索栏 ---- */
.search-bar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.search-bar input { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }
.search-bar input:focus { border-color: var(--green); }
.search-bar select { padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }

/* ---- 空状态 ---- */
.empty-state { text-align: center; padding: 48px 0; color: var(--gray); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ---- 加载 ---- */
.loading { text-align: center; padding: 48px; color: var(--gray); }

/* ---- 分页 ---- */
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; color: var(--gray); }

/* ---- 详情卡片 ---- */
.detail-grid { display: grid; grid-template-columns: 120px 1fr; gap: 10px; font-size: 13px; }
.detail-grid .lbl { color: var(--gray); }

/* ---- 茶室详情：适合人数 ---- */
.sd-cap { margin-top: 6px; font-size: 13px; color: #555; }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  #nav { width: 56px; }
  .nav-btn span { display: none; }
  .nav-btn { text-align: center; padding: 11px 8px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-box, .modal-box.wide { width: 98vw; }
}

/* ͼƬ�Ŵ���䣨���ʱ�鿴����ԭͼ����ֹ�ҷ�ͼ�� */
.img-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.img-lightbox img {
  max-width: 92vw; max-height: 92vh;
  object-fit: contain; border-radius: 8px;
}

/* 茶室详情：图片顶部横排 + 信息下方 */
.sd-imgs { display:flex; flex-wrap:wrap; gap:10px; padding:4px 0 16px; border-bottom:1px dashed var(--border); margin-bottom:14px; }
.sd-img { width:130px; height:130px; object-fit:cover; border-radius:8px; cursor:zoom-in; background:#f3f5f7; display:block; }
.sd-info { line-height:1.8; }
.sd-cap { color: var(--green); font-weight: 600; padding: 6px 0; }

/* ---- 商品图文混排 blocks 编辑器 ---- */
.block-ops { display: flex; gap: 8px; margin-top: 8px; }
.gb-block { display: flex; flex-direction: column; gap: 6px; position: relative; background: #fafafa; border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.gb-ta { width: 100%; min-height: 76px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 14px; resize: vertical; box-sizing: border-box; }
.gb-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; }
.gb-del { align-self: flex-end; color: #e53935; font-size: 12px; cursor: pointer; background: none; border: none; padding: 2px 6px; }

/* ---- 富文本编辑器（商品/茶室图文详情） ---- */
.rt-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rt-btn { min-width: 64rpx !important; padding: 6px 12px !important; font-size: 13px !important; line-height: 1.2; }
.rt-editor {
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.7;
  background: #fff;
  outline: none;
  overflow-y: auto;
}
.rt-editor:empty:before { content: attr(data-placeholder); color: #bbb; }
.rt-editor img { max-width: 100%; border-radius: 8px; display: block; margin: 6px 0; }
.rt-editor p { margin: 0 0 8px; }
.rt-editor h2 { font-size: 18px; margin: 6px 0; }
.rt-editor ul, .rt-editor ol { padding-left: 22px; margin: 0 0 8px; }
