/* ─── Stage 2: Wait for Match ──────────────────────────────────────────────── */

/* Hide conflicting stage-1 / stage-1b panels */
.page-wait-match .ride-sheet,
.page-wait-match .checkout-bar,
.page-wait-match .pickup-sheet {
  display: none;
}

/* ── Sheet shell ───────────────────────────────────────────────────────────── */

.wait-match-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  width: 100%;
  height: var(--wm-sheet-height, 532px);
  overflow: hidden;
  padding-top: 28px;
  border-radius: 16px 16px 0 0;
  background: #fff;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.04);
  pointer-events: auto;
  transition:
    height 260ms cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 260ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: height;
}

.wait-match-sheet.is-dragging {
  transition: none;
}

.page-wait-match .wait-match-sheet {
  display: flex;
}

.page-wait-match .wait-match-sheet > .wait-match-sheet-handle {
  z-index: 3;
}

.wait-match-sheet.is-dragging .wait-match-sheet-handle {
  cursor: grabbing;
}

/* Manual collapse only: clip after ride details (~12px below card) */
.wait-match-sheet.is-collapsed .wm-scroll {
  overflow-y: hidden;
  padding-bottom: 12px;
}

.wait-match-sheet.is-collapsed .wm-promo-outer,
.wait-match-sheet.is-collapsed .wm-offers-outer,
.wait-match-sheet.is-collapsed .wm-scroll > .wm-section ~ .wm-section {
  display: none;
}

/* ── Scroll container ──────────────────────────────────────────────────────── */

.wm-scroll {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Stage-1 rhythm: ~12px between handle and title */
  padding: 12px 0 16px;
}

.wm-scroll::-webkit-scrollbar {
  display: none;
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.wm-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0;
  text-align: center;
}

.wm-header h2 {
  margin: 0;
  max-width: 344px;
  color: #000;
  font-size: 24px;
  font-weight: 700;
  line-height: 28px;
}

.wm-header p {
  margin: 0;
  color: #707076;
  font-size: 18px;
  font-weight: 400;
  line-height: 18px;
  white-space: nowrap;
}

/* ── Generic section wrapper ───────────────────────────────────────────────── */

.wm-section {
  padding: 0 16px;
  min-width: 0;
}

/* ── Ride details card ─────────────────────────────────────────────────────── */

.wm-ride-card {
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.wm-ride-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 109px;
  padding: 16px;
}

.wm-ride-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 8px;
  justify-content: center;
}

.wm-ride-eyebrow {
  display: block;
  color: #000;
  font-size: 14px;
  font-weight: 400;
  line-height: 16px;
}

.wm-ride-title {
  display: block;
  color: #000;
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
}

.wm-more-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='5' cy='12' r='2' fill='%23000'/%3E%3Ccircle cx='12' cy='12' r='2' fill='%23000'/%3E%3Ccircle cx='19' cy='12' r='2' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 32px 32px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── Ride action tiles ─────────────────────────────────────────────────────── */

.wm-ride-tiles {
  display: none;
  gap: 8px;
  padding: 0 16px 16px;
}

/* Show tiles in actions + expanding states */
.wait-match-sheet.is-actions .wm-ride-tiles,
.wait-match-sheet.is-expanding .wm-ride-tiles {
  display: flex;
}

.wm-tile {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: #f5f5f5;
  color: #000;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wm-tile-icon {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.wm-tile-bolt {
  background-image: url("../assets/illustration/upgradebelt.svg");
}

.wm-tile-pin {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E");
}

/* ── Promo horizontal carousel (expanding state) ───────────────────────────── */

.wm-promo-outer {
  display: none;
  min-width: 0;
  margin-right: -16px;
  padding-right: 0;
  --coupon-notch-bg: #fff;
}

.wait-match-sheet.is-expanding:not(.is-collapsed) .wm-promo-outer {
  display: block;
}

.wm-promo-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.wm-promo-track::-webkit-scrollbar {
  display: none;
}

/* Carousel sizing — yellow first, orange peeks at the right */
.wm-promo-track .coupon-card--yellow {
  flex: 0 0 calc(100% - 60px);
  width: calc(100% - 60px);
}

