/**
 * Moto — outils carte partagés (passager + chauffeur).
 * 1. FAB « type de carte » + popover Normale / Satellite / Terrain / Hybride
 * 2. Sélecteur de position par pin central (déplacer la carte, confirmer)
 */

/* ———— FAB type de carte ———— */
.moto-maptype-fab {
  position: absolute;
  right: 0.875rem;
  right: max(0.875rem, env(safe-area-inset-right));
  bottom: 9.7rem;
  z-index: 30;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(45, 27, 78, 0.08);
  background: #fff;
  color: #2d1b4e;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(45, 27, 78, 0.18);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.moto-maptype-fab:active {
  transform: scale(0.92);
}
.moto-maptype-fab svg {
  width: 21px;
  height: 21px;
}
.moto-maptype-fab[hidden] {
  display: none;
}

/* Zoom +/- — toutes plateformes : à chaque étape, sur chaque carte
   (le pinch reste possible, les boutons sont la garantie). */
.moto-map-zoom {
  display: flex;
  position: absolute;
  right: 0.875rem;
  right: max(0.875rem, env(safe-area-inset-right));
  bottom: 13.4rem;
  z-index: 30;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(45, 27, 78, 0.08);
  background: #fff;
  box-shadow: 0 8px 22px rgba(45, 27, 78, 0.18);
}
.moto-map-zoom__btn {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(45, 27, 78, 0.08);
  background: transparent;
  color: #2d1b4e;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.moto-map-zoom__btn:last-child {
  border-bottom: 0;
}
.moto-map-zoom__btn:active {
  background: rgba(123, 57, 183, 0.08);
}
html[data-theme="dark"] .moto-map-zoom {
  background: #241a33;
  border-color: rgba(255, 255, 255, 0.1);
}
html[data-theme="dark"] .moto-map-zoom__btn {
  color: #f4effb;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
html.moto-rtl .moto-map-zoom {
  right: auto;
  left: 0.875rem;
}

/* Boussole — apparaît quand la carte est tournée/inclinée, remet le nord.
   Pastille « verre » : fond translucide flouté, anneau gradué discret,
   aiguille bicolore facettée, apparition ressort. */
.moto-map-compass {
  position: absolute;
  right: 0.875rem;
  right: max(0.875rem, env(safe-area-inset-right));
  bottom: 13.4rem;
  z-index: 30;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(45, 27, 78, 0.1);
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.86) 58%, rgba(240, 236, 248, 0.9) 100%);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  box-shadow:
    0 10px 26px rgba(45, 27, 78, 0.22),
    0 2px 6px rgba(45, 27, 78, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -6px 12px rgba(45, 27, 78, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.5) rotate(-40deg);
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.34s cubic-bezier(0.18, 1.15, 0.35, 1.2);
  -webkit-tap-highlight-color: transparent;
}
/* Graduations cardinales du cadran. */
.moto-map-compass::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background:
    conic-gradient(
      rgba(45, 27, 78, 0.35) 0 0.8%, transparent 0.8% 24.2%,
      rgba(45, 27, 78, 0.22) 24.2% 25.8%, transparent 25.8% 49.2%,
      rgba(45, 27, 78, 0.22) 49.2% 50.8%, transparent 50.8% 74.2%,
      rgba(45, 27, 78, 0.22) 74.2% 75.8%, transparent 75.8% 99.2%,
      rgba(45, 27, 78, 0.35) 99.2% 100%
    );
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%);
  mask: radial-gradient(circle, transparent 62%, #000 64%);
  transform: rotate(var(--compass-heading, 0deg));
  transition: transform 0.1s linear;
  pointer-events: none;
}
.moto-map-compass.is-visible {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  pointer-events: auto;
}
.moto-map-compass:active {
  transform: scale(0.9);
}
.moto-map-compass svg {
  width: 26px;
  height: 26px;
  transform: rotate(var(--compass-heading, 0deg));
  transition: transform 0.1s linear;
  filter: drop-shadow(0 1px 1.5px rgba(45, 27, 78, 0.3));
}
/* Facettes de l'aiguille : côté éclairé / côté ombré. */
.moto-map-compass__north-l {
  fill: #ff5147;
}
.moto-map-compass__north-r {
  fill: #d3352c;
}
.moto-map-compass__south-l {
  fill: #d9d3e6;
}
.moto-map-compass__south-r {
  fill: #b4abc9;
}
.moto-map-compass__pivot {
  fill: #fff;
  stroke: rgba(45, 27, 78, 0.5);
  stroke-width: 1;
}
/* La pile zoom (13,4 rem + 88 px) occupe ce coin sur toutes les
   plateformes : la boussole passe au-dessus, sinon elle recouvre « − ». */
