/* ============================================
   JomCari Admin — 设计系统
   从原型的内联 <style> 提取，配色与圆角保持一致
   ============================================ */

:root {
  --primary: #E2738C;
  --primary-dark: #9e3d56;
  --bg: #f8f5f5;
  --sidebar-bg: #1a1215;
  --sidebar-hover: #2d2025;
  --sidebar-active: #3d2a32;
  --card-bg: #ffffff;
  --text: #22191b;
  --text-light: #887275;
  --border: #e7d6d7;
  --success: #4CAF50;
  --warning: #FF9500;
  --error: #E02020;
  --info: #1565C0;
  --tb-orange: #FF9500;
  --pdd-red: #E02020;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(34, 25, 27, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.app-ready { display: flex; }

/* ============================================
   侧边栏
   ============================================ */
.sidebar { width: 260px; background: var(--sidebar-bg); color: #fff; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100; }
.sidebar-brand { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand h1 { font-size: 24px; color: var(--primary); }
.sidebar-brand span { font-size: 11px; color: rgba(255,255,255,0.4); display: block; margin-top: 2px; }

.sidebar-nav { padding: 16px 0 40px; }
.nav-section { padding: 12px 20px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.3); }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: rgba(255,255,255,0.6); cursor: pointer; transition: all 0.2s; font-size: 14px; border-left: 3px solid transparent; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: var(--primary); border-left-color: var(--primary); }
.nav-item .icon { width: 20px; text-align: center; font-size: 16px; }
.nav-item .badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.nav-item .badge:empty, .nav-item .badge[data-count="0"] { display: none; }

/* ============================================
   主区域
   ============================================ */
.main { margin-left: 260px; flex: 1; min-height: 100vh; }
.topbar { background: var(--card-bg); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar h2 { font-size: 20px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-right .admin-name { font-size: 14px; color: var(--text-light); }
.btn-logout { padding: 8px 16px; background: none; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-light); }
.btn-logout:hover { border-color: var(--primary); color: var(--primary); }

.content { padding: 32px; }

/* 语言切换器 */
.lang-switch { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lang-switch button { padding: 6px 12px; border: none; background: #fff; cursor: pointer; font-size: 12px; color: var(--text-light); border-right: 1px solid var(--border); }
.lang-switch button:last-child { border-right: none; }
.lang-switch button.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ============================================
   统计卡片
   ============================================ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 16px; }
.stat-icon.blue { background: #E3F2FD; }
.stat-icon.green { background: #E8F5E9; }
.stat-icon.orange { background: #FFF3E0; }
.stat-icon.pink { background: #FCE4EC; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ============================================
   表格
   ============================================ */
.table-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px; }
.table-header { padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px; }
.table-header h3 { font-size: 16px; font-weight: 600; }
.table-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 24px; font-size: 12px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; background: #faf7f7; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 24px; font-size: 14px; border-bottom: 1px solid #f5f0f0; vertical-align: middle; }
tr:hover td { background: #fdf9f9; }
td.nowrap { white-space: nowrap; }

.empty-row { text-align: center; padding: 48px 24px; color: var(--text-light); font-size: 14px; }

/* ============================================
   标签
   ============================================ */
.tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.tag-tb { background: var(--tb-orange); color: #fff; }
.tag-pdd { background: var(--pdd-red); color: #fff; }

.tag-status { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st-grey   { background: #F0EBEB; color: #6B5B5E; }
.st-green  { background: #E8F5E9; color: #2E7D32; }
.st-orange { background: #FFF3E0; color: #E65100; }
.st-blue   { background: #E3F2FD; color: #1565C0; }
.st-red    { background: #FFEBEE; color: #C62828; }
.st-purple { background: #F3E5F5; color: #6A1B9A; }

/* ============================================
   按钮
   ============================================ */
.btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; border: none; font-weight: 500; transition: all 0.2s; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0; }

.action-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================
   表单
   ============================================ */
.search-input { padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; width: 240px; outline: none; }
.search-input:focus { border-color: var(--primary); }
.filter-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: #fff; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; font-family: inherit; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ============================================
   弹窗
   ============================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius); padding: 32px; width: 560px; max-width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal h3 { font-size: 18px; margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* ============================================
   其它
   ============================================ */
.pagination { display: flex; justify-content: center; gap: 8px; padding: 20px; }
.pagination button { min-width: 36px; height: 36px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; padding: 0 8px; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

.quick-panel { background: var(--card-bg); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.quick-panel h3 { font-size: 16px; margin-bottom: 16px; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.loading-row { text-align: center; padding: 48px; color: var(--text-light); }

/* 顶部提示条 */
.toast { position: fixed; top: 20px; right: 20px; z-index: 300; background: var(--text); color: #fff; padding: 14px 20px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); max-width: 360px; }
.toast.ok { background: var(--success); }
.toast.err { background: var(--error); }

/* 登录页 */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); width: 100%; }
.login-card { background: #fff; padding: 48px; border-radius: 16px; box-shadow: var(--shadow); width: 400px; text-align: center; }
.login-card h1 { color: var(--primary); font-size: 32px; margin-bottom: 8px; }
.login-card p { color: var(--text-light); margin-bottom: 32px; }
.login-card .lang-switch { justify-content: center; margin-bottom: 24px; display: inline-flex; }

@media (max-width: 1200px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; }
  .content { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
}
