/* 登录 / 注册门禁样式（独立文件，不改 styles.css）。复用 styles.css 的 :root 变量。 */

.auth-locked {
  overflow: hidden;
}

/* hidden 属性必须能隐藏遮罩（否则下方的 display: flex 会顶掉它，登录后遮罩藏不住）*/
.auth-overlay[hidden] {
  display: none !important;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  /* safe center：内容比屏幕高时退回顶部对齐，避免卡片顶部被裁切且无法滚动 */
  align-items: safe center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(36, 107, 97, 0.18), transparent 60%),
    radial-gradient(1000px 600px at 100% 110%, rgba(135, 80, 162, 0.16), transparent 55%),
    var(--bg, #f7f4ef);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel, #fffdf9);
  border: 1px solid var(--line, #ded7cc);
  border-radius: 16px;
  box-shadow: var(--shadow, 0 18px 44px rgba(54, 45, 34, 0.12));
  padding: 32px 28px;
  animation: authIn 0.4s ease;
}

@keyframes authIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-brand {
  text-align: center;
  margin-bottom: 22px;
}

.auth-brand .eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent, #246b61);
  font-weight: 700;
}

.auth-brand h1 {
  margin: 6px 0 4px;
  font-size: 26px;
  color: var(--ink, #242424);
}

.auth-tagline {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted, #68645f);
}

.auth-version {
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted, #68645f);
  opacity: 0.65;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(120, 110, 95, 0.08);
  border-radius: 10px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted, #68645f);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.auth-tab.active {
  background: var(--panel, #fffdf9);
  color: var(--accent, #246b61);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink, #242424);
  font-weight: 600;
}

/* 隐藏字段（邮箱/确认密码）：hidden 必须能盖过上面的 display: flex */
.auth-form label[hidden] {
  display: none !important;
}

/* 字段下方的小字说明（如邮箱用途） */
.auth-form .field-note {
  font-weight: 400;
}

/* 同意隐私政策：复选框 + 文字，横向排列 */
.auth-consent-field {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 8px !important;
  font-weight: 400 !important;
  font-size: 12px;
  color: var(--muted, #68645f);
  line-height: 1.4;
}

.auth-consent-field input {
  width: auto !important;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--accent, #246b61);
}

.auth-consent-field a {
  color: var(--accent, #246b61);
  font-weight: 600;
}

.auth-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  border: 1px solid var(--line, #ded7cc);
  border-radius: 9px;
  background: var(--bg, #f7f4ef);
  color: var(--ink, #242424);
  font-size: 14px;
  font-weight: 400;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent, #246b61);
  box-shadow: 0 0 0 3px rgba(36, 107, 97, 0.15);
}

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(194, 65, 50, 0.1);
  color: var(--red, #c24132);
  font-size: 13px;
}

/* 密码显示/隐藏切换 */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  width: 100%;
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: none;
  background: none;
  color: var(--muted, #68645f);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.password-toggle:hover {
  opacity: 1;
}

.password-toggle .eye-off {
  display: none;
}

.password-toggle.revealed .eye-open {
  display: none;
}

.password-toggle.revealed .eye-off {
  display: inline;
}

/* 找回密码 */
#authForgot { display: none; }
.auth-card.forgot-mode #authForgot { display: block; }
.auth-card.forgot-mode .auth-tabs,
.auth-card.forgot-mode #authForm,
.auth-card.forgot-mode #forgotLink,
.auth-card.forgot-mode #authSwitch { display: none; }

.auth-switch {
  margin: 16px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--muted, #6b6b6b);
}
.auth-switch button {
  padding: 0;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--accent, #246b61);
  cursor: pointer;
}
.auth-switch button:hover { text-decoration: underline; }
.auth-switch[hidden] { display: none !important; }

.auth-link {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 4px;
  background: none;
  border: none;
  color: var(--accent, #246b61);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}
.auth-link:hover { text-decoration: underline; }
.auth-link[hidden] { display: none !important; }

.auth-forgot-title {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--ink, #242424);
  text-align: center;
}

.auth-ok {
  margin: 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(47, 125, 71, 0.1);
  color: var(--green, #2f7d47);
  font-size: 13px;
}

#sendCodeBtn { width: 100%; }

#resetStep {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
#resetStep[hidden] { display: none !important; }

.captcha-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.captcha-row input {
  flex: 1;
  min-width: 0;
}
.captcha-img {
  width: 120px;
  min-height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line, #ded7cc);
  border-radius: 9px;
  background: #f7f4ef;
  cursor: pointer;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted, #68645f);
}
.captcha-img svg { max-width: 100%; height: auto; display: block; }

.auth-submit {
  margin-top: 4px;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

/* API 设置弹窗里的「记住 Key」复选框 */
.remember-key-row {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted, #68645f);
  cursor: pointer;
}

.remember-key-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #246b61);
  cursor: pointer;
}

/* iOS 防聚焦自动放大：触屏设备登录/注册/找回表单的输入框统一 16px（覆盖上面的 14px） */
@media (pointer: coarse) {
  .auth-form input {
    font-size: 16px;
  }
}

/* 小屏：收紧间距，让较高的注册 / 找回密码表单尽量一屏放下 */
@media (max-width: 480px) {
  .auth-overlay {
    padding: 14px 12px;
    align-items: flex-start;
  }
  .auth-card {
    padding: 22px 18px;
  }
  .auth-brand {
    margin-bottom: 16px;
  }
  .auth-tabs {
    margin-bottom: 14px;
  }
  .auth-form {
    gap: 11px;
  }
}
