/* ============================================================
   Secuura Identity Pages — shell + form-card + hybrid errors +
   external-login button. Loaded AFTER bootstrap-overrides.css.
   Layer-on-top only.
   Per LOGIN-01, LOGIN-05, LOGIN-06, LOGIN-07.
   Per Phase-2 CONTEXT decisions D-01..D-06, D-09.
   ============================================================ */

/* ---------- Backdrop override (per D-02) ----------
   Identity pages opt in via <body class="secuura-identity-page">.
   Any inherited backdrop (e.g. /images/backdrop/default.png from
   the legacy Login.cshtml inline style or from theme_ssd.css)
   is suppressed for a flat brand surface.
   Higher specificity than the inherited selector — specificity wins, no overrides needed. */
body.secuura-identity-page {
  background-image: none;
  background-color: hsl(var(--background));
}

/* ---------- Shell ---------- */
.secuura-identity-shell {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 48px 16px 32px;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* Wordmark sizing per D-04 (~120px desktop, ~100px phone, 24px to form-card) */
.secuura-identity-wordmark {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 24px;
}
/* Square-logo variant: gentle rounded mask matches the SVG's own corner radius
   and gives the wordmark area more presence on the dark identity background. */
.secuura-identity-wordmark--square {
  width: 96px;
  border-radius: 16px;
}
.secuura-identity-wordmark-link {
  display: inline-block;
  border-radius: 4px;
}
.secuura-identity-wordmark-link:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 4px;
}
@media (max-width: 375px) {
  .secuura-identity-shell { padding: 24px 12px; }
  .secuura-identity-wordmark { width: 100px; margin-bottom: 16px; }
}

.secuura-identity-footnote {
  margin-top: 24px;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

/* ---------- Form-card container ---------- */
.secuura-form-card {
  width: 100%;
  max-width: 480px;
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: 0 1px 2px hsl(var(--foreground) / 0.04);
}
.secuura-form-card--wide { max-width: 720px; }
.secuura-form-card__header {
  margin: 0 0 8px;
  font-size: 1.5rem;     /* 24px */
  font-weight: 600;
  line-height: 1.2;
  color: hsl(var(--card-foreground));
}
.secuura-form-card__lede {
  margin: 0 0 24px;
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;  /* 15px */
  line-height: 1.5;
}
@media (max-width: 375px) {
  .secuura-form-card { padding: 24px 16px; }
  .secuura-form-card__header { font-size: 1.25rem; }
}

/* ---------- Form group + input ---------- */
.secuura-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 16px;
}
.secuura-form-group__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}
/* .form-control is already styled in Phase 1 bootstrap-overrides.css.
   .secuura-input is a parallel hook for inputs we can't easily mark
   as .form-control. */
