/* /plan in-page option-details drawer.
 *
 * Hosts a single named turbo frame ("plan_listing_details") that swaps when a
 * builder card is clicked. The drawer slides in from the inline-end on
 * desktop and covers the viewport as a full sheet on phones. The page
 * underneath stays mounted — the drawer is layered over the .bx-dark builder
 * surface and carries .bx-light-surface so light tokens apply to its panel.
 */

.bido-listing-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}

.bido-listing-drawer.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.18s ease, visibility 0s linear 0s;
}

.bido-listing-drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  /* Black overlay reads as dimming over both light and dark page surfaces;
     a navy tint on the dark /plan page is invisible. */
  background: rgba(var(--bx-black-rgb), 0.45);
  cursor: pointer;
}

.bido-listing-drawer-panel {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  inline-size: clamp(22rem, 38vw, 30rem);
  max-inline-size: 100%;
  background: var(--bx-paper);
  border-inline-start: 1px solid var(--bx-line);
  box-shadow: -24px 0 48px rgba(var(--bx-navy-rgb), 0.32);
  display: flex;
  flex-direction: column;
  transform: translateX(8%);
  transition: transform 0.22s ease;
  overflow: hidden;
  outline: none;
}

.bido-listing-drawer.open .bido-listing-drawer-panel {
  transform: translateX(0);
}

.bido-listing-drawer-panel[hidden] {
  display: none;
}

/* The turbo-frame is the panel's flex child once the listing body is
   fetched in. It stacks the pillar-aware head + the scrolling body so the
   close button sits in a fixed bar while the body scrolls underneath. */
.bido-listing-drawer-frame {
  flex: 1;
  min-block-size: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bido-listing-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-block-end: 1px solid var(--bx-line);
  background: var(--bx-paper-2);
  flex-shrink: 0;
}

.bido-listing-drawer-head .eyebrow {
  color: var(--bx-ink-3);
}

.bido-listing-drawer-close {
  inline-size: 32px;
  block-size: 32px;
  border: 0;
  border-radius: var(--bx-r-pill);
  background: var(--bx-fill);
  color: var(--bx-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (any-hover: hover) {
  .bido-listing-drawer-close:hover {
    background: var(--bx-fill-2);
  }
}

.bido-listing-drawer-body {
  flex: 1;
  min-block-size: 0;
  overflow-y: auto;
  padding: 18px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
}

.bido-listing-drawer-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bido-listing-drawer-title {
  margin: 4px 0 2px;
  font-family: var(--bx-font-display);
  font-size: var(--bx-text-2xl);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--bx-ink);
}

.bido-listing-drawer-meta {
  font-size: var(--bx-text-md);
  color: var(--bx-ink-3);
}

.bido-listing-drawer-gallery {
  /* Anchors the absolutely-positioned "All N photos" jump button
     (.bido-gallery-jump, reused from the detail gallery). */
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
  block-size: clamp(220px, 38vw, 320px);
}

.bido-listing-drawer-gallery > .photo {
  inline-size: 100%;
  block-size: 100%;
}

.bido-listing-drawer-gallery > .photo:first-child {
  grid-row: 1 / span 2;
}

.bido-listing-drawer-gallery.bido-listing-drawer-gallery--sparse {
  grid-template-columns: 1fr;
  block-size: auto;
}

.bido-listing-drawer-gallery.bido-listing-drawer-gallery--sparse > .photo {
  aspect-ratio: 16 / 10;
  block-size: auto;
}

.bido-listing-drawer-gallery.bido-listing-drawer-gallery--sparse > .photo:first-child {
  grid-row: auto;
}

.bido-listing-drawer-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr));
  gap: 8px;
}

.bido-listing-drawer-facts > div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--bx-line);
  border-radius: var(--bx-r);
  background: var(--bx-paper-2);
  font-size: var(--bx-text-sm);
  color: var(--bx-ink);
}

.bido-listing-drawer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bido-listing-drawer-section .eyebrow {
  color: var(--bx-ink-3);
}

.bido-listing-drawer-description {
  margin: 0;
  font-size: var(--bx-text-md);
  line-height: 1.6;
  color: var(--bx-ink-2);
}

.bido-listing-drawer-description + .bido-listing-drawer-description {
  margin-block-start: 6px;
}

.bido-listing-drawer-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 8px;
}

.bido-listing-drawer-highlights > div,
.bido-listing-drawer-highlights > li {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--bx-line);
  border-radius: var(--bx-r);
  background: var(--bx-paper-2);
  font-size: var(--bx-text-sm);
  color: var(--bx-ink);
}

.bido-listing-drawer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bido-listing-drawer-chip {
  padding: 4px 10px;
  border-radius: var(--bx-r-pill);
  border: 1px solid var(--bx-line);
  background: var(--bx-paper-2);
  font-size: var(--bx-text-xs);
  color: var(--bx-ink-2);
}

.bido-listing-drawer-tagrow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--bx-font-mono);
  font-size: var(--bx-text-xs);
  color: var(--bx-ink-3);
}

