/* ===== 登录 / 注册 页面专用样式 ===== */

/* 页面整体 */
.auth-page {
  min-height: 100vh;
  background: #f7f9fb;
  display: flex;
  flex-direction: column;
}

/* 主内容区 */
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 128px 24px 80px;
}

.auth-main--register {
  padding-top: 100px;
}

/* 卡片 */
.auth-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 49px;
  width: 420px;
  max-width: 100%;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03);
  position: relative;
}

.auth-card--wide {
  width: 485px;
}

/* 注册标题 */
.auth-heading {
  font-size: 30px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.3px;
  margin: 0 0 32px;
}

.auth-subheading {
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.6;
  margin: -20px 0 28px;
}

/* 登录 Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 23px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 0 13px;
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
  cursor: pointer;
  text-align: center;
  transition: color .2s, border-color .2s;
  font-family: 'Noto Sans SC', sans-serif;
}

.auth-tab--active {
  color: #003c90;
  border-bottom-color: #0f52ba;
}

.auth-tab-sep {
  flex: 0 0 auto;
  align-self: center;
  padding: 0 4px 13px;
  font-size: 14px;
  color: #d1d5db;
  line-height: 1;
  user-select: none;
}

/* 表单 */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 23px;
}

.auth-form--hidden {
  display: none;
}

/* 表单字段 */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-label {
  font-size: 14px;
  font-weight: 400;
  color: #434653;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-required {
  font-size: 12px;
  color: #ba1a1a;
  font-weight: 400;
}

/* 输入框包装 */
.auth-input-wrap {
  position: relative;
}

.auth-input {
  width: 100%;
  background: #f2f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 13px 17px 14.8px 41px;
  font-size: 14px;
  font-family: 'Noto Sans SC', sans-serif;
  color: #111827;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}

.auth-input::placeholder {
  color: rgba(107,114,128,.6);
  font-weight: 300;
}

.auth-input:focus {
  border-color: #0f52ba;
  box-shadow: 0 0 0 2px rgba(15,82,186,.15);
}

.auth-input--no-icon {
  padding-left: 17px;
}

.auth-input--padded-right {
  padding-right: 49px;
}

/* 输入框左侧图标 */
.auth-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.auth-input-icon img {
  width: 14px;
  height: auto;
  object-fit: contain;
}

/* 密码显示/隐藏按钮 */
.auth-input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
}

.auth-input-toggle img {
  width: 18px;
  height: auto;
}

/* 带按钮的输入框组 */
.auth-input-wrap--with-btn {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.auth-input-wrap--with-btn .auth-input {
  flex: 1;
  min-width: 0;
  padding-left: 17px;
}

.auth-code-btn {
  flex-shrink: 0;
  min-width: 100px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 13px 17px;
  font-size: 14px;
  font-weight: 300;
  color: #111827;
  cursor: pointer;
  font-family: 'Noto Sans SC', sans-serif;
  white-space: nowrap;
  transition: background .2s, color .2s;
}

.auth-code-btn:hover {
  background: #f2f4f6;
}

.auth-code-btn:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

/* 下拉选择器 */
.auth-select-wrap {
  position: relative;
}

.auth-select {
  width: 100%;
  background: #f2f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 13px 17px;
  font-size: 13px;
  font-weight: 300;
  color: #111827;
  font-family: 'Noto Sans SC', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color .2s, box-shadow .2s;
  text-align: left;
}

.auth-select:focus,
.auth-select.is-open {
  border-color: #0f52ba;
  box-shadow: 0 0 0 2px rgba(15,82,186,.15);
  outline: none;
}

.auth-select-arrow {
  width: 9px;
  height: auto;
  transition: transform .2s;
}

.auth-select.is-open .auth-select-arrow {
  transform: rotate(180deg);
}

/* 下拉列表 */
.auth-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  list-style: none;
  margin: 0;
  padding: 8px 0;
  z-index: 100;
  display: none;
  overflow: hidden;
}

.auth-dropdown.is-open {
  display: block;
}

.auth-dropdown-item {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 400;
  color: #111827;
  cursor: pointer;
  transition: background .15s;
}

.auth-dropdown-item:hover,
.auth-dropdown-item.is-selected {
  background: #f0f7ff;
}

/* 选项区域 */
.auth-options {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0 5px;
}

/* 服务条款 */
.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-top: 9px;
}

.auth-checkbox {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1px solid #737784;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 2px;
  accent-color: #0f52ba;
}

.auth-terms-label {
  font-size: 14px;
  font-weight: 300;
  color: #6b7280;
  line-height: 1.5;
  cursor: pointer;
}

/* 提交按钮 */
.auth-submit {
  width: 100%;
  background: #0f52ba;
  border: none;
  border-radius: 9999px;
  padding: 17px 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  font-family: 'Noto Sans SC', sans-serif;
  box-shadow: 0 1px 1px rgba(0,0,0,.05);
  transition: background .2s, transform .1s;
}

.auth-submit:hover {
  background: #0d47a1;
}

.auth-submit:active {
  transform: scale(.98);
}

/* 链接 */
.auth-link {
  color: inherit;
  text-decoration: none;
}

.auth-link--blue {
  color: #003c90;
}

.auth-link--blue:hover {
  text-decoration: underline;
}

/* 底部文字 */
.auth-footer-text {
  text-align: center;
  font-size: 16px;
  font-weight: 300;
  color: #6b7280;
  margin: 0;
}

.auth-footer-divider {
  border-top: 1px solid #e5e7eb;
  margin: 0;
}

/* 错误状态 */
.auth-input--error {
  border-color: #ba1a1a;
}

.auth-field-error {
  font-size: 12px;
  color: #ba1a1a;
  margin-top: 2px;
}

/* ===== 动态效果 ===== */

/* 卡片入场动画 */
@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-card {
  animation: authCardIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Tab 滑动指示线 */
.auth-tabs {
  position: relative;
}

.auth-tabs::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 50%;
  background: var(--primary, #0f52ba);
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-tabs[data-active="email"]::after {
  transform: translateX(100%);
}

/* Tab 文字切换时淡入 */
.auth-tab {
  transition: color 0.25s ease, font-weight 0.25s ease;
}

/* 输入框焦点辉光 */
.auth-input {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input:focus {
  outline: none;
  border-color: #0f52ba;
  box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.12);
}

/* 表单切换淡入 */
@keyframes formFadeIn {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.auth-form:not(.auth-form--hidden) {
  animation: formFadeIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 错误抖动 */
@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.auth-field.shake {
  animation: authShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* 提交按钮加载态 */
.auth-submit {
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
  position: relative;
  overflow: hidden;
}

.auth-submit:active {
  transform: scale(0.97);
}

.auth-submit.loading {
  opacity: 0.75;
  pointer-events: none;
}

.auth-submit.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.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinBtn 0.7s linear infinite;
}

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

/* 错误信息飞入 */
@keyframes errorIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-field-error {
  animation: errorIn 0.2s ease both;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .auth-main {
    padding: 80px 16px 40px;
    align-items: flex-start;
  }

  .auth-card,
  .auth-card--wide {
    width: 100%;
    padding: 32px 24px;
  }

  .auth-heading {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .auth-main {
    padding: 72px 12px 32px;
  }

  .auth-card {
    padding: 24px 16px;
  }

  .auth-input-wrap--with-btn {
    flex-direction: column;
  }

  .auth-code-btn {
    width: 100%;
    text-align: center;
  }
}
