/* ============================================================
   用户注册 / 登录 页面样式
   浅色主题 · 蓝紫渐变品牌区 + 白色表单卡
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e4e7f0;
  --border-strong: #cfd5e4;

  --text: #141a2b;
  --text-2: #59627b;
  --text-3: #8992a8;

  --brand: #3055f5;
  --brand-2: #6d4dfc;
  --brand-dark: #2440c9;
  --brand-soft: #eef1ff;

  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warning: #f5a524;
  --success: #12a06b;
  --success-soft: #e8f7f1;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(20, 26, 43, 0.06);
  --shadow: 0 10px 30px rgba(20, 26, 43, 0.07);
  --shadow-lg: 0 28px 70px rgba(20, 26, 43, 0.13);

  --ok-color: #12a06b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------------- 认证页整体布局 ---------------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

.auth-brand {
  position: relative;
  overflow: hidden;
  padding: 52px 56px;
  color: #fff;
  background: linear-gradient(150deg, #1e2a78 0%, #3055f5 48%, #6d4dfc 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  pointer-events: none;
}

.auth-brand::before {
  width: 460px;
  height: 460px;
  right: -170px;
  top: -140px;
}

.auth-brand::after {
  width: 320px;
  height: 320px;
  left: -120px;
  bottom: -130px;
  background: rgba(255, 255, 255, 0.07);
}

.brand-top,
.brand-bottom {
  position: relative;
  z-index: 1;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.brand-logo svg {
  flex: none;
}

.brand-title {
  font-size: 34px;
  line-height: 1.35;
  font-weight: 700;
  margin: 40px 0 16px;
  letter-spacing: 0.5px;
}

.brand-desc {
  font-size: 14.5px;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.84);
  max-width: 430px;
  margin: 0 0 34px;
}

.brand-points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.brand-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
}

.brand-points .tick {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
}

.brand-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.7);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 12px;
}

/* ---------------- 表单区 ---------------- */

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card.wide {
  max-width: 460px;
}

.auth-head {
  margin-bottom: 26px;
}

.auth-head h1 {
  font-size: 25px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: 0.3px;
}

.auth-head p {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
}

/* 数据库状态提示条 */
.db-hint {
  display: none;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.6;
  background: #fff8e8;
  border: 1px solid #f7e2b5;
  color: #8a6417;
}

.db-hint.show {
  display: flex;
}

.db-hint svg {
  flex: none;
  margin-top: 2px;
}

/* ---------------- 表单控件 ---------------- */

.form-row {
  margin-bottom: 16px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 7px;
}

.form-label .optional {
  font-weight: 400;
  color: var(--text-3);
  font-size: 12px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(48, 85, 245, 0.13);
}

.input-wrap .icon {
  flex: none;
  margin-left: 12px;
  color: var(--text-3);
  display: flex;
}

.input-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 11.5px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}

.input-wrap input::placeholder {
  color: #b3bacb;
}

.input-wrap input:disabled {
  color: var(--text-3);
  cursor: not-allowed;
}

/* 输入框右侧按钮（显示密码 / 校验状态） */
.input-suffix {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 10px;
}

.icon-btn {
  border: 0;
  background: transparent;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  transition: color 0.15s, background 0.15s;
}

.icon-btn:hover {
  color: var(--text-2);
  background: var(--surface-2);
}

/* 校验状态 */
.input-wrap.is-error {
  border-color: var(--danger);
  background: #fffbfb;
}

.input-wrap.is-error:focus-within {
  box-shadow: 0 0 0 3.5px rgba(229, 72, 77, 0.13);
}

.input-wrap.is-ok {
  border-color: #8fd7bb;
}

.field-msg {
  display: none;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
  line-height: 1.5;
}

.field-msg.show {
  display: block;
}

.field-msg.ok {
  color: var(--success);
}

/* 密码强度 */
.strength {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}

.strength.show {
  display: flex;
}

