/* 
# Copyright (c) 2026 Nokia. All rights reserved.
# This program contains proprietary information which is a trade secret
# of Nokia and also is protected as an unpublished work under applicable
# Copyright laws. Recipient is to retain this program in confidence and
# is not permitted to use or make copies thereof other than as permitted
# in a written agreement with Nokia.
*/

@font-face {
  font-family: 'Nokia Pure Text';
  src: url('/assets/NokiaPureText_Rg.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* Brand tokens. The IAP layer overrides individual surface colours where it
   needs the dark-on-photo treatment; reusing variables keeps any new
   component (or future email template) on the same palette by default. */
:root {
  --signin-bg: #1a1a2e;
  --signin-text: #fff;
  --signin-text-muted: rgba(255, 255, 255, 0.7);
  --signin-error: #f00;
  --signin-error-soft: #ffb4b4;
  --signin-success: #80f0a0;
  --signin-focus-ring: rgba(255, 255, 255, 0.85);
  --signin-accent: rgba(35, 2, 247, 0.9);
}

html {
  min-height: 100%;
}

body {
  font-family: 'Nokia Pure Text', system-ui, sans-serif;
  background-color: var(--signin-bg);
  background-image: url('/assets/Nokia.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Visible focus ring on every interactive element. Browsers vary on default
   :focus styling; pinning it explicitly is essential for keyboard users. */
[data-id] :where(input, textarea, button, a):focus-visible,
[data-id]:where(input, textarea, button, a):focus-visible {
  outline: 2px solid var(--signin-focus-ring);
  outline-offset: 2px;
}

/* Error/loading step styles (shared by signin.html and signin-iap.html) */
.error-slot,
.main-container [data-id="error-slot"],
#firebaseui-container [data-id="error-slot"] {
  min-height: 2em;
  width: 100%;
  max-width: min(420px, 92vw);
  min-width: 0;
  text-align: right;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

#error,
.main-container [data-id="error"],
#firebaseui-container [data-id="error"] {
  color: #f00;
  font-size: 1.125rem;
  margin: 0;
  max-width: min(420px, 92vw);
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

#idp-step,
.main-container [data-id="redirect-status"],
#firebaseui-container [data-id="redirect-status"] {
  color: #000;
  text-align: right;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 200px;
  min-width: 0;
}

#idp-step p {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Loading page (post IdP authentication) - separate from redirect message */
#loading-page,
.main-container [data-id="loading-page"],
#firebaseui-container [data-id="loading-page"] {
  color: #fff;
  text-align: right;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 200px;
  min-width: 0;
}

#loading-page p {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Email form layout (signin.html + email-first-handler) */
.signin-email-row,
[data-id="email-input-row"] {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.signin-email-form,
[data-id="email-form"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Email input/button base (signin.html + signin-iap overrides) */
.signin-email-input,
#email-step input[type="email"],
[data-id="email-input"] {
  width: 100%;
  min-width: 180px;
  max-width: 280px;
  padding: 0.5rem;
  box-sizing: border-box;
  font-size: 1.125rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  -webkit-text-fill-color: #fff;
  border-radius: 4px;
}

.signin-email-input::placeholder,
#email-step input[type="email"]::placeholder,
[data-id="email-input"]::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.signin-email-input:focus,
#email-step input[type="email"]:focus,
[data-id="email-input"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.45);
}

.signin-email-btn,
#email-step button,
[data-id="continue-btn"] {
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 4px;
}

.signin-email-btn:hover,
#email-step button:hover,
[data-id="continue-btn"]:hover {
  background: rgba(255, 255, 255, 0.25);
}

[data-id="tos-privacy-footer"] {
  text-align: right;
  font-size: 0.85rem;
  max-width: 200px;
  min-width: 0;
}

/* Auth method picker (shown when more than one sign-in method is enabled). */
[data-id="auth-method-picker"] {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
}

[data-id="auth-method-list"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

[data-id="auth-method-list"] button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.6rem 0.9rem;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  font: inherit;
}

[data-id="auth-method-label"] {
  font-weight: 600;
}

[data-id="auth-method-description"] {
  font-size: 0.85rem;
  opacity: 0.85;
}

/* Phone OTP form (mirrors email-first layout). */
[data-id="phone-otp-form"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

[data-id="phone-input-row"],
[data-id="otp-input-row"] {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

[data-id="phone-input"],
[data-id="otp-input"] {
  width: 100%;
  min-width: 180px;
  max-width: 280px;
  padding: 0.5rem;
  box-sizing: border-box;
  font-size: 1.125rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  -webkit-text-fill-color: #fff;
  border-radius: 4px;
}

[data-id="phone-input"]::placeholder,
[data-id="otp-input"]::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

[data-id="phone-input"]:focus,
[data-id="otp-input"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.45);
}

[data-id="phone-send-btn"],
[data-id="phone-verify-btn"],
[data-id="phone-resend-btn"] {
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 4px;
}

[data-id="phone-send-btn"]:hover,
[data-id="phone-verify-btn"]:hover,
[data-id="phone-resend-btn"]:hover {
  background: rgba(255, 255, 255, 0.25);
}

[data-id="phone-nav-row"] {
  display: flex;
  justify-content: flex-end;
}

[data-id="phone-back-btn"] {
  background: transparent;
  border: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

[data-id="recaptcha-container"] {
  display: flex;
  justify-content: flex-end;
}

/* Email-link (magic link) form. */
[data-id="email-link-form"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

[data-id="email-link-input-row"] {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

[data-id="email-link-input"] {
  width: 100%;
  min-width: 180px;
  max-width: 280px;
  padding: 0.5rem;
  box-sizing: border-box;
  font-size: 1.125rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  -webkit-text-fill-color: #fff;
  border-radius: 4px;
}

[data-id="email-link-input"]::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

[data-id="email-link-input"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.45);
}

[data-id="email-link-send-btn"] {
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 4px;
}

[data-id="email-link-send-btn"]:hover {
  background: rgba(255, 255, 255, 0.25);
}

[data-id="email-link-status"] {
  text-align: right;
  max-width: min(420px, 92vw);
  word-wrap: break-word;
  color: #fff;
}

[data-id="email-link-nav-row"] {
  display: flex;
  justify-content: flex-end;
}

[data-id="email-link-back-btn"] {
  background: transparent;
  border: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

/* --- Access-request form (Option D) ----------------------------------- */

[data-id="access-request-form"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(420px, 92vw);
  margin-left: auto;
}

[data-id="access-request-title"] {
  margin: 0;
  font-weight: 600;
}

[data-id="access-request-intro"] {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Read-only "Submitting access request for: <email>" panel that sits
   between the intro and the form fields. Visually called out with a
   light chip so the user notices it before filling in the rest. */
[data-id="access-request-email-display"] {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 0.85rem;
}

[data-id="access-request-email-display-row"] {
  word-break: break-all; /* long emails wrap inside the chip, not overflow */
}

[data-id="access-request-email-display-hint"] {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* --- SSO-required panel ------------------------------------------------ *
 *
 * Rendered by the email-link / email-otp drivers when the server returns
 * `403 { reason: 'sso_required' }`. Wrapped in a soft callout card so the
 * user recognises it as a "you need to do something different" prompt
 * rather than just another form field — same intent as the IAP variant,
 * just toned down for the plain (no-photo) backdrop.
 */
[data-id="sso-required-panel"] {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.5rem 0;
  padding: 0.85rem 0.95rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  box-shadow: inset -3px 0 0 0 rgba(0, 0, 0, 0.15);
  text-align: right;
}

[data-id="sso-required-title"] {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: right;
}

[data-id="sso-required-email"] {
  padding: 0.4rem 0.6rem;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.85rem;
  word-break: break-all;
  text-align: right;
}

[data-id="sso-required-body"] {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
  line-height: 1.4;
  text-align: right;
}

[data-id="sso-required-actions"] {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.25rem;
  text-align: right;
}

/* Label + input pairs inside the access-request form. Attribute-prefix
   selectors so adding a new field (first-name / last-name / company /
   country) doesn't need a CSS update — the data-id naming convention
   alone is enough to pick up the shared styling. */
[data-id="access-request-form"] label[data-id^="access-request-"][data-id$="-label"] {
  font-size: 0.8rem;
  opacity: 0.75;
}

[data-id="access-request-form"] input[data-id^="access-request-"][data-id$="-input"],
[data-id="access-request-form"] textarea[data-id^="access-request-"][data-id$="-input"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  font: inherit;
  box-sizing: border-box;
}

/* Two-column rows: first/last name, company/country. Use grid (rather
   than flex) so the two columns share width 1:1 even when one input has
   a longer placeholder than the other. Stacks vertically below 480px so
   inputs stay tappable on phones. */
[data-id="access-request-form"] .access-request-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

[data-id="access-request-form"] .access-request-field-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0; /* let inputs shrink inside the grid track */
}

@media (max-width: 480px) {
  [data-id="access-request-form"] .access-request-field-row {
    grid-template-columns: 1fr;
  }
}

[data-id="access-request-reason-input"] {
  resize: vertical;
}

[data-id="access-request-captcha-slot"] {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

[data-id="access-request-nav-row"] {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

[data-id="access-request-back-btn"] {
  background: transparent;
  border: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

[data-id="access-request-status"] {
  text-align: right;
  margin: 0;
}

[data-id="access-request-error"] {
  color: #c0392b;
  text-align: right;
  margin: 0;
}

/* --- Email-OTP (Phase 3) ------------------------------------------------ */

[data-id="email-otp-form"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

[data-id="email-otp-input-row"],
[data-id="email-otp-code-row"] {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

[data-id="email-otp-input"],
[data-id="email-otp-code-input"] {
  width: 100%;
  min-width: 180px;
  max-width: 280px;
  padding: 0.5rem;
  box-sizing: border-box;
  font-size: 1.125rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  -webkit-text-fill-color: #fff;
  border-radius: 4px;
}

[data-id="email-otp-code-input"] {
  /* Bigger letter-spacing so 6-digit codes read clearly. */
  letter-spacing: 0.25em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

[data-id="email-otp-input"]::placeholder,
[data-id="email-otp-code-input"]::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

[data-id="email-otp-input"]:focus,
[data-id="email-otp-code-input"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.45);
}

[data-id="email-otp-send-btn"],
[data-id="email-otp-verify-btn"] {
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 4px;
}

[data-id="email-otp-send-btn"]:hover,
[data-id="email-otp-verify-btn"]:hover {
  background: rgba(255, 255, 255, 0.25);
}

[data-id="email-otp-status"] {
  text-align: right;
  max-width: min(420px, 92vw);
  word-wrap: break-word;
  color: #fff;
}

[data-id="email-otp-code-block"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

[data-id="email-otp-code-label"] {
  font-size: 0.8rem;
  opacity: 0.75;
  text-align: right;
}

[data-id="email-otp-code-nav-row"],
[data-id="email-otp-nav-row"] {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

[data-id="email-otp-resend-btn"],
[data-id="email-otp-back-btn"] {
  background: transparent;
  border: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

/* --- Busy state (withBusy in auth-ux.ts) ------------------------------- */

/* The `.is-busy` class is applied to a button while an async submit is in
   flight. We hide the existing label / arrow and overlay a small spinner so
   the user knows their click was registered. `cursor: wait` reinforces the
   message while the document.body cursor stays normal. */
button.is-busy {
  position: relative;
  cursor: wait;
  /* Hide the label without affecting the box (font-size / display would
     reflow). Pseudo-element border colours below stay opaque because
     they're set explicitly. */
  color: transparent !important;
  text-shadow: none !important;
}

button.is-busy::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  top: 50%;
  left: 50%;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: signin-spin 0.8s linear infinite;
}

/* Hide any direct child markers (e.g. the picker's <span> labels) so the
   spinner is the only thing visible. visibility (not display) preserves
   the button's intrinsic width so it doesn't jump around. */
button.is-busy > * {
  visibility: hidden;
}

/* The continue button uses an ::after arrow as its visible glyph (the actual
   text is hidden by font-size:0 in the IAP overrides). Hide the arrow when
   busy so the spinner takes its place. */
[data-id="continue-btn"].is-busy::after {
  visibility: hidden !important;
}

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

/* Persistence hint shown just above the method list. Heading was removed
   (the buttons are self-describing); this single line stays so users
   understand the choice persists across visits. */
[data-id="auth-method-picker-hint"] {
  margin: 0 0 0.5rem 0;
  font-size: 0.8rem;
  opacity: 0.75;
}

/* The user's last-used method gets a subtle outline so returning visitors
   see it at a glance. We avoid changing the dimensions to keep the row
   layout stable. */
[data-id="auth-method-list"] button.is-preferred {
  outline: 2px solid var(--signin-accent);
  outline-offset: 2px;
}

/* --- OTP one-box-per-digit input (makeOtpInput in auth-ux.ts) ---------- */

[data-id="otp-input-cells"] {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

[data-id="otp-input-cells"] input {
  width: 2.5rem;
  height: 3rem;
  padding: 0;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  -webkit-text-fill-color: #fff;
  border-radius: 4px;
  box-sizing: border-box;
}

[data-id="otp-input-cells"] input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.45);
}

/* Invalid feedback after a wrong code: red border on every cell. Caller
   clears with `otp.setInvalid(false)` once the user starts editing. */
[data-id="otp-input-cells"].is-invalid input {
  border-color: var(--signin-error-soft);
}

/* --- Email-link wait panel (post-send) --------------------------------- */

[data-id="email-link-wait"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: right;
  max-width: min(420px, 92vw);
  margin-left: auto;
}

[data-id="email-link-wait-title"] {
  margin: 0;
  font-weight: 600;
}

[data-id="email-link-wait-sent-to"],
[data-id="email-link-wait-instructions"] {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

[data-id="email-link-wait-actions"] {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

[data-id="email-link-resend-btn"] {
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 4px;
}

[data-id="email-link-resend-btn"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

[data-id="email-link-resend-btn"]:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
}

[data-id="email-link-change-email-btn"] {
  background: transparent;
  border: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

/* --- Access-request "what happens next" confirmation panel ------------- */

[data-id="access-request-done"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: right;
  max-width: min(420px, 92vw);
  margin-left: auto;
}

[data-id="access-request-done-title"] {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

[data-id="access-request-done-intro"] {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

[data-id="access-request-done-list"] {
  margin: 0;
  /* List markers right of the text — list is right-aligned so we keep the
     bullets visible by switching to inside positioning. */
  list-style-position: inside;
  padding: 0;
  font-size: 0.9rem;
}

[data-id="access-request-done-list"] li {
  margin: 0.25rem 0;
}

[data-id="access-request-done-actions"] {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

[data-id="access-request-done-back-btn"] {
  background: transparent;
  border: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

/* --- SAML email form: "Use a different sign-in method" nav row -------- */

[data-id="email-saml-nav-row"] {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

/* --- Shared "secondary" button utility class --------------------------- */

/* Used for "Resend / Use a different email / Use a different sign-in
   method" — anything that's a *de-emphasised* alternative to the primary
   action on the surface. Drivers add `.secondary` to their nav / back
   buttons explicitly. */
button.secondary {
  background: transparent;
  border: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

button.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  text-decoration: none;
}
