/* ==========================================================================
   StarNexus 终端用户登录页 — styles-user-login.css
   --------------------------------------------------------------------------
   作用域：**仅** body#keycloak-bg.snx-realm-user（即 realm.name != "master"）
           master 管理域（body.snx-realm-admin）与其它主题完全不受影响。
   加载顺序：在 styles-brand-v9.css 之后（theme.properties 的 styles 顺序），
             故可复用其令牌并覆盖其布局规则。

   设计意图：把用户登录页从「居中单列卡片」升级为与管理台同族的
             「左侧深紫品牌板 + 右侧认证卡」双栏，理由是：
               · 1440/1920 桌面下原来的单列 452px 卡片周围大片留白，视觉失衡；
               · OJS / OMP / .press 的登录页已是该布局，Keycloak 作为统一认证入口
                 若保持单列，"一次登录" 的叙事在视觉上是断的；
               · 品牌板承载 LOGO + 价值点，卡片只留表单，信息层级更清楚。
   原则：只改视觉。不新增 / 不修改任何表单字段、CSRF、execution、client_data 参数。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 页面骨架：整屏两列，左品牌板 + 右认证区
   -------------------------------------------------------------------------- */
html {
  background: #F7F5FB !important;
}

/* body#keycloak-bg 的特异度是 (1,0,1)，v9 里用的是同一选择器，
   这里再加一个类提高特异度 (1,1,1) 才能稳定压过 v9 的背景与布局声明 */
body#keycloak-bg.snx-realm-user {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  min-height: 100vh !important;
  background-color: #F7F5FB !important;
  background-image: none !important;
}

