@charset "UTF-8";

:root{
  --bg:#050506;
  --panel:#121214;
  --ink:#f9fafb;
  --muted:#9ca3af;
  --line:#1f2933;
  --accent:#39ff14;
  --danger:#ef4444;
  --highlight:#fbbf24;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"SF Pro Rounded","Segoe UI Rounded","Segoe UI",Roboto,Arial,sans-serif;
  overflow:hidden;
}

/* Header */

.bar{
  height:64px;
  display:grid;
  grid-template-columns:auto 1fr;
  align-items:center;
  padding:0 14px;
  border-bottom:1px solid var(--line);
  background:#0b0b0e;
}

.brand-left{
  display:flex;
  align-items:center;
  gap:10px;
}

.logo{
  width:36px;height:36px;
  display:grid;place-items:center;
  background:#111827;
  border-radius:10px;
  border:1px solid #1f2937;
}

.brand-title{
  display:flex;
  align-items:center;
  gap:3px;
  margin-left:4px;
}

.fb{
  font-weight:900;
  font-size:22px;
  letter-spacing:.08em;
  color:#e5f2ff;
  text-transform:uppercase;
  text-shadow:0 0 6px rgba(191,219,254,.8),0 0 12px rgba(96,165,250,.7);
}

.brand-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}

.info-btn{
  width:24px;
  height:24px;
  border-radius:999px;
  border:1px solid #4b5563;
  background:#020617;
  color:#e5e7eb;
  font-size:13px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.info-btn:hover{
  border-color:#9ca3af;
}

.pills{display:flex;gap:6px;align-items:center}
.pill{
  padding:4px 10px;
  border-radius:999px;
  border:1px solid #1f2933;
  font-size:11px;
  color:var(--muted);
  background:#050607;
}
.pill.strong{
  font-weight:600;
  color:#e5f2ff;
  border-color:#2563eb;
}

/* Layout */

.layout{
  height:calc(100vh - 64px);
  display:grid;
  grid-template-columns:minmax(0,2.3fr) minmax(320px,0.9fr);
}

#map{
  width:100%;
  height:100%;
}

/* Sidebar */

.side{
  background:var(--panel);
  border-left:1px solid var(--line);
  padding:10px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  color:var(--ink);
  font-size:13px;
  overflow:hidden;
}

.section{
  background:#0b0b0f;
  border-radius:14px;
  border:1px solid #1f2933;
  padding:10px 10px 8px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.steps-section{
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
}

.section h3{
  margin:0 0 4px;
  font-size:14px;
}

.form-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:6px 10px;
}
.form-grid label{
  font-size:12px;
  color:var(--muted);
}
.form-grid select{
  width:100%;
}

/* rows & buttons */

.row{
  display:flex;
  gap:8px;
  align-items:center;
}
.wrap{flex-wrap:wrap}

