/* @changeId workspace.update.LOGIN-001 @featureId workspace.login.presentation
 * Scoped to the login screen only. Consumes existing 18-theme tokens (--surface,
 * --text, --dim, --heading) via color-mix; never forces fixed dark/white colors.
 * Exit the login screen and none of these rules apply to business pages.
 *
 * Brand layout (user-final 2026-10-25):
 *   HIWIN panel LEFT, TETRA panel LEFT, NEXUS panel RIGHT.
 *   Step-2 verification modal follows the SAME side (R-08).
 */

/* ---- Video background stage ---- */
#loginScreen.workspace-login-stage { position: fixed; inset: 0; overflow: hidden; background: #0b1622; }
#loginScreen .design-visual.workspace-login-video-stage {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
#loginScreen .workspace-login-video-stage .workspace-login-poster,
#loginScreen .workspace-login-video-stage .workspace-login-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center center; border: 0;
}
#loginScreen .workspace-login-video-stage .workspace-login-video { background: #0b1622; }
/* Local scrim: darkens the panel band, keeps logo side bright. */
#loginScreen .workspace-login-video-stage .workspace-login-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(100deg,
    rgba(8,16,26,0.55) 0%, rgba(8,16,26,0.40) 32%,
    rgba(8,16,26,0.12) 55%, rgba(8,16,26,0.04) 75%, rgba(8,16,26,0.0) 100%);
}
#loginScreen[data-login-brand="nexus"] .workspace-login-scrim {
  background: linear-gradient(260deg,
    rgba(8,16,26,0.55) 0%, rgba(8,16,26,0.40) 32%,
    rgba(8,16,26,0.12) 55%, rgba(8,16,26,0.04) 75%, rgba(8,16,26,0.0) 100%);
}
#loginScreen[data-login-brand="nexus"] .workspace-login-video { object-position: 65% center; }
#loginScreen[data-login-brand="hiwin"] .workspace-login-video { object-position: 60% center; }
#loginScreen[data-login-brand="tetra"] .workspace-login-video { object-position: 50% center; }

