/* Date and time boxes: a day button with a calendar, and a time box with a list
   (date_picker_controller.js). */

/* The real input stays in the form, invisible, where the picker starts, so the
   browser's "please fill this in" message points at the right place. */
input.date-picker-native {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.date-picker {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.date-picker-day.input {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-align: left;
  cursor: pointer;
}

.date-picker-day > svg {
  flex: none;
  color: var(--ink-3);
}

.date-picker-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.date-picker.is-blank .date-picker-day {
  color: var(--ink-3);
}

.date-picker-time.input {
  flex: 0 0 6.5em;
  min-width: 0;
}

.date-picker[data-kind='time'] .date-picker-time.input {
  flex: 1 1 auto;
}

.date-picker-day:disabled,
.date-picker-time:disabled {
  background: var(--steel);
  color: var(--ink-3);
  cursor: not-allowed;
}

.date-picker.is-invalid .input {
  border-color: var(--danger);
}

/* Compact boxes (the dispatch board, the crew map) keep their size. */
.date-picker-day.input-compact {
  flex: 0 1 auto;
}

/* The calendar and the time list are popovers, so they show above popups and are never cut off. */
.date-picker-calendar,
.date-picker-slots {
  position: fixed;
  inset: auto;
  margin: 0;
  overflow-y: auto;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 16px 40px -12px rgb(19 28 51 / 0.35);
  font: 400 15px/1.3 var(--font-body-stack);
}

.date-picker-calendar {
  box-sizing: border-box;
  width: 296px;
  padding: 10px;
  overflow-x: hidden;
}

.date-picker-head {
  display: grid;
  grid-template-columns: auto 1fr 5.5em auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.date-picker-head select.input {
  width: 100%;
}

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px 0;
}

.date-picker-weekday {
  padding: 4px 0;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.date-picker-date {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.date-picker-date:hover {
  background: var(--carbon-wash);
}

.date-picker-date:focus-visible {
  outline: 2px solid var(--carbon);
  outline-offset: -2px;
}

.date-picker-date.is-other-month {
  color: var(--ink-3);
}

.date-picker-date[aria-current='date'] {
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--line-2);
}

/* A linked start and end: the days between are shaded, end to end. */
.date-picker-date.in-range {
  border-radius: 0;
  background: var(--carbon-wash);
}

.date-picker-date.is-range-start {
  border-radius: 6px 0 0 6px;
}

.date-picker-date.is-range-end {
  border-radius: 0 6px 6px 0;
}

.date-picker-date.is-range-start.is-range-end {
  border-radius: 6px;
}

.date-picker-date[aria-pressed='true'] {
  background: var(--carbon);
  color: var(--paper);
  font-weight: 600;
}

.date-picker-date:disabled {
  background: none;
  color: var(--line-2);
  cursor: not-allowed;
}

.date-picker-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.date-picker-slots {
  padding: 4px;
  list-style: none;
}

.date-picker-slot {
  padding: 8px 10px;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
}

.date-picker-slot.is-active {
  background: var(--carbon-wash);
}

.date-picker-slot[aria-selected='true'] {
  font-weight: 600;
}

/* How long an end would make it: "(1 h 30)". */
.date-picker-slot small {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 400;
}