.wm-promo-track .coupon-card--orange {
  flex: 0 0 calc(100% - 60px);
  width: calc(100% - 60px);
}

/* ── Reusable coupon / reward card ─────────────────────────────────────────── */

.coupon-card {
  --coupon-notch-size: 14px;
  --coupon-notch-offset: 62px;

  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  margin: 0;
  padding: 12px 16px;
  overflow: visible;
  border: 0;
  border-radius: 16px;
  background: #f5f5f5;
  color: #000;
  font: inherit;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  -webkit-appearance: none;
}

/* Ticket notches — match sheet/page background behind the carousel */
.coupon-card::before,
.coupon-card::after {
  content: "";
  position: absolute;
  left: var(--coupon-notch-offset);
  z-index: 2;
  width: var(--coupon-notch-size);
  height: var(--coupon-notch-size);
  border-radius: 50%;
  background: var(--coupon-notch-bg, #fff);
  pointer-events: none;
}

.coupon-card::before {
  top: 0;
  transform: translate(-50%, -50%);
}

.coupon-card::after {
  bottom: 0;
  transform: translate(-50%, 50%);
}

.coupon-card--yellow {
  background: #ffc62b;
}

.coupon-card--orange {
  background: #ff6730;
}

.coupon-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.coupon-icon img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.coupon-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin-left: 6px;
}

.coupon-title {
  display: block;
  color: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
  white-space: nowrap;
}

.coupon-subtitle {
  display: block;
  color: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 16px;
}

.coupon-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.coupon-card--reward:disabled {
  cursor: default;
}

.coupon-card--reward:disabled .coupon-button,
.coupon-button.is-disabled {
  background: #f2f2f2;
  color: #8a8a8a;
  pointer-events: none;
}

.coupon-card--orange .coupon-button {
  background: #fff;
  color: #000;
}

.coupon-card--reward.is-completed {
  background: #f5f5f5;
  color: #000;
  cursor: pointer;
}

.coupon-card--reward.is-unlocked .coupon-button {
  background: #000;
  color: #fff;
  pointer-events: auto;
}

.coupon-card--reward.is-completed .coupon-button {
  margin-left: 10px;
  background: #000;
  color: #fff;
  pointer-events: auto;
}

.coupon-card--yellow.coupon-card--reward.is-completed .coupon-button.is-claimed {
  background: #d5d5d5;
  color: #000;
}

.coupon-card--reward.is-completed .coupon-title-locked,
.coupon-card--reward.is-completed .coupon-subtitle-locked {
  display: none;
}

.coupon-card--reward.is-completed .coupon-title-unlocked,
.coupon-card--reward.is-completed .coupon-subtitle-unlocked {
  display: block;
}

.coupon-card--yellow.coupon-card--reward.is-completed .coupon-subtitle-unlocked {
  white-space: nowrap;
}

.coupon-card--yellow.coupon-card--reward .coupon-confetti {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: 16px;
  pointer-events: none;
}

.coupon-card--yellow.coupon-card--reward .coupon-icon,
.coupon-card--yellow.coupon-card--reward .coupon-content,
.coupon-card--yellow.coupon-card--reward .coupon-button {
  position: relative;
  z-index: 1;
}

.coupon-confetti-piece {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  animation: coupon-confetti-burst 2.05s cubic-bezier(0.22, 0.72, 0.24, 1) forwards;
}

.coupon-confetti-piece--rect {
  width: 5px;
  height: 7px;
  border-radius: 1.5px;
}

.coupon-confetti-piece--strip {
  width: 3px;
  height: 10px;
  border-radius: 2px;
}

@keyframes coupon-confetti-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(0, 0) rotate(var(--rot0, 0deg))
      scale(0.6);
  }

  18% {
    opacity: 0.62;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(var(--tx, 0), var(--ty, 0))
      rotate(var(--rot1, 0deg)) scale(1);
  }
}

.coupon-claim-confetti-piece {
  position: fixed;
  z-index: 9999;
  left: var(--spawn-x);
  top: var(--spawn-y);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  animation: coupon-claim-confetti-burst 1.45s cubic-bezier(0.16, 0.72, 0.22, 1)
    forwards;
}

