/* ─────────────────────────────────────────────────────────────────────────────
   Parada — the date-range calendar popover (desktop) / bottom sheet (phone).
   ONE look for every field that picks a range of days: the browse pages' filter
   field (/v1/rental, /v1/parkings, /v1/storage/browse, /v1/comm/parkings) and the
   landing pages' hero search (/car-rental, /storage, /commercial-parking).
   Markup: views/includes/browse/date-range-modal.ejs (which links this sheet);
   script: /assets/js/date-popover.js, which sets left / top / width and
   data-side="bottom|left|top|sheet".

   2026-11-15 (user request: "improve the modal and move it near the date
   selection"): the calendar opens NEXT TO its field — below it, beside the box
   the page names (the browse filter card), or above — with an arrow pointing at
   the field; under 768px it is a bottom sheet over the dimmed page. Until then
   each was a modal in the middle of the page.
   ───────────────────────────────────────────────────────────────────────────── */

.pls-dp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 11999;
  background: rgba(15, 23, 42, .45);
}
.pls-dp-backdrop[hidden] { display: none; }

.pls-dp {
  --pls-dp-caret: 50%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 12000;
  width: 352px;
  max-width: calc(100vw - 16px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 22px 50px rgba(15, 23, 42, .18), 0 3px 10px rgba(15, 23, 42, .08);
  color: #111827;
  text-align: left;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .14s ease, transform .14s ease;
}
.pls-dp[hidden] { display: none; }
.pls-dp.is-shown { opacity: 1; transform: none; }
.pls-dp[data-side="top"] { transform: translateY(-6px); }
.pls-dp[data-side="left"] { transform: translateX(-6px); }
.pls-dp[data-side="top"].is-shown,
.pls-dp[data-side="left"].is-shown { transform: none; }

/* The arrow: a rotated square on the edge facing the field. */
.pls-dp-caret {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  transform: rotate(45deg);
  pointer-events: none;
}
.pls-dp[data-side="bottom"] .pls-dp-caret { top: -8px; left: calc(var(--pls-dp-caret) - 7px); border-right: 0; border-bottom: 0; }
.pls-dp[data-side="top"] .pls-dp-caret { bottom: -8px; left: calc(var(--pls-dp-caret) - 7px); border-left: 0; border-top: 0; }
.pls-dp[data-side="left"] .pls-dp-caret { right: -8px; top: calc(var(--pls-dp-caret) - 7px); border-left: 0; border-bottom: 0; }

.pls-dp-head { padding: 14px 16px 4px; }
.pls-dp-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.pls-dp-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  color: #111827;
  letter-spacing: 0;
  text-transform: none;
}
.pls-dp-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: -6px -8px -6px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #6b7280;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pls-dp-close:hover { background: #f3f4f6; color: #111827; }