.moto-map-compass {
  bottom: 19.6rem;
}

/* Taxi · recherche avec offres : la carte n'est plus qu'une bande de
   contexte (22 dvh) — zoom en ligne au pied de la bande, boussole à côté. */
#screen-ride.screen-ride--offers .moto-map-zoom {
  bottom: 0.6rem;
  flex-direction: row;
}
#screen-ride.screen-ride--offers .moto-map-zoom__btn {
  border-bottom: 0;
  border-right: 1px solid rgba(45, 27, 78, 0.08);
}
#screen-ride.screen-ride--offers .moto-map-zoom__btn:last-child {
  border-right: 0;
}
html[data-theme="dark"] #screen-ride.screen-ride--offers .moto-map-zoom__btn {
  border-right-color: rgba(255, 255, 255, 0.08);
}
/* Rangée unique au pied de la bande : [boussole] [ma position] [+ −]. */
#screen-ride.screen-ride--offers .moto-locate-fab {
  top: auto;
  bottom: 0.6rem;
  right: calc(max(0.875rem, env(safe-area-inset-right)) + 96px);
}
#screen-ride.screen-ride--offers .moto-map-compass {
  bottom: 0.6rem;
  right: calc(max(0.875rem, env(safe-area-inset-right)) + 150px);
}
html.moto-rtl #screen-ride.screen-ride--offers .moto-locate-fab {
  right: auto;
  left: calc(0.875rem + 96px);
}
html.moto-rtl #screen-ride.screen-ride--offers .moto-map-compass {
  right: auto;
  left: calc(0.875rem + 150px);
}
html[data-theme="dark"] .moto-map-compass {
  background:
    radial-gradient(circle at 30% 26%, rgba(52, 40, 72, 0.98) 0%, rgba(36, 26, 51, 0.92) 62%, rgba(28, 19, 42, 0.95) 100%);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .moto-map-compass::before {
  background:
    conic-gradient(
      rgba(255, 255, 255, 0.5) 0 0.8%, transparent 0.8% 24.2%,
      rgba(255, 255, 255, 0.28) 24.2% 25.8%, transparent 25.8% 49.2%,
      rgba(255, 255, 255, 0.28) 49.2% 50.8%, transparent 50.8% 74.2%,
      rgba(255, 255, 255, 0.28) 74.2% 75.8%, transparent 75.8% 99.2%,
      rgba(255, 255, 255, 0.5) 99.2% 100%
    );
}
html[data-theme="dark"] .moto-map-compass__south-l {
  fill: rgba(255, 255, 255, 0.55);
}
html[data-theme="dark"] .moto-map-compass__south-r {
  fill: rgba(255, 255, 255, 0.32);
}
html[data-theme="dark"] .moto-map-compass__pivot {
  fill: #241a33;
  stroke: rgba(255, 255, 255, 0.6);
}
html.moto-rtl .moto-map-compass {
  right: auto;
  left: 0.875rem;
}

/* Survol cinématique du trajet — puce d'état, toucher pour passer. */
.moto-flyover-chip {
  position: absolute;
  left: 50%;
  bottom: 1.05rem;
  bottom: max(1.05rem, calc(env(safe-area-inset-bottom) + 0.7rem));
  transform: translate(-50%, 14px);
  z-index: 32;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  background: rgba(16, 12, 28, 0.78);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 30px rgba(10, 6, 22, 0.4);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  -webkit-tap-highlight-color: transparent;
}
.moto-flyover-chip.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.moto-flyover-chip:active {
  transform: translate(-50%, 0) scale(0.96);
}
.moto-flyover-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--moto-coral, #ff5f4d), var(--moto-magenta, #e8327a));
  box-shadow: 0 0 10px var(--moto-coral, #ff5f4d);
  animation: moto-flyover-dot 1.4s ease-in-out infinite;
}
@keyframes moto-flyover-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.7;
  }
}

/* ———— Popover choix du type ———— */
.moto-maptype-pop {
  position: absolute;
  right: 0.875rem;
  right: max(0.875rem, env(safe-area-inset-right));
  bottom: 13.2rem;
  z-index: 31;
  min-width: 176px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(45, 27, 78, 0.07);
  box-shadow: 0 18px 44px rgba(45, 27, 78, 0.22);
  padding: 0.4rem;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.moto-maptype-pop.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.moto-maptype-pop__title {
  margin: 0.35rem 0.75rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a6b8a;
}
.moto-maptype-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #2d1b4e;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.moto-maptype-option:active {
  background: rgba(123, 57, 183, 0.08);
}
.moto-maptype-option__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(45, 27, 78, 0.22);
  flex: none;
  position: relative;
  transition: border-color 0.15s ease;
}
.moto-maptype-option.is-active .moto-maptype-option__dot {
  border-color: #7b39b7;
}
.moto-maptype-option.is-active .moto-maptype-option__dot::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  inset: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff5f4d, #7b39b7);
}

