/* The Visits > Waitlist tab: one table of the patients who need a new appointment, and
   the read-only details modal a row opens. The table follows the Patients list and the
   Workflows board; nothing here is louder than its two Tags. */
.waitlist--page {
  /* Spaced by the margins the calendar's header, tabs and filter bar already carry, so
     switching tabs moves nothing. */
  padding-bottom: var(--rem-32);
}

/* Narrow windows scroll the table sideways, never the page. */
.waitlist--scroll {
  overflow-x: auto;
  padding: 1px;
}

/* Builds on the global table (white card, light outline, row rules). */
.waitlist--table {
  min-width: 68rem;

  td {
    padding-block: var(--rem-10);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* On the header cells: in a fixed layout the first row sets the widths. Every column has
   a set width but the last contact, which takes the room that is left: the table then
   fits a laptop window with the sidebar open, and long names end in "…". */
.waitlist--col-patient { width: 9.5rem; }
.waitlist--col-provider { width: 9.5rem; }
.waitlist--col-type { width: 6rem; }
.waitlist--col-appointment { width: 6rem; }
.waitlist--col-timing { width: 8rem; }
.waitlist--col-priority { width: 5.5rem; }
.waitlist--col-contact { width: auto; }
.waitlist--col-status { width: 7.5rem; }
.waitlist--col-menu { width: 8.5rem; }

/* Windows too narrow for every name (under about 1640px, with the sidebar): the provider
   shrinks to their avatar, named on hover, as on the Workflows board, so the last
   contact keeps enough room to be read. */
@media (max-width: 1640px) {
  .waitlist--table {
    min-width: 64rem;
  }

  /* Wide enough for the header, which stays: an avatar-only column needs its name. */
  .waitlist--table .waitlist--col-provider {
    width: 5.5rem;
  }

  .waitlist--table td.waitlist--col-provider {
    font-size: 0;
  }

  .waitlist--table .waitlist--col-provider .details-row--value-text {
    display: none;
  }
}

.waitlist--patient {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-heading);
  font-variation-settings: 'wght' var(--text-semibold);
  text-decoration: none;
}

.waitlist--secondary {
  display: block;
  margin-top: var(--rem-2);
  font-size: var(--rem-12);
  color: var(--text-additional);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* How many are listed and in what order, under the table. */
.waitlist--summary {
  margin: var(--rem-12) 0 0;
  font-size: var(--rem-12);
  color: var(--text-additional);
}

/* Nobody waiting, or nobody matching the filters: a card where the table would be. */
.waitlist--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rem-8);
  padding: 4.5rem var(--rem-24);
  border-radius: var(--table-radius);
  outline: solid 1px var(--neutral-100);
  background-color: white;
  text-align: center;

  p {
    margin: 0;
  }

  a[role="button"] {
    margin-top: var(--rem-8);
  }
}

.waitlist--empty-title {
  font-size: var(--rem-15);
  font-variation-settings: 'wght' var(--text-semibold);
  color: var(--text-heading);
}

.waitlist--empty-hint {
  font-size: var(--rem-13);
  color: var(--text-additional);
}

/* ---- Details modal ---- */

dialog.modals--main-modal.waitlist--details-modal {
  width: 35rem;
}

.waitlist--details {
  display: flex;
  flex-direction: column;
  gap: var(--rem-20);
}

.waitlist--details-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rem-8);
}

.waitlist--details-rows {
  display: flex;
  flex-direction: column;
  gap: var(--rem-12);

  .details-row--group[data-size="sm"] .details-row--label {
    width: 11rem;
  }
}

.waitlist--details-heading {
  margin: 0;
  font-size: var(--rem-13);
  font-variation-settings: 'wght' var(--text-medium);
  line-height: 1.2;
  color: var(--text-heading);
}

/* The note and the activity each start under a rule, as sections of one card. */
.waitlist--details-note {
  display: flex;
  flex-direction: column;
  gap: var(--rem-6);
  padding-top: var(--rem-20);
  box-shadow: inset 0 1px 0 var(--border-subtle);

  p {
    margin: 0;
    font-size: var(--rem-13);
    line-height: 1.5;
    color: var(--text-information);
  }
}

/* Closed until asked for, as the medication merge review's sections. */
.waitlist--details-activity {
  box-shadow: inset 0 1px 0 var(--border-subtle);

  summary {
    display: flex;
    align-items: center;
    gap: var(--rem-8);
    padding-top: var(--rem-20);
    list-style: none;
    cursor: pointer;
  }

  summary::-webkit-details-marker {
    display: none;
  }

  summary .waitlist--details-chevron {
    width: var(--rem-16);
    min-width: var(--rem-16);
    height: var(--rem-16);
    transition: transform 0.15s ease;
  }

  .waitlist--details-chevron i {
    font-size: var(--rem-13);
  }

  &[open] .waitlist--details-chevron {
    transform: rotate(90deg);
  }

  .medications--activity {
    padding-top: var(--rem-16);
  }
}

/* ---- Add form and its prompts ---- */

dialog.modals--main-modal.waitlist--form-modal {
  width: 32rem;
}

dialog.modals--main-modal.waitlist--prompt-modal {
  width: 29rem;
}

/* Why the last save was refused, above the fields: the error text the other edit
   modals use. */
.waitlist--form-error {
  margin: 0;
  font-size: var(--rem-13);
  color: var(--text-error);
}

/* A value the form shows but does not let change (the patient's provider). */
.waitlist--form-static {
  margin: 0;
  font-size: var(--rem-14);
  color: var(--text-heading);
}

.waitlist--form-hint {
  display: block;
  margin-top: var(--rem-4);
  font-size: var(--rem-12);
  color: var(--text-additional);
}

.waitlist--prompt-text {
  margin: 0;
  font-size: var(--rem-14);
  line-height: 1.5;
  color: var(--text-information);
}

/* The contact outcomes, one under the other, as the design lists them. */
.waitlist--form-radios .input-groups--radio-input-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--rem-8);
}

/* The row's Schedule button beside its menu, at the row's right edge, with clear space
   between it and the status Tag before it. */
.waitlist--actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--rem-4);
  padding-left: var(--rem-16);
}

.waitlist--table td.waitlist--col-menu {
  overflow: visible;
}

/* What the waitlist item says, set apart inside the "does this appointment complete
   it?" prompt. */
.waitlist--summary-card {
  display: flex;
  flex-direction: column;
  gap: var(--rem-12);
  padding: var(--rem-16);
  border-radius: var(--radius-md);
  background-color: var(--surface-subtle);

  .details-row--group[data-size="sm"] .details-row--label {
    width: 10rem;
  }
}
