/* OPC 登录弹窗 · 按 design 的 plan-a 像素还原
   设计稿：/tmp/opc-design/opc/project/login/plan-a.jsx
   - 420px 单列，PingFang SC，#2563eb brand
   - 不污染全局：所有规则在 .opc-auth-* 命名空间内
*/

.opc-auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.opc-auth-overlay.is-open {
  display: flex;
  opacity: 1;
}

.opc-auth-modal {
  position: relative;
  width: 420px;
  max-width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 28px;
  box-shadow:
    0 24px 60px rgba(10, 37, 64, 0.22),
    0 2px 10px rgba(10, 37, 64, 0.08);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
  transform: translateY(8px);
  transition: transform 0.22s ease;
}
.opc-auth-overlay.is-open .opc-auth-modal {
  transform: translateY(0);
}

.opc-auth-modal *, .opc-auth-modal *::before, .opc-auth-modal *::after { box-sizing: border-box; }

.opc-auth-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: #999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.opc-auth-close:hover { background: #f4f5f7; color: #0a2540; }
.opc-auth-close svg { display: block; }

.opc-auth-head { margin-bottom: 26px; }
.opc-auth-title {
  font-size: 22px;
  font-weight: 700;
  color: #0a2540;
  letter-spacing: -0.005em;
  margin: 0 0 8px;
}
.opc-auth-sub {
  font-size: 13.5px;
  color: #555;
  line-height: 1.65;
  margin: 0;
}
.opc-auth-sub .em { color: #2563eb; font-weight: 600; }

.opc-auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.opc-auth-input-wrap {
  display: flex;
  align-items: stretch;
  height: 48px;
  border: 1px solid #ececec;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.opc-auth-input-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.opc-auth-input-wrap.is-error {
  border-color: #e11d48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12);
}
/* 错误抖动：比单纯变红更"体感"。is-shake 由 JS 重新触发（强制 reflow） */
.opc-auth-input-wrap.is-error.is-shake {
  animation: opc-auth-shake 0.38s ease;
}
@keyframes opc-auth-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.opc-auth-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 14px;
  font-size: 15px;
  color: #0a2540;
  letter-spacing: 0.04em;
  /* 不用 JetBrains Mono：其 0 中间带点像有根线。用系统字体圆 0 + tabular-nums 保持数字等宽 */
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.opc-auth-input::placeholder {
  color: #999;
  font-family: "PingFang SC", "HarmonyOS Sans SC", -apple-system, system-ui, sans-serif;
  letter-spacing: 0;
}

.opc-auth-code-btn {
  height: auto;
  align-self: center;
  padding: 0 14px;
  border: 0;
  border-left: 1px solid #f1f1f1;
  background: transparent;
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}
.opc-auth-code-btn:hover:not(:disabled) { color: #1d4ed8; }
.opc-auth-code-btn:disabled,
.opc-auth-code-btn.is-counting {
  color: #999;
  cursor: not-allowed;
}
.opc-auth-code-btn .mono {
  /* 不用 JetBrains Mono：其 0 中间带点像有根线。用系统字体的圆 0 + tabular-nums 保持等宽不抖 */
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.opc-auth-primary {
  position: relative;
  margin-top: 4px;
  height: 48px;
  border: 0;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.05s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.22);
}
.opc-auth-primary:hover:not(:disabled) { background: #1d4ed8; }
.opc-auth-primary:active:not(:disabled) { transform: translateY(1px); }
.opc-auth-primary:disabled {
  background: #c2cbd9;
  box-shadow: none;
  cursor: not-allowed;
}
/* 提交中：文字隐藏，中心转圈 */
.opc-auth-primary.is-loading {
  color: transparent;
  background: #2563eb;
  cursor: wait;
}
.opc-auth-primary.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: opc-auth-spin 0.6s linear infinite;
}
@keyframes opc-auth-spin { to { transform: rotate(360deg); } }
/* 成功：按钮变绿 + ✓ 文案，给一个"成了"的确认瞬间 */
.opc-auth-primary.is-success,
.opc-auth-primary.is-success:disabled {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.28);
}

.opc-auth-agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #555;
  line-height: 1.6;
  cursor: pointer;
}
.opc-auth-agree input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  margin-top: 2px;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  background: #fff;
}
.opc-auth-agree input[type="checkbox"]:checked {
  background: #2563eb;
  border-color: #2563eb;
}
.opc-auth-agree input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}
.opc-auth-agree a { color: #2563eb; text-decoration: none; }
.opc-auth-agree a:hover { text-decoration: underline; }

.opc-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #999;
  font-size: 12px;
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  margin: 22px 0 14px;
}
.opc-auth-divider::before,
.opc-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #f1f1f1;
}