.secuura-input {
  display: block;
  width: 100%;
  min-height: 44px;            /* WCAG 2.1 AA tap target */
  padding: 0.5rem 0.75rem;
  font-size: 1rem;             /* 16px — prevents iOS zoom on focus */
  line-height: 1.5;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.secuura-input::placeholder { color: hsl(var(--muted-foreground)); }
.secuura-input:focus,
.secuura-input:focus-visible {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
  outline: none;
}
.secuura-input[aria-invalid="true"] {
  border-color: hsl(var(--destructive));
}

/* ---------- Hybrid error pattern (per D-05) ----------
   Per-field inline error: .secuura-form-error
   Non-field banner:        .secuura-form-error-banner
   Server-rendered summary: .secuura-form-summary-errors
                             (styled like banner for consistency) */
.secuura-form-error {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: hsl(var(--destructive));
}
.secuura-form-error:empty { display: none; }
.secuura-form-error::before {
  content: "\f06a";   /* fa-exclamation-circle */
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
  font-weight: 900;
  font-size: 0.875rem;
  line-height: 1.4;
  flex-shrink: 0;
}

.secuura-form-error-banner,
.secuura-form-summary-errors {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background-color: hsl(var(--destructive) / 0.08);
  border: 1px solid hsl(var(--destructive) / 0.3);
  border-radius: calc(var(--radius) - 2px);
  padding: 12px 14px;
  margin-bottom: 16px;
  color: hsl(var(--destructive));
  font-size: 0.875rem;
  line-height: 1.5;
}
.secuura-form-error-banner:empty,
.secuura-form-summary-errors:empty { display: none; }
.secuura-form-error-banner::before,
.secuura-form-summary-errors::before {
  content: "\f071";   /* fa-exclamation-triangle */
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.secuura-form-summary-errors ul { margin: 0; padding-left: 20px; }
.secuura-form-summary-errors ul li { margin: 0; }
/* ASP.NET emits the validation-summary <div> with class
   `validation-summary-errors` (when there are errors) or
   `validation-summary-valid` (when valid). The visible state we
   care about is the errors state — the .secuura-form-summary-errors
   class applied by the page picks up the same look. The default
   valid state is hidden by Bootstrap. */

/* ---------- Primary CTA (LOGIN-01) ---------- */
.secuura-form-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: 1px solid hsl(var(--primary));
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
  text-decoration: none;       /* anchor variant */
}
.secuura-form-cta:hover,
.secuura-form-cta:focus {
  background-color: hsl(var(--primary) / 0.9);
  border-color: hsl(var(--primary) / 0.9);
  color: hsl(var(--primary-foreground));
  text-decoration: none;
}
.secuura-form-cta:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}
.secuura-form-cta:disabled { opacity: 0.6; cursor: not-allowed; }
.secuura-form-cta--secondary {
  background-color: hsl(var(--secondary));
  border-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.secuura-form-cta--secondary:hover,
.secuura-form-cta--secondary:focus {
  background-color: hsl(var(--secondary) / 0.9);
  border-color: hsl(var(--secondary) / 0.9);
  color: hsl(var(--secondary-foreground));
}

/* ---------- External login button (per D-06) ----------
   Outline-secondary variant + icon-aware layout.
   Used by "Continue with Microsoft" on Login/Register/
   ExternalLogin/ExternalSignup. */
.secuura-btn-outline-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5;
  background-color: transparent;
  color: hsl(var(--secondary));
  border: 1px solid hsl(var(--secondary));
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
  text-decoration: none;
}
.secuura-btn-outline-secondary:hover,
.secuura-btn-outline-secondary:focus {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--secondary));
  text-decoration: none;
}
.secuura-btn-outline-secondary:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}
/* Disabled placeholder state for the outline button — used for the Google
   and Apple "Continue with X" placeholders that don't yet have a backend
   handler. Cursor signals non-interactivity; hover/focus colour changes
   are suppressed so the button reads as inactive. */
.secuura-btn-outline-secondary:disabled,
.secuura-btn-outline-secondary[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.secuura-btn-outline-secondary:disabled:hover,
.secuura-btn-outline-secondary[aria-disabled="true"]:hover,
.secuura-btn-outline-secondary:disabled:focus,
.secuura-btn-outline-secondary[aria-disabled="true"]:focus {
  background-color: transparent;
  color: hsl(var(--secondary));
  border-color: hsl(var(--secondary));
}
/* Small inline "Soon" pill that sits at the right end of a placeholder CTA.
   margin-left:auto pushes it to the trailing edge inside the flex row. */
.secuura-btn-coming-soon {
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid hsl(var(--secondary) / 0.5);
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  background: transparent;
  line-height: 1;
}
/* Inline info notice — used above sections that are temporarily disabled
   (e.g. the email signup block on Register). Sits inside the form card so
   it picks up the card's foreground/background tokens. */
.secuura-form-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
  padding: 12px 14px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.45;
}
.secuura-form-notice > i {
  flex-shrink: 0;
  margin-top: 2px;
  color: hsl(var(--primary));
}

/* Reset default fieldset chrome and visually dim a disabled fieldset.
   <fieldset disabled> already prevents interaction with all child form
   controls — this rule just makes the dimming explicit so the section
   reads as inactive at a glance. */
.secuura-form-fieldset--disabled {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;       /* override the legacy fieldset min-content min-width */
  opacity: 0.55;
}
.secuura-form-fieldset--disabled .secuura-form-cta,
.secuura-form-fieldset--disabled .form-control,
.secuura-form-fieldset--disabled input,
.secuura-form-fieldset--disabled select,
.secuura-form-fieldset--disabled button {
  cursor: not-allowed;
}

/* Visually hidden text for screen readers — used so AT users hear
   "Continue with Google, coming soon" without sighted users seeing
   the redundant phrase next to the visible "Soon" pill. */
