/* Stage 4: Find the Driver */

.find-driver-sheet {
  --fd-matched-card-height: 196px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: none;
  width: 100%;
  height: var(--find-driver-sheet-height, 492px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 44px 16px max(20px, env(safe-area-inset-bottom));
  border-radius: 12px 12px 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);
  will-change: height;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.find-driver-sheet::-webkit-scrollbar {
  display: none;
}

.find-driver-sheet.is-dragging {
  transition: none;
}

.page-find-driver .find-driver-sheet {
  display: block;
}

.page-find-driver .ride-sheet,
.page-find-driver .checkout-bar,
.page-find-driver .pickup-sheet,
.page-find-driver .wait-match-sheet,
.page-find-driver .wait-arrive-sheet {
  display: none;
}

.page-find-driver .route-overlay {
  visibility: hidden;
}

.has-map.page-find-driver .arrive-pickup-overlay,
.has-map.page-find-driver .arrive-driver-overlay,
.has-map.page-find-driver .user-location-overlay,
.has-map.page-find-driver .fd-map-ui {
  visibility: visible;
}

.has-map.page-find-driver .arrive-driver-overlay {
  overflow: visible;
}

.page-find-driver[data-stage4-screen="found"] .device-frame {
  overflow: visible;
}

/* Rider pulse (close-up locator) */
.page-find-driver .user-location-marker {
  width: 18px;
  height: 18px;
}

.page-find-driver .user-dot {
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  background: #276ef1;
  box-shadow: 0 0 0 8px rgba(39, 110, 241, 0.22);
}

.page-find-driver .user-direction {
  display: none;
}

.page-find-driver .arrive-driver-marker {
  position: absolute;
  width: 28px;
  height: 52px;
  overflow: visible;
}

.page-find-driver .arrive-driver-marker__car {
  position: relative;
  z-index: 1;
  display: block;
  width: 28px;
  height: 52px;
  object-fit: contain;
  /* Bearing set in JS from drive-route segment toward pickup */
}

.page-find-driver[data-stage4-screen="arrived"] .arrive-driver-marker__car {
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.2));
}

.page-find-driver[data-stage4-screen="found"] .arrive-driver-marker__car {
  position: relative;
  z-index: 2;
  filter: none;
}

.arrive-driver-marker__glow {
  position: absolute;
  z-index: 1;
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: rgba(255, 205, 70, 1);
  box-shadow: 0 10px 18px 6px rgba(255, 205, 70, 0.5);
  filter: none;
}

/* Under the body — lower front corners; glow casts downward onto the road */
.arrive-driver-marker__glow--headlight-l {
  left: 4px;
  top: 17px;
  transform: translate(-10%, 25%);
}

.arrive-driver-marker__glow--headlight-r {
  right: 4px;
  top: 17px;
  transform: translate(10%, 25%);
}

.arrive-driver-marker__glow--taillight-l {
  left: 4px;
  bottom: 3px;
  background: rgba(255, 198, 68, 1);
  box-shadow: 0 10px 18px 6px rgba(255, 195, 65, 0.42);
  transform: translate(-10%, 40%);
}

.arrive-driver-marker__glow--taillight-r {
  right: 4px;
  bottom: 3px;
  background: rgba(255, 198, 68, 1);
  box-shadow: 0 10px 18px 6px rgba(255, 195, 65, 0.42);
  transform: translate(10%, 40%);
}

.page-find-driver[data-stage4-screen="found"] .arrive-driver-marker__glow {
  display: block;
}

.page-find-driver[data-stage4-screen="found"]
  .arrive-driver-marker.is-headlight-ack
  .arrive-driver-marker__glow {
  animation: fd-car-lights-flash 1.4s ease-in-out forwards;
}

.page-find-driver[data-stage4-screen="found"]
  .arrive-driver-marker.is-headlight-idle
  .arrive-driver-marker__glow {
  opacity: 0.45;
  animation: none;
}

