/*
 * Care4 account page (/RDWeb/account/): same look as the branded RD web client (care4-branding.css).
 * html.dark follows the web client's own theme setting (account.js).
 */
:root {
  --orange: #f36f21;
  --orange-strong: #c04f0c;
  --orange-stronger: #a8450a;
  --page: #faf9f8;
  --bar: #fff;
  --bar-border: #edebe9;
  --panel: #fff;
  --panel-border: #e1dfdd;
  --text: #323130;
  --muted: #605e5c;
  --input: #fff;
  --input-border: #8a8886;
  --input-border-hover: #323130;
  --hover: rgba(0, 0, 0, 0.05);
  --ok: #107c10;
  --bad: #a4262c;
  --error-background: #fde7e9;
  --error-text: #a80000;
  --divider: rgba(138, 136, 134, 0.6);
  --tooltip-background: #fff;   /* as the web client's tooltips */
  --tooltip-text: #323130;
  --tooltip-shadow: 0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108);
  color-scheme: light;
}

html.dark {
  --page: #1b1a19;
  --bar: #11100f;
  --bar-border: #292827;
  --panel: #252423;
  --panel-border: #3b3a39;
  --text: #faf9f8;
  --muted: #c8c6c4;
  --input: #1b1a19;
  --input-border: #8a8886;
  --input-border-hover: #c8c6c4;
  --hover: rgba(255, 255, 255, 0.08);
  --ok: #6ccb5f;
  --bad: #f1707b;
  --error-background: #442726;
  --error-text: #f1bbbc;
  --tooltip-background: #292827;
  --tooltip-text: #faf9f8;
  --tooltip-shadow: 0 6.4px 14.4px 0 #000, 0 1.2px 3.6px 0 #000;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 14px/20px "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

svg {
  display: block;
}

/* ---- Bar, like the web client's nav bar ---- */

.bar {
  display: flex;
  align-items: center;
  height: 48px;
  padding-right: 8px;
  border-bottom: 1px solid var(--bar-border);
  background: var(--bar);
}

.bar-home {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 48px;
}

.bar-home svg {
  width: 16px;
  height: 16px;
}

.bar-home:hover,
.bar-links a:hover {
  background: var(--hover);
}

.bar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0 16px 0 4px;
}

.bar-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.logos {
  display: flex;
  align-items: center;
}

.logos::before {
  content: "";
  width: 1px;
  height: 16px;
  margin: 0 16px;
  background: var(--divider);
}

.logos a {
  display: flex;
  border-radius: 2px;
}

.logos a:hover {
  opacity: 0.8;
}

.logos img {
  display: block;
  height: 21px;
}

.logo-divider {
  width: 1px;
  height: 12px;
  margin: 0 8px;
  background: var(--divider);
}

.bar-links {
  display: flex;
  align-self: stretch;
  margin-left: auto;
}

.bar-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  text-decoration: none;
  white-space: nowrap;
}

/* Line icons like the web client's links */
.bar-links svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a:focus-visible,
button:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: -3px;
}

/* The logos need about 700 px next to the links: below that they overlapped "Hulp op afstand" */
@media (max-width: 740px) {
  .logos {
    display: none;
  }
}

/* Phones: no room for the texts, so the links keep only their icons (the text stays for screen readers) */
@media (max-width: 480px) {
  .bar-links a {
    padding: 0 14px;
  }

  .bar-links a span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .bar-links svg {
    width: 20px;
    height: 20px;
  }
}

/* ---- Page ---- */

main {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: -4px;
  padding: 4px;
  border-radius: 2px;
  color: var(--muted);
  text-decoration: none;
}

/* A new account comes from an email, not from the web client */
.back[hidden] {
  display: none;
}

.back svg {
  width: 14px;
  height: 14px;
}

.back:hover {
  color: var(--text);
}

h1 {
  margin: 12px 0 4px;
  font-size: 28px;
  font-weight: 600;
  line-height: 36px;
}

.lead {
  margin: 0 0 24px;
  color: var(--muted);
}

/* ---- Panel ---- */

.panel {
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--orange);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 1.6px 3.6px rgba(0, 0, 0, 0.13), 0 0.3px 0.9px rgba(0, 0, 0, 0.11);
}

.panel-head {
  display: flex;
  gap: 14px;
  padding: 20px 24px 4px;
}

.panel-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(243, 111, 33, 0.14);
  color: var(--orange);
}

.panel-icon svg {
  width: 20px;
  height: 20px;
}

h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.panel-head p {
  margin: 2px 0 0;
  color: var(--muted);
}

form {
  padding: 12px 24px 24px;
}

/* ---- Fields, like Fluent UI text fields ---- */

.field {
  margin-top: 14px;
}

label {
  display: block;
  padding: 5px 0;
  font-weight: 600;
}

input {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--input-border);
  border-radius: 2px;
  background: var(--input);
  color: var(--text);
  font: inherit;
}

input:hover {
  border-color: var(--input-border-hover);
}

input:focus {
  border-color: var(--orange);
  outline: 1px solid var(--orange);
  outline-offset: -2px;
}

input[aria-invalid="true"] {
  border-color: var(--bad);
}

