/* =============================================================================
   BUAMS AI new-ui — REGISTER PAGE
   Spec: /frontend_design.md §J.2

   ONLY styling unique to registration (spec §L). Sections, fields and buttons
   come from the component layer.
   ============================================================================= */

/* The register form is the longest in Phase 1, so its card gets a wider
   measure than the auth default to keep the three sections readable. */
.bui-register-panel {
  max-width: 560px;
}

/* ── Subdomain preview ────────────────────────────────────────────────────
   Shows the address the clinic's team will actually sign in at. Derived from
   the clinic name until edited by hand, then the typed value is respected. */
.bui-subdomain-preview {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--bui-space-1);
  margin-top: var(--bui-space-2);
  min-height: 18px;
  font-size: var(--bui-text-xs);
  line-height: var(--bui-lh-snug);
  color: var(--bui-ink-500);
}

.bui-subdomain-host {
  font-family: var(--bui-font-mono);
  font-size: var(--bui-text-xs);
  font-weight: var(--bui-fw-semibold);
  color: var(--bui-ink-900);
  word-break: break-all;
}

/* Availability verdict — icon + text + colour (spec §F.3) */
.bui-subdomain-status {
  display: inline-flex;
  align-items: center;
  gap: var(--bui-space-1);
  font-weight: var(--bui-fw-medium);
}

.bui-subdomain-status.is-ok {
  color: var(--bui-success);
}

.bui-subdomain-status.is-ok::before {
  content: '\2713';
  font-weight: var(--bui-fw-heavy);
}

.bui-subdomain-status.is-bad {
  color: var(--bui-danger);
}

.bui-subdomain-status.is-bad::before {
  content: '\26A0';
}

.bui-subdomain-status.is-checking::before {
  content: '';
  width: 11px;
  height: 11px;
  border: 2px solid var(--bui-line-strong);
  border-top-color: var(--bui-primary-700);
  border-radius: 50%;
  animation: bui-spin .6s linear infinite;
}

/* ── Terms row ────────────────────────────────────────────────────────────── */
.bui-terms {
  padding: var(--bui-space-3) var(--bui-space-4);
  margin-bottom: var(--bui-space-5);
  background: var(--bui-surface-2);
  border: 1px solid var(--bui-line);
  border-radius: var(--bui-radius-md);
}

.bui-terms.is-invalid {
  border-color: var(--bui-danger);
  background: var(--bui-danger-bg);
}

/* ── intl-tel-input integration ───────────────────────────────────────────
   The library injects its own wrapper and an absolutely-positioned country
   dropdown. These rules re-fit it to the .bui-input geometry without forking
   the library's internals (spec §P). */
.iti {
  display: block;
  width: 100%;
}

.iti__flag-container {
  border: 0;
}

.iti--separate-dial-code .iti__selected-flag {
  background: var(--bui-surface-2);
  border-radius: var(--bui-radius-md) 0 0 var(--bui-radius-md);
}

.iti__country-list {
  border: 1px solid var(--bui-line-strong);
  border-radius: var(--bui-radius-md);
  box-shadow: var(--bui-shadow-md);
  font-size: var(--bui-text-sm);
}

.iti__country.iti__highlight {
  background: var(--bui-primary-50);
}

.iti__dial-code {
  color: var(--bui-ink-500);
}

@media (max-width: 575.98px) {
  .bui-register-panel {
    max-width: none;
  }

  /* The country list is absolutely positioned and will overflow a narrow
     card; cap it to the field width so the page never scrolls sideways. */
  .iti__country-list {
    max-width: calc(100vw - var(--bui-space-10));
  }
}

/* ── Account-type switch ──────────────────────────────────────────────────
   Two server-rendered links styled as a segmented control, at the top of the
   form. The page used to render one form only — "Create your clinic account"
   — so a solo clinician arriving from a solo plan card was asked to name a
   clinic they do not have, with no visible way to say otherwise.

   Links rather than radio inputs: choosing re-renders a different form from
   the server, which is a navigation, and dressing a navigation up as a form
   control would leave a keyboard user expecting a value change and getting a
   page load. */
.bui-acct-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--bui-space-2);
  margin-bottom: var(--bui-space-6);
}

.bui-acct-option {
  display: flex;
  align-items: center;
  gap: var(--bui-space-3);
  padding: var(--bui-space-3);
  border: 1.5px solid var(--bui-line);
  border-radius: var(--bui-radius-md);
  background: var(--bui-surface);
  color: var(--bui-ink-700);
  text-decoration: none;
  transition: border-color var(--bui-transition), background var(--bui-transition);
}

.bui-acct-option:hover {
  border-color: var(--bui-line-strong);
  background: var(--bui-surface-2);
  color: var(--bui-ink-900);
}

.bui-acct-option.is-active {
  border-color: var(--bui-primary-700);
  background: var(--bui-primary-50);
  color: var(--bui-ink-900);
}

.bui-acct-option:focus-visible {
  outline: 2px solid var(--bui-primary-700);
  outline-offset: 2px;
}

.bui-acct-option .bi {
  flex-shrink: 0;
  font-size: 1.15rem;
  color: var(--bui-ink-500);
}

.bui-acct-option.is-active .bi { color: var(--bui-primary-700); }

.bui-acct-option-title {
  display: block;
  font-size: var(--bui-text-sm);
  font-weight: var(--bui-fw-heavy);
  line-height: var(--bui-lh-tight);
}

.bui-acct-option-sub {
  display: block;
  margin-top: 2px;
  font-size: var(--bui-text-overline);
  line-height: var(--bui-lh-snug);
  color: var(--bui-ink-500);
}

/* Below 420px two side-by-side options wrap their sub-lines to three lines
   each; stacked they stay one line and the whole control is shorter. */
@media (max-width: 419.98px) {
  .bui-acct-switch { grid-template-columns: minmax(0, 1fr); }
  .bui-acct-option-sub { display: none; }
}
