/**
 * =========================
 *    Route Planner – Modern UI
 *    =========================
 *
 * @format
 */

/* Kleuren als in je site */
:root {
  --rp-primary: #dc592b; /* oranje */
  --rp-primary-600: #b84a22;
  --rp-primary-100: #ffe9e1;
  --rp-ink: #2b2b2b;
  --rp-muted: #6b7280;
  --rp-border: #f2a485;
  --rp-bg: #ffffff;
  --rp-elev: rgba(0, 0, 0, 0.08);
  --rp-ring: rgba(220, 89, 43, 0.22);
  --rp-radius: 16px;
}

.routePlannerSection {
  width: 33%;
  height: 100dvh;
  position: absolute;
  top: 0;
  right: -33%;
  z-index: 12000;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--rp-bg);
  /* subtiel elevation + blur voor ‘paneel boven kaart’ */
  /* box-shadow: -14px 0 30px var(--rp-elev); */
  backdrop-filter: saturate(110%) blur(0px);
  transition: all 0.75s ease;
}

/* Panels standaard zichtbaar */
body.ui-offscreen .routePlannerSection,
body.ui-offscreen .routePlannerSection:not(.active) {
  transition: all 0.3s ease !important;
}

/* Wanneer ui-offscreen actief is: alles schuift weg */
body.ui-offscreen .routePlannerSection,
body.ui-offscreen .filtersSection {
  transform: translateX(110%);
}

body.ui-offscreen .routePlannerSection.left,
body.ui-offscreen .filtersSection.left {
  transform: translateX(-110%);
}


.routePlannerSection:not(.active) {
  transition: 0.75s
    linear(
      0,
      0.004,
      0.016,
      0.035,
      0.063,
      0.098,
      0.141 13.6%,
      0.25,
      0.391,
      0.563,
      0.765,
      1,
      0.891 40.9%,
      0.848,
      0.813,
      0.785,
      0.766,
      0.754,
      0.75,
      0.754,
      0.766,
      0.785,
      0.813,
      0.848,
      0.891 68.2%,
      1 72.7%,
      0.973,
      0.953,
      0.941,
      0.938,
      0.941,
      0.953,
      0.973,
      1,
      0.988,
      0.984,
      0.988,
      1
    );
}

/* Router-controlled transitions: simple ease when UI is moved by navigation */
body.ui-offscreen .routePlannerSection,
body.ui-offscreen .routePlannerSection:not(.active),
body.ui-restore .routePlannerSection,
body.ui-restore .routePlannerSection:not(.active) {
  transition: all 0.3s ease !important;
}

/* Keep filters in sync with the same behavior */
body.ui-offscreen .filtersSection,
body.ui-restore .filtersSection {
  transition: all 0.3s ease !important;
}
.routePlannerSection.active {
  right: 0;
  border-left: solid 3px var(--rp-primary);
  z-index: 11111111111;
}