input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.secret {
  position: relative;
}

.secret input {
  padding-right: 40px;
}

.reveal {
  position: absolute;
  top: 1px;
  right: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0 1px 1px 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.reveal:hover {
  color: var(--text);
  background: var(--hover);
}

.reveal svg {
  width: 16px;
  height: 16px;
}

/* ---- Password rules, checked while typing ---- */

.rules {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 18px;
}

.rules li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 3px;
  color: var(--muted);
}

.rules li::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  opacity: 0.7;
}

.rules li.ok {
  color: var(--ok);
}

.rules li.ok::before {
  border: 0;
  opacity: 1;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cmask id='m'%3E%3Ccircle cx='7' cy='7' r='7' fill='%23fff'/%3E%3Cpath d='m4 7.2 2 2 4-4.4' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/mask%3E%3Crect width='14' height='14' mask='url(%23m)'/%3E%3C/svg%3E") center / contain no-repeat;
}

.rules li.bad {
  color: var(--bad);
}

.rules li.bad::before {
  border: 0;
  opacity: 1;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cmask id='m'%3E%3Ccircle cx='7' cy='7' r='7' fill='%23fff'/%3E%3Cpath d='m4.7 4.7 4.6 4.6m0-4.6-4.6 4.6' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/mask%3E%3Crect width='14' height='14' mask='url(%23m)'/%3E%3C/svg%3E") center / contain no-repeat;
}

.rules li.info::before {
  border-style: dotted;
}

/* The button after the leaked-password rule, and its explanation */
.rule-info {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: -4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.rule-info:hover {
  background: var(--hover);
  color: var(--text);
}

.rule-info svg {
  width: 14px;
  height: 14px;
}

/* Its tooltip, like the web client's own (Fluent UI): over the form, below the rule */
.rules li:has(.rule-tip) {
  position: relative;
}

.rule-tip {
  position: absolute;
  top: calc(100% + 6px);
  left: 22px;
  z-index: 10;
  width: max-content;
  max-width: min(340px, calc(100vw - 104px)); /* stays clear of the screen's edge on phones */
  padding: 8px 12px;
  border-radius: 2px;
  background: var(--tooltip-background);
  box-shadow: var(--tooltip-shadow);
  color: var(--tooltip-text);
  font-size: 12px;
  line-height: 16px;
}

.rule-tip[hidden] {
  display: none;
}

.rules li:empty {
  display: none;
}

/* ---- Messages and actions ---- */

.message {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 2px;
  background: var(--error-background);
  color: var(--error-text);
}

.message[hidden] {
  display: none;
}

/* Not an error: what the user does now (approve in Duo) */
.message.notice {
  background: var(--hover);
  color: var(--text);
}

.message a {
  color: inherit;
  font-weight: 600;
}

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 80px;
  height: 32px;
  padding: 0 16px;
  border: 1px solid var(--orange-strong);
  border-radius: 2px;
  background: var(--orange-strong);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.primary:hover,
.primary:active {
  border-color: var(--orange-stronger);
  background: var(--orange-stronger);
}

.primary:focus-visible {
  outline: 1px solid #fff;
  outline-offset: -4px;
}

.primary[aria-busy="true"] {
  cursor: progress;
  opacity: 0.85;
}

.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.primary[aria-busy="true"] .spinner {
  display: block;
}

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

/* ---- Done ---- */

.done {
  padding: 16px 24px 32px;
  text-align: center;
  outline: none;
}

.done[hidden] {
  display: none;
}

.done-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-top: 8px;
  border-radius: 50%;
  background: rgba(16, 124, 16, 0.14);
  color: var(--ok);
}

.done-icon svg {
  width: 28px;
  height: 28px;
}

.done h3 {
  margin: 14px 0 4px;
  font-size: 18px;
  font-weight: 600;
}

.done-text {
  margin: 0 0 20px;
  color: var(--muted);
}

.done-text p {
  margin: 0;
}

/* ---- Activation of a new account (?activate) ---- */

/* The page's mode, set before it is drawn (account.js): the change form, or the activation form. In activate mode
   the title and lead wait for the link's details (welcome or new password: class known), and there is no way back. */
html.activate #change-panel,
html:not(.activate) #activate-panel,
html.activate .back,
html.activate:not(.known) main > h1,
html.activate:not(.known) .lead {
  display: none;
}

.who {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 6px 0 0;
}

.who[hidden] {
  display: none;
}

.who dt {
  color: var(--muted);
}

.who dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

/* Phones: each label above its value, so a long user name keeps its line */
@media (max-width: 480px) {
  .who {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .who dd + dt {
    margin-top: 4px;
  }
}

.status {
  padding: 0 24px;
}

.status.alone {
  padding-bottom: 24px;
}

.loading {
  margin: 16px 0 0;
  color: var(--muted);
}

.note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.steps {
  max-width: 440px;
  margin: 4px auto 16px;
  padding-left: 20px;
  text-align: left;
}

.steps li {
  margin: 6px 0;
}

.steps a {
  color: var(--orange-strong);
}

html.dark .steps a {
  color: var(--orange);
}

/* For password managers only: the account the new password belongs to */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
}
