/* ===== 仁护通 H5 移动端样式（功能优先，最简适配） ===== */

:root {
  --primary: #F36B21;
  --primary-dark: #D85A14;
  --primary-light: #FFF0E8;
  --text: #1F2A30;
  --text-2: #4E5961;
  --text-3: #8A949B;
  --border: #EDEFF1;
  --bg: #FFF8F5;
  --bg-card: #FFFFFF;
  --success: #2BA471;
  --warning: #E8912D;
  --danger: #D93F3F;
  --shadow-sm: 0 4px 16px rgba(16, 63, 66, .06);
  --shadow-md: 0 12px 32px rgba(16, 63, 66, .10);
  --radius: 16px;
  --radius-sm: 10px;
}

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

html, body {
  font-family: 'Noto Sans SC', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

/* ===== 关系选择 ===== */
.role-brand-logo { display: block; width: 86px; height: auto; margin: 12vh auto 14px; }
.login-header h1 { color: var(--primary); letter-spacing: .08em; }
.login-header p { color: var(--text-2); }
.role-choice-list { display: grid; gap: 14px; margin: 8vh 0 0; }
.role-choice { display: flex; align-items: center; gap: 14px; width: 100%; padding: 20px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--text); text-align: left; box-shadow: 0 6px 18px rgba(31,42,48,.06); }
.role-choice:active { background: var(--primary-light); border-color: var(--primary); }
.role-choice-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-size: 24px; }
.role-choice-content { display: grid; gap: 3px; flex: 1; }
.role-choice-content strong { font-size: 16px; }
.role-choice-content small { color: var(--text-3); font-size: 12px; }

