/* booking.css — styles only the booking page needs: step indicator, extras, review, price summary.
   Used by: pages/booking.html */


/* --------------------------------------------------------------------------
   Step indicator
   -------------------------------------------------------------------------- */

/* [TOPIC: flexbox]  four steps spread evenly in a row */
.stepper {
  display: flex;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.stepper-item {
  position: relative;
  flex: 1;
}

/* [TOPIC: ::before]  the line connecting each step number to the previous one */
.stepper-item::before {
  content: "";
  position: absolute;
  top: 1.0625rem;
  left: calc(-50% + 1.5rem);
  right: calc(50% + 1.5rem);
  height: 2px;
  background-color: var(--color-border);
}

.stepper-item:first-child::before {
  display: none;
}

.stepper-item.is-active::before,
.stepper-item.is-complete::before {
  background-color: var(--color-ink);
}

.stepper-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.stepper-btn:disabled {
  cursor: default;
}

/* [TOPIC: z-index]  the number sits above the connecting line */
.stepper-number {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid var(--color-border);
  background-color: var(--color-bg);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
}

.stepper-item.is-active .stepper-btn,
.stepper-item.is-complete .stepper-btn {
  color: var(--color-ink);
  font-weight: 600;
}

.stepper-item.is-active .stepper-number {
  border-color: var(--color-red);
  background-color: var(--color-red);
  color: #ffffff;
}

.stepper-item.is-complete .stepper-number {
  border-color: var(--color-ink);
  background-color: var(--color-ink);
  color: var(--color-bg);
}

.stepper-item.is-complete .stepper-btn:hover .stepper-label {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}


/* --------------------------------------------------------------------------
   Layout and step panels
   -------------------------------------------------------------------------- */
.booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23rem;
  align-items: start;
  gap: 2.5rem;
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

/* Step 1: preview of the chosen car */
.selected-car {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
}

.selected-car img {
  width: 9rem;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.selected-car-info {
  flex: 1;
  min-width: 0;
}

.selected-car h3 {
  margin-bottom: 0.25rem;
  font-size: 1.375rem;
}

.selected-car .car-specs {
  margin: 0;
}

/* Step 2: extras */
.extras-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.extra-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.extra-option:hover {
  border-color: var(--color-ink);
}

/* Chosen extras get a 2px black frame (border + 1px inner line, so nothing moves) */
.extra-option.is-selected {
  border-color: var(--color-ink);
  box-shadow: inset 0 0 0 1px var(--color-ink);
}

.extra-option input {
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
}

.extra-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.extra-text strong {
  color: var(--color-ink);
  font-weight: 600;
}

.extra-text small {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.extra-price {
  color: var(--color-ink);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.extra-price small {
  display: block;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

/* Step 4: review */
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.review-block {
  padding: 1.25rem;
  border: 1px solid var(--color-border);
}

.review-block-wide {
  grid-column: 1 / -1;
}

.review-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.review-block h3 {
  margin: 0;
  font-size: 1.125rem;
}

.review-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.45rem 1.25rem;
  margin: 0;
  font-size: 0.95rem;
}

.review-list dt {
  color: var(--color-muted);
}

.review-list dd {
  margin: 0;
  color: var(--color-ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.review-list-wide {
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
}


/* --------------------------------------------------------------------------
   Live price summary (right column)
   -------------------------------------------------------------------------- */
.booking-summary {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
}

.summary-card {
  padding: 1.5rem;
  border: 2px solid var(--color-ink);
  background-color: var(--color-bg);
}

.summary-title {
  margin-bottom: 1rem;
  font-size: 1.375rem;
}

.summary-car {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.summary-car img {
  width: 5.5rem;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.summary-car strong {
  display: block;
  color: var(--color-ink);
  font-weight: 600;
}

.summary-car span {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.summary-dates {
  margin: 1rem 0 0;
  font-size: 0.95rem;
}

.summary-lines {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--color-border);
  font-size: 0.95rem;
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.summary-lines li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.summary-lines .is-discount {
  color: var(--color-red-text);
  font-weight: 600;
}

.summary-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 2px solid var(--color-ink);
  color: var(--color-ink);
  font-weight: 600;
}

.summary-total strong {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.discount-hint {
  margin: 1rem 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.discount-hint.is-applied {
  color: var(--color-red-text);
  font-weight: 600;
}

.summary-perks {
  margin: 1.25rem 0 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.875rem;
  list-style: none;
}

.summary-perks li + li {
  margin-top: 0.3rem;
}

.summary-empty {
  margin: 0;
  color: var(--color-muted);
}


/* --------------------------------------------------------------------------
   Success modal
   -------------------------------------------------------------------------- */
.success-icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  background-color: var(--color-ink);
  color: var(--color-bg);
}

#success-modal h2 {
  padding-right: 0;
}

.booking-code {
  margin: 1.25rem 0 0.75rem;
  padding: 1rem;
  border: 2px solid var(--color-ink);
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}


/* --------------------------------------------------------------------------
   Responsive  [TOPIC: media queries]
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .booking-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .booking-summary {
    position: static;
  }
}

@media (max-width: 768px) {
  .review-grid {
    grid-template-columns: 1fr;
  }

  .review-list-wide {
    grid-template-columns: auto minmax(0, 1fr);
  }

  /* Picture on the left, name + price stacked on the right */
  .selected-car {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    align-items: start;
    gap: 0.5rem 1rem;
  }

  .selected-car img {
    width: 100%;
  }

  .selected-car .price {
    grid-column: 2;
  }
}

@media (max-width: 480px) {
  .stepper-label {
    font-size: 0.8rem;
  }

  .booking-code {
    font-size: 1.35rem;
  }
}