/* ---- Glass panel: consumes theme --surface / --text via color-mix ---- */
#loginScreen .design-login { position: relative; z-index: 2; }
@media (min-width: 900px) {
  #loginScreen.workspace-login-stage .login-box,
  #loginScreen .design-login {
    margin: 0 6vw 0 6vw;
    max-width: 440px;
    background: color-mix(in srgb, var(--surface, #fdfcf8) 30%, transparent);
    /* LOGIN-001: removed backdrop blur so the looping video stays sharp behind
       the panel. Keep only the non-blur saturate() color tweak; no frosted glass. */
    backdrop-filter: saturate(125%);
    -webkit-backdrop-filter: saturate(125%);
    border: 1px solid color-mix(in srgb, var(--text, #2a2419) 16%, transparent);
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.28);
    color: var(--text, #2a2419);
  }
  #loginScreen[data-login-brand="hiwin"].workspace-login-stage .login-box,
  #loginScreen[data-login-brand="hiwin"] .design-login,
  #loginScreen[data-login-brand="tetra"].workspace-login-stage .login-box,
  #loginScreen[data-login-brand="tetra"] .design-login { margin-left: 6vw; margin-right: auto; }
  #loginScreen[data-login-brand="nexus"].workspace-login-stage .login-box,
  #loginScreen[data-login-brand="nexus"] .design-login { margin-left: auto; margin-right: 6vw; }
  #loginScreen.workspace-login-stage .login-box h2,
  #loginScreen .design-login h2 { color: var(--heading, #211b11); }
  #loginScreen.workspace-login-stage .login-box label,
  #loginScreen .design-login label { color: var(--text, #2a2419); }
  #loginScreen.workspace-login-stage .login-box .form-control {
    background: color-mix(in srgb, var(--surface, #fdfcf8) 55%, transparent);
    color: var(--text, #2a2419);
    border: 1px solid color-mix(in srgb, var(--text, #2a2419) 25%, transparent);
  }
}
@media (max-width: 899px) {
  #loginScreen .design-login {
    background: color-mix(in srgb, var(--surface, #fdfcf8) 32%, transparent);
    backdrop-filter: saturate(125%);
    -webkit-backdrop-filter: saturate(125%);
    border: 1px solid color-mix(in srgb, var(--text, #2a2419) 16%, transparent);
    border-radius: 14px;
    color: var(--text, #2a2419);
  }
}

/* ---- INT-033 R01: when the SMS verify step is active, the stage gets
   .workspace-login-code. Hide the step-1 form so it no longer shows through the
   38%-transparent verify modal (no overlapping title/inputs/buttons/policy links).
   The verify overlay is a separate stage child carrying .design-verify /
   .workspace-login-verification and NOT .design-login, so it stays visible.
   form.inert already keeps keyboard focus out; on back the class is removed and
   visibility restores. The same <video> node and playback progress are untouched. ---- */
#loginScreen.workspace-login-code .design-login { visibility: hidden; }

/* ---- INT-033 R02: the shared global .btn rule in style.css applies
   backdrop-filter: blur(12px) to every button. Remove only the blur on login
   buttons (Send SMS / Resend / Back / Sign in), scoped to the login screen and
   the SMS verify overlay. Button background, box-shadow, ::before top highlight,
   hover/active transforms and 18-theme metal material/color/border all remain from
   style.css; this override does not touch the shared business-button style. ---- */
#loginScreen .design-login .btn,
.modal-overlay.workspace-login-verification .btn {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---- R-09 fix: language clip grid stacking (ported from payment-login-scene.css
   lines 74-76). All language layers stack in grid-area:1/1; only current visible.
   Hidden size spans do NOT take inline width. ---- */
#loginScreen .login-language-clip {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  position: relative; width: 100%; min-width: 0;
  overflow: hidden; vertical-align: bottom;
  text-align: inherit;
  font: inherit !important; letter-spacing: inherit; line-height: inherit;
}
#loginScreen .login-language-clip > span {
  grid-area: 1 / 1;
  display: block !important;
  font: inherit !important; letter-spacing: inherit; line-height: inherit;
  white-space: normal; overflow-wrap: normal;
  align-self: center;
}
#loginScreen .login-language-size {
  visibility: hidden !important;
  pointer-events: none;
}

/* ---- Steps row: number + label same line, centered ---- */
#loginScreen .login-steps,
.modal-overlay.workspace-login-verification .login-steps {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0;
}
#loginScreen .login-steps .current,
.modal-overlay.workspace-login-verification .login-steps .current {
  display: flex; align-items: center; gap: 12px;
}
#loginScreen .login-steps i,
.modal-overlay.workspace-login-verification .login-steps i {
  font-style: normal; min-width: 42px; flex-shrink: 0; padding: 0 5px; white-space: nowrap;
}
#loginScreen .login-steps .quad-step-label,
.modal-overlay.workspace-login-verification .quad-step-label {
  font-size: 14px; font-weight: 500;
}

/* ---- Language picker: compact, top-right of panel ---- */
#loginScreen .login-language-picker,
.modal-overlay.workspace-login-verification .login-language-picker {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 0 0 14px; font-size: 13px;
}
#loginScreen .login-language-picker label,
.modal-overlay.workspace-login-verification .login-language-picker label {
  margin: 0;
}

/* ---- Step-2 verification modal: compact, follows brand side (R-08) ---- */
.modal-overlay.workspace-login-verification {
  background: rgba(6,12,20,0.45);
  justify-content: center;
  /* LOGIN-001: neutralize the global .modal-overlay backdrop blur(6px) so the
     looping video stays sharp behind the SMS verify step. Scoped to the login
     verify overlay only; business modals keep their own blur. The 0.45 dimmer
     stays as the readability scrim. */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
@media (min-width: 900px) {
  /* HIWIN/TETRA: modal on the left, same as step 1. */
  #loginScreen[data-login-brand="hiwin"] ~ .modal-overlay.workspace-login-verification,
  body:has(#loginScreen[data-login-brand="hiwin"]) .modal-overlay.workspace-login-verification,
  #loginScreen[data-login-brand="tetra"] ~ .modal-overlay.workspace-login-verification,
  body:has(#loginScreen[data-login-brand="tetra"]) .modal-overlay.workspace-login-verification {
    justify-content: flex-start;
    padding-left: 6vw;
  }
  /* NEXUS: modal on the right, same as step 1. */
  body:has(#loginScreen[data-login-brand="nexus"]) .modal-overlay.workspace-login-verification {
    justify-content: flex-end;
    padding-right: 6vw;
  }
}
.modal-overlay.workspace-login-verification .modal {
  max-width: 440px;
  background: color-mix(in srgb, var(--surface, #fdfcf8) 38%, transparent) !important;
  backdrop-filter: saturate(125%);
  -webkit-backdrop-filter: saturate(125%);
  color: var(--text, #2a2419) !important;
  border: 1px solid color-mix(in srgb, var(--text, #2a2419) 14%, transparent);
}
.modal-overlay.workspace-login-verification .modal .modal-header {
  background: transparent !important;
  color: var(--text, #2a2419) !important;
  border-bottom: 1px solid color-mix(in srgb, var(--text, #2a2419) 10%, transparent);
}
.modal-overlay.workspace-login-verification .modal .modal-header h3,
.modal-overlay.workspace-login-verification .modal #phoneLoginTitle {
  text-align: center !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.modal-overlay.workspace-login-verification .modal .modal-footer {
  background: transparent !important;
  border-top: 1px solid color-mix(in srgb, var(--text, #2a2419) 10%, transparent);
}
.modal-overlay.workspace-login-verification .modal label { color: var(--text, #2a2419); }
.modal-overlay.workspace-login-verification .modal .form-control {
  background: color-mix(in srgb, var(--surface, #fdfcf8) 55%, transparent);
  color: var(--text, #2a2419);
  border: 1px solid color-mix(in srgb, var(--text, #2a2419) 25%, transparent);
}
.modal-overlay.workspace-login-verification #plCode { width: 100%; }
.workspace-login-methods { display: flex; gap: 8px; margin: 4px 0 12px; }
.workspace-login-methods[hidden] { display: none; }
#plSend { margin-top: 10px; }
#plNotice { min-height: 18px; font-size: 13px; margin: 8px 0 0; color: color-mix(in srgb, var(--text, #2a2419) 72%, var(--dim, #5a5244)); text-shadow: 0 1px 2px rgba(255,255,255,0.65), 0 0 1px rgba(255,255,255,0.45); }
#plError { min-height: 18px; font-size: 13px; color: #b33324; margin: 4px 0 0; text-shadow: 0 1px 2px rgba(255,255,255,0.65), 0 0 1px rgba(255,255,255,0.45); }

/* ---- Fallback (background unavailable) keeps the form usable ---- */
html.payment-login-fallback #loginScreen .design-visual.workspace-login-video-stage { display: none; }
html.payment-login-fallback #loginScreen .design-login {
  background: var(--surface, #fdfcf8);
  color: var(--text, #2a2419);
}

/* ---- Motion control ---- */
.login-motion-control {
  position: absolute; right: 16px; bottom: 14px; z-index: 3;
  font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  color: var(--text, #2a2419);
  background: color-mix(in srgb, var(--surface, #fdfcf8) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--text, #2a2419) 18%, transparent);
}

/* ---- Send status ---- */
.workspace-login-status {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 13px; color: var(--text, #2a2419);
}
.workspace-login-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--text, #2a2419) 25%, transparent);
  border-top-color: currentColor;
  animation: workspace-login-spin 0.9s linear infinite;
}
@keyframes workspace-login-spin { to { transform: rotate(360deg); } }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  #loginScreen .workspace-login-video { animation: none; }
  .workspace-login-spinner { animation-duration: 2s; }
}
