/* 中正数商 商家后台 - 全局样式 */
:root {
  --primary: #003fb1;
  --primary-light: #e8eefb;
  --primary-dark: #002d82;
  --success: #006c4a;
  --success-light: #e6f4ee;
  --warning: #b85c00;
  --warning-light: #fff3e6;
  --danger: #ba1a1a;
  --danger-light: #fce8e8;
  --bg: #f5f5f9;
  --surface: #ffffff;
  --border: #e0e0e6;
  --text: #1a1a2e;
  --text-secondary: #6b6b80;
  --text-muted: #9999aa;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 登录页 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #003fb1 0%, #0055d4 50%, #006c4a 100%); }
.login-card { background: var(--surface); border-radius: 12px; padding: 48px 40px; width: 420px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 24px; color: var(--primary); font-weight: 700; }
.login-logo p { color: var(--text-secondary); font-size: 14px; margin-top: 8px; }
.login-tabs { display: flex; margin-bottom: 24px; border-bottom: 2px solid var(--border); }
.login-tab { flex: 1; text-align: center; padding: 12px 0; cursor: pointer; font-size: 15px; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; transition: border-color 0.2s; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.btn { padding: 12px 24px; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* 主布局 */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--border); position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; display: flex; flex-direction: column; }
.sidebar-header { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 16px; color: var(--primary); font-weight: 700; }
.sidebar-header p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 24px; color: var(--text-secondary); cursor: pointer; transition: all 0.2s; font-size: 14px; }
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item i { width: 20px; text-align: center; font-size: 16px; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--border); }
.sidebar-footer .user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar-footer .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; font-size: 14px; }
.sidebar-footer .user-name { font-size: 14px; font-weight: 600; }
.sidebar-footer .user-role { font-size: 12px; color: var(--text-muted); }

.main-area { flex: 1; margin-left: var(--sidebar-width); }
.top-header { height: var(--header-height); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 50; }
.top-header h3 { font-size: 18px; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.content-area { padding: 24px 32px; }

/* 卡片 */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-info h4 { font-size: 24px; font-weight: 700; }
.stat-info p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* 表格 */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { font-weight: 600; color: var(--text-secondary); background: var(--bg); font-size: 13px; white-space: nowrap; }
td { vertical-align: middle; }
tr:hover td { background: var(--primary-light); }
.product-thumb { width: 48px; height: 48px; border-radius: var(--radius); object-fit: cover; background: var(--bg); }
.product-name-cell { display: flex; align-items: center; gap: 12px; }

/* 状态标签 */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-online { background: var(--success-light); color: var(--success); }
.badge-offline { background: var(--danger-light); color: var(--danger); }
.badge-rejected { background: var(--danger-light); color: var(--danger); }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; }
.page-btn { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 13px; background: var(--surface); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 搜索筛选栏 */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar .form-input { width: 220px; }
.filter-bar select { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; background: var(--surface); }

/* 商品编辑表单 */
.edit-form { max-width: 720px; }
.edit-form .form-group { margin-bottom: 24px; }
.edit-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.edit-form textarea { width: 100%; min-height: 120px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; resize: vertical; outline: none; font-family: inherit; }
.edit-form textarea:focus { border-color: var(--primary); }

/* 图片上传 */
.upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px; text-align: center; cursor: pointer; transition: all 0.2s; }
.upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-area i { font-size: 32px; color: var(--text-muted); }
.upload-area p { color: var(--text-secondary); margin-top: 8px; font-size: 13px; }
.image-preview { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.image-preview-item { position: relative; width: 100px; height: 100px; border-radius: var(--radius); overflow: hidden; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-btn { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; }

/* 数据中心 */
.chart-container { height: 300px; position: relative; }
.data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.data-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.data-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.data-list { list-style: none; }
.data-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-list li:last-child { border-bottom: none; }
.data-list .label { color: var(--text-secondary); }
.data-list .value { font-weight: 600; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px 20px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; font-size: 14px; animation: slideIn 0.3s ease; min-width: 280px; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; margin-bottom: 20px; }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .edit-form .form-row { grid-template-columns: 1fr; }
}

/* 支付进件 */
.onboard-notice { display: flex; align-items: flex-start; gap: 16px; padding: 20px; border-radius: var(--radius); margin-bottom: 16px; }
.onboard-notice i { font-size: 24px; margin-top: 2px; }
.onboard-notice h4 { font-size: 15px; margin-bottom: 4px; }
.onboard-notice p { font-size: 13px; margin: 0; }
.onboard-notice-warn { background: var(--warning-light); color: #856404; border: 1px solid #ffc107; }
.onboard-notice-info { background: #e8f4fd; color: #0c5460; border: 1px solid #bee5eb; }
.onboard-notice-success { background: var(--success-light); color: #155724; border: 1px solid #28a745; }
.onboard-notice-error { background: var(--danger-light); color: #721c24; border: 1px solid #ba1a1a; }
.onboard-success-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--success); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; flex-shrink: 0; }
.onboard-pending-icon { font-size: 36px; flex-shrink: 0; }
.onboard-reject-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; flex-shrink: 0; }
.onboard-data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; padding: 16px; background: var(--bg); border-radius: var(--radius); }
.onboard-data-item { display: flex; flex-direction: column; gap: 2px; }
.onboard-data-item .label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.onboard-data-item .value { font-size: 14px; color: var(--text); word-break: break-all; }
.onboard-logs { max-height: 300px; overflow-y: auto; font-size: 12px; font-family: monospace; background: #1a1a2e; color: #e0e0e0; padding: 12px; border-radius: var(--radius); }
.log-line { padding: 2px 0; display: flex; gap: 8px; }
.log-time { color: #888; flex-shrink: 0; }
.log-line.info .log-msg { color: #8f8; }
.log-line.error .log-msg { color: #f88; }
.log-line.warn .log-msg { color: #ff8; }
@media (max-width: 768px) { .onboard-data-grid { grid-template-columns: 1fr; } }

/* 导航徽章 */
.nav-badge { font-size:11px; padding:1px 6px; border-radius:10px; margin-left:auto; }
.nav-badge-success { background:#28a745; color:#fff; }
.nav-badge-pending { background:#ffc107; color:#333; }
.nav-badge-error { background:#dc3545; color:#fff; }