.secuura-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.secuura-btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.secuura-btn-with-icon > i {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ---------- Secondary links ---------- */
.secuura-form-link {
  color: hsl(var(--primary));
  text-decoration: none;
  text-underline-offset: 4px;
}
.secuura-form-link:hover,
.secuura-form-link:focus { text-decoration: underline; color: hsl(var(--primary) / 0.85); }
.secuura-form-link:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: 2px;
}
.secuura-form-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
/* When the form-card has no lede paragraph (e.g. simplified Login card),
   give the actions block a full line of breathing room below the heading. */
.secuura-form-card__header + .secuura-form-actions { margin-top: 24px; }
.secuura-form-meta {
  margin-top: 16px;
  text-align: center;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}
.secuura-form-meta__inline { display: inline; }

/* Label-row: label on the left, helper link (e.g. "Forgot password?") on the right,
   sitting above the input. Used by the GitHub-style consolidated Login layout. */
.secuura-form-group__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

/* "or" divider — separates local-form from external-providers cluster on the Login
   card. A token-colored hairline with the word inset into a card-bg pill so it
   reads as a divider, not a chip. */
.secuura-form-divider {
  position: relative;
  text-align: center;
  margin: 20px 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}
.secuura-form-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: hsl(var(--border));
}
.secuura-form-divider > span {
  position: relative;
  padding: 0 12px;
  background-color: hsl(var(--card));
}

/* Button-as-link: lets a POST form (e.g. EntraIDSignUp) present as an
   anchor without inheriting any browser <button> chrome. Pair with
   .secuura-form-link for the actual link colour/hover behaviour. */
.secuura-link-button {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .secuura-input,
  .secuura-form-cta,
  .secuura-btn-outline-secondary,
  .secuura-form-link { transition: none; }
}

/* ============================================================
   Status banner (per D-09).
   Used by:
     - _StatusMessage.cshtml (auth-side) — success/error
     - Manage/_StatusMessage.cshtml — success/error (via plan 02-06)
     - ConfirmEmail.cshtml / ConfirmEmailChange.cshtml
     - any in-card status block (2FA recovery-code warnings)
   ============================================================ */
.secuura-status-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
  font-size: 0.9375rem;
  line-height: 1.5;
}
.secuura-status-banner::before {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Success variant — primary token (teal). Per BRAND-CHIPS §1: primary = trust state. */
.secuura-status-banner--success {
  background-color: hsl(var(--primary) / 0.1);
  border-color: hsl(var(--primary) / 0.3);
  color: hsl(var(--primary));
}
.secuura-status-banner--success::before {
  content: "\f058"; /* fa-check-circle */
}

/* Error variant — destructive token (red). */
.secuura-status-banner--error {
  background-color: hsl(var(--destructive) / 0.08);
  border-color: hsl(var(--destructive) / 0.3);
  color: hsl(var(--destructive));
}
.secuura-status-banner--error::before {
  content: "\f071"; /* fa-exclamation-triangle */
}

/* Info variant — secondary token (blue). */
.secuura-status-banner--info {
  background-color: hsl(var(--secondary) / 0.08);
  border-color: hsl(var(--secondary) / 0.3);
  color: hsl(var(--secondary));
}
.secuura-status-banner--info::before {
  content: "\f05a"; /* fa-info-circle */
}

/* Warning variant — accent token (gold). Used by 2FA "low recovery codes" notice. */
.secuura-status-banner--warning {
  background-color: hsl(var(--accent) / 0.12);
  border-color: hsl(var(--accent) / 0.4);
  color: hsl(var(--foreground));
}
.secuura-status-banner--warning::before {
  content: "\f071"; /* fa-exclamation-triangle */
  color: hsl(var(--accent));
}

.secuura-status-banner > * { margin: 0; }
.secuura-status-banner > * + * { margin-top: 8px; }
.secuura-status-banner a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Stacked form-cards spacing (Login dual-card) — consolidated here. */
.secuura-identity-shell > .secuura-form-card + .secuura-form-card { margin-top: 16px; }

/* ============================================================
   Long-form prose for T&C / Privacy / policy pages.
   Per LOGIN-04 (≤75ch readable measure, Geist Sans body).
   ============================================================ */
.secuura-prose {
  max-width: 75ch;
  margin: 0 auto;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: hsl(var(--foreground));
}
.secuura-prose h1, .secuura-prose h2, .secuura-prose h3, .secuura-prose h4 {
  font-weight: 600;
  line-height: 1.3;
  color: hsl(var(--foreground));
}
.secuura-prose h1 { font-size: 1.75rem; margin: 0 0 16px; }
.secuura-prose h2 { font-size: 1.5rem;  margin: 32px 0 12px; }
.secuura-prose h3 { font-size: 1.25rem; margin: 24px 0 8px; }
.secuura-prose h4 { font-size: 1.0625rem; margin: 20px 0 6px; }
.secuura-prose p,
.secuura-prose ul,
.secuura-prose ol { margin: 0 0 16px; }
.secuura-prose ul,
.secuura-prose ol { padding-left: 1.5rem; }
.secuura-prose li { margin-bottom: 6px; }
.secuura-prose a {
  color: hsl(var(--primary));
  text-underline-offset: 4px;
}
.secuura-prose a:hover,
.secuura-prose a:focus { text-decoration: underline; }
.secuura-prose a:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: 2px;
}
.secuura-prose strong { font-weight: 600; }
.secuura-prose em { font-style: italic; }
.secuura-prose code {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  padding: 0.125rem 0.375rem;
  background-color: hsl(var(--muted));
  border-radius: calc(var(--radius) - 6px);
}
.secuura-prose hr {
  border: 0;
  border-top: 1px solid hsl(var(--border));
  margin: 32px 0;
}
.secuura-prose address {
  font-style: normal;
  color: hsl(var(--muted-foreground));
  margin: 16px 0;
}
@media (max-width: 375px) {
  .secuura-prose { font-size: 0.9375rem; line-height: 1.55; }
  .secuura-prose h1 { font-size: 1.5rem; }
  .secuura-prose h2 { font-size: 1.25rem; }
}