/* ———— Pin central (choisir une position) ———— */
.moto-pin-picker {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 34;
  pointer-events: none;
}
.moto-pin-picker[hidden] {
  display: none;
}

/* Pin fixe au centre — la carte glisse dessous */
.moto-pin-picker__pin {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -100%);
  width: 40px;
  height: 52px;
  filter: drop-shadow(0 10px 14px rgba(45, 27, 78, 0.35));
  transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.moto-pin-picker.is-moving .moto-pin-picker__pin {
  transform: translate(-50%, -118%);
}
.moto-pin-picker__pin svg {
  width: 100%;
  height: 100%;
}
/* Point d'ancrage au sol sous le pin */
.moto-pin-picker__ground {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 5px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(45, 27, 78, 0.34);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.moto-pin-picker.is-moving .moto-pin-picker__ground {
  transform: translate(-50%, -50%) scale(1.5);
  opacity: 0.55;
}

/* Bandeau adresse en haut */
.moto-pin-picker__chip {
  position: absolute;
  top: 4.4rem;
  top: max(4.4rem, calc(env(safe-area-inset-top) + 3.4rem));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(86vw, 340px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  color: #2d1b4e;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(45, 27, 78, 0.22);
  border: 1px solid rgba(45, 27, 78, 0.06);
  pointer-events: none;
}
.moto-pin-picker__chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.moto-pin-picker__chip-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff5f4d, #7b39b7);
}

/* Barre d'action en bas */
.moto-pin-picker__bar {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1.1rem;
  bottom: max(1.1rem, calc(env(safe-area-inset-bottom) + 0.8rem));
  display: flex;
  gap: 0.6rem;
  pointer-events: auto;
}
.moto-pin-picker__cancel {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(45, 27, 78, 0.08);
  background: #fff;
  color: #2d1b4e;
  font-size: 1.15rem;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(45, 27, 78, 0.18);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.moto-pin-picker__cancel:active {
  transform: scale(0.93);
}
.moto-pin-picker__confirm {
  flex: 1;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff5f4d 0%, #e8327a 55%, #7b39b7 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 30px rgba(232, 50, 122, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.moto-pin-picker__confirm:active {
  transform: scale(0.97);
  filter: brightness(0.96);
}
.moto-pin-picker__confirm[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

/* En mode sélection : masquer la feuille de commande */
.screen.is-map-picking .moto-locate-fab,
.screen.is-map-picking .moto-maptype-fab,
.screen.is-map-picking .map-float-menu {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* La feuille libère sa place : la carte occupe tout l'écran sous le pin. */
.screen.is-map-picking .uber-sheet {
  display: none;
}

/* ———— Mode ambiant : pin affiché en permanence sur la carte d'accueil ————
   Au repos seul le pin est visible ; glisser la carte (is-armed) fait
   apparaître le bandeau adresse et le bouton de confirmation. */
.moto-pin-picker--ambient:not(.is-armed) .moto-pin-picker__chip,
.moto-pin-picker--ambient:not(.is-armed) .moto-pin-picker__bar {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.moto-pin-picker--ambient.is-armed .moto-pin-picker__chip,
.moto-pin-picker--ambient.is-armed .moto-pin-picker__bar {
  opacity: 1;
  transition: opacity 0.25s ease;
}
/* Au repos, pin discret (légèrement réduit) pour ne pas gêner la lecture. */
.moto-pin-picker--ambient:not(.is-armed) .moto-pin-picker__pin {
  transform: translate(-50%, -100%) scale(0.86);
  opacity: 0.92;
}
.moto-pin-picker--ambient:not(.is-armed) .moto-pin-picker__ground {
  opacity: 0.55;
}

/* ———— Thème sombre ———— */
html[data-theme="dark"] .moto-maptype-fab,
html[data-theme="dark"] .moto-maptype-pop,
html[data-theme="dark"] .moto-pin-picker__chip,
html[data-theme="dark"] .moto-pin-picker__cancel {
  background: #241a33;
  color: #f4effb;
  border-color: rgba(255, 255, 255, 0.1);
}
html[data-theme="dark"] .moto-maptype-option {
  color: #f4effb;
}
html[data-theme="dark"] .moto-maptype-pop__title {
  color: #b3a6c6;
}

/* ———— RTL (arabe) ———— */
html.moto-rtl .moto-maptype-fab,
html.moto-rtl .moto-maptype-pop {
  right: auto;
  left: 0.875rem;
  transform-origin: bottom left;
}