.bido-listing-drawer-tag {
  padding: 2px 8px;
  border-radius: var(--bx-r-pill);
  background: var(--bx-fill);
}

.bido-listing-drawer-stay-details {
  display: grid;
  gap: 6px;
  margin: 0;
}

.bido-listing-drawer-stay-details > div {
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  font-size: var(--bx-text-sm);
}

.bido-listing-drawer-stay-details dt {
  color: var(--bx-ink-3);
}

.bido-listing-drawer-stay-details dd {
  margin: 0;
  font-weight: 600;
  color: var(--bx-ink);
}

.bido-listing-drawer-ladder {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: 8px;
}

.bido-listing-drawer-ladder-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--bx-line);
  border-radius: var(--bx-r);
  background: var(--bx-paper-2);
  font-size: var(--bx-text-sm);
  color: var(--bx-ink);
  text-decoration: none;
}

.bido-listing-drawer-ladder-card.current {
  border-color: var(--bx-accent);
  background: var(--bx-accent-soft);
}

.bido-listing-drawer-ladder-card .seats {
  font-size: var(--bx-text-xs);
  color: var(--bx-ink-3);
}

.bido-listing-drawer-ladder-card .price {
  font-weight: 800;
}

.bido-listing-drawer-summary {
  border: 1px solid var(--bx-line);
  border-radius: var(--bx-r-lg);
  padding: 14px 16px 16px;
  background: var(--bx-paper-2);
  /* The drawer panel is a light surface over the dark /plan page; set an
     explicit ink color so the price + plain row numbers don't inherit the
     dark page's near-white text and wash out. */
  color: var(--bx-ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bido-listing-drawer-summary-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.bido-listing-drawer-summary-head .muted {
  font-size: var(--bx-text-sm);
}

.bido-listing-drawer-summary-quantity {
  font-size: var(--bx-text-sm);
  color: var(--bx-ink-3);
}

.bido-listing-drawer-summary-rows {
  display: grid;
  gap: 6px;
  font-size: var(--bx-text-sm);
  padding-block-start: 8px;
  border-block-start: 1px solid var(--bx-line);
}

.bido-listing-drawer-summary-rows > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
}

.bido-listing-drawer-summary-rows .total {
  padding-block-start: 6px;
  border-block-start: 1px solid var(--bx-line);
  font-weight: 800;
  color: var(--bx-ink);
}

.bido-listing-drawer-cta {
  inline-size: 100%;
  justify-content: center;
}

.bx .button_to:has(.bido-listing-drawer-cta) {
  display: flex;
  inline-size: 100%;
}

.bido-listing-drawer-locked {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--bx-text-sm);
  color: var(--bx-ink-3);
}

.bido-listing-drawer-warning {
  padding: 10px 12px;
  border-radius: var(--bx-r);
  background: rgba(var(--bx-amber-rgb), 0.14);
  color: var(--bx-ink);
  font-size: var(--bx-text-sm);
}

/* Rendered just above the Swap CTA when adding this listing will replace an
   existing trip item (a different stay, or a different vehicle for the same
   occasion). Reads as informational — not a warning, just a heads-up. */
.bido-listing-drawer-swap-note {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--bx-r);
  background: var(--bx-accent-soft);
  color: var(--bx-accent-ink);
  font-size: var(--bx-text-sm);
}

.bido-listing-drawer-swap-note strong {
  font-weight: 700;
}

.bido-listing-drawer-payment-note {
  text-align: center;
  font-size: var(--bx-text-xs);
  color: var(--bx-ink-3);
}

.bido-listing-drawer-wheels-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bido-listing-drawer-wheels-fields label {
  display: block;
  font-size: var(--bx-text-xs);
  color: var(--bx-ink-3);
  margin-block-end: 4px;
}

.bido-listing-drawer-wheels-hint {
  font-size: var(--bx-text-xs);
  color: var(--bx-ink-3);
  margin: 4px 0 0;
}

/* The chosen vehicle count can't seat the whole group — flag the fit line. */
.bido-listing-drawer-wheels-hint--warn {
  color: var(--bx-warn-ink);
}

/* Lock body scroll behind the drawer. */
body.listing-drawer-open {
  overflow: hidden;
}

/* === Responsive ===
   On phones the drawer becomes a full sheet — no side gap, no slide-in
   translate that would feel cramped, and the panel grows to fill the
   viewport so the long detail flow has room to breathe. */
@media (max-width: 48rem) {
  .bido-listing-drawer-panel {
    inline-size: 100%;
    border-inline-start: 0;
    box-shadow: none;
    transform: translateY(6%);
  }
  .bido-listing-drawer.open .bido-listing-drawer-panel {
    transform: translateY(0);
  }
  .bido-listing-drawer-gallery {
    grid-template-columns: 1fr;
    block-size: auto;
  }
  .bido-listing-drawer-gallery > .photo {
    aspect-ratio: 16 / 10;
    block-size: auto;
  }
  .bido-listing-drawer-gallery > .photo:first-child {
    grid-row: auto;
  }
}