@keyframes fd-car-lights-flash {
  0% {
    opacity: 0;
  }

  14% {
    opacity: 1;
  }

  24% {
    opacity: 0.16;
  }

  38% {
    opacity: 1;
  }

  48% {
    opacity: 0.16;
  }

  62% {
    opacity: 0.62;
  }

  100% {
    opacity: 0.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-find-driver[data-stage4-screen="found"]
    .arrive-driver-marker.is-headlight-ack
    .arrive-driver-marker__glow,
  .page-find-driver[data-stage4-screen="found"]
    .arrive-driver-marker.is-headlight-idle
    .arrive-driver-marker__glow {
    animation: none;
    opacity: 0.45;
  }
}

/* Pickup tooltip + dot (matches 0.5 miles label weight) */
.page-find-driver .arrive-pickup-marker {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0;
  transform: translate(calc(-100% + 11px), -50%);
}

.page-find-driver .arrive-pickup-label {
  position: relative;
  display: inline-flex;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 6px;
  color: #fff;
  background: #000;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.page-find-driver .arrive-pickup-label::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -5px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid #000;
  transform: translateY(-50%);
}

.page-find-driver .arrive-pickup-dot {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: #000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.page-find-driver .arrive-pickup-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
}

/* Map chrome */
.fd-map-ui {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  visibility: hidden;
}

.fd-distance-label {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d5d9de;
  border-radius: 6px;
  color: #000;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translate(-50%, -100%);
}

.fd-map-3d-button {
  position: absolute;
  right: 12px;
  bottom: calc(var(--find-driver-sheet-height, 492px) + 12px);
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: #276ef1;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  pointer-events: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}

.fd-direction-hint {
  position: absolute;
  left: 18px;
  top: auto;
  bottom: calc(var(--find-driver-sheet-height, 492px) + 22px);
  z-index: 4;
  display: block;
  width: 93.6px;
  height: 93.6px;
  background: transparent;
  transform: none;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.fd-direction-hint img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  transform: rotate(var(--fd-direction-angle, 135deg));
  transform-origin: center;
}

@keyframes fd-direction-hint-wiggle {
  0% {
    transform: rotate(calc(var(--fd-direction-angle, 135deg) - 10deg));
  }

  20% {
    transform: rotate(calc(var(--fd-direction-angle, 135deg) + 10deg));
  }

  40% {
    transform: rotate(calc(var(--fd-direction-angle, 135deg) - 10deg));
  }

  60% {
    transform: rotate(calc(var(--fd-direction-angle, 135deg) + 10deg));
  }

  80% {
    transform: rotate(calc(var(--fd-direction-angle, 135deg) - 5deg));
  }

  100% {
    transform: rotate(var(--fd-direction-angle, 135deg));
  }
}

.page-find-driver[data-stage4-screen="arrived"] .fd-direction-hint.is-wiggling img {
  animation: fd-direction-hint-wiggle 2s ease-in-out;
}

.fd-arrival-nav-button {
  position: absolute;
  right: 8px;
  bottom: calc(var(--find-driver-sheet-height, 492px) + 12px);
  z-index: 4;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #000;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.fd-arrival-nav-icon {
  display: block;
  width: 19.5px;
  height: 19.5px;
  flex-shrink: 0;
}

.page-find-driver[data-stage4-screen="arrived"] .fd-direction-hint,
.page-find-driver[data-stage4-screen="found"] .fd-direction-hint,
.page-find-driver[data-stage4-screen="arrived"] .fd-arrival-nav-button,
.page-find-driver[data-stage4-screen="found"] .fd-arrival-nav-button {
  opacity: 1;
  visibility: visible;
}

.page-find-driver[data-stage4-screen="arrived"] .fd-arrival-nav-button,
.page-find-driver[data-stage4-screen="found"] .fd-arrival-nav-button {
  pointer-events: auto;
}

/* Bottom sheet */
.find-driver-sheet h2 {
  margin: 0 0 20px;
  color: #000;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.fd-arrival-info-card {
  --fd-banner-state-duration: 420ms;
  --fd-banner-state-ease: cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 0 16px;
  border-radius: 10px;
  background: #edf2fe;
  opacity: 0;
  max-height: 0;
  transform: translateY(12px);
  overflow: hidden;
  pointer-events: none;
  transition:
    opacity 320ms ease,
    transform 320ms ease,
    max-height 320ms ease,
    margin 320ms ease,
    padding 320ms ease,
    background-color var(--fd-banner-state-duration) var(--fd-banner-state-ease);
}

.fd-arrival-info-icon-slot {
  position: relative;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}

.fd-arrival-info-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 3px;
  border-radius: 999px;
  background: transparent;
  opacity: 0;
  transform: translateY(5px);
  transition:
    opacity var(--fd-banner-state-duration) var(--fd-banner-state-ease),
    transform var(--fd-banner-state-duration) var(--fd-banner-state-ease);
}

.fd-arrival-info-icon img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

.page-find-driver[data-stage4-screen="arrived"] .fd-arrival-info-icon--turn {
  opacity: 1;
  transform: translateY(0);
}

.page-find-driver[data-stage4-screen="arrived"] .fd-arrival-info-icon--check {
  opacity: 0;
  transform: translateY(5px);
}

.page-find-driver[data-stage4-screen="found"] .fd-arrival-info-icon--turn {
  opacity: 0;
  transform: translateY(-5px);
}

.page-find-driver[data-stage4-screen="found"] .fd-arrival-info-icon--check {
  opacity: 1;
  transform: translateY(0);
}

.fd-arrival-info-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
}

