/* ============================================================================
   DÉMO VTC ABIDJAN — Styles
   Palette inspirée des couleurs ivoiriennes :
     --orange  #E8650D  (action, chauffeur)
     --vert    #00874A  (disponible, succès)
     --encre   #171B21  (texte)
     --ivoire  #FBF7F0  (fonds de cartes)
   ==========================================================================*/

:root {
  --orange: #E8650D;
  --orange-fonce: #C45106;
  --vert: #00874A;
  --rouge: #C8322B;
  --encre: #171B21;
  --gris: #5B6470;
  --ivoire: #FBF7F0;
  --bord: #E4DCCE;
  --ombre: 0 10px /30px rgba(23, 27, 33, 0.18);
  --radius: 14px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--encre);
}

button { font-family: inherit; cursor: pointer; }

/* ============================ ÉCRAN INSCRIPTION ========================== */

.register-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(232, 101, 13, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(0, 135, 74, 0.14), transparent 60%),
    var(--ivoire);
}

.register-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border: 1px solid var(--bord);
  border-radius: 20px;
  box-shadow: var(--ombre);
  padding: 32px 30px 26px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
}

.brand-mark {
  background: var(--encre);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 8px;
}

.brand-city {
  font-size: 26px;
  font-weight: 700;
  color: var(--orange);
}

.register-subtitle {
  margin: 10px 0 24px;
  font-size: 13px;
  color: var(--gris);
}

.field { margin-bottom: 16px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field label,
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gris);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  border: 1.5px solid var(--bord);
  border-radius: 10px;
  background: var(--ivoire);
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus { border-color: var(--orange); background: #fff; }

.role-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.role-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border: 1.5px solid var(--bord);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.role-option .role-icon { color: var(--gris); }
.role-option .role-name { font-weight: 600; font-size: 15px; }
.role-option .role-desc { font-size: 12px; color: var(--gris); }

.role-option.selected[data-role="client"] {
  border-color: var(--vert);
  background: rgba(0, 135, 74, 0.07);
}
.role-option.selected[data-role="client"] .role-icon { color: var(--vert); }

.role-option.selected[data-role="chauffeur"] {
  border-color: var(--orange);
  background: rgba(232, 101, 13, 0.07);
}
.role-option.selected[data-role="chauffeur"] .role-icon { color: var(--orange); }

.role-option:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--encre);
  outline-offset: 2px;
}

.register-position-toggle {
  margin-bottom: 16px;
}

.register-map-picker {
  margin: -4px 0 16px;
}

.register-map {
  height: 220px;
  border-radius: 10px;
  border: 1.5px solid var(--bord);
  overflow: hidden;
}

.register-map-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--gris);
}

.register-error {
  color: var(--rouge);
  font-size: 13px;
  margin: 0 0 12px;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--orange);
  border: none;
  border-radius: 10px;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) { background: var(--orange-fonce); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--encre);
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 10px;
}

.btn-secondary:hover { border-color: var(--encre); }

.register-hint {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--gris);
  text-align: center;
}

/* ============================ ÉCRAN CARTE ================================ */

.map-screen { position: fixed; inset: 0; }

#map { position: absolute; inset: 0; z-index: 1; }

.panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid var(--bord);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.panel-identity strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.panel-avatar.client { background: var(--vert); }
.panel-avatar.chauffeur { background: var(--orange); }

.panel-role {
  font-size: 12px;
  color: var(--gris);
  text-transform: capitalize;
}

.statut {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 99px;
}

.statut-disponible { background: rgba(0, 135, 74, 0.12); color: var(--vert); }
.statut-en_attente { background: rgba(232, 101, 13, 0.12); color: var(--orange-fonce); }
.statut-en_course  { background: rgba(23, 27, 33, 0.08); color: var(--encre); }

.panel-message {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--encre);
  background: var(--ivoire);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  min-height: 42px;
}

.panel-actions { display: grid; gap: 8px; margin-bottom: 12px; }

.driver-idle-text {
  margin: 0;
  font-size: 13px;
  color: var(--gris);
  text-align: center;
}

.sim-toggle {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--gris);
  line-height: 1.4;
  cursor: pointer;
}

.sim-toggle input { margin-top: 2px; accent-color: var(--orange); }

.panel-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--bord);
  font-size: 12px;
  color: var(--gris);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-logout {
  flex: none;
  padding: 0;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--rouge);
}

.panel-logout:hover { text-decoration: underline; }

/* ----- Choix de la destination (client) ----- */

.destination-picker {
  border: 1.5px solid var(--bord);
  border-radius: 12px;
  padding: 12px;
  background: var(--ivoire);
}

.destination-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--gris);
}

.destination-summary { margin-bottom: 10px; }

.destination-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 4px 0;
}

.destination-summary-row span { color: var(--gris); }

.destination-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ----- Marqueurs Leaflet (divIcon) ----- */

.marker {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px rgba(23, 27, 33, 0.35);
  color: #fff;
}

.marker.client { background: var(--vert); }
.marker.chauffeur { background: var(--orange); }
.marker.me { outline: 3px solid rgba(23, 27, 33, 0.55); outline-offset: 1.5px; }
.marker.busy:not(.searching) { filter: grayscale(0.7); opacity: 0.75; }

/* ----- Ondes de recherche (radar) : client en attente d'un chauffeur ----- */

.radar-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  border: 3px solid var(--vert);
  background: rgba(0, 135, 74, 0.45);
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  animation: radar-pulse 1.8s cubic-bezier(0.25, 0.6, 0.4, 1) infinite;
}

.radar-ring.delay1 { animation-delay: 0.6s; }
.radar-ring.delay2 { animation-delay: 1.2s; }

@keyframes radar-pulse {
  0%   { transform: scale(0.8); opacity: 0.9; }
  55%  { opacity: 0.5; }
  100% { transform: scale(8.4); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .radar-ring { animation: none; opacity: 0; }
}

/* ----- Repères de trajet (départ / destination) ----- */

.trip-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(23, 27, 33, 0.35);
}

.trip-pin.pickup { background: var(--vert); }
.trip-pin.destination { background: var(--encre); }

.marker-label {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--bord);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--encre);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(23, 27, 33, 0.15);
}

/* ----- Proposition de course (chauffeur) ----- */

.proposal-overlay {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px;
  background: rgba(23, 27, 33, 0.35);
}

.proposal-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--ombre);
  padding: 22px;
  animation: slide-up 0.25s ease-out;
}

@keyframes slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .proposal-card { animation: none; }
}

.proposal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.proposal-details {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gris);
}

.proposal-trip {
  border: 1.5px solid var(--bord);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.proposal-trip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 3px 0;
}

.proposal-trip-row span { color: var(--gris); }

.proposal-timer {
  height: 5px;
  border-radius: 99px;
  background: var(--bord);
  overflow: hidden;
  margin-bottom: 16px;
}

.proposal-timer-bar {
  height: 100%;
  width: 100%;
  background: var(--orange);
  transform-origin: left;
}

.proposal-timer-bar.running {
  animation: shrink linear forwards;
}

@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.proposal-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ----- Toast ----- */

.toast {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  background: var(--encre);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: var(--ombre);
  max-width: calc(100vw - 40px);
  text-align: center;
}

/* ----- Mobile ----- */

@media (max-width: 540px) {
  .panel { top: 10px; left: 10px; right: 10px; width: auto; }
  .register-card { padding: 24px 20px; }
}
