/* flatpickr in Terra's colours (date_picker_controller). Loaded after the vendored
   flatpickr.css, which it overrides at equal specificity, so it must stay after
   it in every layout's stylesheet_link_tag.

   The vendored sheet highlights the chosen day in blue (#569ff7), and Terra is
   never blue: the selected day takes --brand-500, today's ring --brand-200.
   Greys are Tailwind's own tokens (--color-gray-*), which the tailwind build
   loaded before this sheet defines on :root. */
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--brand-500);
  border-color: var(--brand-500);
}

.flatpickr-day.today {
  border-color: var(--brand-200);
}

.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: inherit;
}

/* The visible box flatpickr draws beside the hidden real field. It is not
   readonly (a readonly box is skipped by the browser's required check), so it
   gets readonly's look by hand: a pointer, and no text caret. */
.flatpickr-input + input {
  cursor: pointer;
  caret-color: transparent;
}
/* A box that takes typing (date_picker_controller, data-date-typed) looks it. */
.flatpickr-input + input[data-date-typed] {
  cursor: text;
  caret-color: auto;
}

/* No pointer arrow between the calendar and its box (David, 2026-11-09): it
   read as a stray white spot below the calendar. */
.flatpickr-calendar.arrowTop::before, .flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before, .flatpickr-calendar.arrowBottom::after {
  display: none;
}

/* ── The calendar, everywhere a date and time are picked (David, 2026-10-22) ──
   About 10% smaller than flatpickr's own, and the time made the easiest thing
   to read: large, bold, centred under a small "Time" label, with AM/PM after it
   on the 24-hour clock ("14 : 00 PM", date_picker_controller adds the AM/PM). */
.flatpickr-calendar { width: 252px; font-size: 12px; }
.flatpickr-calendar .flatpickr-days,
.flatpickr-calendar .dayContainer { width: 252px; min-width: 252px; max-width: 252px; }
.flatpickr-calendar .flatpickr-day { max-width: 34px; height: 32px; line-height: 32px; font-size: 12px; }
.flatpickr-calendar .flatpickr-weekday { font-size: 11px; }
.flatpickr-calendar .flatpickr-months .flatpickr-month { height: 30px; }

/* .hasTime: the vendored sheet sets the row's height with the same pair. */
.flatpickr-calendar.hasTime .flatpickr-time {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 2px;
  height: 70px;
  max-height: 70px;
  padding-top: 18px;
  border-top: 1px solid var(--color-gray-200);
  border-radius: 0 0 6px 6px;
  background: var(--color-white); /* no light green behind the time (David, 2026-10-23) */
}
.flatpickr-calendar .flatpickr-time::before {
  content: "Time";
  position: absolute;
  inset: 2px 0 auto;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  color: var(--brand-500);
}
.flatpickr-calendar .flatpickr-time .numInputWrapper { flex: 0 0 40px; width: 40px; height: 48px; }
.flatpickr-calendar .flatpickr-time .numInputWrapper span.arrowUp,
.flatpickr-calendar .flatpickr-time .numInputWrapper span.arrowDown { display: none; }
.flatpickr-calendar .flatpickr-time input {
  height: 48px;
  padding: 0;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  line-height: 48px;
  color: var(--color-gray-900);
}
.flatpickr-calendar .flatpickr-time .flatpickr-time-separator {
  flex: 0 0 auto;
  width: auto;
  height: 48px;
  padding: 0 1px;
  font-size: 26px;
  font-weight: 700;
  line-height: 48px;
  color: var(--color-gray-900);
}
/* "Time not given" under the calendar (date_picker_controller#untimedBox). */
.flatpickr-calendar .terra-untimed {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--color-gray-200);
  font-size: 13px;
  color: var(--color-gray-700);
  cursor: pointer;
}
.flatpickr-calendar .terra-untimed input {
  accent-color: var(--brand-500);
}
/* .input twice in the selector: the form's .shipment-form-scope .input colour
   outranked a single class and the box stayed gray (U9). */
input.input.terra-time-tbc {
  color: var(--color-amber-800);
  font-weight: 600;
}
.flatpickr-calendar .flatpickr-time .terra-meridiem {
  display: flex;
  align-items: center;
  height: 48px;
  margin-left: 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-500);
}

/* While a calendar is open the page behind it is dimmed and blurred, so the
   calendar is what you look at — except the box being filled in, which the
   blur leaves a hole around (date_picker_controller sets the clip-path). A click
   on the blur closes the calendar. */
.terra-date-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: color-mix(in oklab, var(--color-gray-900) 18%, transparent);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.terra-date-backdrop.is-open { opacity: 1; pointer-events: auto; }
.flatpickr-calendar.open { z-index: 99999; }
