/* Booking flow — shared step chrome, fold-fit protection, premium add-ons */

:root {
  --rf-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rf-dur: 480ms;
  --rf-sticky-top: 8.75rem;
  --rf-rail-h: 3.35rem;
  --rf-brand: #132a8e;
  --rf-accent: #ff7a1a;
  --rf-ink: #0e1116;
}

/* =========================================================
   Shared persistent step rail (all booking steps)
   ========================================================= */
#rf-shared-steps {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 48;
  pointer-events: none;
  padding: 0.55rem 0 0.65rem;
  background: rgba(250, 250, 252, 0.92);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(14, 17, 22, 0.07);
  box-shadow: 0 8px 28px -18px rgba(14, 17, 22, 0.28);
  transition:
    opacity 280ms var(--rf-ease),
    transform 280ms var(--rf-ease);
}

#rf-shared-steps[hidden] {
  display: none !important;
}

#rf-shared-steps .rf-shared-inner {
  pointer-events: auto;
  max-width: 110rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (min-width: 1024px) {
  #rf-shared-steps .rf-shared-inner {
    padding-inline: 2.5rem;
  }
}

#rf-shared-steps .rf-shared-track {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

#rf-shared-steps .rf-shared-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

#rf-shared-steps .rf-shared-item:last-child {
  flex: 0 1 auto;
}

#rf-shared-steps .rf-shared-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  cursor: default;
  text-decoration: none;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: rgba(14, 17, 22, 0.45);
  background: rgba(14, 17, 22, 0.05);
  white-space: nowrap;
  transition:
    background-color 320ms var(--rf-ease),
    color 320ms var(--rf-ease),
    box-shadow 320ms var(--rf-ease),
    transform 320ms var(--rf-ease);
}

#rf-shared-steps .rf-shared-icon {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #fff;
  color: inherit;
  flex-shrink: 0;
  transition: background-color 320ms var(--rf-ease), color 320ms var(--rf-ease);
}

#rf-shared-steps .rf-shared-label {
  display: none;
}

@media (min-width: 768px) {
  #rf-shared-steps .rf-shared-label {
    display: inline;
  }
}

#rf-shared-steps .rf-shared-item.is-done .rf-shared-pill {
  cursor: pointer;
  color: var(--rf-brand);
  background: rgba(19, 42, 142, 0.08);
}

#rf-shared-steps .rf-shared-item.is-done .rf-shared-icon {
  background: var(--rf-brand);
  color: #fff;
}

#rf-shared-steps .rf-shared-item.is-done .rf-shared-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -12px rgba(19, 42, 142, 0.45);
}

#rf-shared-steps .rf-shared-item.is-current .rf-shared-pill {
  color: #fff;
  background: var(--rf-ink);
  box-shadow: 0 10px 24px -14px rgba(14, 17, 22, 0.65);
}

#rf-shared-steps .rf-shared-item.is-current .rf-shared-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

#rf-shared-steps .rf-shared-conn {
  flex: 1;
  height: 2px;
  min-width: 0.75rem;
  border-radius: 999px;
  background: rgba(14, 17, 22, 0.1);
  transition: background-color 360ms var(--rf-ease);
}

#rf-shared-steps .rf-shared-item.is-done .rf-shared-conn {
  background: var(--rf-brand);
}

#rf-shared-steps .rf-shared-item.is-current .rf-shared-conn {
  background: linear-gradient(90deg, var(--rf-brand), rgba(14, 17, 22, 0.1));
}

