/* ============================================
   在京助手 H5 - 全局样式
   现代简约设计系统
   ============================================ */

:root {
  --primary: #4F6EF7;
  --primary-dark: #3D56D4;
  --primary-light: #EEF1FE;
  --success: #10B981;
  --success-light: #ECFDF5;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --bg-primary: #F8FAFC;
  --bg-white: #FFFFFF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --header-height: 48px;
  --tabbar-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom));
}

body.no-tabbar { padding-bottom: 0; }

/* ========== Header ========== */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px;
}
.header-back {
  position: absolute; left: 12px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  border-radius: 50%; color: var(--text-primary);
}
.header-back:active { background: var(--border-light); }
.header-back svg { width: 24px; height: 24px; }
.header-title {
  font-size: 17px; font-weight: 600;
  color: var(--text-primary); letter-spacing: -0.3px;
}

/* ========== Bottom TabBar ========== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  height: var(--tabbar-height);
  padding-bottom: var(--safe-bottom);
  display: flex; align-items: center;
}
.tabbar-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; text-decoration: none; color: var(--text-muted);
  font-size: 11px; font-weight: 500; cursor: pointer;
  transition: color 0.2s;
}
.tabbar-item.active { color: var(--primary); }
.tabbar-item svg { width: 24px; height: 24px; }

/* ========== Page Content ========== */
.page-content {
  padding-top: calc(var(--header-height) + 16px);
  padding-left: 16px; padding-right: 16px;
  padding-bottom: 20px;
}

/* ========== Card ========== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

/* ========== Button ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 24px;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.2s;
  text-decoration: none; color: #fff;
  gap: 8px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn-lg { height: 52px; font-size: 17px; border-radius: var(--radius-xl); }
.btn:disabled {
  opacity: 0.5; pointer-events: none;
}

/* ========== Form ========== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 6px;
}
.form-input {
  width: 100%; height: 48px; padding: 0 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 15px; color: var(--text-primary);
  background: var(--bg-white); outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--text-muted); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ========== Badge / Tag ========== */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 100px; font-size: 12px; font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-muted { background: var(--border-light); color: var(--text-muted); }

/* ========== Toast ========== */
.toast-container {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 24px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; color: #fff;
  white-space: nowrap; box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ========== Modal ========== */
.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-white); border-radius: var(--radius-xl);
  width: 100%; max-width: 340px; overflow: hidden;
  box-shadow: var(--shadow-lg); animation: scaleIn 0.2s ease;
}
.modal-header {
  padding: 24px 24px 0; text-align: center;
  font-size: 18px; font-weight: 700; color: var(--text-primary);
}
.modal-body { padding: 16px 24px 24px; font-size: 15px; color: var(--text-secondary); text-align: center; line-height: 1.6; }
.modal-footer { display: flex; border-top: 1px solid var(--border); }
.modal-footer .btn {
  flex: 1; height: 48px; border-radius: 0; font-size: 15px;
  background: none; color: var(--primary);
}
.modal-footer .btn:first-child { border-right: 1px solid var(--border); color: var(--text-muted); }
.modal-footer .btn:active { background: var(--border-light); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ========== Loading ========== */
.loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.8); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Empty State ========== */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state svg { width: 80px; height: 80px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-text { font-size: 15px; }

/* ========== License Plate ========== */
.plate-sim {
  display: inline-flex; align-items: center; border-radius: 6px;
  padding: 6px 14px; font-family: "PingFang SC","DIN Alternate","Arial",sans-serif;
  font-weight: 800; font-size: 20px; letter-spacing: 2px;
  min-width: 120px; justify-content: center;
}
.plate-sim--blue { background: #1A3A8F; color: #fff; border: 2px solid #0F2560; }
.plate-sim--green { background: linear-gradient(180deg,#EAF8F0,#B8E9CE,#6FD49A); color: #0D0D0D; border: 2px solid #4DC480; }

/* ========== Utils ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
