/* ============================================================
   根哥收款中心 - 样式系统
   ============================================================ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f8fafc;
  --card: #fff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-sec: #64748b;
  --text-light: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: 12px; color: var(--text-sec); }

/* ── Utilities ── */
.mono { font-family: 'SF Mono', 'Cascadia Code', Consolas, 'Courier New', monospace; }
.amount { font-weight: 700; text-align: right; white-space: nowrap; }
.time { white-space: nowrap; color: var(--text-sec); font-size: 13px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: #f1f5f9; border-color: #cbd5e1; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-outline { background: transparent; }
.btn-outline.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 4px; }

/* ── Badges & Tags ── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; background: #f1f5f9; color: var(--text-sec);
}
.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-success { background: #d1fae5; color: #059669; }
.status-tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
}
.status-pending { background: #fef3c7; color: #d97706; }
.status-paid { background: #d1fae5; color: #059669; }
.status-cancelled { background: #fee2e2; color: #dc2626; }
.status-refunded { background: #f1f5f9; color: #64748b; }

/* ── Cards ── */
.card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 24px; box-shadow: var(--shadow);
}
.card h2 { font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; font-weight: 600; color: var(--text-sec); text-transform: uppercase; letter-spacing: .5px; background: #f8fafc; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }
.table-sm th, .table-sm td { padding: 8px 10px; font-size: 13px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--text); }
.form-input, .form-textarea, select.form-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: var(--card); transition: border-color .15s;
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-section h3 { font-size: 15px; margin-bottom: 12px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; line-height: 1.5; }
.form-actions { margin-top: 24px; display: flex; gap: 12px; }
.input-group { display: flex; gap: 8px; }
.input-group .form-input { flex: 1; }

/* ── Page Header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 24px; font-weight: 700; }

/* ── Filter Bar ── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Loading / Empty ── */
.loading { padding: 60px 20px; text-align: center; color: var(--text-sec); font-size: 15px; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-sec); font-size: 14px; }

/* ============================================================
   Admin Layout
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; min-width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px; font-weight: 700; font-size: 16px;
  color: #fff; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon { font-size: 24px; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--sidebar-text); font-size: 14px; font-weight: 500; transition: all .15s;
  text-decoration: none; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(59,130,246,.2); color: #93c5fd; }
.nav-icon { display: flex; align-items: center; flex-shrink: 0; width: 20px; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer .nav-item { border: none; background: none; width: 100%; text-align: left; }

.admin-main { flex: 1; padding: 32px; overflow-y: auto; max-width: 1200px; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 48px 40px; width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.login-header h1 { font-size: 22px; margin-bottom: 4px; }
.login-header p { font-size: 14px; color: var(--text-sec); }

/* ============================================================
   Stats Grid
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.stat-icon { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-info { display: flex; flex-direction: column; }
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-sec); margin-top: 2px; }

/* ============================================================
   Buy Page (Public)
   ============================================================ */
.buy-page { max-width: 960px; margin: 0 auto; padding: 40px 20px; }
.buy-header { text-align: center; margin-bottom: 40px; }
.buy-back { display: inline-block; margin-bottom: 20px; font-size: 14px; color: var(--text-sec); }
.buy-logo { max-width: 80px; max-height: 80px; margin-bottom: 16px; border-radius: 16px; }
.buy-header h1 { font-size: 32px; margin-bottom: 8px; }
.buy-header p { color: var(--text-sec); font-size: 16px; }

.plans-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px;
  margin-bottom: 40px;
}
.plan-card {
  background: var(--card); border-radius: var(--radius); border: 2px solid var(--border);
  padding: 28px 24px; transition: all .2s; cursor: pointer; position: relative;
}
.plan-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.plan-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.plan-header { text-align: center; margin-bottom: 20px; }
.plan-header h3 { font-size: 20px; margin-bottom: 12px; }
.plan-price { display: flex; align-items: baseline; justify-content: center; }
.price-num { font-size: 36px; font-weight: 800; color: var(--primary); line-height: 1; }
.price-period { font-size: 14px; color: var(--text-sec); margin-left: 2px; }
.plan-features { list-style: none; margin-bottom: 24px; }
.plan-features li { padding: 8px 0; font-size: 14px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #f8fafc; }
.plan-features li.disabled { color: var(--text-light); text-decoration: line-through; }
.plan-features li:last-child { border-bottom: none; }

.order-form { margin-top: 32px; }
.order-form .card { max-width: 600px; margin: 0 auto; }

.success-card { text-align: center; padding: 40px; }
.success-icon { font-size: 48px; margin-bottom: 16px; }
.success-card h2 { font-size: 22px; margin-bottom: 12px; justify-content: center; }
.payment-info { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.payment-tips { padding: 16px; background: #fef3c7; border-radius: 8px; font-size: 14px; }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed; top: 24px; right: 24px; z-index: 9999;
  padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.15); transition: opacity .3s;
  max-width: 380px; word-break: break-all;
}
.toast-info { background: var(--primary); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; min-width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .sidebar-brand { width: 100%; padding: 12px; border-bottom: none; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 4px; }
  .nav-item { font-size: 12px; padding: 6px 10px; }
  .admin-main { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .plans-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .table { display: block; overflow-x: auto; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { width: 90%; padding: 32px 24px; }
}