/* Hide native in-page step rails — shared chrome replaces them */
html.rf-has-shared-rail .rf-native-rail,
html.rf-has-shared-rail .rf-step-rail {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Checkout: also kill any leftover step strip in the dark hero */
html.rf-has-shared-rail[data-rf-step="checkout"] section.bg-ink a[href="/addons"] + div {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Reserve space under sticky header for the fixed shared rail */
html.rf-has-shared-rail[data-rf-step] #root main > div.mx-auto,
html.rf-has-shared-rail[data-rf-step="build"] #root [class*="max-w-[110rem]"].px-4.py-8,
html.rf-has-shared-rail[data-rf-step="addons"] #root [class*="max-w-[110rem]"].px-4.py-8 {
  padding-top: calc(0.75rem + var(--rf-rail-h)) !important;
}

html.rf-has-shared-rail[data-rf-step="checkout"] section.bg-ink > div[class*="max-w"] {
  padding-top: calc(0.85rem + var(--rf-rail-h)) !important;
}

/* =========================================================
   Body-only premium transitions
   ========================================================= */
@keyframes rf-body-in {
  from {
    opacity: 0;
    transform: translate3d(28px, 6px, 0);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

@keyframes rf-body-in-back {
  from {
    opacity: 0;
    transform: translate3d(-28px, 6px, 0);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

.rf-step-body.rf-enter {
  animation: rf-body-in var(--rf-dur) var(--rf-ease) both;
}

.rf-step-body.rf-enter-back {
  animation: rf-body-in-back var(--rf-dur) var(--rf-ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .rf-step-body.rf-enter,
  .rf-step-body.rf-enter-back {
    animation: none !important;
  }

  #rf-shared-steps .rf-shared-pill,
  #rf-shared-steps .rf-shared-conn,
  #rf-shared-steps .rf-shared-icon {
    transition: none !important;
  }
}

/* =========================================================
   Protection — cards fit one desktop viewport
   ========================================================= */
@media (min-width: 1024px) {
  html[data-rf-step="build"] #root .fixed.inset-x-0.bottom-0 {
    display: none !important;
  }

  html[data-rf-step="build"] #root a[href*="/car/"] {
    margin-bottom: 0;
  }

  /* Heading row: keep premium air, trim only excess before cards */
  html[data-rf-step="build"] #root a[href*="/car/"] ~ .rf-step-body.mt-8,
  html[data-rf-step="build"] #root .rf-step-body.mt-8.flex {
    margin-top: 1.15rem !important;
  }

  html[data-rf-step="build"] #root h1 {
    font-size: clamp(1.55rem, 2vw, 1.95rem) !important;
    line-height: 1.15 !important;
    margin-top: 0.35rem !important;
  }

  html[data-rf-step="build"] #root h1 + p {
    margin-top: 0.4rem !important;
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
    max-width: 36rem;
  }

  html[data-rf-step="build"] #root .rounded-2xl.border.border-line.bg-white {
    padding: 0.55rem 0.9rem !important;
  }

  html[data-rf-step="build"] #root .grid[class*="gap-4"][class*="grid-cols"] {
    margin-top: 0.85rem !important;
    gap: 0.8rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] {
    padding: 0.8rem 0.9rem !important;
    border-radius: 1.15rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] > span.absolute {
    top: -0.55rem !important;
    padding: 0.18rem 0.55rem !important;
    font-size: 9px !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] [class*="text-[1.35rem]"] {
    font-size: 1.1rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] .mt-3 {
    margin-top: 0.4rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] .mt-2 {
    margin-top: 0.3rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] .mt-4 {
    margin-top: 0.5rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] .border-t {
    padding-top: 0.5rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] [class*="space-y-2.5"] > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.32rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] [class*="h-8"][class*="w-8"] {
    height: 1.6rem !important;
    width: 1.6rem !important;
    border-radius: 0.45rem !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] [class*="text-[13px]"] {
    font-size: 0.74rem !important;
    line-height: 1.25 !important;
  }

  html[data-rf-step="build"] #root button[aria-pressed] [class*="text-2xl"] {
    font-size: 1.3rem !important;
  }
}

/* =========================================================
   Add-ons — premium hero strip + list peek
   ========================================================= */
