/* ==========================================================================
   BigiWorld · 登录 / 注册 / 个人中心
   --------------------------------------------------------------------------
   三页共用这一份样式，配色全部来自 navBarStyle.css 里的 CSS 变量，
   所以亮色 / 夜间模式自动跟着走。

   DOM：
     main.authPage > section.authCard        登录、注册
     main.accountPage > section.accountCard  个人中心

   页面里没有 aria-current 导航项，pageTransition.js 不会画指示线。
   ========================================================================== */

/* --------------------------------------------------------------------------
   登录 / 注册：卡片在导航栏下面居中
   -------------------------------------------------------------------------- */
.authPage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* 不按 max-content 撑宽，窄屏不横向溢出 */
  place-items: center;
  min-height: calc(100vh - var(--nav-h));
  padding: clamp(24px, 6vh, 64px) 16px;
}

.authCard {
  width: min(460px, 100%);
  max-width: 100%;
  padding: clamp(24px, 4.4vw, 38px);

  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);

  animation: authCardIn 280ms ease-out both;
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.authCard__eyebrow {
  margin: 0 0 10px;
  color: var(--brand-a);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.authCard__title {
  margin: 0;
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.authCard__subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.authCard__switch {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.authCard__switch a {
  color: var(--brand-a);
  font-weight: 600;
  text-decoration: none;
}

.authCard__switch a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.authCard__hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

/* --------------------------------------------------------------------------
   表单
   -------------------------------------------------------------------------- */
.authForm {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.authField {
  display: grid;
  gap: 7px;
}

.authField__label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.authField__input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;

  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}

.authField__input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.authField__input:hover {
  border-color: rgba(79, 107, 255, 0.28);
}

.authField__input:focus {
  background: var(--nav-bg);
  border-color: var(--brand-a);
  box-shadow: 0 0 0 3px rgba(79, 107, 255, 0.16);
  outline: none;
}

/* 浏览器自动填充时不要变成刺眼的黄底 */
.authField__input:-webkit-autofill,
.authField__input:-webkit-autofill:hover,
.authField__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  transition: background-color 9999s ease-out;
}

.authField__hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.authForm__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.authCheck {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.authCheck input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-a);
  cursor: pointer;
}

.authForm__aside {
  color: var(--muted);
  font-size: 12px;
}

/* 按钮：主操作一个渐变，危险操作单独一套红 */
.authBtn {
  width: 100%;
  min-height: 46px;
  padding: 12px 18px;

  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  border: 0;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(79, 107, 255, 0.24);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.authBtn:hover {
  filter: brightness(1.06);
  box-shadow: 0 11px 24px rgba(79, 107, 255, 0.32);
}

.authBtn:active {
  transform: translateY(1px);
}

.authBtn:focus-visible {
  outline: 3px solid var(--brand-a);
  outline-offset: 2px;
}

.authBtn--danger {
  background: linear-gradient(135deg, #e5484d, #c62a2f);
  box-shadow: 0 8px 20px rgba(198, 42, 47, 0.22);
}

.authBtn--danger:hover {
  box-shadow: 0 11px 24px rgba(198, 42, 47, 0.3);
}

/* --------------------------------------------------------------------------
   提示条
   -------------------------------------------------------------------------- */
.formMsg {
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.6;
}

/* 没有内容时完全不占位（模板里始终保留这两个 p） */
.formMsg:empty {
  display: none;
}

.formMsg--error {
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.18);
  color: #b42318;
}

.formMsg--ok {
  background: rgba(31, 157, 106, 0.1);
  border-color: rgba(31, 157, 106, 0.22);
  color: #157347;
}

[data-theme="dark"] .formMsg--error {
  background: rgba(255, 180, 171, 0.1);
  border-color: rgba(255, 180, 171, 0.2);
  color: #ffb4ab;
}

[data-theme="dark"] .formMsg--ok {
  background: rgba(70, 209, 148, 0.1);
  border-color: rgba(70, 209, 148, 0.22);
  color: #74e0ad;
}

/* --------------------------------------------------------------------------
   个人中心
   -------------------------------------------------------------------------- */
.accountPage {
  width: min(720px, 100% - 32px);
  margin: 0 auto;
  padding: clamp(28px, 6vh, 64px) 0 clamp(56px, 10vh, 96px);
}

.accountCard {
  padding: clamp(24px, 4.4vw, 40px);

  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);

  animation: authCardIn 280ms ease-out both;
}

.accountHead {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 6px 0 22px;
}

.accountAvatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 20px;

  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  box-shadow: 0 10px 24px rgba(79, 107, 255, 0.28);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
}

.accountHead__text {
  min-width: 0;
}

.accountHead__name {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 28px);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.accountHead__meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.accountStats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 8px;
}

/* 管理员在个人中心看到的「进入管理后台」按钮；普通用户这里为空 */
.accountAdminLinkRow {
  margin: 0;
  font-size: 14px;
}

.accountAdminLinkRow:empty {
  display: none;
}

.accountAdminLink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;

  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(79, 107, 255, 0.22);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.accountAdminLink:hover {
  filter: brightness(1.06);
  box-shadow: 0 9px 20px rgba(79, 107, 255, 0.3);
}

.accountAdminLink:focus-visible {
  outline: 3px solid var(--brand-a);
  outline-offset: 2px;
}

.accountStat {
  padding: 14px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.accountStat__value {
  display: block;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.accountStat__label {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.accountSection {
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.accountSection__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.accountSection__desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.accountSection .authForm {
  margin-top: 16px;
}

.accountSection--danger .accountSection__title {
  color: #b42318;
}

[data-theme="dark"] .accountSection--danger .accountSection__title {
  color: #ffb4ab;
}

.accountSection form + .authBtn,
.accountSection form {
  margin-top: 16px;
}

.accountCard__back {
  margin: 28px 0 0;
  font-size: 13px;
}

.accountCard__back a {
  color: var(--muted);
  text-decoration: none;
}

.accountCard__back a:hover {
  color: var(--brand-a);
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
  .authPage {
    min-height: calc(100vh - var(--nav-h));
    padding: 18px 12px 36px;
  }

  .authCard,
  .accountCard {
    border-radius: 18px;
  }

  .accountPage {
    width: calc(100% - 24px);
    padding-top: 18px;
  }

  .accountStats {
    grid-template-columns: 1fr;
  }

  .accountHead {
    gap: 12px;
  }

  .accountAvatar {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    font-size: 23px;
  }

  .authForm__row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

/* 系统开了「减少动态效果」：不播进场动画、不做位移 */
@media (prefers-reduced-motion: reduce) {
  .authCard,
  .accountCard {
    animation: none;
  }

  .authField__input,
  .authBtn {
    transition: none;
  }

  .authBtn:active,
  .authBtn:hover {
    transform: none;
  }
}
