/* Tankstelle entlang der Route (routePlan.js): Auswahl nach der Ortssuche und
   Routen-Panel. Mobil ein Bottom-Sheet, auf Desktop (gleicher Breakpoint wie
   gasStationList.css) ein schwebendes Panel rechts wie die Ergebnisliste. */

/* Waehrend der Routenplanung gehoeren Karte und Panel der Planung. */
body.route-plan-open .list-slider,
body.route-plan-open .map-search {
    display: none;
}

/* --- Buttons --- */
.route-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: var(--rounded);
    border: 2px solid var(--primary-color);
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.route-button--primary {
    background: var(--primary-color);
    color: var(--white);
}

.route-button--secondary {
    background: transparent;
    color: var(--primary-color);
}

.route-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* --- Panel --- */
.route-plan {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    color: var(--extra-dark-grey);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.25);
    transform: translateY(100%);
    transition: transform 0.28s ease-out;
}

.route-plan.is-open {
    transform: translateY(0);
}

.route-plan.is-dragging {
    transition: none;
}

/* Ergebnis: Karte soll mit der Route sichtbar bleiben. */
.route-plan.is-result {
    max-height: 55dvh;
}

.route-plan-knob {
    display: flex;
    justify-content: center;
    padding: 8px 0 2px;
}

.route-plan-knob span {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--standard-grey);
}

.route-plan-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 8px 18px;
}

.route-plan-title {
    flex: 1;
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--primary-color);
}

/* Mobil schliesst Wischen nach unten (wie bei allen Bottom Sheets), X und
   Zurueck-Pfeil gibt es nur auf dem Desktop. */
.route-plan-icon-button {
    display: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--light-grey);
    color: var(--extra-dark-grey);
    cursor: pointer;
}

.route-plan-body {
    overflow-y: auto;
    padding: 0 18px calc(18px + env(safe-area-inset-bottom, 0px));
    scrollbar-width: thin;
}

@media (min-width: 700px) and (orientation: landscape) {
    .route-plan {
        left: auto;
        top: var(--desktop-panel-inset);
        right: var(--desktop-panel-inset);
        bottom: var(--desktop-panel-inset);
        width: var(--desktop-panel-width);
        max-height: none !important;
        border-radius: 18px;
        transform: translateX(110%);
        box-shadow:
            0 22px 42px -20px rgba(0, 0, 0, 0.4),
            0 4px 14px rgba(0, 0, 0, 0.14);
    }

    .route-plan.is-open {
        transform: translateX(0);
    }

    .route-plan-knob {
        display: none;
    }

    .route-plan-icon-button {
        display: block;
    }

    .route-plan-header {
        padding-top: 14px;
    }
}

/* --- Formular --- */
.route-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Gruppe aus Ueberschrift, Feld und Link/Hinweis: einheitlicher Innenabstand. */
.route-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--dark-grey);
}

.route-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    min-height: 46px;
    border: 1px solid var(--standard-grey);
    border-radius: 10px;
    background: var(--surface-color);
}

.route-field--readonly {
    background: var(--light-grey);
}

.route-field-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 15px;
}

.route-field-text {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.route-dot--start {
    background: var(--primary-color);
}

.route-dot--end {
    background: var(--red);
}

.route-suggestions {
    display: flex;
    flex-direction: column;
}

.route-suggestion {
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--mid-grey);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.route-suggestion--saved,
.route-suggestion--action {
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-suggestion--saved i,
.route-suggestion--action i {
    width: 16px;
    color: var(--primary-color);
}

.route-suggestion--action {
    color: var(--primary-color);
    font-weight: 600;
}

.route-level-summary {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 15px;
}

.route-level-range {
    font-size: 13px;
    color: var(--dark-grey);
}

.route-slider {
    width: 100%;
    margin: 0;
    accent-color: var(--primary-color);
}

.route-km-input,
.route-select {
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--standard-grey);
    border-radius: 10px;
    background: var(--surface-color);
    color: inherit;
    font: inherit;
    font-size: 15px;
}

.route-km-field {
    position: relative;
}

.route-km-field .route-km-input {
    padding-right: 44px;
}

.route-km-suffix {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--dark-grey);
    pointer-events: none;
}

