/* ==========================================================================
   登录页 · 移动端优先 · 仅浅色主题
   结构：Logo + 系统名称 + 登录模块
   ========================================================================== */

.login-page {
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: calc(var(--safe-top) + 28px);
  padding-right: calc(var(--safe-right) + 20px);
  padding-bottom: calc(var(--safe-bottom) + 28px);
  padding-left: calc(var(--safe-left) + 20px);
  overflow-x: hidden;
  overflow-y: auto;
}

/* --------------------------------------------------------------------------
   背景装饰
   -------------------------------------------------------------------------- */

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 72% at 100% 0%, rgba(34, 211, 238, 0.14), transparent 58%),
    radial-gradient(110% 70% at 0% 12%, rgba(70, 102, 214, 0.14), transparent 62%),
    linear-gradient(180deg, #f8faff 0%, #f3f6fd 58%, #f7f9fe 100%);
}

.login-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(70, 102, 214, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 102, 214, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(80% 62% at 50% 16%, #000 0%, transparent 86%);
  mask-image: radial-gradient(80% 62% at 50% 16%, #000 0%, transparent 86%);
}

.login-bg::after {
  content: "";
  position: absolute;
  top: 10%;
  right: -34%;
  width: min(90vw, 540px);
  aspect-ratio: 1;
  border: 1px solid rgba(34, 211, 238, 0.20);
  border-radius: 50%;
  box-shadow:
    0 0 0 62px rgba(70, 102, 214, 0.032),
    0 0 0 124px rgba(34, 211, 238, 0.020);
}

/* --------------------------------------------------------------------------
   页面骨架
   -------------------------------------------------------------------------- */

.login-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 400px;
  margin: auto;
}

/* 品牌 */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.brand-logo {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 10px 24px -12px rgba(48, 74, 158, 0.55);
}

.brand-name {
  margin: 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: 0.2px;
}

/* --------------------------------------------------------------------------
   登录模块
   -------------------------------------------------------------------------- */

.panel {
  width: 100%;
  padding: 22px 18px 18px;
  border: 1px solid rgba(70, 102, 214, 0.10);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.login-form {
  margin: 0;
}

/* 表单字段 */

.field {
  margin-bottom: 16px;
}

.control {
  position: relative;
  display: flex;
  align-items: center;
  height: 50px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

.control:hover {
  border-color: rgba(70, 102, 214, 0.32);
}

.control:focus-within {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: var(--focus-ring);
}

.control.is-invalid {
  border-color: rgba(220, 38, 38, 0.55);
  background: rgba(220, 38, 38, 0.035);
}

.control.is-invalid:focus-within {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.field-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--text-faint);
  pointer-events: none;
  transition: color 0.16s ease;
}

.control:focus-within .field-icon {
  color: var(--primary);
}

.control.is-invalid .field-icon,
.control.is-invalid:focus-within .field-icon {
  color: var(--danger);
}

.control input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 14px 0 42px;
  border: 0;
  border-radius: inherit;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px; /* 不小于 16px，避免 iOS 聚焦时自动放大 */
  line-height: 1.2;
}

.control input::placeholder {
  color: var(--text-faint);
  font-size: 14px;
}

.control input:-webkit-autofill,
.control input:-webkit-autofill:hover,
.control input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-soft) inset;
  transition: background-color 9999s ease-out;
}

.control input::-ms-reveal,
.control input::-ms-clear {
  display: none;
}

/* 密码可见切换 */

.password-toggle {
  width: 44px;
  height: 44px;
  margin-right: 3px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  transition: background-color 0.16s ease, color 0.16s ease;
}

.password-toggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.password-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle .icon-eye-off,
.password-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: block;
}

/* 表单内错误提示（预留给服务端错误） */

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0 0 13px;
  padding: 9px 11px;
  border: 1px solid rgba(220, 38, 38, 0.24);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 12px;
  line-height: 1.5;
}

.form-alert[hidden] {
  display: none;
}

.form-alert::before {
  content: "!";
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: 0 0 15px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* 登录按钮 */

.submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid rgba(70, 102, 214, 0.65);
  border-radius: var(--radius-md);
  background: var(--action-gradient);
  color: #fff;
  box-shadow: 0 10px 22px -10px rgba(48, 74, 158, 0.65);
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.submit:active:not(:disabled) {
  transform: scale(0.985);
}

.submit:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), 0 10px 22px -10px rgba(48, 74, 158, 0.65);
}

.submit:disabled {
  cursor: wait;
  opacity: 0.68;
}

.submit-spinner {
  display: none;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: login-spin 0.7s linear infinite;
}

.submit.is-loading .submit-spinner {
  display: block;
}

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

/* 忘记密码 */

.form-help {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}

/* --------------------------------------------------------------------------
   桌面端：同一套单列结构，卡片略放大
   -------------------------------------------------------------------------- */

@media (min-width: 600px) {
  .login-shell {
    max-width: 420px;
    gap: 28px;
  }

  .brand-logo {
    width: 80px;
    height: 80px;
    flex-basis: 80px;
    border-radius: 20px;
  }

  .brand-name {
    font-size: 22px;
  }

  .panel {
    padding: 28px 26px 22px;
  }

  .field {
    margin-bottom: 18px;
  }

  .form-help {
    margin-top: 16px;
    font-size: 12px;
  }
}

@media (min-width: 900px) {
  .login-bg::after {
    top: 6%;
    right: 6%;
    width: 620px;
    box-shadow:
      0 0 0 76px rgba(70, 102, 214, 0.032),
      0 0 0 152px rgba(34, 211, 238, 0.020);
  }
}

/* 小屏压缩 */

@media (max-width: 359px) {
  .login-page {
    padding-right: calc(var(--safe-right) + 16px);
    padding-left: calc(var(--safe-left) + 16px);
  }

  .panel {
    padding: 20px 15px 16px;
  }

  .brand-logo {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
    border-radius: 16px;
  }

  .brand-name {
    font-size: 19px;
  }
}

/* 触屏设备统一走按压反馈，桌面端补充悬停态 */

@media (hover: hover) and (pointer: fine) {
  .submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -12px rgba(48, 74, 158, 0.7);
  }
}
