/* ==========================================================================
   Component — Flatpickr theme

   Load AFTER css/flatpickr.min.css. This maps the vendor stylesheet onto the
   template's tokens, so the calendar follows the active colour scheme and the
   active service accent without a second theme file per palette.

   The calendar is appended to <body>, outside any [data-service] ancestor, so
   --wu-service resolves to its :root value there. `--wu-picker-accent` is set
   on the calendar by nothing at all today and simply falls back to the primary
   colour — override it per page if a service tint is wanted.
   ========================================================================== */

.flatpickr-calendar {
  --wu-picker-accent: var(--wu-primary);

  width: 20rem;
  padding: var(--wu-space-2);
  background: var(--wu-surface);
  border: 1px solid var(--wu-border);
  border-radius: var(--wu-radius-lg);
  box-shadow: var(--wu-shadow);
  font-family: var(--wu-font-body);
  font-size: var(--wu-fs-sm);
}

/* The vendor draws the little pointer with borders; retint both layers. */
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowBottom::before { border-bottom-color: var(--wu-border); }
.flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::after { border-bottom-color: var(--wu-surface); }

/* --- Month header -------------------------------------------------------- */
.flatpickr-months {
  padding-bottom: var(--wu-space-2);
  align-items: center;
}
.flatpickr-current-month {
  font-size: var(--wu-fs-base);
  font-weight: var(--wu-fw-semibold);
  color: var(--wu-heading);
  padding-top: 0;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  font-family: inherit;
  font-weight: inherit;
  color: inherit;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover { background: var(--wu-surface-alt); }

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  top: 2px;
  padding: 6px 8px;
  border-radius: var(--wu-radius);
  fill: var(--wu-text-muted);
  transition: background-color var(--wu-duration-sm) var(--wu-ease);
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover { background: var(--wu-surface-alt); }
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg { fill: var(--wu-picker-accent); }

/* --- Weekday row --------------------------------------------------------- */
span.flatpickr-weekday {
  font-size: var(--wu-fs-xs);
  font-weight: var(--wu-fw-semibold);
  color: var(--wu-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* --- Days ---------------------------------------------------------------- */
.flatpickr-day {
  border-radius: var(--wu-radius);
  border: 0;
  color: var(--wu-text);
  font-size: var(--wu-fs-sm);
  line-height: 38px;
  height: 38px;
  max-width: 38px;
  transition: background-color var(--wu-duration-sm) var(--wu-ease),
              color var(--wu-duration-sm) var(--wu-ease);
}
.flatpickr-day:hover { background: var(--wu-surface-alt); color: var(--wu-heading); }

.flatpickr-day.today {
  font-weight: var(--wu-fw-bold);
  box-shadow: inset 0 0 0 1px var(--wu-border-strong);
}
.flatpickr-day.today:hover { background: var(--wu-surface-alt); }

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--wu-picker-accent);
  border-color: var(--wu-picker-accent);
  color: var(--wu-on-primary);
  font-weight: var(--wu-fw-semibold);
}

/* Nights between the two ends of a stay. */
.flatpickr-day.inRange,
.flatpickr-day.inRange:hover {
  background: color-mix(in srgb, var(--wu-picker-accent) 14%, transparent);
  border-color: transparent;
  box-shadow: none;
  color: var(--wu-heading);
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: var(--wu-border-strong);
}
.flatpickr-day.flatpickr-disabled { text-decoration: line-through; cursor: not-allowed; }

/* --- Time picker (transfer pickup times) --------------------------------- */
.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm {
  font-family: inherit;
  font-size: var(--wu-fs-base);
  color: var(--wu-heading);
}
.flatpickr-time input:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:hover { background: var(--wu-surface-alt); }
.flatpickr-time .numInputWrapper span.arrowUp::after { border-bottom-color: var(--wu-text-muted); }
.flatpickr-time .numInputWrapper span.arrowDown::after { border-top-color: var(--wu-text-muted); }

/* --- The visible input flatpickr swaps in --------------------------------
   altInput inherits the original's classes, so it already looks like any
   other .wu-input. It is read-only by design — dates are picked, not typed —
   so make that legible rather than looking disabled. */
.wu-input-picker {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M19 3h-1V1h-2v2H8V1H6v2H5a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 18H5V9h14v12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-inline-end: 2.5rem;
}
.wu-input-picker:focus {
  border-color: var(--wu-primary);
  box-shadow: 0 0 0 3px rgba(var(--wu-primary-rgb), .15);
}

/* Inside the glass search widget the calendar needs a solid ground of its own;
   stacking two translucent layers turns the grid to mush. */
.wu-search .flatpickr-calendar { background: var(--wu-body-bg); }

@media (max-width: 575.98px) {
  .flatpickr-calendar { width: 17.5rem; }
  .flatpickr-day { height: 34px; line-height: 34px; max-width: 34px; }
}