.route-hint {
    margin: 0;
    font-size: 12px;
    color: var(--dark-grey);
}

.route-link {
    align-self: flex-start;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary-color);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.route-vehicle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--standard-grey);
    border-radius: 10px;
    background: var(--surface-color);
    color: inherit;
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.route-vehicle--add {
    border-style: dashed;
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 700;
}

.route-place .route-field-input[readonly] {
    cursor: pointer;
}

.route-form > .route-button--primary {
    margin-top: 4px;
}

.route-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
    text-align: center;
}

/* --- Ergebnis --- */
.route-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0 0 6px;
    padding: 0 0 16px;
    border: 0;
    border-bottom: 1px solid var(--mid-grey);
    background: none;
    color: var(--dark-grey);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.route-summary-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
}

.route-summary-places {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 700;
    color: var(--extra-dark-grey);
}

.route-summary-edit {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
}

.route-summary-edit .fa-pen {
    font-size: 12px;
}

.route-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 13px;
}

.route-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.route-summary-item .fa-solid {
    font-size: 12px;
    color: var(--primary-color);
}

.route-footnotes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 0 12px;
}

.route-footnote {
    margin: 0;
    font-size: 12px;
    line-height: 17px;
    color: var(--dark-grey);
    text-align: center;
}

.route-banner {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--green) 14%, var(--surface-color));
    color: var(--green);
    font-size: 13px;
}

.route-banner > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.route-banner b {
    font-size: 14px;
}

.route-banner.is-warning {
    background: color-mix(in srgb, var(--red) 12%, var(--surface-color));
    color: var(--red);
}

.route-list {
    margin: 0 -18px;
    overflow: visible;
}

/* Beste Tankstelle: gruen statt gelb hinterlegt (die normale Liste behaelt
   ihr Gelb), mit der Empfehlungs-Info in der Zeile. */
.route-list .gasStationListItem.is-top-ranked {
    position: relative;
    background-color: color-mix(in srgb, var(--green) 10%, var(--surface-color));
    color: var(--extra-dark-grey);
}

.route-list .gasStationListItem.is-top-ranked .gasStationListItem-content {
    background: linear-gradient(90deg, color-mix(in srgb, var(--green) 16%, var(--surface-color)), color-mix(in srgb, var(--green) 8%, var(--surface-color)) 95%);
    color: var(--extra-dark-grey);
}

.route-list .gasStationListItem.is-top-ranked .bestPrice,
.route-list .gasStationListItem.is-top-ranked .address {
    color: var(--dark-grey);
}

.route-top-info {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    color: var(--green);
    font-size: 13px;
}

.route-top-info b {
    font-size: 14px;
}

.bestPrice b.is-negative {
    color: var(--red);
}

/* --- Karte: Start-/Zielpunkt --- */
.route-endpoint {
    display: block;
    width: 18px;
    height: 18px;
    box-sizing: border-box;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.route-endpoint--start {
    background: #243860;
}

.route-endpoint--end {
    background: #b3261e;
}

.station-detail-navigate-hint {
    margin: 10px 18px 0;
    font-size: 12px;
    color: var(--dark-grey);
}

/* Umweg als Gegenwert zur Ersparnis: "+5,91 € (+12 min)" */
.route-detour {
    color: var(--dark-grey);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
}

/* --- Empfehlung auf der Karte hervorgehoben: die uebrigen Marker treten
   zurueck, bleiben aber sichtbar und antippbar (wie bei der Zielstation). --- */
.route-plan-highlight .gas-station-icon-with-price-wrapper:not(.is-plan-recommended) {
    opacity: 0.4;
}

.route-plan-highlight .gas-station-icon-with-price-wrapper:not(.is-plan-recommended) .gas-station-icon-with-price {
    box-shadow: none;
}

/* Rueckfrage beim Runterwischen der Ergebnisliste: gleiches zentriertes
   Modal wie "Aenderungen verwerfen?" (siehe nav.css). */
.route-close-scrim {
    z-index: 1000002;
}

.route-close-dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    width: min(300px, calc(100vw - 48px));
    box-sizing: border-box;
    background-color: var(--surface-color);
    border-radius: 16px;
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.3);
    padding: 22px 20px 18px;
    text-align: center;
    z-index: 1000003;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.route-close-dialog.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
