/* ---- the closed field ----
   One control for the whole rental. Two date boxes make the customer think in
   endpoints; a single field with a day count makes the span the subject, which
   is the whole point of the redesign. Ships with the component so every page
   gets the same control. */

.trpf {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  font-family: Inter, sans-serif;
  transition: border-color .18s, box-shadow .18s;
}
.trpf:hover { border-color: var(--primary); }
.trpf:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,60,225,.12); }
.trpf__icon { flex: none; width: 19px; height: 19px; color: var(--primary); }
.trpf__txt { min-width: 0; }
.trpf__lab { display: block; font-size: .72rem; font-weight: 600; color: var(--gray-500); }
.trpf__val {
  display: block;
  font-size: .93rem;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.trpf__val--empty { color: var(--gray-400); font-weight: 500; }
.trpf__days {
  margin-left: auto;
  flex: none;
  background: var(--primary-light);
  color: var(--primary-deeper);
  font-size: .78rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
}
.trpf__days[hidden] { display: none; }

/* first tap fetches the calendar; show the field is working */
.trpf--loading { opacity: .7; cursor: progress; }
.trpf--loading .trpf__icon { animation: trpf-pulse 1s ease-in-out infinite; }
@keyframes trpf-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .trpf--loading .trpf__icon { animation: none; } }

/* search bar: same control, tighter, to sit in a one-line sticky row */
.trpf--compact { padding: 9px 12px; gap: 9px; border-width: 1.5px; border-radius: var(--radius-xs); }
.trpf--compact .trpf__icon { width: 16px; height: 16px; }
.trpf--compact .trpf__lab { font-size: .68rem; }
.trpf--compact .trpf__val { font-size: .85rem; }
.trpf--compact .trpf__days { font-size: .72rem; padding: 3px 8px; }

@media (max-width: 640px) {
  .trpf__val { font-size: .88rem; white-space: normal; }
  .trpf__days { align-self: flex-start; }
}

/* Trip range picker. Uses the site tokens (violet primary, amber accent, slate
   greys) so it reads as part of the same product, not a bolted-on widget. */

.trp {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  background: rgba(15, 23, 42, .45);
  padding: 24px;
  overflow-y: auto;
}
.trp--open { display: flex; align-items: flex-start; justify-content: center; }
body.trp-locked { overflow: hidden; }

.trp__panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 660px;
  margin: auto;
  overflow: hidden;
}

/* The read-out is the one loud element: it answers "how long, and how much"
   while the choice is still being made. */
.trp__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.trp__read strong {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.025em;
  color: var(--dark);
  line-height: 1.15;
}
.trp__read span {
  display: block;
  margin-top: 3px;
  font-size: .86rem;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}
.trp--invalid .trp__read strong { color: #b91c1c; }

.trp__close {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-700);
  cursor: pointer;
  transition: background .18s;
}
.trp__close:hover { background: var(--gray-200); }
.trp__close svg { width: 15px; height: 15px; }

.trp__cal { display: none; }   /* flatpickr renders its calendar as a sibling of this */
.trp .flatpickr-calendar.inline { padding: 6px 10px 0; }

.trp__times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 22px 18px;
}
.trp__time { display: block; }
.trp__time span {
  display: block;
  font-size: .76rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 5px;
}
.trp__time select {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-xs);
  background: var(--gray-50);
  font-family: Inter, sans-serif;
  font-size: .88rem;
  color: var(--dark);
  font-variant-numeric: tabular-nums;
}
.trp__time select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 60, 225, .1); }

.trp__tz { grid-column: 1 / -1; margin: 2px 0 0; font-size: .76rem; color: var(--gray-400); }

