/* =========================================================
 * 空调·地暖清洗预约下单系统 - 主样式
 * 移动端优先 + 浅色主题
 * ========================================================= */

:root {
  --primary: #16a085;          /* 主色：清洗类业务蓝绿 */
  --primary-dark: #0e7c66;
  --primary-light: #e8f6f3;
  --accent: #f39c12;          /* 强调色：橙（支付按钮） */
  --danger: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --info: #3498db;

  --text-1: #1f2933;
  --text-2: #52606d;
  --text-3: #7b8794;
  --text-4: #9aa5b1;

  --bg-page: #f5f7fa;
  --bg-card: #ffffff;
  --bg-muted: #f0f3f7;

  --border: #e4e7eb;
  --border-strong: #cbd2d9;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --max-w: 480px;            /* 移动端容器最大宽度 */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg-page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; outline: none; }

/* ============ 顶部 App Bar ============ */
.appbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.appbar .title { font-size: 16px; font-weight: 600; }
.appbar .action { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,0.18); color: #fff; }
.appbar .action:active { background: rgba(255,255,255,0.3); }
.appbar .back { font-size: 18px; padding: 4px 8px; color: #fff; }

/* ============ 主容器 ============ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px;
}

/* ============ 头图/Banner ============ */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 16px 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.hero h1 { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.hero p { margin: 0; font-size: 12px; opacity: 0.9; }
.hero .price-hint {
  margin-top: 12px; padding: 8px 12px;
  background: rgba(255,255,255,0.16);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

/* ============ 卡片 ============ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 14px; font-weight: 600; color: var(--text-1);
  margin: 0 0 12px; display: flex; align-items: center; gap: 6px;
}
.card-title::before {
  content: ''; display: inline-block; width: 3px; height: 14px;
  background: var(--primary); border-radius: 2px;
}

/* ============ 表单 ============ */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 10px 12px;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-1); font-size: 14px;
  transition: all 0.15s;
}
.form-control:focus {
  background: #fff; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.12);
}
.form-control.error { border-color: var(--danger); background: #fef3f2; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; min-height: 14px; }
textarea.form-control { min-height: 76px; resize: vertical; }

/* 三级地址 */
.address-row { display: flex; gap: 8px; margin-bottom: 8px; }
.address-row select { flex: 1; }

/* 数字步进器 */
.stepper {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-muted); border-radius: var(--radius-sm); padding: 4px;
  width: fit-content;
}
.stepper button {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: #fff; color: var(--primary);
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.stepper button:active { background: var(--primary-light); }
.stepper input {
  width: 56px; text-align: center; font-size: 16px; font-weight: 600;
  background: transparent; border: none;
}

/* ============ 清洗等级切换 ============ */
.level-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.level-btn {
  text-align: center; padding: 14px 8px; border-radius: var(--radius-md);
  background: var(--bg-muted); border: 2px solid transparent;
  transition: all 0.15s;
}
.level-btn.active {
  background: var(--primary-light); border-color: var(--primary);
}
.level-btn .level-name { font-size: 14px; font-weight: 600; color: var(--text-1); }
.level-btn.active .level-name { color: var(--primary-dark); }
.level-btn .level-price { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.level-btn.active .level-price { color: var(--primary); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:active { background: #d68910; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: var(--bg-muted); color: var(--text-2); }
.btn-ghost:active { background: #e4e7eb; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ 订单卡片 ============ */
.order-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.order-card .head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px dashed var(--border);
}
.order-card .head .oid { font-size: 12px; color: var(--text-3); }
.order-card .body { padding: 12px 16px; font-size: 13px; color: var(--text-2); }
.order-card .body .row { display: flex; gap: 8px; margin-bottom: 6px; }
.order-card .body .row .k { color: var(--text-3); width: 72px; flex-shrink: 0; }
.order-card .body .row .v { color: var(--text-1); flex: 1; word-break: break-all; }
.order-card .foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg-muted);
}
.order-card .foot .amount { font-size: 16px; font-weight: 700; color: var(--accent); }

/* 状态徽章 */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge-pending { background: #fff4e6; color: #d97706; }
.badge-paid    { background: #e6f7ff; color: #096dd9; }
.badge-serving { background: #f0f5ff; color: #2f54eb; }
.badge-done    { background: #e6f8ed; color: #1e8e3e; }
.badge-cancelled { background: #fde8e8; color: #c0392b; }
.badge-refunded  { background: #fef0f0; color: #e74c3c; }

/* ============ Tabs ============ */
.tabs {
  display: flex; background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.tabs .tab {
  flex: 1; padding: 12px 0; text-align: center;
  font-size: 13px; color: var(--text-3); position: relative;
}
.tabs .tab.active { color: var(--primary); font-weight: 600; }
.tabs .tab.active::after {
  content: ''; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 24px; height: 3px; background: var(--primary); border-radius: 2px;
}

/* ============ 空状态 ============ */
.empty {
  text-align: center; padding: 60px 16px; color: var(--text-3);
}
.empty .icon { font-size: 48px; margin-bottom: 8px; opacity: 0.5; }
.empty .text { font-size: 13px; }

/* ============ Toast ============ */
.toast-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.4); display: flex;
  align-items: center; justify-content: center;
}
.toast {
  background: #fff; border-radius: var(--radius-md);
  padding: 20px 24px; min-width: 240px; max-width: 80%;
  text-align: center; box-shadow: var(--shadow-lg);
}
.toast .icon { font-size: 36px; margin-bottom: 8px; }
.toast .title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.toast .text { font-size: 13px; color: var(--text-3); }

/* ============ 收银台 ============ */
.cashier {
  text-align: center; padding: 8px 0;
}
.cashier .amount {
  font-size: 36px; font-weight: 700; color: var(--text-1);
  margin: 12px 0 4px;
}
.cashier .amount::before { content: '¥'; font-size: 18px; vertical-align: top; margin-right: 2px; color: var(--text-3); }
.cashier .sub { font-size: 12px; color: var(--text-3); }

.pay-channel {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--bg-muted);
  border-radius: var(--radius-md); margin-bottom: 10px;
}
.pay-channel .logo {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
}
.pay-channel .name { flex: 1; font-size: 14px; font-weight: 500; }
.pay-channel .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); }
.pay-channel.active .radio { border-color: var(--primary); background: var(--primary) radial-gradient(circle, #fff 30%, transparent 30%); }
.pay-channel.wx { background: linear-gradient(135deg, #f0fff4 0%, #fff 100%); }
.pay-channel.ali { background: linear-gradient(135deg, #f0f7ff 0%, #fff 100%); }

/* ============ 加载与支付处理中 ============ */
.loading-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6); display: flex;
  align-items: center; justify-content: center;
}
.spinner {
  width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; margin-top: 12px; font-size: 14px; }

/* ============ 后台样式 ============ */
.admin-layout { min-height: 100vh; background: var(--bg-page); }
.admin-header {
  background: var(--primary-dark); color: #fff;
  padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
}
.admin-header .title { font-size: 16px; font-weight: 600; }
.admin-header .sub { font-size: 12px; opacity: 0.8; }
.admin-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--border); overflow-x: auto; }
.admin-tabs .tab { flex: 1; min-width: 80px; padding: 12px 8px; text-align: center; font-size: 13px; color: var(--text-3); white-space: nowrap; }
.admin-tabs .tab.active { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); }
.admin-content { padding: 16px; max-width: 1200px; margin: 0 auto; }

/* ============ 登录页 ============ */
.admin-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}
.login-card {
  background: #fff; padding: 32px 28px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 90%; max-width: 360px; text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-title { font-size: 18px; font-weight: 600; color: var(--text-1); }
.login-sub { font-size: 12px; color: var(--text-3); margin: 4px 0 20px; }
.login-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.login-reset { display: block; font-size: 12px; color: var(--text-3); margin-top: 8px; }
.login-client { display: block; font-size: 12px; color: var(--primary); margin-top: 4px; }

/* ============ 响应式 ============ */
.desktop-only { display: block; }
.mobile-only { display: none; }

@media (max-width: 768px) {
  .admin-content { padding: 10px; }
  .admin-tabs .tab { font-size: 12px; min-width: 70px; padding: 10px 4px; }
  .admin-header .title { font-size: 14px; }
  .admin-header .sub { display: none; }
  .desktop-only { display: none; }
  .mobile-only { display: block; }
  .filter-bar { padding: 8px; gap: 6px; }
  .filter-bar select, .filter-bar input { width: 100% !important; }
  .stats-row .stat-card { min-width: 100px; padding: 10px; }
  .stats-row .stat-card .num { font-size: 18px; }
}

.filter-bar {
  background: #fff; padding: 12px; border-radius: var(--radius-md);
  margin-bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.filter-bar select, .filter-bar input {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.filter-bar .date-field { display: flex; flex-direction: column; gap: 2px; }
.filter-bar .date-label { font-size: 11px; color: #9aa5b1; padding-left: 2px; }

.table-wrap { background: #fff; border-radius: var(--radius-md); overflow: auto; box-shadow: var(--shadow-sm); }
table.data {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 800px;
}
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.data th { background: var(--bg-muted); color: var(--text-2); font-weight: 600; position: sticky; top: 0; }
table.data tr:hover { background: var(--primary-light); }
table.data .ops { display: flex; gap: 6px; flex-wrap: wrap; }

.stats-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 120px; background: #fff; padding: 14px;
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.stat-card .num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ============ 模态框 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.5); display: flex;
  align-items: center; justify-content: center;
}
.modal {
  background: #fff; border-radius: var(--radius-lg);
  width: 90%; max-width: 360px; padding: 20px;
  box-shadow: var(--shadow-lg);
}
.modal .title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal .actions { display: flex; gap: 8px; margin-top: 16px; }

/* ============ 详情列表 ============ */
.detail-list .item {
  display: flex; padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.detail-list .item .k { width: 100px; color: var(--text-3); font-size: 13px; }
.detail-list .item .v { flex: 1; color: var(--text-1); font-size: 13px; word-break: break-all; }

/* ============ 工具类 ============ */
.text-muted { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
