/* 瑞亿智能打车系统 - 公共样式 */

:root {
  --primary: #2f6bff;
  --primary-dark: #1f52d8;
  --primary-light: #eaf1ff;
  --success: #18b364;
  --warning: #ff9500;
  --danger: #f5453c;
  --text: #1a1d24;
  --text-2: #5b6270;
  --text-3: #98a0ae;
  --border: #e8ebf0;
  --bg: #f5f7fa;
  --card: #fff;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(20, 30, 50, 0.06);
  --shadow-lg: 0 8px 32px rgba(20, 30, 50, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

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

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- 手机外壳（桌面预览用，移动端自动全屏） ---------- */
.phone-frame {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}
@media (min-width: 480px) {
  body.framed { background: #e9edf2; padding: 20px 0; }
  body.framed .phone-frame {
    min-height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }
}

/* ---------- 顶部导航 ---------- */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: calc(var(--safe-top) + 14px) 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 10;
}
.navbar .back {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16); font-size: 20px; line-height: 1;
  color: #fff; flex-shrink: 0;
}
.navbar .title { flex: 1; font-size: 17px; font-weight: 600; }
.navbar .actions { display: flex; gap: 8px; align-items: center; }
.navbar .badge {
  position: absolute; top: 8px; right: 10px;
  background: var(--danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  font-size: 15px; font-weight: 600;
}
.card-title .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  background: var(--primary); color: #fff;
  transition: transform .12s, opacity .12s, background .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { display: flex; width: 100%; }
.btn.lg { padding: 14px 20px; font-size: 16px; }
.btn.ghost { background: var(--primary-light); color: var(--primary); }
.btn.outline { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- 表单 ---------- */
.field { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.field:last-child { border-bottom: none; }
.field-row { display: flex; align-items: center; gap: 12px; }
.field-label { font-size: 13px; color: var(--text-2); width: 84px; flex-shrink: 0; }
.field-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 15px; color: var(--text); min-width: 0;
}
.field-input::placeholder { color: var(--text-3); }
.arrow { color: var(--text-3); font-size: 16px; flex-shrink: 0; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 500;
  background: var(--primary-light); color: var(--primary);
}
.tag.gray { background: #f0f2f5; color: var(--text-2); }
.tag.green { background: #e6f7ee; color: var(--success); }
.tag.orange { background: #fff3e0; color: var(--warning); }
.tag.red { background: #ffeceb; color: var(--danger); }

/* ---------- 状态 ---------- */
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pending { color: var(--warning); }
.status.assigned, .status.accepted { color: var(--primary); }
.status.pickup, .status.ongoing { color: var(--success); }
.status.completed { color: var(--text-3); }
.status.cancelled, .status.exception { color: var(--danger); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(26, 29, 36, 0.92); color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; z-index: 9999; max-width: 80%;
  text-align: center; pointer-events: none;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,-46%); } to { opacity: 1; transform: translate(-50%,-50%); } }

.loading { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .icon { font-size: 44px; margin-bottom: 12px; opacity: .5; }
.empty .text { font-size: 14px; }

/* ---------- 底部固定条 ---------- */
.bottom-bar {
  position: sticky; bottom: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--border);
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -2px 12px rgba(20,30,50,.05);
}
.bottom-bar .price-info { flex: 1; min-width: 0; }
.bottom-bar .price { font-size: 22px; font-weight: 700; color: var(--danger); }
.bottom-bar .price-note { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ---------- 适老化模式 ---------- */
body.care-mode { font-size: 17px; }
body.care-mode .navbar { padding-top: calc(var(--safe-top) + 18px); padding-bottom: 18px; }
body.care-mode .navbar .title { font-size: 20px; }
body.care-mode .field { padding: 16px; }
body.care-mode .field-input { font-size: 18px; }
body.care-mode .btn { font-size: 18px; padding: 14px 20px; }
body.care-mode .card-title { font-size: 17px; padding: 18px 16px 12px; }
body.care-mode .tag { font-size: 13px; padding: 5px 10px; }
body.care-mode .hide-in-care { display: none !important; }

/* ---------- 滚动 ---------- */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
