/*
  Fyxdo — Registreren, inloggen, uitloggen, sessie verlopen.
  Componentstijlen. Gebruikt uitsluitend variabelen uit brand/tokens.css.
  Geen eigen kleuren, geen gradiënten, geen schaduwen.

  Breed scherm: in de app via een media query (min-width: 768px).
  In de referentiepagina via een container query, zodat mobiel en breed naast elkaar te zien zijn.
*/

/* ---------- App-container ---------- */
.fx-app {
  container-type: inline-size;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.fx-auth {
  box-sizing: border-box;
  min-height: 100%;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
}

/* Woordmerk: <picture class="fx-logo"> wisselt in het donker naar fyxdo-wordmark-dark.svg (#247).
   display: contents, zodat de img zelf in de opmaak blijft staan (zoals .fx-brand en .fx-home-link img). */
.fx-logo { display: contents; }

.fx-brand {
  display: block;
  height: var(--size-wordmark-auth);   /* 36 px: woordmerk 93 px breed, boven de minimale 80 px */
  width: auto;
  align-self: flex-start;
  margin: 0 0 var(--space-10);
}

.fx-panel {
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
}

.fx-title {
  margin: 0 0 var(--space-2);
  font-size: 28px; line-height: 34px; font-weight: 600;   /* text-h1 */
}

.fx-lead {
  margin: 0 0 var(--space-6);
  font-size: 16px; line-height: 24px;                       /* text-body */
  color: var(--text-muted);
}

/* ---------- Formulier ---------- */
.fx-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin: 0;
}

.fx-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.fx-label {
  font-size: 14px; line-height: 20px; font-weight: 600;   /* text-field-label */
  color: var(--text);
}

.fx-hint {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: 14px; line-height: 20px;                       /* text-small */
  color: var(--text-muted);
}
.fx-hint--ok { color: var(--green-text); }
.fx-hint svg, .fx-hint .fx-icon { flex: none; width: 16px; height: 16px; }

.fx-control { position: relative; }

.fx-input {
  box-sizing: border-box;
  width: 100%;
  height: var(--size-control);
  margin: 0;
  padding: 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: 16px; line-height: 24px;   /* 16 px voorkomt automatisch inzoomen op iOS */
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  appearance: none;
}
.fx-input--password { padding-right: 96px; }
.fx-input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--primary);
}
.fx-input[aria-invalid="true"] { border-color: var(--danger); }
.fx-input[aria-invalid="true"]:focus-visible { outline-color: var(--danger); }
.fx-input:read-only { color: var(--text-muted); }

.fx-toggle {
  position: absolute;
  top: 2px; right: 2px;
  height: var(--size-touch);    /* aanraakdoel 44 px */
  min-width: 88px;
  padding: 0 var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px; line-height: 20px; font-weight: 600;
  cursor: pointer;
}
.fx-toggle svg, .fx-toggle .fx-icon { width: var(--size-icon-sm); height: var(--size-icon-sm); flex: none; }
.fx-toggle:hover { background: var(--tint); }
.fx-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.fx-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0;
  font-size: 14px; line-height: 20px;
  color: var(--danger);
}
.fx-error svg, .fx-error .fx-icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }

/* ---------- Knoppen ---------- */
.fx-btn {
  box-sizing: border-box;
  width: 100%;
  height: var(--size-control);
  padding: 0 var(--space-6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-sans);
  font-size: 16px; line-height: 24px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.fx-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.fx-btn svg, .fx-btn .fx-icon { width: var(--size-icon-sm); height: var(--size-icon-sm); flex: none; }

/* Bezig: blijft navy zodat de knop niet knippert; klikken doet niets (aria-disabled). */
.fx-btn[aria-busy="true"] { cursor: progress; }

/* Uitgeschakeld (alleen bij "te veel pogingen") */
.fx-btn:disabled,
.fx-btn[aria-disabled="true"]:not([aria-busy="true"]) {
  background: var(--tint);
  border-color: var(--tint);
  color: var(--text-muted);
  cursor: not-allowed;
}

.fx-btn--secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--border-strong);
}
.fx-btn--secondary:hover { background: var(--tint); }