.trp__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.trp__hint { font-size: .82rem; color: #b45309; margin: 0; max-width: 42ch; }
.trp__hint[hidden] { display: none; }
.trp__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.trp__clear {
  background: none; border: none;
  font-family: Inter, sans-serif;
  font-size: .86rem; font-weight: 600;
  color: var(--gray-500);
  cursor: pointer; padding: 10px 4px;
}
.trp__clear:hover { color: var(--gray-700); }
.trp__apply {
  padding: 11px 24px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: Inter, sans-serif;
  font-size: .9rem; font-weight: 600;
  cursor: pointer;
  transition: background .18s, transform .18s;
}
.trp__apply:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.trp__apply:disabled { background: var(--gray-200); color: var(--gray-400); cursor: not-allowed; }

/* ---- flatpickr, restyled to the brand ---- */
.trp .flatpickr-calendar.inline { box-shadow: none; width: 100%; max-width: none; }
.trp .flatpickr-months { padding: 4px 0 2px; }
.trp .flatpickr-current-month {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .96rem;
  font-weight: 700;
  color: var(--dark);
}
/* single-month view (mobile) gets flatpickr's month jump dropdown - keep it,
   advance bookings need it, but make it look like the rest of the panel */
.trp .flatpickr-monthDropdown-months {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .96rem;
  font-weight: 700;
  color: var(--dark);
  background: transparent;
  border-radius: var(--radius-xs);
  padding: 2px 4px;
}
.trp .flatpickr-monthDropdown-months:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.trp .flatpickr-weekday {
  font-size: .7rem;
  font-weight: 700;
  color: var(--gray-400);
}
.trp .flatpickr-day {
  font-size: .86rem;
  font-weight: 500;
  color: var(--gray-900);
  border-radius: 8px;
  border: none;
  font-variant-numeric: tabular-nums;
}
.trp .flatpickr-day:hover:not(.flatpickr-disabled) { background: var(--gray-100); }

/* today reads as a marker, not a selection */
.trp .flatpickr-day.today:not(.selected):not(.inRange) {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
}

.trp .flatpickr-day.inRange,
.trp .flatpickr-day.inRange:hover {
  background: var(--primary-light);
  color: var(--primary-deeper);
  box-shadow: -5px 0 0 var(--primary-light), 5px 0 0 var(--primary-light);
  border-radius: 0;
}
.trp .flatpickr-day.selected,
.trp .flatpickr-day.startRange,
.trp .flatpickr-day.endRange,
.trp .flatpickr-day.selected:hover,
.trp .flatpickr-day.startRange:hover,
.trp .flatpickr-day.endRange:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  font-weight: 700;
  box-shadow: none;
}
.trp .flatpickr-day.startRange { border-radius: 8px 0 0 8px; }
.trp .flatpickr-day.endRange { border-radius: 0 8px 8px 0; }
.trp .flatpickr-day.startRange.endRange { border-radius: 8px; }

/* An unavailable day should look unavailable, not merely quiet. */
.trp .flatpickr-day.flatpickr-disabled,
.trp .flatpickr-day.flatpickr-disabled:hover {
  background: transparent;
  color: var(--gray-300);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  cursor: not-allowed;
}
/* Once a start day is picked, flatpickr marks days you cannot reach because a
   booked run sits in between. Show that, rather than letting clicks do nothing. */
.trp .flatpickr-day.notAllowed,
.trp .flatpickr-day.notAllowed:hover {
  background: transparent;
  color: var(--gray-300);
  cursor: not-allowed;
}

.trp .flatpickr-day.prevMonthDay,
.trp .flatpickr-day.nextMonthDay { color: var(--gray-300); }

/* ---- mobile: a sheet, so phone users get the same calendar and the same
        struck-through unavailable days as desktop ---- */
@media (max-width: 640px) {
  .trp { padding: 0; align-items: flex-end; }
  .trp__panel {
    max-width: none;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    margin: 0;
  }
  .trp__head { position: sticky; top: 0; background: var(--white); z-index: 2; }
  .trp__cal { flex: 1; overflow-y: auto; }
  .trp__foot { position: sticky; bottom: 0; flex-wrap: wrap; }
  .trp__actions { width: 100%; }
  .trp__apply { flex: 1; text-align: center; }
  .trp__hint { max-width: none; }
  .trp .flatpickr-day { height: 42px; line-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .trp__apply, .trp__close { transition: none; }
  .trp__apply:hover:not(:disabled) { transform: none; }
}