/* 右侧认证区：占满剩余宽度，卡片在其中居中 */
body.snx-realm-user .pf-v5-c-login {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 100vh !important;
  display: grid !important;
  /* PF 默认列宽是 auto，会把 452px 的卡片挤成 336px —— 显式给一列 minmax */
  grid-template-columns: minmax(0, 1fr) !important;
  place-items: center !important;
  padding: 44px 32px !important;
  background-color: #F7F5FB !important;
  background-image:
    radial-gradient(760px 440px at 50% -6%, #EFEAF8 0%, rgba(239, 234, 248, 0) 68%) !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
}

/* 品牌标识已由左侧板承载，隐藏卡片上方的品牌头，避免同一屏出现两次 */
body.snx-realm-user #kc-header,
body.snx-realm-user .pf-v5-c-login__header {
  display: none !important;
}

body.snx-realm-user .pf-v5-c-login__container {
  grid-template-areas: "main" "footer" !important;
  grid-template-columns: minmax(0, 1fr) !important;
  justify-self: center !important;
  justify-content: center !important;
  max-width: 452px !important;
  width: 100% !important;
}

/* --------------------------------------------------------------------------
   2. 左侧品牌板
   -------------------------------------------------------------------------- */
.snx-user-aside {
  position: relative;
  flex: 0 0 46%;
  max-width: 700px;
  min-width: 400px;
  display: flex;
  overflow: hidden;
  color: #FFFFFF;
  background-image:
    radial-gradient(880px 520px at 8% 4%, rgba(212, 175, 55, .16) 0%, rgba(212, 175, 55, 0) 62%),
    radial-gradient(680px 460px at 102% 104%, rgba(108, 95, 123, .60) 0%, rgba(108, 95, 123, 0) 72%),
    linear-gradient(158deg, #3A2C55 0%, #4A3A6B 52%, #2E2444 100%);
}

/* 细网格肌理，只在左上角显影，给深色面一点材质感 */
.snx-user-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(circle at 26% 22%, #000 0%, transparent 76%);
  mask-image: radial-gradient(circle at 26% 22%, #000 0%, transparent 76%);
  pointer-events: none;
}

/* 与右侧浅色区的交界：一道金色柔光，替代生硬边线 */
.snx-user-aside::after {
  content: "";
  position: absolute;
  inset: 0 -1px 0 auto;
  width: 1px;
  background: linear-gradient(180deg,
    rgba(212, 175, 55, 0) 0%,
    rgba(212, 175, 55, .45) 45%,
    rgba(212, 175, 55, 0) 100%);
}

.snx-user-aside__inner {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 60px 56px;
  max-width: 620px;
}

/* 品牌区 + 价值说明作为一整块在剩余空间里垂直居中；页脚独占底部一行 */
.snx-user-aside__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 44px;
}

/* ---------- 2.1 品牌区 ---------- */
.snx-user-aside__brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.snx-user-aside__logo {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  /* 与全站 LOGO 外框统一：圆角方形（2026-10-03 由 50% 圆裁改来） */
  border-radius: 14px;
  object-fit: cover;
  background: #FFFFFF;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, .60), 0 12px 30px rgba(0, 0, 0, .38);
}

.snx-user-aside__brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.snx-user-aside__name {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: .012em;
  color: #FFFFFF;
}

.snx-user-aside__dot {
  color: var(--snx-gold, #D4AF37);
}

.snx-user-aside__tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(232, 200, 76, .94);
}

/* ---------- 2.2 价值说明 ---------- */
.snx-user-aside__headline {
  margin: 0 0 14px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: .01em;
  color: #FFFFFF;
}

.snx-user-aside__lede {
  margin: 0 0 32px;
  max-width: 42ch;
  font-size: 15px;
  line-height: 1.74;
  color: rgba(255, 255, 255, .78);
}

.snx-user-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.snx-user-points li {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.snx-user-points svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-top: 2px;
  color: var(--snx-gold, #D4AF37);
}

.snx-user-points span {
  font-size: 14px;
  line-height: 1.62;
  color: rgba(255, 255, 255, .74);
}

.snx-user-points b {
  font-weight: 650;
  color: #FFFFFF;
}

.snx-user-points__body::before {
  content: " — ";
  color: rgba(255, 255, 255, .42);
}

/* ---------- 2.3 页脚 ---------- */
.snx-user-aside__foot {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: .01em;
  color: rgba(255, 255, 255, .64);
}

/* --------------------------------------------------------------------------
   3. 身份视角切换（作者 / 编委）
   --------------------------------------------------------------------------
   原实现是 login.ftl 里的行内 <style>：1px currentColor 描边 + opacity 区分选中，
   选中态只靠透明度，弱且不符合无障碍对「状态可辨识」的要求。改为分段控件：
   浅紫底座 + 选中态白色凸起 + 描边 + 金色图标。
   契约保持：#snxRoleTabs / .snx-role-tab / .active / data-role —— JS 未改选择器。
   -------------------------------------------------------------------------- */
.snx-role-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  /* 底座比 --snx-bg-tint(#EFEAF8) 再深一档：与选中态白底的分界更清楚 */
  background-color: #EAE5F4;
  border: 1px solid var(--snx-border, #E2DEF0);
  border-radius: 14px;
}

.snx-role-tab {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  /* #5F5870 对底座 #EAE5F4 为 5.06:1、对浅紫 5.26:1 —— AA。
     不用 --snx-muted(#6B6580)：它在加深后的底座上只有 4.3:1，会掉出 AA。 */
  color: #5F5870;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1px;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent;
}

.snx-role-tab:hover {
  color: var(--snx-primary, #4A3A6B);
  background-color: rgba(255, 255, 255, .62);
}

/* 选中态：白色凸起 + 紫色描边。描边（#4A3A6B 系）对白底 5.5:1、
   对浅紫底 4.3:1，满足 1.4.11「非文本对比 ≥3:1」，
   不会出现「只靠 opacity 差异、看不清选中的是哪个」的问题。 */
.snx-role-tab.active {
  color: var(--snx-primary, #4A3A6B);     /* 白底 8.44:1 —— AAA */
  background-color: #FFFFFF;
  border-color: rgba(74, 58, 107, .38);
  box-shadow: 0 1px 3px rgba(74, 58, 107, .12);
  cursor: default;
}

.snx-role-tab__icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: currentColor;
}

.snx-role-tab.active .snx-role-tab__icon {
  color: var(--snx-gold-deep, #7D6318);
}

.snx-role-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--snx-primary, #4A3A6B);
}

.snx-role-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   4. 认证卡内的少量适配（卡片本体沿用 v9 的白卡 + 金按钮）
   -------------------------------------------------------------------------- */

/* 「记住我」：v9 只设了 accent-color，实际渲染出来是 13px 的原生小方块，
   与 14px 的输入框节奏不搭。放大到 17px 并补圆角 / 描边，仍用原生控件，
   保留 accent-color 的选中态着色，不引入自定义勾选层。 */
body.snx-realm-user .pf-v5-c-check__input {
  width: 17px !important;
  height: 17px !important;
  border-radius: 5px !important;
  accent-color: var(--snx-primary, #4A3A6B) !important;
  cursor: pointer;
}

body.snx-realm-user .pf-v5-c-check {
  align-items: center !important;
  gap: 9px !important;
}

body.snx-realm-user .pf-v5-c-check__label {
  font-size: 13px !important;
  color: var(--snx-muted, #6B6580) !important;
  font-weight: 500 !important;
  cursor: pointer;
}

/* 语言选择器：v9 已给胶囊底，这里只把悬停/聚焦态补齐，
   与卡片内其它控件的交互反馈保持一致 */
body.snx-realm-user .pf-v5-c-login__main-header-utilities .pf-v5-c-form-control:hover {
  border-color: var(--snx-primary-soft, #6C5F7B) !important;
}

body.snx-realm-user .pf-v5-c-login__main-header-utilities select {
  cursor: pointer;
}

/* 安全声明与版本号已由左侧品牌板承担，卡片底部不再重复。
   注意要连 .snx-footnote-ver 一起隐藏：两者是并列的兄弟节点，
   只藏 .snx-footnote 会留下一条失去上下文的版本号孤行。 */
body.snx-realm-user .snx-footnote,
body.snx-realm-user .snx-footnote-ver {
  display: none !important;
}

/* --------------------------------------------------------------------------
   5. 断点：< 1024px 品牌板收缩为顶部条（与管理台登录页同一处理）
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  body#keycloak-bg.snx-realm-user {
    flex-direction: column !important;
  }

  .snx-user-aside {
    flex: 0 0 auto !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .snx-user-aside__inner {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 22px 24px !important;
  }

  .snx-user-aside__body {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0 !important;
  }

  .snx-user-aside__pitch,
  .snx-user-aside__foot {
    display: none !important;
  }

  .snx-user-aside__logo {
    width: 44px !important;
    height: 44px !important;
    flex-basis: 44px !important;
    border-radius: 11px !important;
  }

  .snx-user-aside__name {
    font-size: 18px !important;
  }

  body.snx-realm-user .pf-v5-c-login {
    min-height: 0 !important;
    padding: 36px 20px 48px !important;
  }
}

/* 矮屏（笔记本 1280×720 / 1366×768）：压缩品牌板纵向节奏，保证首屏不滚动 */
@media (min-width: 1024px) and (max-height: 820px) {
  .snx-user-aside__inner {
    gap: 26px;
    padding: 40px 48px;
  }

  .snx-user-aside__headline {
    font-size: 25px;
  }

  .snx-user-aside__lede {
    margin-bottom: 22px;
    font-size: 14px;
  }

  .snx-user-points {
    gap: 13px;
  }

  body.snx-realm-user .pf-v5-c-login {
    padding: 28px 32px !important;
  }
}

/* --------------------------------------------------------------------------
   6. 无障碍偏好
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .snx-user-aside,
  .snx-user-aside::before,
  .snx-user-aside::after,
  .snx-role-tab {
    transition: none !important;
  }
}