@media (min-width: 1024px) {
  html[data-rf-step="addons"] #root .fixed.inset-x-0.bottom-0 {
    display: none !important;
  }

  html[data-rf-step="addons"] #root h1 {
    font-size: clamp(1.55rem, 2vw, 1.95rem) !important;
    line-height: 1.15 !important;
    margin-top: 0.35rem !important;
  }

  html[data-rf-step="addons"] #root .rf-step-body .mt-8.grid,
  html[data-rf-step="addons"] #root .grid[class*="lg:grid-cols"] {
    margin-top: 1.15rem !important;
    gap: 1.25rem !important;
    align-items: start !important;
  }

  html[data-rf-step="addons"] #root p.font-display.text-lg {
    margin-top: 0.85rem !important;
    font-size: 1rem !important;
  }

  /* Recommended: horizontal premium strip */
  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] {
    margin-top: 0.55rem !important;
    border-radius: 1.2rem !important;
    max-height: 12.25rem;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] > div {
    max-height: 12.25rem;
    align-items: stretch;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] [class*="sm:w-64"] {
    width: 11.5rem !important;
    flex-shrink: 0 !important;
    overflow: hidden;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] img,
  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] [class*="object-cover"] {
    height: 100% !important;
    max-height: 12.25rem !important;
    object-fit: cover !important;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] .p-5,
  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] [class*="sm:p-6"],
  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] [class*="p-5"] {
    padding: 0.85rem 1.05rem !important;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] .text-xl,
  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] [class*="text-xl"] {
    font-size: 1.15rem !important;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] .text-sm {
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] .mt-3 {
    margin-top: 0.35rem !important;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] .mt-4 {
    margin-top: 0.45rem !important;
  }

  /* Hide bulky compare / warning so strip stays elegant */
  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] .rounded-2xl.border.border-line.bg-surface,
  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] .bg-amber-50 {
    display: none !important;
  }

  html[data-rf-step="addons"] #root [class*="overflow-hidden"][class*="rounded-[1.6rem]"] [class*="space-y-1.5"] > :nth-child(n + 4) {
    display: none !important;
  }

  html[data-rf-step="addons"] #root p.mt-10.font-display,
  html[data-rf-step="addons"] #root .mt-10.font-display.text-lg {
    margin-top: 1.1rem !important;
    font-size: 1rem !important;
  }

  html[data-rf-step="addons"] #root .mt-3.grid.gap-3 {
    margin-top: 0.55rem !important;
    gap: 0.5rem !important;
  }

  html[data-rf-step="addons"] #root .mt-3.grid.gap-3 > button {
    padding: 0.7rem 0.9rem !important;
    border-radius: 1rem !important;
  }

  html[data-rf-step="addons"] #root .mt-3.grid.gap-3 > button [class*="h-12"][class*="w-12"] {
    height: 2.5rem !important;
    width: 2.5rem !important;
    border-radius: 0.75rem !important;
  }

  html[data-rf-step="addons"] #root .sticky.top-24 [class*="rounded-[1.6rem]"],
  html[data-rf-step="addons"] #root .sticky.top-24 .card {
    padding: 1rem !important;
    border-radius: 1.2rem !important;
  }
}

/* =========================================================
   Checkout — no overlapping native rail; shared chrome only
   ========================================================= */
html[data-rf-step="checkout"] section.bg-ink .rf-native-rail {
  display: none !important;
}

@media (min-width: 1024px) {
  html[data-rf-step="checkout"] section.bg-ink h1 {
    font-size: clamp(1.85rem, 2.5vw, 2.5rem) !important;
    line-height: 1.05 !important;
  }
}

@media (max-width: 767px) {
  :root {
    --rf-sticky-top: 4.25rem;
    --rf-rail-h: 3rem;
  }

  #rf-shared-steps {
    padding: 0.4rem 0 0.5rem;
  }

  #rf-shared-steps .rf-shared-inner {
    padding-inline: 1rem;
  }

  #rf-shared-steps .rf-shared-pill {
    padding: 0.4rem 0.55rem;
  }
}
