/* =====================================================================
 * Web UI · Pages · Login.css
 * ---------------------------------------------------------------------
 * 页面专属样式。仅被该页面引用的类归此文件;
 * 被 >=2 个页面引用的类归 css/components.css(判定口径见
 * openspec/changes/add-web-ui-redesign/design.md §D2)。
 * ===================================================================== */

/* ---------- 登录页 v2 旗舰版(2026-10-13 重构)—— 50/50 分屏 + Data Constellation + glass 登录卡 ---------- */
/* ============================================================
   登录页 v2 旗舰版(2026-10-13 重构)
   - 50/50 分屏:左 hero 深紫 + Data Constellation,右浅紫 + glass 登录卡
   - 保留 SloganMain 中文口号("助力客户、行业和社会可持续发展",2026-10-13 合并 SloganSub 为单行)
   - 不接 tenant theme(Web 主色硬约束,见 docs/web/UI规范.md §2.3)
   - 完整 token / 动效 / 移动端响应见 docs/web/redesign-preview/design-spec.md
   ============================================================ */

.login-page {
  /* 2026-10-13:min-height → height,强制恰好 100vh,杜绝纵向滚动条。
     overflow: hidden 兜底:内嵌内容若仍溢出,被裁掉而不引发滚动。
     内层用 min-height: 0 + flex: 1 配合,允许 flex 子项在父级约束内收缩。 */
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}

/* —— 左半边 hero(深紫)—— */
.login-hero {
  position: relative;
  background: var(--primary-deep-night);
  padding: 36px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* min-height: 0 让 flex 子项可在父级高度内收缩(否则会撑爆 100vh) */
  min-height: 0;
  overflow: hidden;
  color: #ffffff;
}
/* 网格底纹 */
.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 1;
}
/* 紫色光晕(主色 25% 渐隐到边缘) */
.login-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 75% 25%, rgba(110, 77, 255, 0.35), transparent 60%),
    radial-gradient(ellipse 60% 60% at 25% 85%, rgba(124, 58, 237, 0.25), transparent 70%);
  pointer-events: none;
  z-index: 2;
}
.login-hero > * { position: relative; z-index: 3; }

/* hero 顶部品牌区 */
.login-hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: #ffffff;
  letter-spacing: -0.01em;
}
/* 用真实 logo(默认 /images/logo.png,租户可覆盖);
   144px 源缩到 40px,object-fit: contain 保持比例 */
.login-hero-brand-mark {
  width: 40px; height: 40px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}
.login-hero-brand-text {
  color: #ffffff;
  /* 大写品牌字,字间距略放,提升识别度 */
  letter-spacing: 0.04em;
}

/* hero 中部内容(constellation + slogan) */
.login-hero-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0;
  /* flex: 1 + min-height: 0 让中部在父级约束内自适应占满剩余空间,
     空间不足时向下收缩而不是撑爆 100vh */
  flex: 1;
  min-height: 0;
  justify-content: center;
}
.login-hero-constellation {
  position: relative;
  width: 100%;
  /* 2026-10-13:420 → 320,给 slogan 留垂直余量,确保 ≤900h 视口不溢出 */
  max-width: 320px;
  aspect-ratio: 1;
  margin: 0 auto;
}
.login-hero-eyebrow {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary-light);
  font-weight: 500;
}
/* 中文口号(单行 SloganMain,2026-10-13 合并 SloganSub,不再右对齐第二行) */
.login-slogan-main {
  font-family: 'Plus Jakarta Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #ffffff;
  margin: 0;
  text-align: left;
}
.login-hero-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
  max-width: 100%;
  /* 2026-10-13:不再强制换行,父容器 login-hero-content 负责约束;短视口断点已有 display:none */
  white-space: nowrap;
  line-height: 1.6;
}

/* hero 底部统计区 */
.login-hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.login-hero-stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.login-hero-stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* —— Data Constellation 动效 ——
     闪烁感的真正根因是 opacity 对比幅度,不是周期。
     2026-10-13 三调:节点 0.55→1(差 45%) 改为 0.78→1(差 22%),
     hub-glow 0.3→0.7(差 40%) 改为 0.45→0.7(差 25%),
     在 7.5s 周期下从"闪烁"转为"缓慢呼吸"。*/
