/* ==========================================================================
   The libraries that replaced jQuery UI, easydropdown and backstretch
   --------------------------------------------------------------------------
   jQuery UI and its theme (global/style/jquery-ui.min.css) are gone. Dialogs
   now run on jquery-confirm through js/dialog-confirm.js, dates on flatpickr
   through js/pickers-flatpickr.js, and sorting on SortableJS through
   js/sortable.js. select.dropdown is Tom Select (js/dropdown-tomselect.js),
   colour fields are Coloris (js/colour-coloris.js), and the login background
   is plain CSS. This is the one place their chrome is described.

   The dialog skin is CoverGenieNG's (assets-ng/cgo/style/dialog-2b.css), in
   the same palette as the 3a sidebar both apps share.
   ========================================================================== */

:root {
  --dlg-panel:   #ffffff;
  --dlg-line:    #e6eaef;
  --dlg-ink:     #1a2330;
  --dlg-muted:   #6b7684;
  --dlg-accent:  #2456b3;
  --dlg-radius:  12px;
}

/* ---- the box ------------------------------------------------------------ */

/*
 * .jconfirm-material as well as .jconfirm: the vendor's material rule
 * (padding 30px 25px 10px) outranks a one-class selector, and jquery-confirm
 * has already put a transition on the box by the time the shim adds classes,
 * so a weaker rule is seen to animate the padding away as the box arrives.
 * transition-property is pinned to what the open and close animations change.
 */
.jconfirm .jconfirm-box,
.jconfirm.jconfirm-material .jconfirm-box {
  border-radius: var(--dlg-radius);
  padding: 0;
  transition-property: transform, opacity;
  background: var(--dlg-panel);
  box-shadow: 0 18px 48px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .10);
  font-family: 'Open Sans', system-ui, sans-serif;
}

/* the 50% dark overlay jQuery UI's .ui-widget-overlay had in boxoffice.css */
.jconfirm .jconfirm-bg,
.jconfirm .jconfirm-bg.jconfirm-bg-h {
  background: rgb(30, 30, 30);
  opacity: .5;
}

/* ---- title ------------------------------------------------------------- */

.jconfirm .jconfirm-box .jconfirm-title-c {
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--dlg-line);
  font-size: 14px;
  font-weight: 700;
  color: var(--dlg-ink);
}

.jconfirm .jconfirm-box .jconfirm-title-c:empty,
.jconfirm .jconfirm-box.mp-dialog-untitled .jconfirm-title-c {
  display: none;
}

.jconfirm .jconfirm-box .jconfirm-closeIcon {
  top: 10px;
  right: 12px;
  color: var(--dlg-muted);
  font-size: 22px;
  opacity: 1;
}

.jconfirm .jconfirm-box .jconfirm-closeIcon:hover {
  color: var(--dlg-ink);
}

/* ---- content ----------------------------------------------------------- */

.jconfirm .jconfirm-box div.jconfirm-content-pane {
  margin: 0;
}

/* long dialogs scroll inside themselves rather than running off the screen */
.jconfirm .jconfirm-box div.jconfirm-content {
  padding: 16px 18px 18px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  color: var(--dlg-ink);
  font-size: 13px;
}

/* every dialog carries its own Save/Pay button; jquery-confirm's row stays empty */
.jconfirm .jconfirm-box .jconfirm-buttons {
  display: none;
}

/* the dialog element moved in by the shim; flow-root contains the settings form's floats */
.jconfirm .mp-dialog-slot {
  display: flow-root;
}

.jconfirm .mp-dialog-slot > div {
  display: block;
}

.jconfirm.mp-dialog .jconfirm-box {
  max-width: calc(100vw - 32px);
}

/* ---- the shake ---------------------------------------------------------- */

/* replaces jQuery UI's effect('shake'), when a dialog's form fails validation */
@keyframes mp-shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-9px); }
  30%      { transform: translateX(8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(4px); }
  80%      { transform: translateX(-2px); }
}

.jconfirm .jconfirm-box.mp-shake,
.mp-shake {
  animation: mp-shake .5s cubic-bezier(.36, .07, .19, .97) both;
}

