/* ==========================================================================
   Login page — commercial-grade two-column layout (UI review P1 #7, 2026-09-23)
   2026-09-30 书卷化：品牌面板由深紫近黑渐变改为"摊开的书"——左页淡紫纸
   + 纸纹肌理 + 深紫墨字（#21005d on #eaddff 13.3:1），右页白纸表单。
   Radius scale: controls 8px / cards 16px. Contrast meets WCAG AA.
   ========================================================================== */

.login-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 140px);
  gap: 0;
  background: var(--md-sys-color-surface-container-low);
}

/* --- Left: brand panel（扉页/左页）----------------------------------------- */
.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 40px;
  padding: 56px 64px;
  /* 书页渐变: 淡紫 → 纸面 → 淡紫灰,叠纸纹;右侧发丝线 = 摊开书的装订沟 */
  background-color: var(--md-sys-color-primary-container);
  background-image:
    var(--paper-grain),
    linear-gradient(
      165deg,
      var(--md-sys-color-primary-container) 0%,
      var(--md-sys-color-surface) 55%,
      var(--md-sys-color-secondary-container) 100%
    );
  border-right: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-primary-container);
}

.login-brand__head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-brand__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--md-sys-radius-md);
  background: var(--md-sys-color-shadow-primary-soft);
  backdrop-filter: blur(4px);
}

.login-brand__logo .material-symbols-outlined {
  font-size: 32px;
}

.login-brand__name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  /* 墨色标题 — 左页为浅紫纸,深紫墨字（13.3:1） */
  color: var(--md-sys-color-on-primary-container);
}

.login-brand__tagline {
  margin: 12px 0 0;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--md-sys-color-on-primary-container);
}

.login-brand__subtitle {
  margin: 12px 0 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--md-sys-color-on-primary-container); /* 淡墨: 深紫 78% */
  opacity: 0.78;
  max-width: 30rem;
}

.login-brand__features {
  display: flex;
  flex-direction: column;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.login-brand__feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.login-brand__feature .material-symbols-outlined {
  font-size: 22px;
  padding: 8px;
  border-radius: var(--md-sys-radius-sm, 8px);
  background: var(--md-sys-color-shadow-primary-soft);
  flex-shrink: 0;
}

.login-brand__feature h3 {
  margin: 0 0 2px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--md-sys-color-on-primary-container);
}

.login-brand__feature p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--md-sys-color-on-primary-container); /* 淡墨 */
  opacity: 0.78;
}

/* --- Right: form column --------------------------------------------------- */
.login-form-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 32px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-radius-md);
  box-shadow: 0 12px 32px var(--md-sys-color-shadow-brand-soft), 0 2px 8px var(--md-sys-color-shadow-brand-faint);
}

.login-card__head {
  margin-bottom: 28px;
}

.login-card__title {
  margin: 0 0 6px;
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.login-card__subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--md-sys-color-on-surface-variant);
}

/* --- Form errors ---------------------------------------------------------- */
.login-errors {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: var(--md-sys-radius-sm, 8px);
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.login-errors p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

/* --- Fields --------------------------------------------------------------- */
.login-field {
  margin-bottom: 18px;
}

/* 2026-11-06：原生 <input> + 自绘 label/icon 迁移为 md-outlined-text-field，
   组件自带 label/leading-icon/error-text，这里只管宽度和圆角对齐卡片视觉。 */
.login-field md-outlined-text-field {
  width: 100%;
  --md-outlined-text-field-container-shape: var(--md-sys-radius-sm, 8px);
}

/* --- Submit --------------------------------------------------------------- */
.login-button {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--md-sys-color-on-primary);
  background: var(--md-sys-color-primary);
  border: none;
  border-radius: var(--md-sys-radius-sm, 8px);
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.login-button:hover {
  box-shadow: 0 4px 12px var(--md-sys-color-shadow-primary);
}

.login-button:active {
  transform: translateY(1px);
}

.login-button:focus-visible {
  outline: 2px solid var(--md-sys-color-on-primary-container);
  outline-offset: 2px;
}

.login-button:disabled {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  cursor: not-allowed;
  box-shadow: none;
}

.login-button .material-symbols-outlined {
  font-size: 20px;
}

.login-button__spinner {
  animation: login-spin 0.9s linear infinite;
}

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

/* --- Help footer ---------------------------------------------------------- */
.login-help {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-variant);
}

.login-help a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
  font-weight: 500;
}

.login-help a:hover {
  text-decoration: underline;
}

/* --- Responsive: collapse to single column -------------------------------- */
@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .login-brand {
    padding: 40px 28px;
    gap: 28px;
  }

  .login-brand__tagline {
    font-size: 1.4rem;
  }

  /* hide the feature list on small screens to keep the form above the fold */
  .login-brand__features {
    display: none;
  }

  .login-form-col {
    padding: 32px 20px 48px;
  }

  .login-card {
    padding: 32px 24px;
  }

  .login-field input {
    font-size: 16px; /* prevent iOS zoom-on-focus */
  }
}