@keyframes constellation-node-pulse {
  0%, 100% { opacity: 0.78; }
  50%      { opacity: 1; }
}
@keyframes constellation-hub-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
@keyframes constellation-hub-glow {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.7; }
}
@keyframes constellation-data-flow {
  to { stroke-dashoffset: -32; }
}
.constellation-node {
  animation: constellation-node-pulse var(--motion-pulse) ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.constellation-node--front { animation-delay: 0s; }
.constellation-node--mid   { animation-delay: 0.3s; }
.constellation-node--back  { animation-delay: 0.6s; }
.constellation-hub {
  transform-origin: center;
  transform-box: fill-box;
  animation: constellation-hub-breathe var(--motion-pulse) ease-in-out infinite;
}
.constellation-hub-glow {
  transform-origin: center;
  transform-box: fill-box;
  animation: constellation-hub-glow var(--motion-pulse) ease-in-out infinite;
}
.constellation-link {
  stroke: var(--primary-light);
  stroke-width: 1;
  stroke-opacity: 0.25;
  fill: none;
}
.constellation-flow {
  stroke: var(--primary-electric);
  stroke-width: 1.5;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 2 30;
  stroke-dashoffset: 0;
  /* 时长 2026-10-13 调整:4/6/3s → 6/9/5s(1.5x 放慢,避免视觉闪动) */
  animation: constellation-data-flow 6s linear infinite;
}
.constellation-flow--slow { animation-duration: 9s; }
.constellation-flow--fast { animation-duration: 5s; }

/* —— 右半边(浅紫 + glass 登录卡)—— */
.login-side {
  position: relative;
  background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  /* min-height: 0 配合父级 height: 100vh,让卡片在视口内完整显示 */
  min-height: 0;
  overflow: hidden;
}
.login-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(110, 77, 255, 0.08), transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(124, 58, 237, 0.06), transparent 50%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-hero);
  padding: 32px 32px 24px;
  /* max-height 让卡片在低高度视口下收缩而不是撑出滚动条 */
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.login-card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}
.login-card-logo {
  width: 72px; height: 72px;
  object-fit: contain;
  display: block;
  margin-bottom: 16px;
  filter: drop-shadow(0 8px 20px rgba(91, 79, 207, 0.18));
}
.login-brand {
  font-family: 'Plus Jakarta Sans', 'PingFang SC', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  text-align: center;
}
.login-brand-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  font-family: 'DM Sans', sans-serif;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  font-family: 'DM Sans', sans-serif;
}
.login-input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-heading);
  outline: none;
  transition: border-color var(--motion-base) var(--ease-out),
              box-shadow var(--motion-base) var(--ease-out);
}
.login-input:focus {
  border-color: var(--primary-main);
  box-shadow: 0 0 0 4px rgba(91, 79, 207, 0.12);
}
.login-input::placeholder { color: var(--text-muted); }
.login-input--select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2364748B' stroke-width='1.5'%3e%3cpath d='M4 6l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.login-button {
  height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-main) 0%, var(--primary-electric) 100%);
  color: #ffffff;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  box-shadow: 0 4px 12px rgba(91, 79, 207, 0.25);
  transition: transform var(--motion-base) var(--ease-out),
              box-shadow var(--motion-base) var(--ease-out);
}
.login-button:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(91, 79, 207, 0.35);
}
.login-button:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(91, 79, 207, 0.2);
}
.login-button-arrow {
  transition: transform var(--motion-base) var(--ease-out);
}
.login-button:hover .login-button-arrow { transform: translateX(3px); }

.login-card-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.login-card-footer a {
  color: var(--primary-main);
  font-weight: 600;
}
.login-card-footer a:hover { color: var(--primary-electric); }

.login-error {
  color: #DC2626;
  background: rgba(220, 38, 38, 0.08);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-danger);
  font-size: 13px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-left-width: 3px;
  font-family: 'DM Sans', sans-serif;
  margin-bottom: 4px;
}

/* —— 入场动效 —— */
@keyframes login-hero-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-hero-brand,
.login-hero-eyebrow,
.login-slogan-main,
.login-hero-sub,
.login-hero-stats {
  animation: login-hero-fade-in var(--motion-slow) var(--ease-out) backwards;
}
.login-hero-brand   { animation-delay: 0.05s; }
.login-hero-eyebrow { animation-delay: 0.20s; }
.login-slogan-main  { animation-delay: 0.30s; }
.login-hero-sub     { animation-delay: 0.50s; }
.login-hero-stats   { animation-delay: 0.60s; }

@keyframes login-card-slide-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.login-card { animation: login-card-slide-in var(--motion-slow) var(--ease-out) 0.3s backwards; }

@keyframes login-field-stagger {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-form .login-row:nth-child(1) { animation: login-field-stagger var(--motion-base) var(--ease-out) 0.50s backwards; }
.login-form .login-row:nth-child(2) { animation: login-field-stagger var(--motion-base) var(--ease-out) 0.56s backwards; }
.login-form .login-row:nth-child(3) { animation: login-field-stagger var(--motion-base) var(--ease-out) 0.62s backwards; }
.login-form .login-button           { animation: login-field-stagger var(--motion-base) var(--ease-out) 0.68s backwards; }

@keyframes login-constellation-stagger {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}
.constellation-node, .constellation-hub {
  animation-name: login-constellation-stagger, constellation-node-pulse;
  animation-duration: var(--motion-base), var(--motion-pulse);
  animation-timing-function: var(--ease-spring), ease-in-out;
  animation-fill-mode: backwards, both;
  animation-delay: 0.5s, 1.0s;
  /* 2026-10-13 根因修复:之前用拆解写法未声明 iteration-count,
     沿用 L778 简写展开的 infinite,导致 stagger 入场动画也 4Hz 无限循环,
     调大 --motion-pulse 救不了。改为 1 + infinite,只让 pulse 持续呼吸 */
  animation-iteration-count: 1, infinite;
}
.constellation-hub {
  animation-name: login-constellation-stagger, constellation-hub-breathe;
}
.constellation-node--mid   { animation-delay: 0.6s, 1.1s; }
.constellation-node--back  { animation-delay: 0.7s, 1.2s; }
.constellation-link {
  animation: login-hero-fade-in var(--motion-slow) var(--ease-out) 0.9s backwards;
}

/* —— 移动端(<= 900px):hero 高度 280px,卡片居中 —— */
@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-hero {
    min-height: 280px;
    padding: 32px 24px;
  }
  .login-hero-constellation { max-width: 200px; }
  .login-slogan-main {
    font-size: 28px;
    text-align: left;
  }
  .login-hero-sub { display: none; }
  .login-hero-stats { gap: 20px; padding-top: 16px; }
  .login-hero-stat-value { font-size: 20px; }
  .login-side { padding: 24px 16px; }
  .login-card {
    border-radius: var(--radius-lg);
    padding: 32px 24px;
  }
}

/* —— 短视口(<= 800px 高):隐藏 hero 描述句,留 50px 余量确保 100vh 内放下 —— */
@media (max-height: 800px) {
  .login-hero-sub { display: none; }
  .login-hero-constellation { max-width: 260px; }
  .login-hero-stats { padding-top: 12px; }
}
