/* The member join form: shared by the landing page (index.html) and the
   standalone form page (join.html). Colour tokens come from each page's :root. */
.join-card {
  padding: 42px;
  background: linear-gradient(135deg, #fff, #fafafa);
  border-radius: 34px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.join-card h2 {
  margin-top: 0;
}

.join-note {
  background: #fff4f3;
  border: 1px solid rgba(244, 67, 54, .20);
  border-radius: 22px;
  padding: 18px;
  margin: 20px 0;
  color: #3b3b3d;
}

/* Story 1221: the member join form lives on this page. */
.join-auth {
  margin-top: 18px;
}

.join-auth-hint {
  color: var(--muted);
  margin: 0 0 14px;
}

/* One provider per row, at every width and in every language. A wrapping row
   put them side by side or stacked depending on how the label happened to
   measure, so the same page looked different twice (audit, 2026-09-12). */
.join-auth-buttons {
  display: grid;
  gap: 12px;
}

.join-auth-buttons .btn {
  width: 100%;
}

.btn-provider {
  gap: 10px;
  color: #111;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(20, 22, 30, .06);
}

.btn-provider svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.btn-apple {
  color: #fff;
  background: #111;
  border-color: #111;
}

.join-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  margin: 14px 0 6px;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 800;
  color: var(--red);
  cursor: pointer;
}

.join-alert {
  background: #fff4f3;
  border: 1px solid rgba(244, 67, 54, .35);
  color: #b71c1c;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 14px 0;
}

.join-alert.join-warn {
  background: #fff8e1;
  border-color: rgba(255, 160, 0, .45);
  color: #7a4f00;
}

.join-subtitle {
  font-size: 20px;
  margin: 18px 0 8px;
}

.member-list {
  display: grid;
  gap: 10px;
  margin: 8px 0 6px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.member-row img,
.member-row .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #eef0f4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #8a8f9a;
  flex: none;
}

.member-row .name {
  font-weight: 800;
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* THE ELLIPSIS MUST EAT THE END OF THE NAME, NEVER ITS BEGINNING.
     `text-overflow` clips at the end of the LINE, which in an RTL block is the
     visual left - so a Latin name inside the Arabic page lost its first
     characters: "QA Required Absent" rendered "...A Required Absent" (W1.63,
     measured 2026-09-21 at a 400px viewport, where the row is short by
     0.078125px - a tenth of a pixel costs a whole character, and integer
     `scrollWidth` cannot even see it).
     `plaintext` takes the direction from the name's own first strong character,
     so a Latin name truncates at its tail and an Arabic name at its own tail.
     Losing the tail is recoverable by a reader; losing the head is not, because
     "Ahmed Ali" and "Mohamed Ali" both become "...Ali". */
  unicode-bidi: plaintext;
}

.member-main {
  flex: 1;
  min-width: 0;
}

/* The academy's note under a rejected or incomplete request. */
.member-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  white-space: normal;
  line-height: 1.5;
}

.member-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.member-row.selected {
  border-color: var(--red);
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
  min-height: 0;
}

.join-block {
  margin-top: 6px;
}

.pill {
  font-size: 13px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: #eef0f4;
  color: #444;
  white-space: nowrap;
}

.pill.pending {
  background: #fff6e0;
  color: #8a5a00;
}

.pill.incomplete {
  background: #e8f1ff;
  color: #0d47a1;
}

.pill.rejected {
  background: #fdecea;
  color: #b71c1c;
}

.pill.active {
  background: #e9f7ec;
  color: #1b5e20;
}

.join-state p {
  margin: 0 0 12px;
}

.join-state p:last-child {
  margin-bottom: 0;
}

.join-state .btn {
  margin-top: 4px;
}

.join-ok-line {
  color: #1b5e20;
  font-weight: 800;
}

/* The box that carries "your request was sent" is a success, not a warning. */
.join-state.ok {
  background: #f1faf3;
  border-color: rgba(46, 125, 50, .30);
}

.join-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-top: 10px;
}

.join-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.join-form .full {
  grid-column: 1 / -1;
}

.join-form label {
  font-weight: 800;
  font-size: 14px;
}

.join-form label small {
  color: var(--muted);
  font-weight: 500;
}

.join-form input,
.join-form select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

.join-form input:focus,
.join-form select:focus {
  outline: 2px solid rgba(244, 67, 54, .35);
  border-color: var(--red);
}

/* The native control's own button reads "Choose File" / "No file chosen" in
   the BROWSER's language, which is English on an Arabic page (audit,
   2026-09-12). The input is kept for behaviour and hidden from sight; the
   label beside it carries our translated text.
   HIDING IS KEYED ON THE CLASS THE NEW MARKUP ADDS, never on the element:
   a visitor holding an hour-old join.js with this stylesheet would otherwise
   get a hidden input and NO button, so no way to pick a photo at all
   (measured on my own browser, 2026-09-12). Old script: the native control
   stays visible. New script: our own button.
   */
.join-form input[type="file"].file-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.join-form input[type="file"]:not(.file-hidden) {
  padding: 10px;
  min-height: 0;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.join-form input[type="file"].file-hidden:focus-visible + .file-btn {
  outline: 2px solid rgba(244, 67, 54, .35);
  border-color: var(--red);
}

.photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.join-photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: none;
}

.join-form .actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.join-form-hint {
  color: var(--muted);
  font-size: 14px;
}

/* The academy's custom fields: one heading per group, the fields in the grid. */
.join-custom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.join-group {
  grid-column: 1 / -1;
  margin: 6px 0 -4px;
  font-size: 16px;
  font-weight: 800;
}

.join-group-fields {
  display: contents;
}

.join-form label .req {
  color: var(--red);
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 6px 0;
}

.checks label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.checks input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
}

.btn[disabled] {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 720px) {
  .join-form,
  .join-custom {
    grid-template-columns: 1fr;
  }

  .member-row {
    flex-wrap: wrap;
  }

  /* Only a row WITH a button needs its own line; a row holding just the
     status pill kept an empty band under the name (audit, 2026-09-12). */
  .member-row.has-action .member-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* SECTIONS, the app's own grouping (Testing #1291): personal, contact,
   physical, the academy's fields, terms. */
.join-section {
  grid-column: 1 / -1;
  margin: 18px 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.join-form .join-section:first-child { margin-top: 0; }

/* TERMS (Testing #1288). The checkbox and its label sit on one line; the text
   itself opens under them and scrolls rather than pushing the button away. */
.join-terms { margin-top: 18px; }
.join-agree {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
  cursor: pointer;
}
.join-agree input { width: 18px; height: 18px; flex: none; }
.join-terms-body {
  margin-top: 10px;
  padding: 12px 14px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--card-2, rgba(0, 0, 0, .04));
  border: 1px solid var(--line);
  border-radius: 10px;
  line-height: 1.7;
}
.join-terms-body h5 { margin: 12px 0 4px; font-size: 14px; }
.join-terms-body p { margin: 0 0 8px; }

/* The back control for a deep-linked form (Testing #1290). */
.join-back {
  display: inline-block;
  margin-bottom: 10px;
}

/* The way out of a failed load (Testing 2026-09-16). */
.join-retry { margin-top: 10px; }