/* ===== 页面容器 ===== */
.page {
  display: none;
  min-height: 100vh;
  padding: 12px;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

.page.active {
  display: block;
}

/* 有底部操作栏的页面 */
#page-service-select.page,
#page-order-confirm.page {
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ===== 顶部栏 ===== */
.top-bar {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.top-bar-location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.arrow {
  color: var(--text-3);
  font-size: 18px;
}

/* ===== 导航栏 ===== */
.navbar {
  display: flex;
  align-items: center;
  height: 44px;
  margin: -12px -12px 12px;
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

.navbar-back {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 24px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  margin-right: 32px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(31, 42, 48, 0.04);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ===== 表单 ===== */
.form-label {
  display: block;
  font-size: 14px;
  color: var(--text-2);
  margin: 12px 0 6px;
}

.form-label:first-child {
  margin-top: 0;
}

.required {
  color: var(--danger);
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
}

.input:focus {
  border-color: var(--primary);
}

.textarea {
  height: auto;
  min-height: 80px;
  padding: 12px;
  resize: vertical;
}

.select-input {
  border: none;
  background: transparent;
  font-size: 15px;
  text-align: right;
  outline: none;
  flex: 1;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.7;
}

.btn:disabled {
  opacity: 0.5;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-block {
  display: flex;
  width: 100%;
  margin-top: 16px;
}

/* ===== 首页 ===== */
.home-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius);
  padding: 24px 16px;
  margin-bottom: 12px;
  color: #fff;
}

.home-banner h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.home-banner p {
  font-size: 13px;
  opacity: 0.9;
}

.select-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.select-row:last-child {
  border-bottom: none;
}

.select-label {
  font-size: 14px;
  color: var(--text-2);
  width: 80px;
  flex-shrink: 0;
}

.select-value {
  flex: 1;
  font-size: 15px;
  text-align: right;
  color: var(--text-3);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(31, 42, 48, 0.04);
}

.action-item:active {
  background: var(--primary-light);
}

.action-icon {
  font-size: 28px;
}

/* ===== 登录页 ===== */
.login-header {
  text-align: center;
  padding: 40px 0 24px;
}

.login-header h1 {
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 8px;
}

.login-header p {
  font-size: 14px;
  color: var(--text-2);
}

.login-card {
  margin-top: 16px;
}

.code-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.code-row .input {
  flex: 1;
}

.code-row .btn {
  white-space: nowrap;
  padding: 0 12px;
  font-size: 13px;
}

.agreement-row {
  margin: 16px 0;
  font-size: 13px;
  color: var(--text-2);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
}

.phone-display {
  height: 44px;
  line-height: 44px;
  padding: 0 12px;
  background: #f5f5f5;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text-2);
}

/* ===== 信息行 ===== */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row span:first-child {
  color: var(--text-2);
}

.info-row span:last-child {
  color: var(--text);
  text-align: right;
}

/* ===== 搜索栏 ===== */
.search-bar {
  margin-bottom: 12px;
}

/* ===== 列表项 ===== */
.list-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(31, 42, 48, 0.04);
}

.list-item:active {
  background: var(--primary-light);
}

.list-item-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.list-item-desc {
  font-size: 13px;
  color: var(--text-3);
}

/* ===== 套餐选择 ===== */
.package-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.package-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.package-card-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.package-card-desc {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.package-card-price {
  font-size: 16px;
  color: var(--primary);
  font-weight: 600;
}

/* ===== 天数选择 ===== */
.days-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.days-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 18px;
  cursor: pointer;
}

.days-input {
  width: 60px;
  height: 36px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
}

.days-unit {
  font-size: 14px;
  color: var(--text-2);
}

/* ===== 底部操作栏 ===== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  box-shadow: 0 -2px 12px rgba(31, 42, 48, 0.06);
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 150;
  max-width: 100%;
}

.price-info {
  display: flex;
  flex-direction: column;
}

.price-label {
  font-size: 12px;
  color: var(--text-3);
}

.price-amount {
  font-size: 20px;
  color: var(--primary);
  font-weight: 700;
}

/* ===== 订单筛选 ===== */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.filter-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.filter-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== 订单卡片 ===== */
.order-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(31, 42, 48, 0.04);
  cursor: pointer;
}

.order-card:active {
  background: var(--primary-light);
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.order-id {
  font-size: 13px;
  color: var(--text-3);
}

.order-status {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.status-confirmed { background: #FEF2E5; color: var(--warning); }
.status-pending { background: #E8F0FE; color: #3A7DD9; }
.status-active { background: #E8F7F0; color: var(--success); }
.status-completed { background: #F0F0F0; color: var(--text-3); }
.status-cancelled { background: #FCE8E8; color: var(--danger); }

.order-info {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.8;
}

.order-amount {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.order-amount-price {
  font-size: 18px;
  color: var(--primary);
  font-weight: 700;
}

.order-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.order-actions .btn {
  flex: 1;
  height: 36px;
  font-size: 14px;
  margin-top: 0;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 14px;
}

/* ===== 我的页面 ===== */
.mine-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mine-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.mine-info {
  flex: 1;
}

.mine-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
}

.mine-phone {
  font-size: 13px;
  color: var(--text-3);
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 15px;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:active {
  color: var(--primary);
}

/* ===== 照护师卡片 ===== */
.caregiver-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(31, 42, 48, 0.04);
}

.caregiver-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.caregiver-name {
  font-size: 16px;
  font-weight: 600;
}

.caregiver-level {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.caregiver-info {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.8;
}

.caregiver-price {
  font-size: 16px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 8px;
}

/* ===== 患者档案 ===== */
.patient-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(31, 42, 48, 0.04);
}

.patient-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.patient-info {
  font-size: 13px;
  color: var(--text-3);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

/* ===== 底部导航 ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  box-shadow: 0 -2px 12px rgba(31, 42, 48, 0.06);
  z-index: 200;
  border-top: 1px solid var(--border);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
}

.tab-item.active {
  color: var(--primary);
}

.tab-icon {
  font-size: 20px;
}

.tab-label {
  font-size: 11px;
}

/* ===== 隐藏底部导航的页面 ===== */
.tab-bar.hidden {
  display: none;
}

/* ===== 协议链接 ===== */
.agreement-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
}

.agreement-link:active {
  opacity: 0.7;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-panel {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 24px;
  color: var(--text-3);
  cursor: pointer;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-2);
}

.modal-body h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.modal-body p {
  margin-bottom: 8px;
}

.page { padding: 18px 16px calc(78px + env(safe-area-inset-bottom)); }
.navbar { height: 52px; margin: -18px -16px 18px; padding: 0 16px; background: rgba(244,248,247,.92); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(220,233,232,.7); }
.navbar-title { font-size: 16px; letter-spacing: .02em; }
.top-bar { margin-bottom: 18px; }
.card { border: 1px solid rgba(220,233,232,.82); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.btn { min-height: 44px; border-radius: 12px; font-weight: 650; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.btn:active { transform: scale(.98); }
.input, select, textarea { min-height: 44px; border: 1px solid var(--border); border-radius: 11px; background: #FBFDFC; color: var(--text); }
.input:focus, select:focus, textarea:focus { outline: 3px solid rgba(11,107,104,.12); border-color: var(--primary); }
.role-choice-list { margin: 26vh 0 0; gap: 12px; }
.role-choice { border: 1px solid rgba(220,233,232,.9); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 18px; transition: transform .2s ease, box-shadow .2s ease; }
.role-choice:active { transform: translateY(1px); box-shadow: none; }
.role-choice-icon { background: var(--primary-light); }
.bottom-tabbar { background: rgba(255,255,255,.94); backdrop-filter: blur(16px); border-top: 1px solid var(--border); }
.badge { border-radius: 999px; font-weight: 650; }
@media (min-width: 700px) {
  body { max-width: 640px; margin: 0 auto; background: #EAF1EF; }
  .page { background: var(--bg); min-height: 100vh; }
}

.modal-panel .btn {
  margin: 12px 16px 16px;
  width: calc(100% - 32px);
  height: 44px;
  border-radius: 22px;
  font-size: 15px;
}
