/* =====================================================================
   webmaps.io — Étapes du trajet
===================================================================== */

/* ---------- Liste des étapes (sous l'itinéraire) ---------- */

.waypoints-panel {
    float: left;
    clear: both;
    width: 100%;
    margin-top: 10px;
}

.waypoints-panel[hidden],
.waypoints-list[hidden] {
    display: none;
}

.waypoints-list {
    margin: 0 0 6px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    list-style: none;
    background: white;
}

.waypoint-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px 6px 8px;
    border-bottom: 1px solid #eef2f7;
}

.waypoint-item:last-child {
    border-bottom: 0;
}

.waypoint-item.reached {
    opacity: .55;
}

.waypoint-item.reached .waypoint-text strong {
    text-decoration: line-through;
}

.waypoint-badge,
.waypoint-marker {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 2px solid white;
    border-radius: 50%;
    background: #f59e0b;
    color: white;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.waypoint-badge {
    flex: 0 0 24px;
}

.waypoint-item.reached .waypoint-badge {
    background: #16a34a;
}

.waypoint-marker {
    width: 28px;
    height: 28px;
    border-width: 3px;
    font-size: 13px;
    cursor: default;
}

.waypoint-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.waypoint-text strong,
.waypoint-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.waypoint-text strong {
    font-size: 14px;
}

.waypoint-text small {
    color: var(--muted);
    font-size: 12px;
}

.waypoint-actions {
    display: flex;
    flex: 0 0 auto;
}

.waypoint-actions .icon-btn {
    width: 30px;
    height: 30px;
}

.waypoint-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px;
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    background: white;
    color: var(--blue);
    font-size: 14px;
}

.waypoint-add:hover {
    border-color: var(--blue);
    background: #eff6ff;
    color: var(--blue-dark);
}

/* En navigation : panneau compact en bas de l'écran */
#Mainsidebar.active .waypoints-panel {
    margin-top: 8px;
}

#Mainsidebar.active .waypoint-item {
    padding-top: 4px;
    padding-bottom: 4px;
}

#Mainsidebar.active .waypoint-text small {
    display: none;
}

#Mainsidebar.active .waypoint-add {
    padding: 7px;
}

/* ---------- Fiche d'un résultat : bouton « Étape » ---------- */

.search-popup-stop {
    padding: 7px 10px;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    background: #f59e0b;
    color: white;
    font-size: 13px;
}

.search-popup-stop:hover {
    background: #d97706;
    color: white;
}

/* ---------- Fenêtre « Ajouter une étape » ---------- */

.stop-content {
    display: flex;
    flex-direction: column;
    width: min(480px, 100%);
    max-height: calc(100vh - 36px);
    padding: 20px;
}

.stop-content h2 {
    margin: 0 44px 12px 0;
    font-size: 20px;
}

.stop-search {
    position: relative;
}

.stop-search i {
    position: absolute;
    top: 50%;
    left: 12px;
    color: var(--muted);
    transform: translateY(-50%);
}

.stop-search input {
    padding-left: 36px;
    font-size: 16px; /* évite le zoom automatique sur iPhone */
}

.stop-categories {
    display: flex;
    gap: 6px;
    margin: 10px -20px 0;
    padding: 0 20px 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.stop-categories::-webkit-scrollbar {
    display: none;
}

.stop-category {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.stop-category:hover {
    border-color: var(--blue);
    background: #eff6ff;
    color: var(--blue-dark);
}

.stop-category i {
    color: var(--blue);
}

.stop-pick {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.stop-results {
    flex: 1;
    min-height: 0;
    margin: 10px -8px 0;
    padding: 0 8px;
    overflow-y: auto;
}

.stop-results-title {
    margin: 6px 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.stop-empty {
    padding: 18px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.stop-result {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 6px;
    border-bottom: 1px solid #eef2f7;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-weight: normal;
    text-align: left;
}

.stop-result:hover {
    background: #f8fafc;
    color: var(--text);
}

.stop-result-icon {
    display: grid;
    flex: 0 0 34px;
    place-items: center;
    height: 34px;
    border-radius: 50%;
    background: #fff7ed;
    color: #d97706;
}

.stop-result-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.stop-result-text strong,
.stop-result-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stop-result-text small {
    color: var(--muted);
    font-size: 12px;
}

.stop-result-detour {
    flex: 0 0 auto;
    color: #047857;
    font-size: 12px;
    font-weight: 600;
}

.stop-result-add {
    display: grid;
    flex: 0 0 30px;
    place-items: center;
    height: 30px;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    font-size: 13px;
}

/* ---------- Bandeau « Touchez la carte » ---------- */

.pick-banner {
    position: fixed;
    top: 12px;
    left: 50%;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: calc(100% - 24px);
    padding: 8px 8px 8px 14px;
    border-radius: 999px;
    background: #111827;
    color: white;
    font-size: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
    transform: translateX(-50%);
}

.pick-banner[hidden] {
    display: none;
}

.pick-banner button {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
}

/* En navigation, les messages ne masquent pas le panneau du bas */
#Mainsidebar.active ~ .toast {
    top: 45%;
    bottom: auto;
}

/* ---------- Itinéraire : départ → + → étape → + → destination ---------- */

.waypoints-panel.in-itinerary {
    margin: -6px 0 6px;
}

.in-itinerary .waypoints-list {
    position: relative;
    margin: 0;
    overflow: visible;
    border: 0;
    background: transparent;
}

/* Trait pointillé reliant les points, comme un tracé */
.in-itinerary .waypoints-list::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 19px;
    border-left: 2px dotted #94a3b8;
}

.in-itinerary .waypoint-item {
    position: relative;
    margin: 2px 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
}

.waypoint-insert {
    position: relative;
}

.waypoint-insert button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 4px 8px;
    border-radius: 8px;
    background: transparent;
    color: var(--blue);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.waypoint-insert button:hover {
    background: #eff6ff;
    color: var(--blue-dark);
}

.waypoint-insert-icon {
    display: grid;
    flex: 0 0 24px;
    place-items: center;
    height: 24px;
    border: 2px dashed #93c5fd;
    border-radius: 50%;
    background: white;
    font-size: 11px;
}

.waypoint-add[hidden] {
    display: none;
}