.fd-arrival-info-message {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(5px);
  transition:
    opacity var(--fd-banner-state-duration) var(--fd-banner-state-ease),
    transform var(--fd-banner-state-duration) var(--fd-banner-state-ease);
}

.page-find-driver[data-stage4-screen="arrived"] .fd-arrival-info-message--arrived {
  opacity: 1;
  transform: translateY(0);
}

.page-find-driver[data-stage4-screen="arrived"] .fd-arrival-info-message--found {
  opacity: 0;
  transform: translateY(5px);
}

.page-find-driver[data-stage4-screen="found"] .fd-arrival-info-message--arrived {
  opacity: 0;
  transform: translateY(-5px);
}

.page-find-driver[data-stage4-screen="found"] .fd-arrival-info-message--found {
  opacity: 1;
  transform: translateY(0);
}

.fd-arrival-info-message strong {
  color: #000;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.fd-arrival-info-message > span {
  color: #000;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.2;
}

.fd-arrival-info-dismiss {
  flex: 0 0 auto;
  margin-left: auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  color: #000;
  background: transparent;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

.page-find-driver[data-stage4-screen="arrived"] #findDriverHeadline,
.page-find-driver[data-stage4-screen="found"] #findDriverHeadline {
  transform: translateY(0);
}

.page-find-driver[data-stage4-screen="arrived"] .fd-arrival-info-card,
.page-find-driver[data-stage4-screen="found"] .fd-arrival-info-card {
  max-height: 94px;
  margin-bottom: 12px;
  padding: 17px 16px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.page-find-driver[data-stage4-screen="found"] .fd-arrival-info-card {
  background: #eaf6ed;
}

.page-find-driver[data-stage4-screen="found"] .fd-arrival-info-card.is-banner-state-transitioning {
  animation: fd-arrival-banner-settle 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fd-arrival-banner-settle {
  from {
    transform: translateY(2px);
  }

  to {
    transform: translateY(0);
  }
}

.page-find-driver[data-stage4-screen="arrived"] .fd-location-preview,
.page-find-driver[data-stage4-screen="found"] .fd-location-preview,
.page-find-driver[data-stage4-screen="arrived"] .fd-distance-label,
.page-find-driver[data-stage4-screen="found"] .fd-distance-label,
.page-find-driver[data-stage4-screen="arrived"] .fd-map-3d-button,
.page-find-driver[data-stage4-screen="found"] .fd-map-3d-button {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
}

.fd-location-preview,
.fd-distance-label,
.fd-map-3d-button {
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.fd-location-preview {
  max-height: var(--fd-matched-card-height);
  transition:
    opacity 320ms ease,
    transform 320ms ease,
    max-height 320ms ease;
}

.page-find-driver[data-stage4-screen="arrived"] .fd-location-preview,
.page-find-driver[data-stage4-screen="found"] .fd-location-preview {
  height: 0;
  max-height: 0;
}

.fd-ride-details {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  grid-template-columns: 1fr 48px;
  align-items: start;
  width: 100%;
  min-height: 108px;
  margin: 0 0 12px;
  padding: 16px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  color: #000;
  background: #fff;
  text-align: left;
}

.fd-ride-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.fd-card-eyebrow {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.fd-card-title {
  max-width: 280px;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.22;
}

.fd-more-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: #eeeeee;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 1px;
}

.fd-driver-card {
  width: 100%;
  min-height: var(--fd-matched-card-height);
  margin-bottom: 12px;
  padding: 16px 12px 16px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  background: #fff;
}

.fd-driver-hero {
  position: relative;
  display: grid;
  grid-template-columns: 150px 1fr;
  min-height: 70px;
  align-items: center;
}

.fd-driver-avatar {
  position: absolute;
  left: 4px;
  top: -3px;
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: 0 0 0 2px #fff;
}

.fd-driver-rating {
  position: absolute;
  left: 4px;
  top: 31px;
  z-index: 3;
  display: grid;
  min-width: 46px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #000;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.16);
}

.fd-driver-car {
  width: 132px;
  height: 61px;
  object-fit: contain;
  transform: translateX(34px);
}

.fd-driver-plate {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  justify-self: end;
  padding-right: 2px;
  white-space: nowrap;
}

.fd-driver-plate strong {
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
}

.fd-driver-plate span {
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
}

.fd-driver-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 4px 0 16px;
}

.fd-driver-name {
  color: #000;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.fd-driver-trips {
  color: #777;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
}

.fd-driver-actions {
  display: grid;
  grid-template-columns: 1fr 48px 48px;
  gap: 8px;
}

.fd-driver-actions button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  color: #000;
  background: #f5f3f5;
  font: inherit;
}

.fd-action-message {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
}

.fd-action-message img {
  width: 20px;
  height: 20px;
}

.fd-action-icon {
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
}

.fd-action-icon img {
  width: 22px;
  height: 22px;
}

.fd-location-preview {
  position: relative;
  width: 100%;
  height: var(--fd-matched-card-height);
  overflow: hidden;
  border-radius: 12px;
  background: #d8dde3;
}

.fd-location-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}

