/* ============================================================
   FOTI-Drive — Version test
   Feuille de style principale (mobile-first, sans framework)
   ============================================================ */

:root {
  --vert: #16a34a;        /* vert principal (boutons, accents) */
  --vert-fonce: #15803d;  /* vert au survol */
  --vert-clair: #dcfce7;  /* fonds verts légers */
  --jaune: #facc15;       /* accent jaune (identité FOTI-Drive) */
  --jaune-clair: #fef9c3;
  --sombre: #0f172a;      /* en-têtes sombres */
  --fond: #f1f5f9;        /* fond de l'app */
  --carte: #ffffff;
  --texte: #1e293b;
  --texte-doux: #64748b;
  --bordure: #e2e8f0;
  --rouge: #dc2626;       /* SOS / danger */
  --orange: #f59e0b;      /* avertissements */
  --rayon: 16px;
  --ombre: 0 2px 12px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #0b1220;
  color: var(--texte);
  -webkit-font-smoothing: antialiased;
}

/* Coquille "téléphone" : plein écran sur mobile, centrée sur desktop */
.phone {
  position: relative;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--fond);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 480px) {
  .phone {
    height: 92dvh;
    margin-top: 4dvh;
    border-radius: 28px;
    border: 10px solid #1e293b;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  }
}

/* Bandeau version test : toujours visible */
.test-banner {
  background: #fef08a;
  color: #713f12;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 6px 10px;
  z-index: 50;
  flex-shrink: 0;
}

/* Bandeau en mode production (backend Supabase configuré) */
.test-banner.bandeau-prod {
  background: #dcfce7;
  color: #166534;
}

/* Zone de contenu défilante */
.view {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- En-têtes ---------- */
.header {
  background: var(--sombre);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.header h1 { font-size: 17px; font-weight: 700; }
.header .back {
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; line-height: 1;
}
.header .spacer { flex: 1; }

/* ---------- Conteneurs & cartes ---------- */
.page { padding: 16px 16px 24px; }
.card {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 16px; margin-bottom: 8px; }
.muted { color: var(--texte-doux); font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: center; }
.mt { margin-top: 12px; }

/* ---------- Boutons ---------- */
.btn {
  display: block; width: 100%;
  border: none; border-radius: 14px;
  padding: 15px;
  font-size: 16px; font-weight: 700;
  cursor: pointer; text-align: center;
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-vert { background: var(--vert); color: #fff; }
.btn-vert:hover { background: var(--vert-fonce); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-sombre { background: var(--sombre); color: #fff; }
.btn-blanc { background: #fff; color: var(--vert-fonce); border: 2px solid var(--vert); }
.btn-rouge { background: var(--rouge); color: #fff; }
.btn-petit { padding: 10px 14px; font-size: 14px; width: auto; display: inline-block; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Formulaires ---------- */
label.champ { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--texte-doux); }
input[type="text"], input[type="tel"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  border: 1.5px solid var(--bordure);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  margin-top: 6px;
  background: #fff;
  color: var(--texte);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--vert); border-color: var(--vert); }
textarea { min-height: 80px; resize: vertical; }

/* Puces de choix (taille colis, etc.) */
.chips { display: flex; gap: 8px; margin-top: 6px; }
.chip {
  flex: 1; text-align: center;
  border: 1.5px solid var(--bordure); border-radius: 12px;
  padding: 10px 4px; font-size: 13px; font-weight: 600;
  background: #fff; cursor: pointer;
}
.chip.actif { border-color: var(--vert); background: var(--vert-clair); color: var(--vert-fonce); }

/* ---------- Cartes de profil (écran choix du profil) ---------- */
.carte-profil {
  display: flex; gap: 14px; align-items: center;
  background: #fff; border: 2px solid var(--bordure);
  border-radius: var(--rayon); padding: 16px;
  margin-bottom: 12px; cursor: pointer;
  transition: border-color 0.15s ease;
}
.carte-profil.actif { border-color: var(--vert); background: #f0fdf4; }
.carte-profil .icone {
  font-size: 30px; width: 52px; height: 52px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--vert-clair); border-radius: 14px;
}
.carte-profil strong { font-size: 15px; display: block; }
.carte-profil p { font-size: 12.5px; color: var(--texte-doux); margin-top: 3px; }

/* ---------- Listes (demandes, notifications, discussions) ---------- */
.item-liste {
  background: #fff; border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 14px 16px;
  margin-bottom: 10px; cursor: pointer;
  border-left: 4px solid var(--vert);
}
.item-liste.colis { border-left-color: #0ea5e9; }
.item-liste .trajet { font-weight: 700; font-size: 15px; }
.item-liste .detail { font-size: 13px; color: var(--texte-doux); margin-top: 4px; }
.item-liste .prix { font-weight: 800; color: var(--vert-fonce); font-size: 15px; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
  background: var(--vert-clair); color: var(--vert-fonce);
}
.badge.bleu { background: #e0f2fe; color: #0369a1; }
.badge.orange { background: #fef3c7; color: #92400e; }
.badge.rouge { background: #fee2e2; color: #991b1b; }
.badge.gris { background: #f1f5f9; color: var(--texte-doux); }
.badge.instant { background: #fef3c7; color: #92400e; }

/* Lignes de bascule (toggles) dans les formulaires */
.toggle-ligne {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 8px 0; cursor: pointer;
}
.toggle-ligne input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--vert); }

/* Demande instantanée mise en avant (priorité taxi-moto) */
.item-liste.instantanee { border-left-color: #f59e0b; background: #fffbeb; }

/* Onglets (Toutes / Passagers / Colis, Jour / Semaine / Mois) */
.onglets { display: flex; gap: 8px; margin-bottom: 14px; }
.onglet {
  flex: 1; text-align: center; padding: 10px;
  border-radius: 12px; background: #fff;
  font-size: 13px; font-weight: 700; color: var(--texte-doux);
  cursor: pointer; border: 1.5px solid transparent;
}
.onglet.actif { background: var(--sombre); color: #fff; }

/* ---------- Discussion P2P ---------- */
.fil-discussion { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 12px; }
.bulle {
  max-width: 78%; padding: 10px 14px; border-radius: 18px;
  font-size: 14px; line-height: 1.45;
}
.bulle.moi { align-self: flex-end; background: var(--vert); color: #fff; border-bottom-right-radius: 6px; }
.bulle.lui { align-self: flex-start; background: #fff; border-bottom-left-radius: 6px; box-shadow: var(--ombre); }
.bulle .heure { display: block; font-size: 10px; opacity: 0.7; margin-top: 4px; }
.suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.suggestion {
  border: 1.5px solid var(--vert); color: var(--vert-fonce);
  background: #fff; border-radius: 20px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.barre-message { display: flex; gap: 8px; padding: 10px 0 4px; }
.barre-message input { flex: 1; margin-top: 0; }
.btn-rond {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--vert); color: #fff; border: none;
  font-size: 20px; cursor: pointer; flex-shrink: 0;
}

/* ---------- Notation (étoiles) ---------- */
.etoiles { display: flex; gap: 6px; justify-content: center; margin: 14px 0; font-size: 38px; }
.etoile { cursor: pointer; color: #cbd5e1; }
.etoile.pleine { color: #f59e0b; }

/* ---------- Tableau de bord ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat {
  background: #fff; border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 14px; text-align: center;
}
.stat .valeur { font-size: 20px; font-weight: 800; color: var(--sombre); }
.stat .etiquette { font-size: 12px; color: var(--texte-doux); margin-top: 4px; }
.graphique { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 10px; }
.barre { flex: 1; background: var(--vert); border-radius: 6px 6px 0 0; min-height: 8px; position: relative; }
.barre span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--texte-doux); }

/* ---------- SOS ---------- */
.sos-page { background: var(--rouge); color: #fff; min-height: 100%; padding: 32px 20px; text-align: center; }
.sos-page h1 { font-size: 42px; margin-bottom: 8px; }
.sos-icone { font-size: 72px; margin: 18px 0; }
.btn-sos {
  background: #fff; color: var(--rouge);
  font-size: 18px; padding: 18px; margin-top: 20px;
}

/* ---------- Carte simulée (course en cours) ---------- */
.carte-simulee {
  background: #dbeafe; border-radius: var(--rayon);
  height: 230px; position: relative; overflow: hidden;
  margin-bottom: 14px; border: 1px solid var(--bordure);
}
.carte-simulee svg { width: 100%; height: 100%; }

/* ---------- Barre d'onglets ---------- */
.tabbar {
  display: flex; background: #fff;
  border-top: 1px solid var(--bordure);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  flex-shrink: 0; z-index: 30;
}
.tabbar.hidden { display: none; }
.onglet-barre {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; color: var(--texte-doux); font-weight: 600;
  padding: 6px 0; position: relative;
}
.onglet-barre .icone { font-size: 21px; }
.onglet-barre.actif { color: var(--vert-fonce); }
.pastille {
  position: absolute; top: 2px; right: calc(50% - 20px);
  background: var(--rouge); color: #fff;
  font-size: 10px; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 16px; right: 16px; bottom: 90px;
  background: var(--sombre); color: #fff;
  padding: 13px 16px; border-radius: 14px;
  font-size: 14px; text-align: center; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: montee 0.25s ease;
}
.toast.hidden { display: none; }
@keyframes montee { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Divers ---------- */
.hidden { display: none !important; }
.centre { text-align: center; }
.logo { font-size: 26px; font-weight: 800; color: var(--vert-fonce); }
.logo .drive { color: var(--sombre); }
.slogan { color: var(--texte-doux); font-size: 13px; margin-top: 4px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--vert-clair); color: var(--vert-fonce);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; flex-shrink: 0;
}
.avatar.petit { width: 44px; height: 44px; font-size: 18px; }
.menu-ligne {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 4px; border-bottom: 1px solid var(--bordure);
  font-size: 15px; cursor: pointer;
}
.menu-ligne:last-child { border-bottom: none; }
.menu-ligne .fleche { margin-left: auto; color: var(--texte-doux); }
.code-sms { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.code-sms input {
  width: 48px; height: 56px; text-align: center;
  font-size: 24px; font-weight: 800; margin-top: 0;
}
.notice-test {
  background: #fef9c3; border: 1.5px dashed #ca8a04;
  border-radius: 12px; padding: 12px 14px;
  font-size: 13px; color: #713f12; margin-bottom: 14px;
}
.doc-ligne {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px; border-bottom: 1px solid var(--bordure); font-size: 14px;
}
.case { margin-left: auto; font-size: 20px; }
.ligne-temps { font-size: 11px; color: var(--texte-doux); }

/* ---------- Paiement préalable des frais FOTI-Drive (modale) ---------- */
.modale-fond {
  position: absolute; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 480px) {
  .modale-fond { align-items: center; padding: 20px; }
}
.modale {
  background: var(--fond); width: 100%; max-width: 430px;
  max-height: 94%; overflow-y: auto;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.25);
  animation: modale-monte 0.25s ease-out;
}
@media (min-width: 480px) {
  .modale { border-radius: 20px; }
}
@keyframes modale-monte {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modale .header { border-radius: 20px 20px 0 0; }
.modale .page { padding-bottom: 24px; }

/* Lignes de choix du moyen de paiement */
.moyen-ligne {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--bordure); border-radius: var(--rayon);
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
  background: var(--carte); font-size: 15px; font-weight: 600;
}
.moyen-ligne input[type="radio"] { width: 18px; height: 18px; accent-color: var(--vert); }
.moyen-ligne .m-icone { font-size: 22px; }
.moyen-ligne.actif { border-color: var(--vert); background: var(--vert-clair); }

/* Indicateur de traitement simulé */
.spinner {
  width: 52px; height: 52px; margin: 0 auto;
  border: 5px solid var(--bordure); border-top-color: var(--vert);
  border-radius: 50%; animation: rotation 0.9s linear infinite;
}
@keyframes rotation { to { transform: rotate(360deg); } }

/* ---------- PIN de montée (pin.js) ---------- */
.pin-carte { border-left: 4px solid #16a34a; }
.pin-code { font-size: 26px; letter-spacing: 8px; font-weight: 800; color: #16a34a; }
.pin-code-petit { letter-spacing: 4px; font-size: 17px; color: #16a34a; }
.pin-saisie { text-align: center; font-size: 28px; letter-spacing: 12px; font-weight: 700; }
.pin-ligne { margin-top: 8px; }

/* ---------- Prix suggéré (prix.js) ---------- */
.prix-suggere { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 10px 12px; margin-top: 8px; }

/* ============================================================
   Identité visuelle officielle FOTI-Drive
   (logo, slogan, pills de catégories, ligne de marque)
   ============================================================ */
.logo-img {
  width: 96px; height: 96px;
  display: block; margin: 0 auto 10px;
  filter: drop-shadow(0 4px 10px rgba(22, 163, 74, 0.35));
}
.brandline {
  color: var(--vert-fonce); font-weight: 800; font-size: 13px;
  letter-spacing: 1px; text-transform: uppercase;
  margin-top: 6px;
}
/* Pills de catégories : Personnes • Colis • Covoiturage • Taxi-moto */
.pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.pills span {
  background: #fff; border: 1.5px solid var(--vert);
  color: var(--vert-fonce); font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: 20px; white-space: nowrap;
}

/* ============================================================
   Tableau de bord administrateur (#/admin)
   ============================================================ */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 4px; }
.admin-tab {
  flex: 1 0 auto; text-align: center; padding: 10px 12px;
  border-radius: 12px; background: #fff;
  font-size: 12.5px; font-weight: 700; color: var(--texte-doux);
  cursor: pointer; border: 1.5px solid var(--bordure); white-space: nowrap;
}
.admin-tab.actif { background: var(--sombre); color: #fff; border-color: var(--sombre); }
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi {
  background: #fff; border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 14px;
  border-top: 4px solid var(--vert);
}
.kpi.jaune { border-top-color: var(--jaune); }
.kpi.rouge { border-top-color: var(--rouge); }
.kpi.bleu { border-top-color: #0ea5e9; }
.kpi .valeur { font-size: 22px; font-weight: 800; color: var(--sombre); }
.kpi .etiquette { font-size: 11.5px; color: var(--texte-doux); margin-top: 4px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  color: var(--texte-doux); padding: 8px 6px;
  border-bottom: 2px solid var(--bordure);
}
.admin-table td { padding: 10px 6px; border-bottom: 1px solid var(--bordure); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-search { margin-bottom: 12px; }
.badge.vert { background: var(--vert-clair); color: var(--vert-fonce); }
.badge.jaune { background: var(--jaune-clair); color: #854d0e; }
.admin-fiche { background: #f8fafc; border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.admin-fiche .ligne { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--bordure); }
.admin-fiche .ligne:last-child { border-bottom: none; }
.admin-fiche .cle { color: var(--texte-doux); }
.btn-danger-mineur { background: #fff; color: var(--rouge); border: 2px solid var(--rouge); }