/* Toggle (aan rechterkant van het paneel “vastgeplakt”) */
.routePlannerToggleBtn {
  position: absolute;
  left: -37.4px;
  top: 20px;
  padding: 1em 0.5em;
  width: fit-content;
  height: fit-content;
  display: grid;
  place-items: center;
  border: 0;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  background: var(--rp-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-size: larger;
}
.routePlannerToggleBtn{ isolation:isolate; }
.routePlannerToggleBtn img {
  width: 14px;
  height: 14px;
  filter: invert(1) brightness(37);
  transform: rotate(90deg);
  transition: transform 0.25s ease;
}
.routePlannerSection.active .routePlannerToggleBtn img {
  transform: rotate(-90deg);
}

/* Header blijft sticky bovenaan */
.rp-header {
  top: 0;
  z-index: 2;
  background: linear-gradient(
    180deg,
    #fff 0%,
    rgba(255, 255, 255, 0.96) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  padding: 20px 22px 10px;
  border-bottom: 1px solid #fff0ea;
}
.rp-header h2 {
  margin: 0;
  font: 700 20px/1.1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  color: var(--rp-primary);
  letter-spacing: 0.2px;
}

/* Body */
.rp-form {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100dvh;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.rp-form::-webkit-scrollbar {
  width: 0;
  background: transparent;
}

.rp-label {
  display: block;
  font: 700 14px/1 ui-sans-serif, system-ui;
  color: var(--rp-primary);
  margin: 6px 0 8px;
  letter-spacing: 0.2px;
}

/* Label + add button on one row */
.rp-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.rp-stop .rp-label {
  margin: 0;
}

/* "+ Stop toevoegen" button */
.rp-add-btn {
  background: transparent;
  border: none;
  color: var(--rp-primary);
  border-radius: 999px;
  font: 600 13px/1 ui-sans-serif, system-ui;
  cursor: pointer;
  transition: all 0.2s ease;
}
.rp-add-btn:hover {
  scale: 1.01;
}
.rp-add-btn:active {
  transform: translateY(1px);
}

.rp-row {
  display: flex;
  gap: 10px;
}

/* Inputs – minder “hard”: zachte rand + focus-ring */
.rp-input {
  width: 100%;
  box-sizing: border-box; /* padding en border tellen mee */
  padding: 12px 14px;
  padding-right: 44px; /* ruimte voor de knop */
  border: 2px solid #ffe1d7;
  border-radius: 12px;
  color: var(--rp-ink);
  font: 500 16px/1.2 ui-sans-serif, system-ui;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
  outline: none;
}
.rp-input::placeholder {
  color: #c08c7b;
}
.rp-input:focus {
  border-color: var(--rp-primary);
  /* box-shadow: 0 0 0 6px var(--rp-ring); */
  background: #fff;
}

/* --- Tussenstops: input met ingebouwde verwijderknop --- */

.rp-stops-list {
  display: grid;
  gap: 10px;
}

.rp-no-stops {
  font: 500 14px/1.4 ui-sans-serif, system-ui;
  color: var(--rp-muted);
  margin: 0;
  padding: 4px 0;
  text-align: start;
}

.rp-stop {
  /* 1 rij in de lijst */
  position: relative;
}

.rp-input-wrap {
  position: relative;
}

/* make the stop row a horizontal flex with a drag handle */
.rp-stop .rp-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* input should take remaining space inside the wrap */
.rp-input-wrap .rp-input {
  flex: 1;
}

/* six-dot drag handle */
.rp-drag-handle {
  cursor: grab;
  user-select: none;
  font-size: 18px;
  line-height: 1;
  padding: 0 6px;
  color: var(--rp-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rp-drag-handle:active {
  cursor: grabbing;
}

/* visual feedback while dragging (Sortable.js) */
.sortable-ghost {
  opacity: 0.45 !important;
}
.sortable-chosen {
  background: #fafafa;
  border-radius: 12px;
}

.rp-input-wrap .rp-input {
  /* padding-right: 44px;          */
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
  max-width: 100%;
}

/* De ✕-knop in het inputveld */
.rp-remove-stop {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--rp-primary);
  background: #fff;
  color: var(--rp-primary);
  display: grid;
  place-items: center;
  font: 800 14px/1 ui-sans-serif, system-ui;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rp-remove-stop:hover {
  background: var(--rp-primary);
  color: #fff;
}

.rp-remove-stop:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--rp-ring);
}

/* Wanneer input focust, laat het knopje subtiel meekleuren */
.rp-input:focus + .rp-remove-stop {
  border-color: var(--rp-primary);
}

/* Vervoerswijzen – chips */
.rp-modes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rp-chip {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--rp-primary);
  border-radius: 999px;
  overflow: hidden;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.rp-chip input {
  appearance: none;
  width: 0;
  height: 0;
  position: absolute;
}
.rp-chip span {
  padding: 8px 14px;
  color: var(--rp-primary);
  font: 700 14px/1 ui-sans-serif, system-ui;
}
.rp-chip:hover {
  background: var(--rp-primary-100);
}
.rp-chip input:checked + span {
  background: var(--rp-primary);
  color: #fff;
}

/* Acties */
.rp-actions {
  margin-top: 1em;
  display: flex;
  gap: 10px;
  /* align-items: center; */
}
.rp-btn {
  border-radius: 12px;
  width: 100%;
  padding: 12px 14px;
  font: 800 15px/1 ui-sans-serif, system-ui;
  cursor: pointer;
  border: 0;
  transition: transform 0.04s ease, background 0.15s ease, box-shadow 0.15s;
  /* box-shadow: 0 6px 18px var(--rp-elev); */
}
.rp-btn:active {
  transform: translateY(1px);
}

.rp-primary {
  background: var(--rp-primary);
  color: #fff;
}
.rp-primary:hover {
  background: var(--rp-primary-600);
}

.rp-secondary {
  background: #fff;
  color: var(--rp-primary);
  border: 2px solid var(--rp-primary);
  box-shadow: none;
}
.rp-secondary:hover {
  background: var(--rp-primary-100);
}

/* Drawer element zelf (je aside) */
.routePlannerDrawer {
  /* behoud voor compat */
  width: 100%;
}

/* Z-index tov Leaflet popups (popup erboven) */
.leaflet-popup-pane {
  z-index: 20000 !important;
}

.route-results{
  font: 400 14px/1.2 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto;
  color: var(--rp-primary-600);
  font-weight: bold;
}
/* === Autocomplete === */
.rp-input-wrap {
  position: relative;
}
.rp-row {
  position: relative;
} /* voor from/to containers */

.rp-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: #fff;
  /* border: 2px solid #dc592b; */
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: block;
  z-index: 1000000;
  max-height: 240px;
  overflow: auto;
}

.rp-suggest.open {
  display: block;
}

.rp-suggest-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font: 600 14px/1.2 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto;
  color: #333;
}

.rp-suggest-item:hover,
.rp-suggest-item.active {
  background: rgba(220, 89, 43, 0.08);
}

.rp-suggest-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rp-suggest-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rp-suggest-icon img {
  width: 70%;
  height: 70%;
}

.rp-suggest-icon.my-location{
  background:#ADD8E6; /* lichtblauw voor "Mijn locatie" */
}
.rp-suggest-icon.my-location img{
  width:70%;
  height:70%;
  display:block;
}

.rp-suggest.kbd-nav .rp-suggest-item:hover {
  background: transparent !important;
}

/* Zorg dat keyboard-active duidelijk is */
.rp-suggest .rp-suggest-item.active {
  background: rgba(232, 73, 31, 0.08);
}
.rp-suggest-icon.activiteiten {
  background: #f58c2a;
}
.rp-suggest-icon.cultuurSport {
  background: #9747ff;
}
.rp-suggest-icon.events {
  background: #ffcd62;
}
.rp-suggest-icon.geschiedenis {
  background: #2830a8;
}
.rp-suggest-icon.horeca {
  background: #dc592b;
}
.rp-suggest-icon.andere {
  background: #d8129d;
}
.rp-suggest-icon.parking {
  background: #737373;
}
.rp-suggest-icon.ingang {
  background: #b93b3b;
}
.rp-suggest-icon.route {
  background-color: #54af69;
}
.rp-suggest-icon.Douche {
  background: #d8129d;
}
.rp-suggest-icon.EHBO {
  background: #d8129d;
}

.rp-no-stops,
.rp-suggest-empty {
  padding: 10px;
  text-align: center;
  color: #777;
  font: 500 13px/1.2 ui-sans-serif, system-ui;
}

/* Responsief */
@media (max-width: 768px) {
  /* Drawer wordt full‑width en fixed boven de kaart */
  .routePlannerSection {
    position: fixed;
    top: 0;
    right: -100%; 
    width: 100vw; /* volle breedte */
    height: 100dvh;
    /* border: 0; */
    box-shadow: none;
    z-index: 12000;
  }
  .routePlannerSection.active {
    right: 0;
    transition: all 0.75s ease;
  }

  .routePlannerToggleBtn{
    top: 12px;
  }
  /* Toggle-knop komt in het paneel te staan (links bovenaan) */
  /* Plaats de toggle-knop BINNEN het paneel op mobiel */
  .routePlannerSection.active .routePlannerToggleBtn{
    left: 0px;           /* in het paneel ipv buiten beeld */
    /* width: 30px;
    height: 46px; */
    border-top-left-radius: 0px;
    border-bottom-left-radius: 0px;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    z-index: 3;           /* boven header-tekst */
    transition: all 0.3s ease;
    top: 0;
  }

  .routePlannerSection.active .routePlannerToggleBtn p{
    display: none;       /* verberg tekst op mobiel */
  }

  /* pijltje wijst naar links wanneer paneel open is (sluiten) */
  /* pijltje wijst naar links wanneer open (om te sluiten) */
  /* .routePlannerSection.active .routePlannerToggleBtn img {
    transform: rotate(180deg);
  } */

  /* Extra ruimte zodat de knop niet over de titel valt */
  .rp-header {
    padding-left: 48px;
  }

  /* Zorg dat content niet per ongeluk horizontaal scrollt */
  html,
  body {
    overflow-x: hidden;
  }
}

/* Optioneel: wanneer je in JS body.no-scroll zet, blokkeer scroll op de achtergrond */
@media (max-width: 768px) {
  body.no-scroll {
    overflow: hidden;
  }
}


/* === SortableJS drag states for stops === */
.rp-stop.sortable-ghost { opacity: .35; }
.rp-stop.sortable-chosen { background: rgba(220,89,43,.06); }
.rp-stop.sortable-drag { opacity: .7; }

/* --- VERVANG dit hele blok (van "make the stop row a horizontal flex..."
   t/m de Sortable-classes) door onderstaande versie --- */

/* De rij zelf */
.rp-stop { position: relative; }

/* De wrapper wordt weer een "gewoon" blok met absolute children */
.rp-stop .rp-input-wrap {
  position: relative;
}

/* Input: ruimte links voor de drag-handle, rechts voor de ✕ */
.rp-stop .rp-input {
  width: 100%;
  padding-left: 44px;   /* ruimte voor sleep-icoon links */
  padding-right: 44px;  /* ruimte voor verwijderknop rechts (had je al) */
  box-sizing: border-box;
}

/* Sleep-icoon BINNEN het inputveld links */
.rp-drag-handle {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--rp-primary);
  cursor: grab;
  user-select: none;
  line-height: 1;
  /* optioneel: subtiel hover-achtergrondje */
  /* background: rgba(0,0,0,.03); */
}
.rp-drag-handle:active { cursor: grabbing; }