/* ============================================================
   Manage subarea — two-column layout + sidebar nav (per D-08).
   Lives inside _LoggedIn.cshtml's chrome (no shell wordmark here).
   ============================================================ */

.secuura-manage-shell {
  padding: 32px 16px;
  max-width: 1100px;
  margin: 0 auto;
}
.secuura-manage-shell__heading {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 24px;
  color: hsl(var(--foreground));
}

.secuura-manage-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}

/* Sidebar nav (desktop + tablet >= 769px) */
.secuura-manage-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 88px;          /* clear of the _LoggedIn navbar */
}
.secuura-manage-nav__item { margin: 0; padding: 0; }
.secuura-manage-nav__link {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: calc(var(--radius) - 4px);
  color: hsl(var(--foreground));
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color 150ms ease, color 150ms ease;
}
.secuura-manage-nav__link:hover,
.secuura-manage-nav__link:focus {
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
  text-decoration: none;
}
.secuura-manage-nav__link[aria-current="page"] {
  background-color: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
  font-weight: 600;
}
.secuura-manage-nav__link:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Phone (<= 768px) — collapse sidebar to a horizontal scrollable strip ABOVE the form-card */
@media (max-width: 768px) {
  .secuura-manage-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .secuura-manage-nav {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    gap: 4px;
    scrollbar-width: thin;
  }
  .secuura-manage-nav__item { flex-shrink: 0; }
  .secuura-manage-nav__link {
    white-space: nowrap;
    padding: 10px 16px;
  }
}

/* Inside the Manage right-column form-card, override .secuura-form-card defaults:
   - No max-width (it should fill the right column)
   - Wide form-card behavior by default */
.secuura-manage-grid > .secuura-form-card,
.secuura-manage-grid .secuura-form-card {
  max-width: none;
  width: 100%;
}

/* ============================================================
   SWEEP-FIX (02-05): Bootstrap 4 .form-control default height is
   calc(1.5em + .75rem + 2px) ≈ 38px, which is below the WCAG 2.1 AA
   44px tap-target minimum. Enforce min-height inside Identity and Manage
   surfaces only (scoped to avoid global regression on other Bootstrap
   forms site-wide).
   ============================================================ */
.secuura-form-card .form-control,
.secuura-manage-grid .form-control {
  min-height: 44px;
}

/* SWEEP-FIX (02-05): Explicit :focus-visible outline on .form-control
   within Identity/Manage surfaces. bootstrap-overrides.css provides
   :focus with box-shadow (visible indicator), but the sweep spec requires
   a 2px teal outline with 2px offset on :focus-visible specifically.
   This supplements (does not replace) the box-shadow. */
.secuura-form-card .form-control:focus-visible,
.secuura-manage-grid .form-control:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}