.fx-spinner {
  width: 18px; height: 18px;
  box-sizing: border-box;
  border: 2px solid var(--on-primary);
  border-right-color: transparent;
  border-radius: 50%;
  animation: fx-spin .8s linear infinite;
  flex: none;
}
.fx-btn--secondary .fx-spinner { border-color: var(--primary); border-right-color: transparent; }
@keyframes fx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fx-spinner { animation: none; border-right-color: currentColor; opacity: .6; } }

/* ---------- Meldingen bovenaan een formulier ---------- */
.fx-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-6);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 14px; line-height: 20px;
}
.fx-alert svg, .fx-alert .fx-icon { flex: none; width: var(--size-icon-sm); height: var(--size-icon-sm); }
.fx-alert p { margin: 0; }
.fx-alert strong { display: block; font-weight: 600; }
.fx-alert--error { background: var(--danger-tint); color: var(--danger); }

/* Vervolgstap binnen een melding (R12). Erft de tekstkleur van de melding (5,8:1 op danger-tint). */
.fx-alert-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--size-touch);   /* aanraakdoel */
  margin-bottom: -12px;        /* houdt de melding compact ondanks het grotere aanraakdoel */
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.fx-alert-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
/* Link in de lopende tekst van een melding (R13: het contactadres). Erft de kleur; inline, dus geen 44 px. */
.fx-alert-inline { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.fx-alert-inline:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.fx-alert--info  { background: var(--tint);   color: var(--text); }
.fx-alert--ok    { background: var(--green-tint);  color: var(--green-text); }

/* ---------- Links ---------- */
.fx-link {
  color: var(--green-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.fx-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* Regel onder "Account maken": akkoord met de algemene voorwaarden, verwijzing naar het privacybeleid */
.fx-terms {
  margin: var(--space-4) 0 0;
  font-size: 14px; line-height: 20px;                       /* text-small */
  color: var(--text-muted);
}

.fx-forgot { align-self: flex-start; font-size: 14px; line-height: 20px; margin-top: calc(var(--space-2) * -1); }

.fx-switch {
  margin: var(--space-6) 0 0;
  font-size: 16px; line-height: 24px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- App-schermen (Instellingen, Home) ---------- */
.fx-page {
  box-sizing: border-box;
  min-height: 100%;
  padding: var(--space-6);
}
.fx-page-title { margin: 0 0 var(--space-6); font-size: 28px; line-height: 34px; font-weight: 600; }
.fx-section-title {
  margin: var(--space-10) 0 var(--space-2);
  font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .3px;  /* text-label */
  text-transform: uppercase;
  color: var(--text-muted);
}
.fx-section-title:first-of-type { margin-top: 0; }
.fx-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.fx-row {
  min-height: 56px;              /* rij met één regel: 24 px tekst + 2 × 16 px */
  padding: var(--space-4);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: 16px; line-height: 24px;
  color: var(--text);
  text-decoration: none;
}
.fx-row + .fx-row { border-top: 1px solid var(--border); }
.fx-row svg, .fx-row .fx-icon { width: var(--size-icon-sm); height: var(--size-icon-sm); color: var(--text-muted); flex: none; }
.fx-row-meta { display: block; font-size: 14px; line-height: 20px; color: var(--text-muted); }
.fx-account { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.fx-account p { margin: 0; }
.fx-note { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-muted); }

.fx-empty {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-4);
}
.fx-empty h2 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.fx-empty p { margin: 0; color: var(--text-muted); }

.fx-topbar { display: flex; align-items: center; margin: 0 0 var(--space-6); }
.fx-topbar img { height: 28px; width: auto; }

/* Alleen voor schermlezers */
.fx-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Breed scherm ---------- */
@container (min-width: 768px) {
  .fx-auth {
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
  }
  .fx-brand { align-self: center; margin: 0 0 var(--space-6); }
  .fx-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-10);
  }
  .fx-switch { max-width: 420px; }
  .fx-page { max-width: 720px; margin: 0 auto; padding: var(--space-10); }
}