/* someone who asked for less motion still needs to see it was rejected */
@media (prefers-reduced-motion: reduce) {
  .jconfirm .jconfirm-box.mp-shake,
  .mp-shake {
    animation: none;
    box-shadow: 0 0 0 3px rgba(201, 64, 64, .45);
  }
}

/* ---- sorting ------------------------------------------------------------ */

/* the gap a dragged row leaves, which jQuery UI's ui-state-highlight drew */
.mp-sort-placeholder {
  opacity: .4;
  outline: 2px dashed var(--dlg-accent);
  outline-offset: -2px;
}

/* ---- date pickers ------------------------------------------------------- */

/* main.css set .ui-datepicker to 12px; keep the calendar that size */
.flatpickr-calendar {
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 12px;
}

/* ---- dropdowns (Tom Select) --------------------------------------------- */

/*
 * The look of easydropdown's metro theme, which these replace: a flat grey
 * 200px box, a chevron on the right that turns blue when the field has focus.
 * The wrapper keeps the select's "dropdown" class, so rules written for
 * easydropdown's box (passes.css: .passes-groups .dropdown { width: 300px })
 * still apply.
 */
.ts-wrapper.dropdown {
  width: 200px;
  display: inline-block;
  vertical-align: middle;
}

.ts-wrapper.dropdown .ts-control {
  min-height: 0;
  padding: 7px 40px 7px 12px;
  border: 0;
  border-radius: 0;
  background: #f8f8f8;
  box-shadow: none;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #000;
  cursor: pointer;
}

.ts-wrapper.dropdown .ts-control:hover {
  background: #f4f4f4;
}

/* the chevron, in a 30px box like the metro carat */
.ts-wrapper.dropdown .ts-control::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 32px;
  background: transparent url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23333%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%209l6%206%206-6%22%2F%3E%3C%2Fsvg%3E") center / 20px no-repeat;
}

.ts-wrapper.dropdown.focus .ts-control::after,
.ts-wrapper.dropdown.dropdown-active .ts-control::after {
  background-color: #0180d1;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%209l6%206%206-6%22%2F%3E%3C%2Fsvg%3E");
}

.ts-wrapper.dropdown.disabled .ts-control {
  opacity: .6;
  cursor: default;
}

/*
 * The label ("Please Select") until something is picked. These menus have no
 * search box, which is where Tom Select would draw its placeholder, so
 * js/dropdown-tomselect.js puts the text on the control instead.
 */
.ts-wrapper.dropdown .ts-control[data-placeholder]:not(:has(.item))::before {
  content: attr(data-placeholder);
  color: #777;
}

/*
 * The list is attached to <body> so a dialog's scroll area can't clip it, which
 * means it must also sit above jquery-confirm's modal (z-index 99999999).
 */
.ts-dropdown {
  z-index: 100000000;
  margin: 0;
  border: 1px solid #e6eaef;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, .12);
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
}

.ts-dropdown .option {
  padding: 7px 12px;
}

.ts-dropdown .active {
  background: #0180d1;
  color: #fff;
}

/* ---- colour fields (Coloris) ------------------------------------------- */

/*
 * spectrum drew its palette as small squares, ten to a row. Coloris draws
 * 20px circles, seven to a row in a 200px picker, which would stretch the
 * seven rows of the palette into ten. A grid of ten keeps them as rows.
 */
.clr-picker .clr-swatches {
  width: calc(100% - 24px);
  margin: 0 12px;
}

.clr-picker .clr-swatches div {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
}

.clr-picker .clr-swatches button {
  width: auto;
  height: auto;
  aspect-ratio: 1;
  margin: 0;
  border-radius: 2px;
}

/*
 * The swatch Coloris puts at the right of the field, as a square inside its
 * border rather than a strip over it, and outlined, so a white foreground
 * still shows against the white field. The hex is short enough to clear it.
 */
.clr-field button {
  width: 22px;
  height: 22px;
  right: 6px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}

.clr-field button:after {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}

/* ---- login and sign-up background (was backstretch) --------------------- */

/*
 * backstretch put the photo in a fixed, full-window layer behind the page and
 * kept it covering the window as it resized. A fixed element with
 * background-size: cover does the same without the script - and, unlike
 * background-attachment: fixed on <body>, it holds still on iOS too.
 */
.mp-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("../global/images/background-login-signup.jpg") center / cover no-repeat;
  pointer-events: none;
}