.coupon-claim-confetti-piece--rect {
  width: 6px;
  height: 8px;
  border-radius: 1.5px;
}

.coupon-claim-confetti-piece--strip {
  width: 3px;
  height: 13px;
  border-radius: 2px;
}

@keyframes coupon-claim-confetti-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(0, 0) rotate(var(--rot0, 0deg))
      scale(0.62);
  }

  14% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(var(--tx, 0), var(--ty, 0))
      rotate(var(--rot1, 0deg)) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .coupon-confetti-piece,
  .coupon-claim-confetti-piece {
    animation: none;
    opacity: 0;
  }
}

.coupon-card--reward:not(.is-completed) .coupon-title-unlocked,
.coupon-card--reward:not(.is-completed) .coupon-subtitle-unlocked {
  display: none;
}

/* ── Meal card ─────────────────────────────────────────────────────────────── */

.wm-meal-card {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 96px;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #f5f5f5;
  color: #000;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  gap: 0;
}

.wm-meal-copy {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 16px 100px 16px 16px;
}

.wm-meal-title {
  display: block;
  color: #000;
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: 0.25px;
}

.wm-meal-cta {
  display: block;
  color: #000;
  font-size: 14px;
  font-weight: 500;
  line-height: 16px;
}

.wm-meal-art {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  pointer-events: none;
}

.wm-meal-art img {
  position: absolute;
  top: 50%;
  right: 0;
  display: block;
  width: auto;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  transform: translate(16px, -50%) scale(1.08);
  transform-origin: center right;
}

/* ── Offer cards horizontal scroll ─────────────────────────────────────────── */

.wm-offers-outer {
  padding: 0;
}

.wm-offers-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-left: 16px;
}

.wm-offers-track::-webkit-scrollbar {
  display: none;
}

.wm-offer-card {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 327px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  color: #000;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wm-offer-tacos {
  gap: 0;
  padding: 0;
  background: #f6f1e8;
}

.wm-offer-dark {
  background: #050c4d;
  color: #fff;
}

.wm-offer-pink {
  gap: 0;
  padding: 0;
  background: #fff0ee;
  border: 2px solid rgba(0, 0, 0, 0.08);
}

/* Offer card image areas — 180px tall, edge-to-edge */
.wm-offer-art {
  position: relative;
  display: block;
  height: 180px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  flex: 0 0 180px;
  line-height: 0;
  background: #000;
}

.wm-offer-tacos .wm-offer-art {
  position: relative;
  display: block;
  align-self: stretch;
  width: 100%;
  max-width: none;
  height: 180px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  flex: 0 0 180px;
  border-radius: 12px 12px 0 0;
  line-height: 0;
  font-size: 0;
  background: transparent;
}

.wm-offer-dark .wm-offer-art {
  background: #050c4d;
}

.wm-offer-art img {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: cover;
  object-position: center;
  transform: translate(-50%, -50%) scale(1.12);
}

.wm-offer-tacos .wm-offer-art img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: cover;
  object-position: center;
  transform: none;
  min-width: 0;
  min-height: 0;
}

.wm-offer-dark .wm-offer-art img {
  object-position: center top;
  transform: translate(-50%, -48%) scale(1.14);
}

.wm-offer-pink .wm-offer-art {
  position: relative;
  display: block;
  align-self: stretch;
  width: 100%;
  max-width: none;
  height: 180px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  flex: 0 0 180px;
  border-radius: 12px 12px 0 0;
  line-height: 0;
  font-size: 0;
  background: transparent;
}

.wm-offer-pink .wm-offer-art img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: cover;
  object-position: center;
  transform: none;
  min-width: 0;
  min-height: 0;
}

/* Offer card text */
.wm-offer-copy {
  padding: 16px;
}

.wm-offer-copy strong {
  display: block;
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: 0.25px;
  margin-bottom: 4px;
}

.wm-offer-copy span {
  display: block;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.wm-offer-copy-light strong,
.wm-offer-copy-light span {
  color: #fff;
}