.field{
  flex:1;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #374151;
  background:#050608;
  color:var(--ink);
  font-size:13px;
}
.field::placeholder{color:#6b7280}

.btn{
  border:none;
  border-radius:999px;
  padding:6px 12px;
  font-size:13px;
  background:linear-gradient(to bottom,#1f2937,#020617);
  color:#e5e7eb;
  border:1px solid #4b5563;
  box-shadow:0 2px 0 rgba(0,0,0,.8);
  cursor:pointer;
  transition:transform .06s ease, box-shadow .06s ease, border-color .06s ease;
  white-space:nowrap;
}
.btn:hover{
  transform:translateY(-1px);
  box-shadow:0 3px 4px rgba(0,0,0,.8);
  border-color:#9ca3af;
}
.btn:active{
  transform:translateY(1px);
  box-shadow:0 0 0 rgba(0,0,0,0);
}
.btn.danger{
  background:linear-gradient(to bottom,#7f1d1d,#450a0a);
  border-color:#b91c1c;
}

.icon-btn{
  padding:6px 8px;
  min-width:32px;
  text-align:center;
}

/* rangée des 3 boutons */

.buttons-row{
  flex-wrap:nowrap;
  justify-content:flex-start;
  gap:8px;
}

/* Toggles */

.toggles{
  gap:6px;
}
.toggle{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:3px 10px;
  border-radius:999px;
  background:#050608;
  border:1px solid #1f2933;
  cursor:pointer;
  font-size:12px;
}
.toggle input{display:none}
.toggle span{color:var(--muted)}
.toggle input:checked + span{
  color:#e5f2ff;
}
.toggle input:checked + span::before{
  content:'● ';
  color:var(--accent);
}

.mini-label{
  font-size:11px;
  color:#6b7280;
}

/* Steps list */

.list{
  flex:1;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:6px;
  scrollbar-width:thin;
  scrollbar-color:#4b5563 #050608;
}

.list::-webkit-scrollbar{
  width:6px;
}
.list::-webkit-scrollbar-track{
  background:#050608;
  border-radius:4px;
}
.list::-webkit-scrollbar-thumb{
  background:#374151;
  border-radius:4px;
}
.list::-webkit-scrollbar-thumb:hover{
  background:#4b5563;
}

/* Step card – version compacte alignée */

.card{
  display:grid;
  grid-template-columns:auto 1fr auto;
  grid-template-rows:auto auto;
  column-gap:8px;
  row-gap:4px;
  align-items:center;
  background:#151820;
  border-radius:12px;
  border:1px solid #1f2933;
  padding:6px 8px;
  transition:box-shadow .08s ease, border-color .08s ease, transform .08s ease;
}
.card.selected{
  border-color:var(--highlight);
  box-shadow:0 0 0 1px rgba(251,191,36,.5);
}
.card.dragging{
  transform:scale(1.02);
  box-shadow:0 8px 18px rgba(0,0,0,.8);
  opacity:.9;
}

.card-handle{
  grid-row:1 / span 2;
  grid-column:1;
  width:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#9ca3af;
  cursor:grab;
  user-select:none;
  font-size:14px;
}

/* Ligne 2 : Étape X : -> xx km (petit texte) */
.card-header{
  grid-column:2 / span 1;   /* s’arrête avant la corbeille */
  grid-row:2;               /* passe en deuxième ligne */
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  font-size:11px;           /* plus discret que l’adresse */
  color:var(--muted);
}

.card-header-left{
  display:flex;
  align-items:center;
  gap:6px;
}

.card-header-left .step-label{
  font-weight:600;
  color:#e5e7eb;
}

.card-header-left .step-km{
  font-size:12px;
  color:#9ca3af;
}

/* Ligne 1 : adresse, plein cadre jusqu’à la corbeille */
.card-main{
  grid-column:2 / span 2;   /* s’étend jusqu’au bord droit */
  grid-row:1;               /* passe en première ligne */
  min-width:0;
}

.card-main input{
  width:100%;
  border:none;
  background:#020617;
  color:var(--ink);
  padding:4px 8px;
  border-radius:8px;
  font-size:12px;
}
.card-main input:focus{
  outline:1px solid #4f46e5;
}

.suppr-btn{
  grid-column:3;
  grid-row:2;
  min-width:32px;
  text-align:center;
  font-size:13px;
  padding:4px 8px;
}

/* Footer crédit */

.side-footer-dev{
  margin-top:4px;
  align-self:flex-end;
  font-size:10px;
  color:#cbd5e1;
  background:#050608;
  border-radius:999px;
  padding:4px 10px;
  border:1px solid #1f2933;
}

/* Leaflet overrides */

.leaflet-container{
  background:#020617;
}
.leaflet-control-zoom{
  box-shadow:0 2px 6px rgba(0,0,0,.7);
}

/* Popup d'aide */

.info-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.65);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
.info-overlay.hidden{
  display:none;
}
.info-dialog{
  max-width:420px;
  width:90%;
  background:#020617;
  border-radius:16px;
  border:1px solid #1f2933;
  padding:18px 18px 14px;
  color:var(--ink);
  box-shadow:0 18px 45px rgba(0,0,0,.8);
}
.info-dialog h2{
  margin:0 0 8px;
  font-size:18px;
}
.info-dialog ul{
  margin:0 0 10px;
  padding-left:18px;
  font-size:13px;
}
.info-dialog li + li{
  margin-top:4px;
}

/* Responsive */

@media (max-width: 900px){
  .layout{
    grid-template-columns:1fr;
    grid-template-rows:1.3fr 1fr;
  }
  .side{
    border-left:none;
    border-top:1px solid var(--line);
  }
}

@media (max-width: 700px){
  #diagLeaflet,#diagTiles,#diagJS{display:none}
}