/* ✕-knop rechts heb je al zo staan; laten we zo */
.rp-remove-stop { 
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--rp-primary);
  background: #fff;
  color: var(--rp-primary);
  display: grid;
  place-items: center;
  font: 800 14px/1 ui-sans-serif, system-ui;
  cursor: pointer;
  padding: 0;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

/* SortableJS drag states */
.rp-stop.sortable-ghost   { opacity: .35; }
.rp-stop.sortable-chosen  { background: rgba(220,89,43,.06); }
.rp-stop.sortable-drag    { opacity: .7; }

/* ===== Mobile floating CTA (Start route) ===== */
.rp-mobile-cta{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12px;
  display: none;
  justify-content: center;
  z-index: 20050; /* boven leaflet popups */
  padding: 0 12px;
}
.rp-mobile-cta.visible{ display: flex; }
.rp-mobile-cta-btn{
  min-width: 180px;
  max-width: 95vw;
  padding: 14px 18px;
  margin-bottom: 2em;
  font: 800 15px/1 ui-sans-serif, system-ui;
  color: #fff;
  background: var(--rp-primary);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  cursor: pointer;
  text-wrap: nowrap;
}
.rp-mobile-cta-btn:active{ transform: translateY(1px); }
@media (min-width: 769px){
  .rp-mobile-cta{ display: none !important; }
}

.rp-toggle-btn-tekst{
  display:block;
  /* writing-mode: sideways-lr;  */
  text-orientation: mixed;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: #fff;
  transform: none;                 /* no rotate */
  -webkit-font-smoothing: antialiased;
  backface-visibility: hidden;
  contain: paint;                  /* isolate from parent's backdrop-filter */
  text-align: right;               /* keep glyphs hugging the right edge */
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

@supports (writing-mode: sideways-lr) {
  .vertical-text {
    writing-mode: sideways-lr;
    transform: none; /* fix weer uitzetten */
  }
}
