/* ==========================================================================
   校里 Campus · 增量样式（在 style.css 基础上补充新组件）
   ========================================================================== */

/* 预设头像选择 */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.avatar-option {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 16px;
  padding: 9px 6px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 650;
  color: var(--muted);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.avatar-option .avatar { width: 46px; height: 46px; font-size: 17px; }
.avatar-option:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.avatar-option.is-active {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(239, 91, 60, .1);
}

/* 上传 */
.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 104px;
  padding: 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.upload-box:hover { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-dark); }
.upload-box .icon { width: 24px; height: 24px; margin-bottom: 2px; }
.upload-box small { font-size: 10px; color: var(--muted-2); }
.upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 11px;
  color: var(--muted);
}
.upload-preview img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 9px;
  background: #fff;
}

/* 登录弹窗顶部为自定义深色头，不显示通用 modal-head */
.auth-modal .modal-head { display: none; }

/* 登录 / 注册弹窗必须可滚动（手机端尤其重要） */
.modal.auth-modal {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.auth-modal .auth-top {
  position: sticky;
  top: 0;
  z-index: 2;
}
.auth-modal .auth-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}
.auth-modal .auth-close:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}
.auth-modal .auth-body {
  background: var(--surface);
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

/* 其他弹窗的触摸滚动 */
.modal {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: min(88vh, 900px);
  max-height: min(88dvh, 900px);
}

/* 深色卡片上的玻璃按钮（hero 之外的通用版本） */
.btn-glass {
  --btn-bg: rgba(255, 255, 255, 0.1);
  --btn-fg: #fff;
  border-color: rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(10px);
}
.btn-glass:hover { --btn-bg: rgba(255, 255, 255, 0.16); }

/* 支付结果 */
.pay-result { text-align: center; padding: 4px 0 2px; }
.pay-result-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 22px;
  display: grid;
  place-items: center;
}
.pay-result-icon .icon { width: 32px; height: 32px; stroke-width: 2.4; }
.pay-result-success .pay-result-icon { background: var(--success-soft); color: var(--success); }
.pay-result-fail .pay-result-icon { background: var(--danger-soft); color: var(--danger); }
.pay-result-title { font-size: 20px; font-weight: 850; letter-spacing: -.025em; }
.pay-result-text { color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 6px; }
.pay-result .fee-box { text-align: left; }

/* 服务商推荐 */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.provider-mini {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.provider-mini .pill { margin-left: auto; }

/* 开发者诊断 */
.dev-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dev-status {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.dev-status-icon {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: none;
}
.dev-status.ok .dev-status-icon { background: var(--success-soft); color: var(--success); }
.dev-status.bad .dev-status-icon { background: var(--danger-soft); color: var(--danger); }
.dev-status-label { font-size: 12px; font-weight: 750; }
.dev-status-detail { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.missing-cols { display: flex; flex-wrap: wrap; gap: 6px; }
.missing-cols code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  background: var(--danger-soft);
  color: #8f2929;
  padding: 5px 8px;
  border-radius: 7px;
}

/* 表单 / 列表微调 */
.modal-body .field:last-child { margin-bottom: 0; }
.field-row .field { margin-bottom: 0; }
.search-box { max-width: 420px; }
.queue-card .queue-actions .btn { margin-left: 0; }
.queue-card .queue-meta { line-height: 1.7; }
.notice-card .btn { flex: none; }
.profile-id button:hover { color: #fff; }
.wallet-mini { width: 100%; cursor: pointer; text-align: left; }
.wallet-mini:hover { filter: brightness(1.05); }

/* 订单详情状态行 */
.order-detail-grid .page-sub .status { vertical-align: middle; }

/* 管理端工具条 */
.toolbar .select { max-width: 180px; }
.console-tabs { scrollbar-width: thin; }

/* 小屏适配 */
@media (max-width: 720px) {
  .avatar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .avatar-option { padding: 7px 4px 5px; }
  .avatar-option .avatar { width: 40px; height: 40px; font-size: 15px; }
  .provider-grid { grid-template-columns: 1fr; }
  .dev-status-grid { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; max-height: 92dvh; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .toolbar .search-box { max-width: none; width: 100%; flex-basis: 100%; }
  .wallet-stats { grid-template-columns: 1fr 1fr; }
  .fee-row.total b { font-size: 18px; }

  /* 手机端登录 / 注册：底部抽屉 + 内部滚动 */
  .modal.auth-modal {
    padding: 0;
    max-height: 92vh;
    max-height: 92dvh;
    max-height: 92svh;
    border-radius: 26px 26px 0 0;
    overflow-y: auto !important;
  }
  .modal.auth-modal .auth-top {
    padding: 22px 20px 16px;
  }
  .modal.auth-modal .auth-body {
    padding: 18px 20px calc(30px + env(safe-area-inset-bottom));
  }
  /* 避免 iOS Safari 聚焦输入框时自动放大页面 */
  .modal.auth-modal .input,
  .modal.auth-modal .select,
  .modal.auth-modal .textarea {
    font-size: 16px;
    min-height: 50px;
  }
  .modal.auth-modal .auth-links {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .modal.auth-modal .avatar-grid {
    margin-bottom: 2px;
  }
}

@media (max-width: 420px) {
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .avatar-option .avatar { width: 36px; height: 36px; font-size: 13px; }
  .segmented button { padding: 0 12px; font-size: 11.5px; }
}