.opc-auth-social {
  display: flex;
  justify-content: center;
}
.opc-auth-social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: 0;
  border: 0;
  padding: 6px 8px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  font-family: inherit;
}
.opc-auth-social-link:hover { color: #2563eb; }

/* 贴在验证码框与登录按钮之间，谁错提示谁；空时彻底移出 flex 流，不占 gap */
.opc-auth-msg {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: -4px 0 0 2px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #e11d48;
}
.opc-auth-msg:empty { display: none; }
.opc-auth-msg::before {
  content: "⚠";
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1.45;
}
.opc-auth-msg.is-ok { color: #16a34a; }
.opc-auth-msg.is-ok::before { content: "✓"; }

/* 移动端适配（≤768px）—— 桌面看着 OK 移动端翻车的预防 */
@media (max-width: 768px) {
  .opc-auth-overlay {
    padding: 0;
    align-items: flex-end;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .opc-auth-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 32px 22px 22px;
  }
  .opc-auth-title { font-size: 20px; }
  .opc-auth-sub { font-size: 13px; }
  .opc-auth-input { font-size: 16px; }  /* iOS 防止聚焦缩放 */
}

/* ============ 顶栏：登录态显示（手机号末四位 + 下拉退出） ============ */
.nav-user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nav-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #ececec;
  border-radius: 999px;
  background: #fff;
  color: #0a2540;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  font-feature-settings: "tnum" 1;
}
.nav-user-trigger:hover { border-color: #2563eb; color: #2563eb; }
.nav-user-trigger svg { display: block; }
.nav-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(10, 37, 64, 0.12);
  padding: 6px;
  display: none;
  z-index: 1000;
}
.nav-user-menu.is-open .nav-user-dropdown { display: block; }
.nav-user-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #1a1a1a;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.nav-user-dropdown button:hover { background: #f6f7f9; color: #2563eb; }

/* ============ 头像组件（圆形；有图用图，无图用渐变底+首字母兜底） ============ */
.opc-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;                 /* flex 容器里锁宽，避免被挤瘪（项目踩过的坑） */
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: #eef2ff;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  user-select: none;
}
.opc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opc-avatar-sm { width: 22px; height: 22px; font-size: 11px; }
.opc-avatar-md { width: 40px; height: 40px; font-size: 18px; }
.opc-avatar-lg { width: 76px; height: 76px; font-size: 34px; }
/* 渐变色板：沿用首页 case-avatar 色系，按昵称 hash 取模分配，刷新稳定不闪 */
.oa-c0 { background: linear-gradient(135deg, #6366f1, #818cf8); }
.oa-c1 { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.oa-c2 { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.oa-c3 { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.oa-c4 { background: linear-gradient(135deg, #16a34a, #4ade80); }
.oa-c5 { background: linear-gradient(135deg, #e11d48, #fb7185); }

/* 顶栏 trigger：左侧塞下头像，左内边距收紧一点 */
.nav-user-trigger { padding: 5px 12px 5px 5px; }

/* 下拉头部：头像 + 昵称 + 副标题（脱敏号/微信登录），底部一条分隔线 */
.nav-user-dropdown { min-width: 208px; }
.nav-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid #f0f1f4;
}
.nav-user-card .opc-avatar { box-shadow: 0 2px 8px rgba(15, 23, 42, 0.10); }
.nav-user-card-meta { min-width: 0; }
.nav-user-card-name {
  font-size: 14px; font-weight: 700; color: #0a2540;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-user-card-sub {
  font-size: 12px; color: #98a2b3; margin-top: 2px;
  font-feature-settings: "tnum" 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-user-card-sub:empty { display: none; }

/* 移动菜单账户态样式见 app.py 的 _NAV_JOIN_CSS（与 .nav-join 主按钮的 is-authed
   联动逻辑在一起，保持底部低调 footer 的克制设计，故不在此重复定义） */

/* ============ 编辑资料弹窗专属（其余全复用 .opc-auth-*，含移动 bottom-sheet） ============ */
.opc-profile-avatar-row {
  display: flex; align-items: center; gap: 16px; margin-bottom: 22px;
}
.opc-profile-preview { cursor: pointer; flex: 0 0 auto; }
.opc-profile-preview .opc-avatar-lg { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12); }
.opc-profile-avatar-side { display: flex; flex-direction: column; gap: 6px; }
.opc-profile-avatar-btn {
  align-self: flex-start;
  padding: 7px 14px;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
  background: #fff;
  color: #0a2540;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.opc-profile-avatar-btn:hover { border-color: #2563eb; color: #2563eb; }
.opc-profile-avatar-hint { font-size: 12px; color: #98a2b3; }
.opc-profile-field { display: flex; flex-direction: column; gap: 7px; }
.opc-profile-label { font-size: 13px; font-weight: 600; color: #344054; }
.opc-profile-save { margin-top: 4px; }

/* ============ 账号绑定区（编辑弹窗内） ============ */
.opc-profile-bind { margin-top: 18px; padding-top: 16px; border-top: 1px solid #f0f1f4; }
.opc-profile-bind-title { font-size: 13px; font-weight: 600; color: #344054; margin-bottom: 8px; }
.opc-bind-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; min-height: 26px; }
.opc-bind-ico { flex: 0 0 auto; color: #98a2b3; }
.opc-bind-label { font-size: 14px; color: #0a2540; }
.opc-bind-phone-status, .opc-bind-wechat-status { margin-left: auto; display: inline-flex; align-items: center; }
.opc-bind-done { font-size: 13px; color: #98a2b3; font-feature-settings: "tnum" 1; }
.opc-bind-btn {
  padding: 5px 14px; border: 1px solid #d7dbe2; border-radius: 999px;
  background: #fff; color: #2563eb; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.opc-bind-btn:hover { border-color: #2563eb; background: #f5f8ff; }
.opc-bind-phone-form {
  display: flex; flex-direction: column; gap: 10px;
  margin: 4px 0 10px; padding: 12px; background: #f8f9fb; border-radius: 10px;
}
.opc-bind-phone-form[hidden] { display: none; }
.opc-bind-phone-form .opc-auth-primary { margin-top: 0; height: 42px; font-size: 14px; }

/* 瞬时提示：仅微信绑定跳转回来后的结果反馈用（整页刷新后无内联落点） */
.opc-notice {
  position: fixed; left: 50%; top: 22px; transform: translate(-50%, -8px);
  z-index: 10000; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-family: inherit; max-width: 88vw; text-align: center;
  box-shadow: 0 10px 30px rgba(10, 37, 64, 0.22);
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none;
}
.opc-notice.is-in { opacity: 1; transform: translate(-50%, 0); }