/* The two tiles: what is picked, and (outlined) what the next click picks. */
.pls-dp-sum {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.pls-dp-tile {
  min-width: 0;
  padding: 7px 11px 8px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.pls-dp-tile.is-active {
  border-color: #1f497d;
  background: #f6f9fd;
  box-shadow: 0 0 0 3px rgba(31, 73, 125, .12);
}
.pls-dp-tile-cap {
  display: block;
  color: #6b7280;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .45px;
  line-height: 1.2;
  text-transform: uppercase;
}
.pls-dp-tile-val {
  display: block;
  margin-top: 2px;
  color: #111827;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pls-dp-tile-val.is-empty { color: #9ca3af; font-weight: 600; }
.pls-dp-arrow { color: #9ca3af; font-size: 13px; }
.pls-dp-hint {
  min-height: 18px;
  margin: 10px 2px 0;
  color: #4b5563;
  font-size: 12.5px;
  line-height: 1.45;
}

.pls-dp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 12px 6px;
  overscroll-behavior: contain;
}
.pls-dp-anchor {
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.pls-dp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 14px;
  border-top: 1px solid #f1f5f9;
}
.pls-dp-clear {
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #1f497d;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.pls-dp-clear:hover { color: #163a6b; }
.pls-dp-apply {
  min-height: 40px;
  padding: 0 24px;
  border: 1.5px solid #1f497d;
  border-radius: 10px;
  background: #1f497d;
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pls-dp-apply:hover { background: #163a6b; border-color: #163a6b; }
.pls-dp-close:focus-visible,
.pls-dp-clear:focus-visible,
.pls-dp-apply:focus-visible { outline: 2px solid #1f497d !important; outline-offset: 2px; }

/* Phone: a bottom sheet over the dimmed page. */
.pls-dp[data-side="sheet"] {
  top: auto !important;
  left: 0 !important;
  right: 0;
  bottom: 0;
  width: auto !important;
  max-width: none;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(24px);
}
.pls-dp[data-side="sheet"].is-shown { transform: none; }
.pls-dp[data-side="sheet"] .pls-dp-caret { display: none; }
.pls-dp[data-side="sheet"] .pls-dp-head { padding: 16px 16px 4px; }
.pls-dp[data-side="sheet"] .pls-dp-title { font-size: 15px; }
.pls-dp[data-side="sheet"] .pls-dp-foot { padding: 12px 16px 16px; }
.pls-dp[data-side="sheet"] .pls-dp-apply { flex: 1 1 auto; max-width: 220px; }

@media (prefers-reduced-motion: reduce) {
  .pls-dp, .pls-dp-tile { transition: none; }
}

/* ── The calendar (Litepicker, inline in #plsDpPicker) — flat, full width ──────
   Litepicker draws its month on a card of its own (shadow, 5px radius, a fixed
   width) and paints today red and hovers in its own blue; inside the panel the
   month is flat, the days fill the width, and everything is site navy (no red). */
#plsDpPicker {
  --litepicker-is-today-color: #1f497d;
  --litepicker-day-color-hover: #1f497d;
  --litepicker-button-prev-month-color-hover: #1f497d;
  --litepicker-button-next-month-color-hover: #1f497d;
}
#plsDpPicker .litepicker {
  display: block !important; /* Litepicker sets inline-block; the month fills the panel */
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  box-shadow: none;
}
#plsDpPicker .litepicker .container__main { display: block; }
#plsDpPicker .litepicker .container__months {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}
#plsDpPicker .litepicker .container__months .month-item {
  width: 100%;
  padding: 0;
  box-sizing: border-box;
}
#plsDpPicker .litepicker .container__months .month-item-header {
  padding: 4px 0 8px;
  color: #111827;
  font-size: 15px;
  font-weight: 800;
}
#plsDpPicker .litepicker .container__months .month-item-header .button-previous-month,
#plsDpPicker .litepicker .container__months .month-item-header .button-next-month {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  color: #1f497d;
  cursor: pointer;
  transition: background .15s;
}
#plsDpPicker .litepicker .container__months .month-item-header .button-previous-month:hover,
#plsDpPicker .litepicker .container__months .month-item-header .button-next-month:hover { background: #eef3fa; }
#plsDpPicker .litepicker .container__months .month-item-header .button-previous-month:focus-visible,
#plsDpPicker .litepicker .container__months .month-item-header .button-next-month:focus-visible { outline: 2px solid #1f497d !important; outline-offset: 1px; }
/* Litepicker centres these two rows with justify-self, which current browsers honour
   on a block: the weekday row then shrinks to its text and stops lining up with the
   day columns. Both rows span the month. */
#plsDpPicker .litepicker .container__months .month-item-weekdays-row,
#plsDpPicker .litepicker .container__days {
  width: 100%;
  justify-self: stretch;
}
#plsDpPicker .litepicker .container__months .month-item-weekdays-row > div {
  width: calc(100% / 7);
  padding: 4px 0 6px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
#plsDpPicker .litepicker .container__days > div,
#plsDpPicker .litepicker .container__days > a {
  width: calc(100% / 7);
  padding: 0;
}
#plsDpPicker .litepicker .container__days .day-item {
  position: relative;
  height: 40px;
  margin: 2px 0;
  line-height: 40px;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
#plsDpPicker .litepicker .container__days .day-item:hover {
  color: #1f497d;
  background: #eef3fa;
  box-shadow: none;
}
#plsDpPicker .litepicker .container__days .day-item:focus-visible { outline: 2px solid #1f497d !important; outline-offset: -2px; }
/* Today: navy, with a dot under the number. */
#plsDpPicker .litepicker .container__days .day-item.is-today { color: #1f497d; font-weight: 800; }
#plsDpPicker .litepicker .container__days .day-item.is-today::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}
#plsDpPicker .litepicker .container__days .day-item.is-locked,
#plsDpPicker .litepicker .container__days .day-item.is-locked:hover {
  color: #cbd5e1;
  background: transparent;
  font-weight: 500;
  cursor: default;
}
#plsDpPicker .litepicker .container__days .day-item.is-in-range {
  color: #1f497d;
  background: #e8eef7;
  border-radius: 0;
}
#plsDpPicker .litepicker .container__days .day-item.is-start-date,
#plsDpPicker .litepicker .container__days .day-item.is-end-date {
  color: #fff;
  background: #1f497d;
  font-weight: 800;
}
#plsDpPicker .litepicker .container__days .day-item.is-start-date { border-radius: 10px 0 0 10px; }
#plsDpPicker .litepicker .container__days .day-item.is-end-date { border-radius: 0 10px 10px 0; }
#plsDpPicker .litepicker .container__days .day-item.is-start-date.is-flipped { border-radius: 0 10px 10px 0; }
#plsDpPicker .litepicker .container__days .day-item.is-end-date.is-flipped { border-radius: 10px 0 0 10px; }
#plsDpPicker .litepicker .container__days .day-item.is-start-date.is-end-date { border-radius: 10px; }
#plsDpPicker .litepicker .container__days .day-item.is-start-date:focus-visible,
#plsDpPicker .litepicker .container__days .day-item.is-end-date:focus-visible { outline-color: #f59e0b !important; }
.pls-dp[data-side="sheet"] #plsDpPicker .litepicker .container__days .day-item { height: 44px; line-height: 44px; }
