/* The design system's controls, rebuilt to its own specification: colours,
   radii and states from the tokens, every transition 200ms ease-in-out and
   declared per property. No press states, no movement on hover. */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  column-gap: var(--spacing-icons-button);
  border-radius: 8px;
  border: 1px solid transparent;
  font: var(--t-body-primary-400);
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--transition-default),
    border-color var(--transition-default),
    color var(--transition-default);
}

.button-primary {
  background: var(--c-blue);
  border-color: var(--c-blue);
  color: var(--c-white);
}

.button-primary:hover {
  background: var(--c-blue-lighter);
  border-color: var(--c-blue-lighter);
}

.button-inverted {
  background: var(--c-bg-black);
  border-color: var(--c-neutral-3);
  color: var(--c-neutral-12);
}

.button-inverted:hover {
  background: var(--c-neutral-1);
  border-color: var(--c-neutral-7);
}

.button-big {
  height: 44px;
  padding: 0 24px;
}

.button-medium {
  height: 36px;
  padding: 0 16px;
}

.button-small {
  height: 32px;
  padding: 0 14px;
  font: var(--t-body-small-400);
}

.button-wide {
  width: 100%;
}

.button:disabled {
  background: var(--c-blue-disabled);
  border-color: var(--c-blue-disabled);
  cursor: default;
}

.field {
  display: flex;
  flex-direction: column;
  row-gap: 6px;
}

.field label {
  font: var(--t-body-small-400);
  color: var(--c-neutral-10);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  background: transparent;
  border: 1px solid var(--c-neutral-3);
  border-radius: 8px;
  color: var(--c-white);
  font: var(--t-body-primary-300);
  padding: 0 14px;
  height: 44px;
  transition: border-color var(--transition-default);
}

.field textarea {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 84px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--c-neutral-7);
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: var(--c-neutral-7);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--c-neutral-8);
}

.field-small input,
.field-small select {
  height: 36px;
  font: var(--t-body-small-300);
}

.field-error {
  font: var(--t-body-small-300);
  color: var(--c-red);
}

.field input[aria-invalid="true"] {
  border-color: var(--c-red);
}

/* One dropdown everywhere. A select left to the browser draws a grey box in
   the middle of a dark screen, so every one of them sits in this shell: the
   field styling, and a chevron drawn on top of a select with its own arrow
   turned off. */
.select-shell {
  position: relative;
  display: block;
}

.select-shell select {
  appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 36px 0 14px;
  background: transparent;
  border: 1px solid var(--c-neutral-3);
  border-radius: 8px;
  color: var(--c-white);
  font: var(--t-body-primary-300);
  cursor: pointer;
  transition: border-color var(--transition-default);
}

.select-shell select:hover {
  border-color: var(--c-neutral-7);
}

.select-shell select:focus {
  outline: none;
  border-color: var(--c-neutral-8);
}

.select-shell::after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.5px solid var(--c-neutral-9);
  border-bottom: 1.5px solid var(--c-neutral-9);
  transform: rotate(45deg);
  pointer-events: none;
}

/* The one in a weekday row, where the row is 36px tall. */
.select-shell-tight select {
  height: 36px;
  padding: 0 28px 0 10px;
  font: var(--t-body-small-300);
}

.select-shell-tight::after {
  right: 11px;
  width: 6px;
  height: 6px;
  margin-top: -4px;
}

/* The list itself is the operating system's, and on a dark page it needs to
   be told the colours. */
.select-shell option {
  background: var(--c-neutral-1);
  color: var(--c-white);
}

/* Removing the application is the one destructive thing on this screen, and
   it is drawn as such: outline until it is the button in the confirmation. */
.button-danger {
  background: transparent;
  border-color: var(--c-red-dark);
  color: var(--c-red);
}

.button-danger:hover {
  background: var(--c-red-dark);
  border-color: var(--c-red);
  color: var(--c-white);
}

.button-danger-filled {
  background: var(--c-red);
  border-color: var(--c-red);
  color: var(--c-white);
}

.button-danger-filled:hover {
  background: var(--c-red-darker);
  border-color: var(--c-red-darker);
}

/* The three callouts. The colour is the only difference between them, and it
   is the difference between "read this" and "this failed". */
.callout {
  border: 1px solid var(--c-neutral-3);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  column-gap: 14px;
}

.callout-words {
  display: flex;
  flex-direction: column;
  row-gap: 8px;
  min-width: 0;
}

.callout-mark {
  flex: none;
  margin-top: 2px;
}

.callout strong {
  font: var(--t-body-primary-500);
  color: var(--c-white);
}

.callout p {
  margin: 0;
  font: var(--t-body-primary-300);
  color: var(--text-body);
}

.callout .fine-print {
  margin: 0;
}

.callout-warning {
  border-color: var(--c-orange-darker);
}

.callout-error {
  border-color: var(--c-red-dark);
}

/* The dropdown the design draws, which a native select cannot be.
 *
 * A browser's option list is the operating system's, not ours: it cannot take
 * the panel, the highlighted row or the chevron that turns over on opening
 * (ANIMATIONS.md, "Select chevron"). So the select stays in the page as the
 * value everything else reads, and this is what people see. Without JavaScript
 * the select is still there and still works.
 *
 * The panel is the same surface as the row menu, because it is the same thing
 * in the design system: a popover over the page.
 */
.select-shell[data-upgraded] select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Upgraded, the button draws the chevron; the shell's own would be a second. */
.select-shell[data-upgraded]::after {
  display: none;
}

.select-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--c-neutral-3);
  border-radius: 8px;
  color: var(--c-white);
  font: var(--t-body-primary-300);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-default);
}

.select-value:hover {
  border-color: var(--c-neutral-7);
}

.select-value:focus-visible {
  outline: none;
  border-color: var(--c-neutral-8);
}

.select-value[aria-expanded="true"] {
  border-color: var(--c-neutral-8);
}

/* The chevron turns over while the panel is open. */
.select-value .chevron {
  flex: none;
  color: var(--c-neutral-9);
  transition: transform var(--transition-default);
}

.select-value[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.select-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  background: var(--c-neutral-0);
  border: 1px solid var(--c-neutral-3);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
}

/* Near the bottom of a dialog the panel opens upwards, or the last field
   would have its options cut off by the edge. */
.select-panel-up {
  top: auto;
  bottom: calc(100% + 8px);
}

.select-option {
  text-align: left;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--c-white);
  font: var(--t-body-primary-300);
  cursor: pointer;
}

.select-option:hover,
.select-option:focus-visible {
  background: var(--c-neutral-1);
  outline: none;
}

/* What is chosen now, which the design shows lit rather than ticked. */
.select-option[aria-selected="true"] {
  background: var(--c-neutral-2);
}