.fd-location-address-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  display: inline-flex;
  max-width: calc(100% - 68px);
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  color: #000;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.14);
}

.fd-location-pin-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
}

.fd-location-address {
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fd-location-expand {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}

.fd-location-expand-icon {
  display: block;
}

/* Expanded full-screen Google Street View (393×852 iPhone frame) */
.fd-street-view-expanded {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  display: none;
  width: 393px;
  height: 852px;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--device-radius, 12px) var(--device-radius, 12px) 0 0;
  background: #000;
}

.page-find-driver.fd-street-view-expanded-open .fd-street-view-expanded {
  display: block;
}

.page-find-driver.fd-street-view-expanded-open .find-driver-sheet,
.page-find-driver.fd-street-view-expanded-open #map,
.page-find-driver.fd-street-view-expanded-open .map-scrim,
.page-find-driver.fd-street-view-expanded-open .arrive-pickup-overlay,
.page-find-driver.fd-street-view-expanded-open .arrive-driver-overlay,
.page-find-driver.fd-street-view-expanded-open .user-location-overlay,
.page-find-driver.fd-street-view-expanded-open .fd-map-ui,
.page-find-driver.fd-street-view-expanded-open .fd-direction-hint,
.page-find-driver.fd-street-view-expanded-open .fd-arrival-nav-button,
.page-find-driver.fd-street-view-expanded-open .route-overlay,
.page-find-driver.fd-street-view-expanded-open .busy-area-overlay,
.page-find-driver.fd-street-view-expanded-open .phone-prototype {
  visibility: hidden;
  pointer-events: none;
}

.fd-street-view-iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.fd-street-view-back {
  position: absolute;
  top: 55px;
  left: 8px;
  z-index: 2;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}

.fd-street-view-back img {
  display: block;
  width: 16.6px;
  height: 15px;
  object-fit: contain;
}