.strength-bars {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.strength-bars span {
  height: 4px;
  border-radius: 3px;
  background: #e8ebf3;
  transition: background 0.2s;
}

.strength[data-level="1"] .strength-bars span:nth-child(-n + 1),
.strength[data-level="2"] .strength-bars span:nth-child(-n + 2),
.strength[data-level="3"] .strength-bars span:nth-child(-n + 3),
.strength[data-level="4"] .strength-bars span:nth-child(-n + 4) {
  background: var(--brand);
}

.strength[data-level="1"] .strength-bars span:nth-child(-n + 1) {
  background: #e5484d;
}

.strength[data-level="2"] .strength-bars span:nth-child(-n + 2) {
  background: #f5a524;
}

.strength[data-level="3"] .strength-bars span:nth-child(-n + 3) {
  background: #3055f5;
}

.strength[data-level="4"] .strength-bars span:nth-child(-n + 4) {
  background: #12a06b;
}

.strength-label {
  flex: none;
  font-size: 12px;
  color: var(--text-3);
  min-width: 30px;
  text-align: right;
}

/* 复选框 */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--brand);
  cursor: pointer;
  flex: none;
}

.form-extra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 20px;
  font-size: 13px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.16s, background 0.16s, opacity 0.16s;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 6px 18px rgba(48, 85, 245, 0.28);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 10px 24px rgba(48, 85, 245, 0.34);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  color: var(--text-2);
  background: var(--surface);
  border-color: var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 13.5px;
}

/* 加载中的小圆圈 */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn.loading .spinner {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-2);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-3);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* 全局提示条 */
.alert {
  display: none;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.6;
}

.alert.show {
  display: flex;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid #f8cfd0;
  color: #a9262a;
}

.alert-success {
  background: var(--success-soft);
  border: 1px solid #bfe9d8;
  color: #0a6f4a;
}

/* 轻提示 Toast */
.toast-box {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text);
  animation: toastIn 0.24s ease;
  max-width: 90vw;
}

.toast.err {
  border-color: #f8cfd0;
  color: #a9262a;
}

.toast.ok {
  border-color: #bfe9d8;
  color: #0a6f4a;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------- 个人中心 ---------------- */

.topbar {
  height: 62px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 顶栏导航（个人中心 / 资讯中心 / 后台管理 之间的跳转） */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-link {
  font-size: 13.5px;
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.topbar-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.topbar-link.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 500;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 14px;
  flex: none;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 26px 60px;
}

.page-head {
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 22px;
  margin: 0 0 6px;
  font-weight: 700;
}

.page-head p {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex: none;
}

.card-body {
  padding: 18px 20px;
}

.info-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
}

.info-item:last-child {
  border-bottom: 0;
}

.info-item dt {
  color: var(--text-2);
  flex: none;
}

.info-item dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.tag.green {
  background: var(--success-soft);
  color: #0a6f4a;
}

.tag.red {
  background: var(--danger-soft);
  color: #a9262a;
}

.tag.grey {
  background: #f1f3f8;
  color: var(--text-2);
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data th {
  color: var(--text-2);
  font-weight: 500;
  background: var(--surface-2);
  font-size: 12.5px;
}

table.data tr:last-child td {
  border-bottom: 0;
}

.empty {
  padding: 26px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--text-2);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 960px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    padding: 34px 32px;
    min-height: auto;
  }

  .brand-title {
    font-size: 25px;
    margin: 22px 0 12px;
  }

  .brand-desc {
    margin-bottom: 22px;
  }

  .brand-points {
    display: none;
  }

  .auth-main {
    padding: 34px 24px 56px;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .auth-main {
    padding: 26px 18px 46px;
  }

  .auth-head h1 {
    font-size: 21px;
  }

  .topbar {
    padding: 0 16px;
  }

  .page {
    padding: 22px 16px 48px;
  }

  .user-chip .name {
    display: none;
  }
}

/* ---------------- 图形验证码 ---------------- */

.captcha-box {
  flex: none;
  width: 140px;
  height: 46px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #f4f6fc;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.16s, box-shadow 0.16s, opacity 0.16s;
}

.captcha-box:hover {
  border-color: var(--brand);
}

.captcha-box:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(48, 85, 245, 0.13);
}

.captcha-box svg {
  display: block;
}

.captcha-box.loading {
  opacity: 0.55;
  cursor: wait;
}

/* ---------------- 通用工具类 ---------------- */

.hidden {
  display: none !important;
}
