/* ==========================================================================
   Ruteplanlægger (/route-designer) — side, panel og Leaflet-markører
   ========================================================================== */

.rd-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rd-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.rd-title {
    font-family: var(--mbh-font-heading);
    font-size: var(--mbh-h1-size);
    letter-spacing: 0.04em;
    margin: 4px 0 0;
    color: var(--mbh-text-primary);
}

.rd-subtitle {
    color: var(--mbh-text-muted);
    font-size: var(--mbh-body2);
}

.rd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    height: calc(100vh - 190px);
    min-height: 540px;
}

.rd-layout.expanded {
    grid-template-columns: minmax(0, 1fr);
}

.rd-layout.expanded .rd-panel {
    display: none;
}

.rd-map-col {
    position: relative;
    min-height: 0;
}

.rd-map {
    width: 100%;
    height: 100%;
    border-radius: var(--mbh-card-radius);
    overflow: hidden;
    z-index: 1;
    box-shadow: var(--mbh-shadow-card);
}

.rd-map.rd-bookmark-mode,
.rd-map.rd-bookmark-mode .leaflet-interactive {
    cursor: crosshair;
}

.rd-map-btn {
    position: absolute;
    left: 10px;
    z-index: 500;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.rd-map-btn:hover { background: #f4f4f4; }
.rd-map-btn:disabled { opacity: 0.6; cursor: wait; }
.rd-map-expand { top: 86px; }
.rd-map-locate { top: 126px; }
.rd-map-home { top: 166px; }

.rd-map-banner {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    background: var(--mbh-accent);
    color: #1a221e;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 999px;
    box-shadow: var(--mbh-shadow-card);
    display: flex;
    gap: 10px;
    align-items: center;
    white-space: nowrap;
}

.rd-map-banner button {
    border: none;
    background: #1a221e;
    color: #fff;
    border-radius: 999px;
    padding: 3px 10px;
    font-weight: 600;
    cursor: pointer;
}

.rd-map-stats {
    position: absolute;
    bottom: 28px;
    right: 12px;
    z-index: 500;
    background: rgba(26, 34, 30, 0.88);
    color: #fff;
    border-radius: 10px;
    padding: 6px 12px;
    display: flex;
    gap: 10px;
    align-items: baseline;
    pointer-events: none;
}

.rd-map-stat-num { font-weight: 700; font-size: 16px; }
.rd-map-stat-sub { font-size: 12px; color: var(--mbh-accent-light); }

.rd-panel {
    background: var(--mbh-surface);
    border-radius: var(--mbh-card-radius);
    padding: 12px;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rd-tabs {
    display: flex;
    gap: 4px;
    background: var(--mbh-surface-dark);
    border-radius: 999px;
    padding: 4px;
    flex: 0 0 auto;
}

.rd-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--mbh-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.rd-tab.active {
    background: var(--mbh-accent);
    color: #1a221e;
}

.rd-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rd-section.rd-row { flex-direction: row; }

.rd-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rd-editing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: var(--mbh-accent-tint);
    border: 1px solid var(--mbh-accent);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 13px;
}

.rd-link-btn {
    background: none;
    border: none;
    color: var(--mbh-accent-light);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
}

.rd-seg {
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    overflow: hidden;
    align-self: flex-start;
}

.rd-seg button {
    border: none;
    background: transparent;
    color: var(--mbh-text-muted);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rd-seg-sm button { padding: 4px 10px; font-size: 12px; }

.rd-seg button.active {
    background: var(--mbh-accent);
    color: #1a221e;
}

.rd-search {
    display: flex;
    gap: 8px;
}

.rd-input {
    flex: 1;
    min-width: 0;
    background: var(--mbh-surface-dark);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--mbh-text-primary);
    padding: 6px 10px;
    font-size: 14px;
}

.rd-input:focus {
    outline: none;
    border-color: var(--mbh-accent);
    box-shadow: var(--mbh-shadow-focus);
}

.rd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rd-chip {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: var(--mbh-surface-light);
    color: var(--mbh-text-secondary);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
}

.rd-chip:hover { border-color: var(--mbh-accent); }

.rd-results,
.rd-route-list,
.rd-bm-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rd-results {
    max-height: 260px;
    overflow-y: auto;
}

.rd-results li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

.rd-results li:hover { background: rgba(255, 255, 255, 0.06); }

.rd-result-mark {
    flex: 0 0 22px;
    height: 22px;
    border-radius: 50%;
    background: #1d4ed8;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rd-result-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rd-icon-btn {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: var(--mbh-text-secondary);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.rd-icon-btn:hover {
    background: var(--mbh-accent-tint);
    color: var(--mbh-accent-light);
}

.rd-hint {
    font-size: 12px;
    color: var(--mbh-text-muted);
    margin: 0;
}

.rd-empty {
    font-size: 13px;
    color: var(--mbh-text-muted);
    margin: 8px 0;
}

.rd-muted { color: var(--mbh-text-muted); font-size: 12px; }

.rd-stats {
    display: flex;
    gap: 20px;
}

.rd-stats > div { display: flex; flex-direction: column; }
.rd-stat-num { font-size: 20px; font-weight: 700; color: var(--mbh-text-primary); }
.rd-stat-label { font-size: 12px; color: var(--mbh-text-muted); }

.rd-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    background: var(--mbh-surface-dark);
    border-radius: 10px;
    padding: 2px;
    align-self: flex-start;
}

.rd-details summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.rd-save-row { margin-top: 4px; }

/* Rute-liste */
.rd-route-list li {
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: 10px;
    padding: 2px 2px 2px 0;
}

.rd-route-list li.active { background: var(--mbh-accent-tint); }
.rd-route-list li:hover { background: rgba(255, 255, 255, 0.05); }

.rd-route-main {
    flex: 1;
    min-width: 0;
    text-align: left;
    background: none;
    border: none;
    color: inherit;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rd-route-name {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rd-route-meta { font-size: 12px; color: var(--mbh-text-muted); }

/* Bogmærkelag */
.rd-layer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 0;
}

.rd-layer-head {
    display: flex;
    align-items: center;
    gap: 2px;
}

.rd-layer-toggle {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: inherit;
    padding: 6px 0;
    cursor: pointer;
    text-align: left;
}

.rd-layer-name {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rd-layer-empty { padding-left: 30px; }

.rd-layer-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.rd-bm-list li {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-left: 26px;
}

.rd-bm-main {
    flex: 1;
    min-width: 0;
    text-align: left;
    background: none;
    border: none;
    color: inherit;
    padding: 5px 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    border-radius: 6px;
}

.rd-bm-main:hover { background: rgba(255, 255, 255, 0.05); }

.rd-bm-note {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Bogmærke-pin (bruges både på kortet og i lister/dialoger) */
.rd-bm { background: none; border: none; }

.rd-bm-pin {
    width: 26px;
    height: 26px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    flex: 0 0 auto;
}

.rd-bm-glyph {
    transform: rotate(45deg);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.rd-bm-pin-sm { width: 20px; height: 20px; }
.rd-bm-pin-sm .rd-bm-glyph { font-size: 10px; }

.rd-bm-popup { font-family: var(--mbh-font-body); color: #222; }
.rd-bm-popup-layer { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.rd-bm-popup-name { font-size: 14px; font-weight: 700; margin: 2px 0; }
.rd-bm-popup-note { font-size: 12px; color: #555; white-space: pre-wrap; margin-bottom: 6px; }
.rd-bm-popup-actions { display: flex; gap: 6px; margin-top: 6px; }

.rd-bm-popup-actions button {
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
}

.rd-bm-popup-actions button:first-child {
    background: var(--mbh-accent);
    border-color: var(--mbh-accent-dark);
    color: #1a221e;
    font-weight: 600;
}

/* Lag-dialog: farver og ikoner */
.rd-swatches,
.rd-icon-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rd-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
}

.rd-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--mbh-accent); }

.rd-icon-choice {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.rd-icon-choice.selected { border-color: var(--mbh-accent); }

/* Leaflet-markører til editoren */
.rd-wp, .rd-mid, .rd-km, .rd-sr, .rd-arrow, .rd-me { background: none; border: none; }

.rd-wp-dot {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    cursor: grab;
}

.rd-mid-dot {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    border: 2px solid rgba(217, 140, 63, 0.8);
    cursor: grab;
    transition: transform 0.1s;
}

.rd-mid-dot:hover { transform: scale(1.3); background: #fff; }

.rd-km-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    color: #5C3510;
    border: 2px solid #D98C3F;
    font-size: 9px;
    font-weight: 700;
    font-family: var(--mbh-font-body);
}

.rd-sr-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1d4ed8;
    color: #fff;
    border: 2px solid #fff;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--mbh-font-body);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    cursor: pointer;
}

.rd-me { position: relative; }

.rd-me-dot {
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #fff;
}

.rd-me-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.35);
    animation: rd-pulse 1.8s ease-out infinite;
}

@keyframes rd-pulse {
    from { transform: scale(0.6); opacity: 1; }
    to { transform: scale(1.8); opacity: 0; }
}

/* Højdeprofil */
.rd-elev { margin-top: 6px; }
.rd-elev-status { font-size: 12px; color: var(--mbh-text-muted); margin: 4px 0; }

.rd-elev-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--mbh-text-secondary);
    margin-bottom: 4px;
}

.rd-elev-svg {
    width: 100%;
    height: 120px;
    display: block;
}

@media (max-width: 959.98px) {
    .rd-layout {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        min-height: 0;
    }

    .rd-map-col { height: 55vh; min-height: 320px; }
    .rd-layout.expanded .rd-map-col { height: calc(100vh - 160px); }
    .rd-panel { overflow: visible; }
}

/* ------------------------------------------------------------ Rejse (offentlig transport) */

@media (max-width: 420px) {
    .rd-tab { font-size: 12px; gap: 2px; }
}

.rd-transit-field {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.rd-transit-when {
    flex-wrap: nowrap;
}

.rd-transit-when > * { flex: 1; min-width: 0; }

.rd-transit-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rd-transit-card {
    background: var(--mbh-surface-dark);
    border-radius: 10px;
    overflow: hidden;
}

.rd-transit-head {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
    background: none;
    border: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.rd-transit-head:hover { background: rgba(255, 255, 255, 0.04); }

.rd-transit-time {
    font-size: 16px;
    font-weight: 700;
    color: var(--mbh-text-primary);
}

.rd-transit-lines {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.rd-line-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--mbh-accent);
    color: #1a221e;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.rd-transit-steps {
    list-style: none;
    margin: 0;
    padding: 0 12px 4px;
    font-size: 13px;
}

.rd-transit-steps li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.rd-transit-walk { color: var(--mbh-text-muted); }
