/* trailforks-map_universal.css — Styles for the universal map page */

/* 2. Rail / Sidebar Navigation — Menu & Dropdowns */
/* Menu trigger arrow — hidden until rail is hovered */
.tf-map-rail-menu-btn {
    display: flex;
    position: absolute;
    align-items: center;
    justify-content: center;
    left: 7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e1e1e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    cursor: pointer;
    color: #333;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease, background 150ms ease;
    flex-shrink: 0;
    z-index: 10;
}
.tf-map-rail:hover .tf-map-rail-menu-btn {
    opacity: 1;
    pointer-events: auto;
}
.tf-map-rail-menu-btn.is-open {
    opacity: 1;
    pointer-events: auto;
    background: #f3f3f3;
}
.tf-map-rail-menu-btn svg {
    display: block;
    transition: transform 200ms ease;
}
.tf-map-rail-menu-btn.is-open svg {
    transform: rotate(180deg);
}
/* Dropdown panel */
.tf-map-rail-menu-dropdown {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    width: 220px;
    max-height: calc(100vh);
    overflow-y: auto;
    overflow-x: hidden;
    background: #1a1a1a;
    color: #fff;
    box-shadow: 4px 0 16px rgba(0,0,0,.35);
    z-index: 3100;
    border-radius: 0 8px 8px 0;
}
.tf-map-rail-menu-dropdown.is-open {
    display: block;
}
#menu li .opener {
    margin-right: 20px;
}
.mapv2 #menu {
    width: 100%;
    background: #29691f;
    z-index: 800;
}
.mapv2 #menu li {
    display: block;
    width: 100%;
    text-align: left; }
.mapv2 #menu li a {
    width: 95%!important; }
.mapv2 #menu li .submenu ul li {
    border-top: none!important; }
.mapv2 #menu li .submenu > ul li a {
    padding-left: 30px!important; }
.mapv2 #menu li > a:hover {
    background: inherit; }
.mapv2 #menu .submenu {
    position: relative;
    width: 100% !important;
    box-shadow: none!important;
    background-color: #1f4a19!important; }
.mapv2 #menu > li:first-child a {
    padding-left: 10px!important; }
/* Loading state */
.tf-map-rail-menu-dropdown .tf-rail-menu-loading {
    padding: 20px;
    color: #aaa;
    font-size: 13px;
    text-align: center;
}
/* Style the injected #menu like mobile nav */
.tf-map-rail-menu-dropdown #menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tf-map-rail-menu-dropdown #menu > li {
    border-bottom: 1px solid rgba(255,255,255,.07);
}
/* Submenus inside the rail dropdown: hidden by default, click-toggled only */
.tf-map-rail-menu-dropdown #menu .submenu {
    display: none;
    position: static !important;
    width: auto !important;
    box-shadow: none !important;
    background-color: rgba(255,255,255,.05) !important;
    min-width: 0 !important;
    margin: 0 !important;
    z-index: auto !important;
}
.tf-map-rail-menu-dropdown #menu .submenu.is-open {
    display: block;
}
.mapv2 #tfAdventureModes {
    display: block;
}
/* Parent toggle button styling */
.tf-map-rail-menu-dropdown #menu .tf-rail-parent {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}
.tf-map-rail-menu-dropdown #menu .tf-rail-parent:hover {
    background: rgba(255,255,255,.08);
}
.tf-map-rail-menu-dropdown #menu .tf-rail-parent .tf-rail-arrow {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 150ms ease;
    flex-shrink: 0;
}
.tf-map-rail-menu-dropdown #menu li.is-open > .tf-rail-parent .tf-rail-arrow {
    transform: rotate(180deg);
}
.tf-map-rail-menu-dropdown #menu .submenu ul {
    list-style: none;
    margin: 0;
    padding: 0 0 6px 0;
}
.tf-map-rail-menu-dropdown #menu .submenu ul li a:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
}

/* Hide greybox region blocks in this context */
.tf-map-rail-menu-dropdown #menu .submenu .greybox,
.tf-map-rail-menu-dropdown #menu .submenu .padding10 {
    display: none;
}
/* Hide floatright items (PRO, admin, Outside) */
.tf-map-rail-menu-dropdown #menu > li.floatright {
    display: none;
}
/* Hide mobile-hide items */
.tf-map-rail-menu-dropdown #menu > li.mobile-hide {
    display: none;
}
.tf-map-rail-logo svg {
    width: 60px;
    height: auto;
    display: block;
}
.tf-map-controls {
    margin-top: 20px;
    border-radius: 8px;
    gap: 4px;
    margin: 0 8px;
    padding: 8px;
    text-align: center;
    flex-direction: column;
    display: flex;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, .25);
}
.tf-map-controls h1 {
    font-size: 1em;
    margin-bottom: 5px;
}

/* Rail link hover/active/visual-detail styles */
.tf-map-rail-link {
    text-align: center;
}
.tf-map-rail-link:hover {
    color: #000000;
    text-decoration: none;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, .15);
}
.tf-map-rail-link[aria-expanded="true"]{
    color: rgb(41, 105, 31);
}
.tf-map-rail-link[aria-expanded="true"] svg *{
    fill: rgb(41, 105, 31);
}
/* Inline rail link variant (icon left, text right) */
.tf-map-rail-link.is-inline {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
}

/* 3. Floating Toolbar & Buttons — Visual Details */
.tf-map-floatbar > * {
    pointer-events: auto;
}
.tf-map-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 8px;
    padding: 2px 8px;
    min-width: 250px;
    height: 33px;
    max-width: min(520px, calc(100vw - 160px));
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.tf-map-search input {
    border: 0;
    outline: 0;
    background: transparent;
    width: 100%;
    font-size: 15px;
}
.tf-map-search button {
    border: 0;
    background: transparent;
    padding: 4px;
    cursor: pointer;
    color: #1C1D1F;
}
.tf-map-floatbtns {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.tf-map-floatbtn {
    background: #fff;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
    cursor: pointer;
    white-space: nowrap;
}
.tf-map-floatbtn .activityIcon {
    display: inline-block;
}
.tf-map-floatbtn[aria-expanded="true"] {
    border-color: rgb(41, 105, 31);
}
/* Filters button active indicator (small green dot) */
.tf-map-floatbtn--hasdot {
    position: relative;
}
.tf-map-floatbtn--dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgb(41, 105, 31);
    border: 2px solid #fff;
    display: none;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    pointer-events: none;
}
.tf-map-floatbtn--hasfilters .tf-map-floatbtn--dot {
    display: block;
}

/* 4. User Menu & Top Right Overlay Elements */
.tf-map-usermenu {
    position: absolute;
    top: calc(16px + var(--tf-pro-topbanner-h));
    right: 16px;
    z-index: 2600;
    pointer-events: none;
}
.tf-map-usermenu > * { pointer-events: auto; }
.tf-map-userbtn {
    width: 38px;
    height: 38px!important;
    border-radius: 999px;
    border: 2px solid #fff;
    background: #fff;
    padding: 0!important;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.22);
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tf-map-userbtn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tf-map-usermenu .user_menu_dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    z-index: 2601;
}
#notificationMenu {
    top: 10px;
    margin-right: 15px;
}
#notificationsDrop {
    top: 40px;
}
.weatherpanel {
    padding: 20px;
}

.tf-map-toptools {
    position: absolute;
    top: calc(66px + var(--tf-pro-topbanner-h));
    right: 14px;
    z-index: 2550;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    box-sizing: content-box;
    width: 36px;
    background: #fff;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
    padding: 6px 2px;
}
.tf-map-toptools.regwall svg {
    opacity: 0.3;
}
.tf-map-toptools > * { pointer-events: auto; }
.tf-map-toptools__label {
    width: 100%;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: rgba(0,0,0,.70);
    line-height: 1;
    padding: 6px 0 4px;
    user-select: none;
}
#tfMapTrailinfoBody .tf-detailpanel__content {
    overflow-x: hidden;
}
.tf-detailpanel.tf-detailpanel--trail {
    margin-bottom: 180px;
}
.tf-map-toptools__btn {
    box-sizing: content-box;
    width: auto;
    height: 38px;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    color: #1C1D1F;
    box-shadow: none;
}
.tf-map-toptools__btn:hover {
    background: rgba(0,0,0,.04);
}
.tf-map-toptools__btn svg {
    width: 18px;
    height: 18px;
    display: block;
}
/* Polygon drawing tool panel */
.tf-poly-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tf-poly-status {
    font-size: 13px;
    color: #555;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 8px 10px;
}
.tf-poly-stats {
    display: flex;
    gap: 14px;
    font-size: 13px;
}
.tf-poly-stats b {
    font-weight: 600;
}


/* ============================================================================
   FEATURE DETAIL PANEL — basemap interaction-layer click target.
   Shared by Gaia POIs, OSM POIs, and OSM ways/lines clicked on the mapv2.
   Renders inside the `featuredetail` panel section (parallel to
   `markedlocation`); reuses the `.tf-markedloc__*` info/section/weather
   chrome so the visual style matches "Refine Your Selection". The standard
   panel header (back / close) is provided by the universal floatpanel —
   we only paint the body + a sticky bottom action bar.
   ============================================================================ */

/* Narrow desktop width, same as markedlocation. */
@media screen and (min-width: 981px) {
    .tf-map-floatpanel[data-open-section="featuredetail"] {
        width: 340px;
    }
}

/* Title row: small grey-square feature pin + title stack on the right */
.tf-feature-titlerow {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0 6px;
}
.tf-feature-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f0f0f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* When the icon comes from the basemap layer (data-URL `<img>`), constrain
   it inside the 40×40 chip with a small inset and let it scale to fit. */
.tf-feature-icon__img {
    max-width: 28px;
    max-height: 28px;
    width: auto;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
}
/* Diff-snapshot icons — the basemap background has been keyed out, so we
   have an icon on transparent. Scale up to fill most of the chip with a
   small breathing inset; `contain` keeps the icon's aspect ratio intact. */
.tf-feature-icon__img--diff {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    padding: 4px;
    box-sizing: border-box;
}
.tf-feature-titlestack {
    flex: 1 1 auto;
    min-width: 0;
}
.tf-feature-title {
    font-size: 17px;
    font-weight: 700;
    color: #1C1D1F;
    line-height: 1.25;
    margin: 0 0 2px 0;
    word-break: break-word;
}
.tf-feature-subtitle {
    color: #6b6b6e;
    font-size: 13px;
}

/* Description block — sits in its own section row */
.tf-feature-description {
    color: #1C1D1F;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
}

/* Attribute table — sits inside a .tf-markedloc__section under the
   "Details" label so the divider line aligns with the other sections. */
.tf-feature-attrs {
    width: 100%;
    margin: 4px 0 0;
    border-collapse: collapse;
    font-size: 13px;
}
.tf-feature-attrs th,
.tf-feature-attrs td {
    padding: 6px 2px;
    border-bottom: 1px solid rgba(0,0,0,.06);
    text-align: left;
    vertical-align: top;
}
.tf-feature-attrs th {
    color: #6b6b6e;
    font-weight: 500;
    width: 38%;
    white-space: nowrap;
}
.tf-feature-attrs td {
    color: #1C1D1F;
    word-break: break-word;
}
.tf-feature-attrs tr:last-child th,
.tf-feature-attrs tr:last-child td {
    border-bottom: none;
}
.tf-feature-attrs a {
    color: #29691f;
    text-decoration: none;
}
.tf-feature-attrs a:hover {
    text-decoration: underline;
}
/* Drop the bottom border on the last visible row whether that's the final
   row of the always-shown tbody (collapsed state) or the final row of the
   expanded tbody. */
.tf-feature-attrs > tbody:last-child > tr:last-child > th,
.tf-feature-attrs > tbody:last-child > tr:last-child > td {
    border-bottom: none;
}
/* Show more / less link below the Details table — small green inline link
   that matches the rest of the panel's link styling. */
.tf-feature-attrs-toggle {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    color: #29691f;
    text-decoration: none;
    cursor: pointer;
}
.tf-feature-attrs-toggle:hover {
    text-decoration: underline;
}

/* Sticky bottom action bar — reuses `.tf-detailpanel__sticky-bottom` +
   `.tf-detailpanel__sticky-actions` (already styled by the trail / waypoint
   / routeplan detail panels) and `.button1` + `.tf-detailpanel__center-map-btn`
   for the buttons themselves. No bespoke button styling needed here. */

/* The global `.tf-detailpanel__sticky-bottom` rule pins via
   `position: absolute; bottom: 0; width: 100%;` with no `left` — so it
   inherits the static-left position. For other detail panels the
   `.tf-map-floatpanel--detailpanel` modifier zeroes out the body padding
   so static-left is 0 and the bar lines up flush. The feature panel
   doesn't get that modifier, so the body keeps its default `padding:
   12px 14px` and the bar drifts right by 14px (overflowing the panel by
   the same amount). Anchor it explicitly to both edges to cancel the
   shift. */
.tf-map-floatpanel[data-open-section="featuredetail"] .tf-detailpanel__sticky-bottom {
    left: 0;
    right: 0;
    width: auto;
}

/* In the narrow feature-detail panel the rounded panel corner can visually
   clip the Center icon chip at the far right. Add a touch more right inset
   so the chip clears the corner. Scoped to this section only. */
.tf-map-floatpanel[data-open-section="featuredetail"] .tf-detailpanel__sticky-actions {
    padding-right: 14px;
}

/* Share button — flash a small "Copied!" tooltip above the button on
   successful copy. */
.tf-feature-share-btn { position: relative; }
.tf-feature-share-btn.is-copied::after {
    content: 'Copied!';
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: #2e7d32;
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
}

/* Scroll the body when content exceeds the panel — but DON'T add a
   defensive `padding-bottom` for the sticky action bar. The sticky bar
   pins itself to the bottom via the flex column's `margin-top: auto`,
   so extra inset just leaves dead white space between content + buttons. */
.tf-map-floatpanel[data-open-section="featuredetail"] .tf-map-floatpanel__body {
    overflow-y: auto;
}
.tf-poly-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.tf-poly-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tf-poly-field-row {
    display: flex;
    gap: 14px;
}
.tf-poly-activitytypes {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 8px 10px;
}
.tf-poly-activitytypes summary::-webkit-details-marker { display: none; }
.tf-poly-activitytypes summary::before { content: '▶ '; font-size: 10px; }
details.tf-poly-activitytypes[open] > summary::before { content: '▼ '; }
.tf-poly-save-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 10px 0 6px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    z-index: 1;
}
#tfPolyActivityTypes .tf-toggle {
    display: flex;
    margin-bottom: 6px;
    font-size: 13px;
}

.tf-map-toptools__btn.is-active {
    background: #e8f4e8;
}
.tf-map-toptools__btn.is-active svg path,
.tf-map-toptools__btn.is-active svg circle {
    fill: #29691f;
    stroke: #29691f;
}

/* ── Map Legend ────────────────────────────────────────────────────── */
.tf-map-legend-btn {
    position: absolute;
    bottom: 225px;
    right: 10px;
    z-index: 110;
    width: 29px;
    height: 31px;
    background: #fff;
    border: none;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(0,0,0,.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 150ms;
}
.tf-map-legend-btn:hover,
.tf-map-legend-btn.is-open {
    background: #e8f4e8;
}
.tf-map-legend-btn svg path {
    fill: #333;
}
.tf-map-legend-btn.is-open svg path {
    fill: #29691f;
}
.tf-map-legend-panel {
    position: absolute;
    bottom: 10px;
    right: 48px;
    z-index: 2549;
    width: 240px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.22);
    display: none;
    flex-direction: column;
}
.tf-map-legend-panel.is-open {
    display: flex;
}
.tf-map-legend-panel__header {
    padding: 10px 12px 6px;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tf-map-legend-panel__refresh {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 14px;
    color: #888;
    border-radius: 4px;
    line-height: 1;
}
.tf-map-legend-panel__refresh:hover { color: #333; background: #f0f0f0; }
.tf-map-legend-panel__list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}
.tf-map-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    cursor: default;
    border-radius: 4px;
    margin: 1px 4px;
    font-size: 13px;
    transition: background 100ms;
    user-select: none;
}
.tf-map-legend-item:hover {
    background: #f0f6f0;
}
.tf-map-legend-item.is-highlighted {
    background: #e2f0e2;
}
.tf-map-legend-item__swatch {
    width: 22px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.08);
}
.tf-map-legend-item__swatch--line {
    height: 4px;
    border-radius: 2px;
    border: none;
    margin: 5px 0;
}
.tf-map-legend-item__swatch--dashed {
    background: repeating-linear-gradient(
        90deg,
        currentColor 0px, currentColor 6px,
        transparent 6px, transparent 10px
    );
    height: 3px;
    border: none;
}
.tf-map-legend-item__swatch--circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: none;
}
.tf-map-legend-item__swatch--icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border: none;
    background: none;
}
.tf-map-legend-item__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tf-map-legend-item__sublabel {
    font-size: 11px;
    color: #888;
    margin-left: auto;
    flex-shrink: 0;
}
.tf-map-legend-empty {
    padding: 16px 12px;
    color: #888;
    font-size: 13px;
    font-style: italic;
    text-align: center;
}
/* Dim overlay for highlight mode */
.tf-map-legend-dim {
    /* applied as a Mapbox paint property via JS — no CSS needed */
}


.tf-map-pinned-layer-btn {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 6px;
    max-width: 120px;
    font-size: 11px;
    margin-bottom: 5px;
    margin-top: 6px;
    position: relative;
    accent-color: #29691f;
}
.tf-map-pinned-layer-btn .layer-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 5px;
    cursor: pointer;
}
.tf-map-pinned-layer-btn .close-btn {
    display: none;
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
}
.tf-map-pinned-layer-btn:hover .close-btn {
    display: inline;
}
#filter_scroll, #results_scroll {
    padding-bottom: 60px;
}

/* 5. Floating Panels — Content Styles */
.tf-map-floatpanel.is-narrow {
    width: 265px;
}
.tf-map-floatpanel.is-wide {
    width: 600px;
}
.tf-map-floatpanel[data-open-section="polygon"] {
    width: 380px;
}
.tf-map-floatpanel[data-open-section="savedrail"] {
    width: 380px;
}
.tf-map-floatpanel[data-open-section="collection"] {
    width: 380px;
}
.tf-map-floatpanel[data-open-section="savedrail"] .tf-map-floatpanel__body {
    height: calc(100vh - 160px - var(--tf-pro-topbanner-h));
}
.tf-map-floatpanel__header {
    display: grid;
    grid-template-columns: max-content 1fr max-content;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0,0,0,.08);
    column-gap: 10px;
}
.tf-map-floatpanel__header > .tf-map-floatpanel__headeractions {
    margin-right: -10px;
}
.tf-map-floatpanel__titlewrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}
.tf-map-floatpanel__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1C1D1F;
    justify-self: center;
    text-align: center;
}
.tf-map-floatpanel__titlelink {
    display: none; /* enabled per section */
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    color: #1C1D1F;
    text-decoration: none;
    cursor: pointer;
    flex: 0 0 auto;
}
.tf-map-floatpanel__titlelink:hover {
    background: rgba(0,0,0,.04);
    text-decoration: none;
}
.tf-map-floatpanel__titlelink svg {
    width: 14px;
    height: 14px;
    display: block;
}
.tf-map-floatpanel__close {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    color: #1C1D1F;
    justify-self: end;
    margin-left: auto;
}
/* Mobile-only chevron toggle to expand the panel to full screen height */
.tf-map-floatpanel__expand-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 28px;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #1C1D1F;
    padding: 0;
    flex-shrink: 0;
}
.tf-map-floatpanel__expand-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform .2s ease;
}
.tf-map-floatpanel.is-expanded .tf-map-floatpanel__expand-toggle svg {
    transform: rotate(180deg);
}
/* Shared dropdown panel overlay used in detail panels (collections, routeplans, etc.) */
.tf-panel-dropdown {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: #fff;
    border: 1px solid #d7d8dc;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    padding: 12px 14px;
    overflow: visible;
}
.tf-panel-dropdown__body {
    max-height: calc(80vh - 60px);
    overflow-y: auto;
}
.tf-panel-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.tf-panel-dropdown__title {
    font-size: 14px;
    font-weight: 700;
    color: #1c1d1f;
}
.tf-panel-dropdown__close {
    border: 0;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    padding: 2px 6px;
}
.tf-panel-dropdown__close:hover {
    color: #1c1d1f;
}
.tf-map-floatpanel__detailmenu {
    position: relative;
    display: flex;
    align-items: center;
}
.tf-map-floatpanel__detailmenubtn {
    font-size: 20px;
    line-height: 1;
    padding: 2px 6px;
}
.dropcontents.tf-map-floatpanel__detailmenudrop {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    z-index: 200;
    display: none;
    background: #fff;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.14);
    padding: 4px 0;
    margin-top: 0;
}
.tf-map-floatpanel__detailmenudrop.is-open {
    display: block;
}
.tf-map-floatpanel__detailmenudrop ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tf-map-floatpanel__detailmenudrop li a,
.tf-map-floatpanel__detailmenudrop li span {
    display: block;
    padding: 9px 16px;
    font-size: 14px;
    color: #1C1D1F;
    text-decoration: none;
    white-space: nowrap;
}
.tf-map-floatpanel__detailmenudrop li a:hover {
    background: rgba(0,0,0,.05);
}
.tf-map-floatpanel__detailmenudrop li a.red { color: #c00; }
.tf-map-floatpanel__body {
    padding: 12px 14px;
    overflow-y: auto;
    max-height: calc(100vh - 160px - var(--tf-pro-topbanner-h));
    -webkit-overflow-scrolling: touch;
}
.tf-map-floatpanel__section {
    display: none;
}
.tf-map-floatpanel__section.is-active {
    display: block;
}

/* Subheader & Back Button */
.tf-map-floatpanel__subheader {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 12px 0;
    border-bottom: 1px solid rgba(0,0,0,.08);
    margin-bottom: 12px;
}
.tf-map-floatpanel__back {
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    line-height: 1;
    font-size: 16px;
}
.tf-map-floatpanel__subtitle {
    font-weight: 700;
    color: #1C1D1F;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tf-map-floatpanel__headerback {
    padding: 4px 6px;
    border-radius: 8px;
    background-color: #fff;
    border: 1px solid #d9d9d9;
    color: #1C1D1F;
    cursor: pointer;
    font-weight: bold;
}
#mlv2CustomFormBar {
    grid-column: 1 / 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
}
.tf-map-dark #mlv2CustomFormBar {
    background: #1e1e1e;
}
#mlv2CustomFormBarTitle {
    font-size: 15px;
    font-weight: bold;
}
#mlv2CustomFormBackBtn {
    padding: 4px 6px;
    border-radius: 8px;
    background-color: #fff;
    border: 1px solid #d9d9d9;
    color: #1C1D1F;
    cursor: pointer;
    font-weight: bold;
}
.tf-map-dark #mlv2CustomFormBackBtn {
    background-color: #2a2a2a;
    border-color: #555;
    color: #eee;
}

/* Header Actions & Search */
.tf-map-floatpanel__headeractions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    justify-self: end;
    width: auto;
}
.tf-map-floatpanel__headerbtn {
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    cursor: pointer;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1;
    color: #1C1D1F;
    white-space: nowrap;
}
.tf-map-floatpanel__headerbtn:hover {
    background: rgba(0,0,0,.04);
}
.tf-map-floatpanel__headerbtn--red {
    color: #d32f2f;
    border-color: rgba(211, 47, 47, 0.2);
}
.tf-map-floatpanel__headerbtn--red:hover {
    background: rgba(211, 47, 47, 0.05);
    border-color: rgba(211, 47, 47, 0.4);
}
.tf-map-floatpanel__headerbtn.is-active,
.tf-map-floatpanel__headerbtn[aria-pressed="true"] {
    border-color: rgb(41, 105, 31);
    box-shadow: 0 0 0 2px rgba(41,105,31,.15);
}
.tf-map-floatpanel__headersearch-wrap {
    position: relative;
    flex: 1;
    min-width: 70px;
    max-width: 200px;
}
.tf-map-floatpanel__headersearch {
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 8px;
    padding: 6px 26px 6px 10px;
    font-size: 13px;
    line-height: 1;
    outline: none;
    box-sizing: border-box;
}
.tf-map-floatpanel__headersearch::-webkit-search-cancel-button {
    -webkit-appearance: none;
    display: none;
}
.tf-map-floatpanel__headersearch-clear {
    display: none;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.15);
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    color: #fff;
    cursor: pointer;
    padding: 0;
}
.tf-map-floatpanel__headersearch-clear.is-visible {
    display: block;
}
.tf-map-floatpanel__headersearch-clear:hover {
    background: rgba(0,0,0,.3);
}

/* 6. Panel Content-Specific Styles */

/* Layers */
.map_layers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.map_layers__item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Discover */
.tf-map-discover {
    min-height: calc(100vh - 140px - var(--tf-pro-topbanner-h));
    padding-bottom: 150px;
}
.tf-map-floatpanel [data-section="discover"] .results_scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 16px;
}

/* Finder */
.tf-map-finder {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 40px;
    min-height: calc(100vh - 140px);
}
.tf-map-finder__list {
    flex: 1 1 auto;
    min-width: 0;
}
.tf-map-finder__list.is-hidden {
    display: none;
}
.tf-map-finder__filters {
    width: 100%;
}
.tf-map-finder__filters thead {
    display: none;
}
.tf-map-finder__filters.is-hidden {
    display: none;
}

/* Reports & Weather */
#results_scroll_reports {
    min-height: calc(100vh - 140px - var(--tf-pro-topbanner-h));
    padding-bottom: 50px !important;
}
.newReports {
    display: none;
}

/* 7. Integration / Library & System Overrides */
.map #proUpgradeBanner {
    top: unset!important;
    bottom: 45px!important;
    left: 15px!important;
    right: unset!important;
}
.ui-dialog {
    top: 60px!important;
    left: 115px!important;
}
.mapv2 #mapControlBoxes {
    right: 70px !important;
    top: 67px !important;
    left: unset;
}
.regwall_enabled input.regwall {
    opacity: 0.3;
}
#mapControlBoxes {
    display: grid;
    grid-auto-flow: row;
    grid-auto-rows: max-content;
    justify-items: end;
    align-items: start;
    gap: 15px;
}
#mapControlBoxes > .controlBox {
    justify-self: end;
}
.map .doGeolocation {
    width: 30px;
    padding: 3px 0;
    text-align: center;
    bottom: 35px;
    top: unset!important;
}
#map3dtoggle {
    bottom: 80px;
}
.mapboxgl-ctrl-top-right {
    bottom: 115px;
    top: unset!important;
}
.results_scroll.padding10, .results_scroll.padding5 {
    padding: 0!important;
}
#browseReportsMap tr {
    background-color: transparent;
}
#browseReportsMap td:nth-child(3) {
    max-width: 70px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
#browseReportsMap td:nth-child(4) {
    text-align: right;
}
.mapv2 #sidebarHeader {
    background-color: transparent;
    padding: 1px;
    margin-bottom: 10px;
}
.mapv2 #sidebarHeader a {
    display: inline-block;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #f3f3f3;
    color: #1C1D1F;
    padding: 4px 8px;
}
.mapv2 #mapWindow {
    margin: 70px 0 0 20px;
    border-radius: 8px;
    border-top: 0;
}
.mapv2 #mapWindow .content-container {
    margin: 15px;
}
#maproutes {
    border-radius: 8px;
    margin-top: 20px;
}

.tf-map-floatpanel--detailpanel .tf-map-floatpanel__header {
    display: none;
}
.tf-map-floatpanel--detailpanel-nohero .tf-map-floatpanel__header {
    display: grid;
}
.tf-map-floatpanel--detailpanel .tf-map-floatpanel__body {
    padding: 0;
    max-height: calc(100vh - 92px - var(--tf-pro-topbanner-h));
    overflow: hidden;
}
.tf-map-floatpanel[data-open-section="trailinfo"] .tf-map-floatpanel__body {
    overflow-y: auto;
}
.tf-detailpanel__sticky-bottom {
    position: absolute;
    bottom: 0;
    width: 100%;
}
.tf-detailpanel__route-trails-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}
.tf-detailpanel__route-trail-row {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.tf-detailpanel__route-trail-row:last-child {
    border-bottom: none;
}
.tf-detailpanel__route-trail-row .floatright {
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}
body.mapv2 .tf-search-modal .featherlight-content {
    border: none!important;
    border-radius: 8px!important;
    top: 65px!important;
    left: 115px!important;
    overflow-x: hidden!important;
}
.tf-map-floatpanel__section .content-container {
    margin: unset;
    padding: unset;
    overflow-x: unset;
    overflow-y: unset;
}
.tf-map-floatpanel__section #maproutes {
    margin-top: 0;
}

/* ---------------------------------------------------------------------------
   Marked Location panel — Gaia-style side panel that replaces the legacy
   floating context menu / "Refine Your Selection" popup on the v2 map.
   --------------------------------------------------------------------------- */
.tf-markedloc {
    display: flex;
    flex-direction: column;
}
/* Narrow panel for the Marked Location section on desktop (mobile keeps the
   shared bottom-sheet rules). Wide enough to fit the action button row. */
@media screen and (min-width: 981px) {
    .tf-map-floatpanel[data-open-section="markedlocation"] {
        width: 340px;
    }
}
.tf-markedloc__info {
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.tf-markedloc__inforow {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 2px;
    border-top: 1px solid rgba(0,0,0,.08);
}
.tf-markedloc__inforow:first-child {
    border-top: none;
}
.tf-markedloc__label {
    color: #6b6b6e;
    font-size: 14px;
}
.tf-markedloc__value {
    margin-left: auto;
    font-weight: 700;
    font-size: 16px;
    color: #1C1D1F;
}
.tf-markedloc__inforow--coords {
    cursor: pointer;
}
.tf-markedloc__inforow--coords .tf-markedloc__value {
    margin-left: auto;
}
.tf-markedloc__copyicon {
    display: inline-flex;
    align-items: center;
    color: #8a8a8d;
    flex: 0 0 auto;
}
.tf-markedloc__copyicon svg {
    width: 18px;
    height: 18px;
}
.tf-markedloc__inforow--coords:hover .tf-markedloc__copyicon {
    color: #508446;
}

/* Action button row + overflow menu */
.tf-markedloc__actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.tf-markedloc__btn {
    /* Flex so the two primary buttons share the row and never overflow the
       narrow panel; the overflow menu keeps its fixed size. */
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 8px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    color: #2e7d32;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.tf-markedloc__btn span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.tf-markedloc__btn:hover {
    background: rgba(46,125,50,.06);
    border-color: rgba(46,125,50,.4);
}
.tf-markedloc__btn svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}
.tf-markedloc__menuwrap {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}
.tf-markedloc__menubtn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    color: #1C1D1F;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.tf-markedloc__menubtn:hover {
    background: rgba(0,0,0,.05);
}
.tf-markedloc__menu {
    /* Fixed so it escapes the panel body's overflow clipping; the open
       handler positions it under the button via getBoundingClientRect. */
    position: fixed;
    min-width: 200px;
    z-index: 2600;
    display: none;
    background: #fff;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.14);
    padding: 4px 0;
}
.tf-markedloc__menu.is-open {
    display: block;
}
.tf-markedloc__menuitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: #1C1D1F;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.tf-markedloc__menuitem:hover {
    background: rgba(0,0,0,.05);
}
.tf-markedloc__menuitem svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: #6b6b6e;
}

.tf-markedloc__distance {
    padding: 12px 2px;
    font-size: 14px;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

/* Sections (Current Weather, Points of Interest) */
.tf-markedloc__section {
    padding: 14px 0;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.tf-markedloc__section:last-child {
    border-bottom: none;
}
.tf-markedloc__poi .widebutton {
    width: 100%;
}
/* Keep long POI names/labels from overflowing the panel — truncate with an
   ellipsis instead. min-width:0 lets the grid columns shrink below content.
   Scoped to the text spans only — the leading icon span (a 0fr track) must keep
   its natural width so the difficulty icon stays visible. */
.tf-markedloc__poi .widebutton > span.large,
.tf-markedloc__poi .widebutton > span.small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Reserve space for the async weather widget so the panel doesn't reflow. */
.tf-markedloc__weather {
    min-height: 46px;
    display: flex;
    align-items: center;
}
/* Make the metric items (high / low / rain) share the row equally so the
   weather strip fills the section width instead of clumping on the left.
   The first `<li>` is the icon — opt it out of the equal-share so the
   metrics aren't shoved together by a stretched icon column. */
.tf-markedloc__weather .weather_tooltip {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}
.tf-markedloc__weather .weather_tooltip > li {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    line-height: 1.2;
}
.tf-markedloc__weather .weather_tooltip > li:first-child {
    flex: 0 0 auto;
    text-align: left;
}
.tf-markedloc__weather .weather_tooltip > li > div {
    margin-top: 2px;
}

/* Waypoint add panel — content scrolls inside floatpanel__body, submit bar sits at the bottom */
#tfWaypointPanelBody {
    min-height: calc(100vh - 200px - var(--tf-pro-topbanner-h));
}

/* Sticky bottom action bar shared by finder, discover, waypoint panels */
.bottomBlock {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #e1e1e1;
    padding: 10px 0;
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tf-map-dark .bottomBlock {
    background: #1e1e1e;
    border-top-color: #333;
}
#waypointBottomSave #submitAjax {
    flex: 1;
}

#mapRegionHint {
    right: 50px!important;
}
#backdrop.active {
    display: none!important;
}
.table1 .highlight, .table1 tr.highlight td {
    background-color: #fcf7d4;
}

/* Detail panel styles */
.tf-detailpanel {
    background-color: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 100px;
}
.tf-detailpanel .h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
}
.tf-map-floatpanel #mapWindowContent a {
    color: unset;
}
.tf-detailpanel__scroll {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}
.tf-detailpanel__top-actions {
    position: sticky;
    top: 0;
    height: 0;
    z-index: 9;
}

.tf-detailpanel__hero {
    position: relative;
    min-height: 250px;
    background: #111111;
}
.tf-detailpanel__hero_empty {
    height: 35px;
}
.tf-detailpanel__hero-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    z-index: 7;
}
.tf-detailpanel__hero-back,
.tf-detailpanel__hero-menu-btn,
.tf-detailpanel__hero-close {
    position: absolute;
    top: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.62);
    cursor: pointer;
}
.tf-detailpanel__hero-back {
    left: 10px;
    z-index: 7;
}
.tf-map-shell--map-direct-detail .tf-detailpanel__hero-back {
    display: none;
}
.tf-detailpanel__hero-menu-btn,
.tf-detailpanel__hero-close {
    position: static;
}
.tf-detailpanel__hero-menu-btn {
    font-size: 20px;
    line-height: 1;
}
.tf-detailpanel__hero-close svg {
    vertical-align: middle;
}

.tf-detailpanel__top-actions .dropcontents {
    margin-top: 0;
    top: 48px;
    right: 10px;
    z-index: 8;
    min-width: 160px;
}
.tf-detailpanel__top-actions .dropcontents.is-open {
    display: block;
}
#results_list_finder {
    margin-bottom: 50px;
}
#results_list_finder td:nth-child(2) {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#results_list_finder td:nth-child(3),
#results_list_finder td:nth-child(4),
#results_list_finder td:nth-child(5) {
    font-size: 90%;
}
#results_list_finder thead {
    display: none;
}
#working {
    top: 67px;
    right: 70px;
}
.tf-detailpanel__content {
    padding: 20px;
    /*padding-bottom: 60px;*/
}
#tfMapFloatpanel .tf-detailpanel__title {
    margin: 0 0 4px 0;
    font-size: 28px;
    line-height: 34px;
    letter-spacing: -0.4px;
    color: #000000;
    text-overflow: ellipsis;
    overflow: hidden;
}
.tf-detailpanel__meta {
    display: flex;
    gap: 8px;
    align-items: center;
    color: rgba(60, 60, 67, 0.6);
    margin-bottom: 12px;
    font-size: 14px;
}
.tf-detailpanel__meta .dicon_small {
    font-size: 100%;
}
.tf-detailpanel__activity-types {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tf-detailpanel__rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.tf-detailpanel__stars .is-on {
    color: #111111;
}
.tf-detailpanel__stars .is-off {
    color: #d0d0d0;
}
.tf-detailpanel__popularity {
    color: #ffffff;
    background-color: #222222;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 12px;
}

.tf-detailpanel__stats {
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #ececec;
    background: #ffffff;
    padding: 10px 8px;
}
.tf-detailpanel__stats-flex {
    display: flex;
    overflow: hidden;
    justify-content: space-evenly;
    gap: 10px;
    width: 100%;
    zoom: 0.8;
}
.tf-detailpanel__stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    align-items: start;
}
.tf-detailpanel__stat {
    text-align: center;
}
.tf-detailpanel__stat .dicon_small {
    font-size: 100%;
}
.tf-detailpanel__stat-value {
    font-size: 24px;
    line-height: 26px;
    letter-spacing: -0.3px;
    font-weight: 700;
    color: #000000;
    white-space: nowrap;
}
.tf-detailpanel__stat-label {
    color: #7f7f7f;
    font-size: 12px;
    line-height: 14px;
    margin-top: 4px;
}

.tf-detailpanel__status-card {
    border-radius: 5px;
    padding: 16px 14px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.tf-detailpanel__status-card--ok {
    border: 1px solid rgba(70, 180, 20, 0.30);
    background: rgba(70, 180, 20, 0.05);
}
.tf-detailpanel__status-card--warn {
    border: 1px solid rgba(255, 201, 0, 0.40);
    background: rgba(255, 201, 0, 0.05);
}
.tf-detailpanel__status-card--closed {
    background-color: #fcf2f2;
    border: 1px solid rgba(204, 1, 0, 0.20);
}
.external-link > svg {
    color: #000000;
    width: 18px;
    height: 18px;
}
.tf-detailpanel__status-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.tf-detailpanel__status-header:last-child {
    margin-bottom: 0;
}
.tf-detailpanel__status-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tf-detailpanel__status-title-wrap {
    flex: 1 1 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.tf-detailpanel__status-title {
    color: #232323;
    font-size: 17px;
    line-height: 22px;
    letter-spacing: -0.4px;
    font-weight: 600;
}
.tf-detailpanel__status-date {
    color: rgba(60, 60, 67, 0.6);
    font-size: 15px;
    line-height: 20px;
}
.tf-detailpanel__status-text {
    color: #000000;
    font-size: 15px;
    line-height: 20px;
}
.tf-detailpanel__status-link {
    font-size: 13px;
    text-decoration: underline;
}
.tf-detailpanel__status-count {
    font-weight: 400;
    font-size: 14px;
    color: rgba(60, 60, 67, 0.8);
}
.tf-detailpanel__status-card a.inherit {
    color: inherit;
    text-decoration: none;
}
.tf-detailpanel__status-card a.inherit:hover {
    text-decoration: underline;
}
.tf-detailpanel__status-card.margin-top-15 {
    margin-bottom: 0;
}

.tf-detailpanel__description {
    margin: 12px 0;
    color: #222222;
}

.tf-detailpanel__metrics .label {
    color: #777777;
    font-weight: 600;
    display: inline-block;
    width: 150px;
}
.tf-detailpanel__metrics div {
    margin-bottom: 10px;
}
.tf-detailpanel__counts {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.tf-detailpanel__counts--inline {
    margin-bottom: 0;
    margin-left: auto;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}
.tf-detailpanel__count-link,
.tf-detailpanel__count-link:visited,
.tf-detailpanel__count-link:active {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #000000 !important;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    flex: 0 0 auto;
}
.tf-detailpanel__count-link:hover {
    color: #000000 !important;
    text-decoration: underline;
}
.tf-detailpanel__count-link svg {
    width: 16px;
    height: 16px;
}
.tf-detailpanel__count-value {
    font-size: 13px;
    font-weight: 700;
}

.tf-detailpanel__sticky-actions {
    position: relative;
    z-index: 4;
    background-color: #ffffff;
    border-top: 1px solid #ececec;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-top: auto;
}
.tf-detailpanel__sticky-actions .wishlist-button-snippet .button1 {
    margin: 0;
}
.tf-detailpanel__center-map-btn {
    margin-left: auto;
    flex-shrink: 0;
    padding: 6px 8px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fcfcfc;
}
.tf-detailpanel__center-map-btn .svgicon {
    width: 18px;
    height: 18px;
    display: block;
}
.tf-detailpanel__pin-btn {
    flex-shrink: 0;
    padding: 6px 8px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fcfcfc;
}
.tf-detailpanel__pin-btn .svgicon {
    width: 18px;
    height: 18px;
    display: block;
}
.tf-detailpanel__pin-btn.is-pinned {
    background: #e8f1fb;
    color: #1a7cc9;
    border-color: #1a7cc9;
}
.tf-detailpanel__pin-btn.is-pinned ellipse {
    fill: currentColor;
}
.tf-detailpanel__sticky-routes {
    position: relative;
    z-index: 5;
    background-color: #fec200;
    border-top: 1px solid #e2b200;
    padding: 8px 10px;
    flex: 0 0 auto;
}
.tf-detailpanel__route {
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Photo slideshow */
.tf-detailpanel-photo {
    min-height: 250px;
    height: 250px;
    overflow: hidden;
    position: relative;
    background-color: #111111;
}
/* Hero expand handle — duplicates tfMapFloatpanelExpandToggle in a more
   reachable spot on mobile when a detail panel has a tall hero photo. */
.tf-detailpanel__hero-expand-handle {
    display: none;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.45);
    color: #ffffff;
    cursor: pointer;
    z-index: 8;
    align-items: center;
    justify-content: center;
}
.tf-detailpanel__hero-expand-handle::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #ffffff;
}
.tf-map-floatpanel.is-expanded .tf-detailpanel__hero-expand-handle::before {
    opacity: 0.6;
}
.tf-detailpanel-photo__track,
.tf-detailpanel-photo__slide {
    height: 100%;
}
.tf-detailpanel-photo__slide {
    display: none;
    background-size: cover;
    background-position: center;
}
.tf-detailpanel-photo__slide.is-active {
    display: block;
}
.tf-detailpanel-photo__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: rgba(0, 0, 0, 0.45);
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 6;
}
.tf-detailpanel-photo__nav.is-prev {
    left: 10px;
}
.tf-detailpanel-photo[data-at-start] .tf-detailpanel-photo__nav.is-prev {
    display: none;
}
.tf-detailpanel-photo__nav.is-next {
    right: 10px;
}
.tf-detailpanel-photo__count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    color: #ffffff;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 7px;
    border-radius: 4px;
    z-index: 6;
}
.tf-detailpanel-photo__tour-btn {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff!important;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.15s;
}
.tf-detailpanel-photo__tour-btn:hover,
.tf-detailpanel-photo__tour-btn:focus {
    background: rgba(0, 0, 0, 0.80);
    color: #ffffff;
    text-decoration: none;
}
.tf-detailpanel-photo__tour-icon {
    font-size: 10px;
    line-height: 1;
}
.tf-detailpanel-photo__slide--more {
    background-color: #000000;
    display: none;
}
.tf-detailpanel-photo__more-wrap {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.tf-detailpanel-photo__more-btn,
.tf-detailpanel-photo__more-btn:visited,
.tf-detailpanel-photo__more-btn:active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid #ffffff;
    border-radius: 6px;
    color: #ffffff !important;
    font-weight: 700;
    text-decoration: none;
    background: transparent;
}
.tf-detailpanel-photo__more-btn:hover {
    color: #ffffff !important;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.12);
}
.surfaceBreakdown {
    white-space: nowrap!important;
}
.surfaceBreakdown > span {
    display: inline-block;
    height: 30px;
    box-sizing: border-box;
    border-width: 0px;
}
.surfaceBreakdown > span::before, .surfaceBreakdown > span::after {
    border-width: 0px;
}

/* 8. Media Queries & Responsiveness — Non-CLS Rules */

/* Tablet / Small Desktops */
@media screen and (max-width: 980px) {
    .tf-map-finder {
        flex-direction: column;
    }
    .tf-savedrail__tab-count {
        display: none;
    }
    /* Show chevron toggle on mobile only */
    .tf-map-floatpanel__expand-toggle {
        display: inline-flex;
    }
    /* Show the hero grabber on the same mobile breakpoint */
    .tf-detailpanel__hero-expand-handle {
        display: inline-flex;
    }
    body.mapv2 .tf-search-modal .featherlight-content {
        left: 60px!important;
        max-width: 290px!important;
    }
    .tf-map-floatpanel.is-wide {
        width: auto;
    }
    .mapv2 #mapWindow {
        margin: 65px 5px 0 !important;
        z-index: 2600;
    }
}

/* Mobile (Landscape/Portrait) */
@media (max-width: 768px) {
    .tf-map-rail-logo svg {
        width: 34px;
    }
    .tf-map-rail-menu-btn {
        display: none;
    }
    .tf-map-controls {
        margin: 0;
        padding: 5px;
    }
    .tf-map-controls h1 {
        display: none;
    }
    .tf-map-rail-link span {
        display: none;
    }
    .tf-map-rail-link svg {
        width: 22px;
        height: 22px;
    }
    .tf-map-rail-link.is-inline {
        flex-direction: column;
        gap: 0;
    }

    /* Floatpanel Elements */
    .map_layers {
        grid-template-columns: 1fr;
    }
    .tf-map-floatpanel__headersearch {
        max-width: 60px;
    }
    #header_search, #navigation .header_button#search_button {
        display: unset!important;
    }

    /* Top Tools (Hide when panel is open) */
    .tf-map-toptools__btn {
        border-radius: 10px;
    }
    body.tf-map-panel-open .tf-map-toptools {
        display: none;
    }
    body:has(#tfMapFloatpanel.is-open) .tf-map-toptools {
        display: none;
    }
    body.tf-map-panel-open .tf-map-floatbtns {
        display: none;
    }
    body:has(#tfMapFloatpanel.is-open) .tf-map-floatbtns {
        display: none;
    }
    .tf-map-controls svg {
        display: block!important;
    }
    .bmv2-body {
        padding: 16px 0!important;
    }
    .bmv2-tabs {
        padding: 0!important;
    }
    .bmv2-group-list {
        grid-template-columns: 1fr!important;
    }
    .tf-map-floatbtns {
        position: absolute;
        top: 40px;
    }
    #results_scroll {
        padding: 0;
    }
    .tf-map-floatpanel__section {
        padding-bottom: 150px;
    }
    .tf-map-floatpanel--detailpanel .tf-map-floatpanel__section[data-section="trailinfo"] {
        padding-bottom: 0;
    }
    .tf-detailpanel__stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 12px;
    }
    .tf-detailpanel__stat-value {
        font-size: 20px;
        line-height: 22px;
    }
    .tf-detailpanel {
        margin-bottom: 180px;
    }
    .tf-detailpanel.tf-detailpanel--trail {
        margin-bottom: 280px;
    }
    .mapv2 #mapControlBoxes {
        top: 97px !important;
    }
    .tf-map-floatpanel__section[data-section="filters"] .makecols2 {
        display: block;
    }
    .tf-map-usermenu {
        right: 11px;
    }
    .tf-map-floatpanel[data-open-section="polygon"] .tf-map-floatpanel__body {
        max-height: calc(60vh - 160px - var(--tf-pro-topbanner-h));
    }
    .tf-map-floatpanel[data-open-section="polygon"] .tf-poly-save-bar {
        position: absolute;
        width: 100%;
    }
    .tf-map-floatpanel[data-open-section="waypoint"] .tf-map-floatpanel__body {
        max-height: calc(60vh - 160px - var(--tf-pro-topbanner-h));
    }
    .tf-map-banner--route,
    .tf-map-banner--isolate {
        top: calc(60px + var(--tf-pro-topbanner-h)) !important;
    }
    #notificationsDrop {
        max-width: 300px;
    }
}

/* Small Mobile */
@media (max-width: 420px) {
    #notificationMenu {
        margin-right: 12px!important;
    }
}

/* Short Viewports (Rail Adjustments) */
@media (max-height: 650px) {
    .tf-map-controls {
        padding: 6px;
        gap: 3px;
        margin: 0 6px;
    }
    .tf-map-controls h1 {
        display: none;
    }
    .tf-map-rail-link span {
        display: none;
    }
    .tf-map-rail-link svg {
        width: 22px;
        height: 22px;
    }
    .tf-map-rail-link.is-inline {
        flex-direction: column;
        gap: 0;
    }
    .tf-map-controls svg {
        display: block!important;
    }
}
@media (max-height: 800px) {
    .tf-map-controls svg {
        display: none;
    }
}
/* Dark mode icon swap */
.tf-darkmode-icon-sun { display: none; }
.tf-map-dark .tf-darkmode-icon-sun { display: inline; }
.tf-map-dark .tf-darkmode-icon-moon { display: none; }

/* ── Toast notifications ─────────────────────────────────────────────
   Generic auto-dismissing feedback toasts used across the map UI.
   Triggered via `window.tfMapToast(message, options)` in map_universal_js.php.
   Stacks at the bottom-center of the viewport; newest on top.
*/
.tf-toast-stack {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 13000;
    pointer-events: none;
    max-width: 90vw;
}
.tf-toast {
    background: #29691f;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    font-size: 14px;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: auto;
    word-wrap: break-word;
}
.tf-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.tf-toast--success { background: #29691f; }
.tf-toast--error   { background: #c43d2e; }
.tf-toast--info    { background: #1c1d1f; }

/* Saved panel — map views list rows */
#mapviewslist {
    list-style: none;
    margin: 0;
    padding: 0;
}
#mapviewslist li.tf-mapview-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 6px;
    border-radius: 5px;
    transition: background 100ms ease;
}
#mapviewslist li.tf-mapview-row:hover {
    background: #f0f0f0;
}
#mapviewslist li.tf-mapview-row.selected {
    background: #e8f2e7;
}
.tf-mapview-row__main {
    flex: 1;
    min-width: 0;
}
.tf-mapview-row__main a {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tf-mapview-collections {
    display: block;
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.tf-mapview-fav {
    flex-shrink: 0;
    cursor: pointer;
    padding: 2px 3px;
    line-height: 1;
    color: #ccc;
    border-radius: 3px;
}
.tf-mapview-fav:hover {
    color: #e74c3c;
}
.tf-mapview-fav.is-faved {
    color: #e74c3c;
}
.tf-mapview-row .disableMapview {
    flex-shrink: 0;
    cursor: pointer;
    padding: 2px 5px;
    font-size: 11px;
    color: #aaa;
    border-radius: 3px;
}
.tf-mapview-row .disableMapview:hover {
    color: #333;
    background: rgba(0,0,0,.07);
}

/* Route planner controls bar */
#tf-routing-controls-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2500;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
    padding: 6px 10px;
    max-width: calc(100vw - 120px);
    display: flex;
    align-items: center;
    gap: 6px;
}
#tf-routing-controls-bar #routingMapControls {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: center;
}
#tf-routing-controls-bar #editRouteControls {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: center;
}
/* Keep buttons at their natural size — never shrink them so the label wraps
   onto a second line and the button grows tall. */
#tf-routing-controls-bar .button1 {
    white-space: nowrap;
    flex-shrink: 0;
}
/* Details / toggle panel button */
#tf-routing-controls-bar .rp-details-btn {
    display: none;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    white-space: nowrap;
}
#tf-routing-controls-bar .rp-details-btn.is-visible { display: inline-flex; }
/* Chevron-up icon for dropdown buttons */
.rp-chevron-up {
    width: 10px;
    height: 10px;
    vertical-align: middle;
    margin-left: 2px;
    display: inline-block;
}
/* Exit route planner button — always on the left */
#tf-routing-controls-bar .rp-exit-btn {
    font-size: 18px;
    line-height: 1;
    color: #888;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: auto;
}
#tf-routing-controls-bar .rp-exit-btn:hover { color: #c00; background: #f5f5f5; }
/* Disabled undo button */
#tf-routing-controls-bar #undo.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
/* Separator between button groups */
#tf-routing-controls-bar .rp-sep {
    width: 1px;
    height: 22px;
    background: #ddd;
    margin: 0 4px;
    flex-shrink: 0;
}
/* Add-object buttons: inline on wide screens, collapsed behind "+" on narrow */
#tf-routing-controls-bar .rp-add-toggle { display: none; position: relative; }
#tf-routing-controls-bar .rp-add-inline { display: inline-flex; gap: 5px; }
#tf-routing-controls-bar .rp-add-drop {
    min-width: 140px;
}
#tf-routing-controls-bar .rp-add-drop.is-open { display: block; }
/* Routing options tab — sits above the controls bar, right-aligned */
.rp-options-tab {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 6px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    padding: 5px 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    white-space: nowrap;
    font-size: 13px;
}
.rp-options-tab label { cursor: pointer; }
.rp-routing-info-btn {
    display: inline-flex;
    align-items: center;
    color: #888;
    margin-left: 2px;
    vertical-align: middle;
}
.rp-routing-info-btn:hover { color: #333; }
.rp-routing-info-popup {
    position: absolute;
    bottom: 100px;
    right: 0;
    width: 300px;
}
/* Isochrone popup */
.rp-isochrone-popup {
    width: 320px;
}
.rp-isochrone-popup__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.rp-isochrone-popup__close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0 2px;
    line-height: 1;
}
.rp-isochrone-popup ul { margin: 4px 0 0; padding: 0; list-style: none; }
.rp-isochrone-popup li { margin: 2px 0; }
/* Mode toggle button group (Draw Route / Selecting / Map Mode) */
.rp-mode-group {
    display: inline-flex;
}
.rp-mode-group .rp-mode-btn {
    border-radius: 0;
    margin: 0;
    border-right: 1px solid rgba(0,0,0,.15);
}
.rp-mode-group .rp-mode-btn:first-child { border-radius: 8px 0 0 8px; }
.rp-mode-group .rp-mode-btn:last-child { border-radius: 0 8px 8px 0; border-right: none; }
.rp-options-tab select { font-size: 12px; padding: 2px 4px; }
/* Mode group: inline segmented buttons on wide screens, collapsed behind a
   single "Mode" dropdown toggle on narrower desktops (see media query below). */
#tf-routing-controls-bar .rp-mode-wrap { position: relative; display: inline-flex; }
#tf-routing-controls-bar .rp-mode-toggle { display: none; align-items: center; }
@media (max-width: 1800px) {
    #tf-routing-controls-bar .rp-add-toggle { display: inline-block; }
    #tf-routing-controls-bar .rp-add-inline { display: none; }
}
/* Collapse the routing modes into a dropdown on smaller desktop screens */
@media (min-width: 901px) and (max-width: 1400px) {
    #tf-routing-controls-bar .rp-mode-toggle { display: inline-flex; }
    #tf-routing-controls-bar .rp-mode-group {
        display: none;
        position: absolute;
        bottom: 100%;
        left: 0;
        margin-bottom: 6px;
        flex-direction: column;
        gap: 2px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,.2);
        padding: 4px;
        z-index: 10;
        min-width: 130px;
    }
    #tf-routing-controls-bar .rp-mode-group.is-open { display: flex; }
    /* Drop the segmented styling so each mode reads as its own button in the menu */
    #tf-routing-controls-bar .rp-mode-group .rp-mode-btn,
    #tf-routing-controls-bar .rp-mode-group .rp-mode-btn:first-child,
    #tf-routing-controls-bar .rp-mode-group .rp-mode-btn:last-child {
        border-radius: 6px;
        border-right: none;
        margin: 0;
        text-align: center;
    }
}
@media (max-width: 900px) {
    .rp-options-tab {
        right: auto; left: 0; right: 0; justify-content: center;
        margin-bottom: 0;
        box-shadow: none;
        border-radius: 0;
    }
}
/* Save button in controls bar — hidden by default, shown via JS when route has >1 point */
#tf-routing-controls-bar .rp-save-btn {
    display: none;
    flex-shrink: 0;
    white-space: nowrap;
}
/* Mobile: full width, fixed to viewport bottom.
   Layout: 2 rows.
   Row 1: mode group + Undo.
   Row 2: Details + Edit Points + Tools + Add + Save. */
@media (max-width: 900px) {
    #tf-routing-controls-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        max-width: none;
        border-radius: 0;
        padding: 6px 8px;
        z-index: 12001;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    #tf-routing-controls-bar > .rp-exit-btn {
        margin-right: 0;
        font-size: 22px;
        padding: 4px 8px;
        flex-shrink: 0;
    }
    #tf-routing-controls-bar #routingMapControls {
        flex: 1;
        min-width: 0;
        flex-wrap: wrap;
    }
    #tf-routing-controls-bar #editRouteControls {
        flex-wrap: wrap;
    }
    #tf-routing-controls-bar .rp-sep { display: none; }
    .tf-detailpanel__routes {
        display: none;
    }
    /* Route planner panel sits above the controls bar on mobile */
    .tf-map-floatpanel[data-open-section="routeplanner"] {
        z-index: 12002;
    }
    .tf-detailpanel__route {
        display: none;
    }
    .tf-detailpanel__scroll {
        padding-bottom: 100px;
    }
}
/* Shorten panel so it doesn't cover the controls bar */
.tf-map-floatpanel[data-open-section="routeplanner"] {
    max-height: calc(100vh - 180px - var(--tf-pro-topbanner-h));
}
/* Smaller desktops: narrow the route planner panel so it doesn't dominate the map.
   Below 980px the panel becomes a full-width bottom sheet (see map_universal.php),
   so this only applies to the in-between side-panel range. */
@media (min-width: 981px) and (max-width: 1600px) {
    .tf-map-floatpanel[data-open-section="routeplanner"] {
        width: 340px;
    }
}

/* ---- Route planner bottom-panel mode ----
   Compact bar at the bottom of the map viewport: stats + the (relocated)
   routing controls bar + expand button on row 1, elevation chart on row 2.
   The panel lives inside .tf-map-viewport so it starts at the rail's right
   edge, and body.tf-rp-bottom-mode shrinks the map so the panel pushes the
   map up (bottom-right map buttons stay visible) instead of covering it.
   The controls bar, #planStats and #planElevation are moved in by
   _rpApplyPanelMode() so all their existing IDs/handlers keep working. */
:root { --tf-rp-bottom-h: 196px; }
#tfRpBottomPanel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--tf-rp-bottom-h);
    z-index: 2500;
    background: #fff;
    border-top: 1px solid #e1e1e1;
    /* hidden via inline style="display:none" until bottom mode is applied */
    display: flex;
    flex-direction: column;
}
/* Push the map up so it isn't covered by the panel. !important because the
   map container carries an inline height:100% (the inner .map is 100% of it,
   so shrinking the outer container is enough). Desktop-only, like the panel. */
@media (min-width: 901px) {
    body.tf-rp-bottom-mode .tf-map-viewport .mapcontainer {
        height: calc(100% - var(--tf-rp-bottom-h)) !important;
    }
}
/* Bottom-panel mode is desktop-only — mobile keeps its own fixed bottom
   controls bar layout. JS also refuses to enter bottom mode at this width. */
@media (max-width: 900px) {
    #tfRpBottomPanel { display: none !important; }
    #rpModeToBottom { display: none !important; }
}
#tfRpBottomPanel .rp-bottombar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    min-height: 44px;
    flex-shrink: 0;
}
#tfRpBottomPanel .rp-bottombar__stats { flex-shrink: 0; }
#tfRpBottomPanel .rp-bottombar__controls {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}
#tfRpBottomPanel .rp-bottombar__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
#tfRpBottomPanel .rp-bottombar__actions .button1 svg { vertical-align: -2px; }
/* Exit button lives at the far right of the bottom bar; hide the embedded
   controls bar's left-side X so there's only one. */
#tfRpBottomPanel #tf-routing-controls-bar .rp-exit-btn { display: none; }
#tfRpBottomPanel .rp-bottombar__actions .rp-exit-btn {
    font-size: 18px;
    line-height: 1;
    color: #888;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
}
#tfRpBottomPanel .rp-bottombar__actions .rp-exit-btn:hover { color: #c00; background: #f5f5f5; }
/* Neutralize the controls bar's floating-pill styling when embedded in the
   bottom panel — descendant rules (#tf-routing-controls-bar .rp-*) still apply. */
#tfRpBottomPanel #tf-routing-controls-bar {
    position: static;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    max-width: none;
    background: transparent;
}
/* The routing options tab anchors to the bottom panel instead of the pill */
#tfRpBottomPanel .rp-options-tab {
    bottom: 100%;
    right: 10px;
    margin-bottom: 8px;
}
/* Compact inline stats (restyles the moved #planStats grid) */
#tfRpBottomPanel .rp-stats-grid {
    display: flex;
    gap: 16px;
    border: none;
    border-radius: 0;
    margin: 0;
    overflow: visible;
}
#tfRpBottomPanel .rp-stat {
    padding: 0;
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 5px;
}
#tfRpBottomPanel .rp-stat + .rp-stat { border-left: none; }
#tfRpBottomPanel .rp-stat__value { font-size: 16px; }
/* Elevation chart row — fixed height whether or not a chart exists yet, so the
   panel doesn't jump. The chart svg stretches (preserveAspectRatio=none) and
   redraws itself on window resize. */
#tfRpBottomPanel .rp-bottombar__chartwrap {
    flex: 1;
    min-height: 0;
    position: relative;
    border-top: 1px solid #eee;
}
#tfRpBottomPanel .rp-bottombar__chart { padding: 0 12px; }
#tfRpBottomPanel #planElevation {
    border-top: none;
    padding: 4px 0 2px;
}
#tfRpBottomPanel .elevationchart > .chart_container svg { height: 110px; }
/* Placeholder shown until the elevation chart loads */
#tfRpBottomPanel .rp-bottombar__chart-ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #c8c8c8;
    pointer-events: none;
}
/* Keep the bottom bar compact: extended stats stay a side-panel feature */
#tfRpBottomPanel #extendedStatsToggle,
#tfRpBottomPanel #extendedStats { display: none !important; }

/* Route planner loading overlay */
#rpLoadingOverlay {
    position: absolute;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.15);
}
.rp-loading-box {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    padding: 24px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
}
.rp-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: rp-spin .7s linear infinite;
}
@keyframes rp-spin { to { transform: rotate(360deg); } }

/* Route planner intro modal */
.rp-intro-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 552px;
    right: 0;
    z-index: 13000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.rp-intro-modal {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    width: 100%;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.rp-intro-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
}
.rp-intro-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.rp-intro-close:hover { color: #000; background: rgba(0,0,0,.06); }
.rp-intro-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}
.rp-intro-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 24px;
}
.rp-intro-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.rp-intro-card {
    text-align: center;
}
.rp-intro-card img {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 6px;
    margin-bottom: 12px;
}
.rp-intro-card p {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 8px;
}
.rp-intro-footer {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid #eee;
}
.rp-intro-dontshow {
    width: 100%;
    text-align: center;
    font-size: 13px;
    color: #666;
}
.rp-intro-dontshow label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.rp-intro-footer select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
}
@media (max-width: 900px) {
    .rp-intro-overlay { left: 0; padding: 10px; align-items: center; }
    .rp-intro-modal { max-height: 75vh; border-radius: 10px; }
    .rp-intro-header { padding: 12px 16px; }
    .rp-intro-title { font-size: 17px; }
    .rp-intro-body { padding: 14px 16px; }
    .rp-intro-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .rp-intro-card img { max-width: 140px; }
    .rp-intro-footer { padding: 12px 16px; }
}
@media (max-width: 420px) {
    .rp-intro-grid { grid-template-columns: 1fr; }
}

/* Route planner panel styles */
#tf-routeplanner-panel .sideBox {
    padding: 0;
}
#tf-routeplanner-panel .collapsebox {
    margin-bottom: 10px;
}
/* Stats grid */
.rp-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 1px solid #eee;
    border-radius: 8px;
    margin: 0 0 10px 0;
    overflow: hidden;
}
#turnDirectionsParent .box1 {
    max-height: 250px;
    overflow-y: auto;
}
.rp-stat {
    text-align: center;
    padding: 10px 6px;
}
.rp-stat + .rp-stat { border-left: 1px solid #eee; }
.rp-stat__value { font-size: 18px; font-weight: 600; color: #1C1D1F; }
.rp-stat__label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.rp-elev-toggle { display: flex; gap: 2px; margin-bottom: 4px; }
.rp-elev-toggle__btn {
    font-size: 11px; padding: 3px 10px; border-radius: 4px;
    background: #f0f0f0; color: #666; cursor: pointer;
}
.rp-elev-toggle__btn.active { background: #29691f; color: #fff; }
/* Layer group toggle pill */
.tf-layergroup-row {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 12px;
}
.tf-layergroup-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}
.tf-layergroup-close:hover { color: #c00; }
.tf-layergroup-row__label {
    font-weight: 600;
    color: #333;
    padding: 0 6px;
    font-size: 11px;
}
.tf-layergroup-btn {
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    background: #f0f0f0;
    color: #555;
    border: none;
    transition: background .15s, color .15s;
}
.tf-layergroup-btn:hover { background: #e0e0e0; }
.tf-layergroup-btn.is-active { background: #29691f; color: #fff; }
.tf-layergroup-btn.is-active:hover { background: #1f5216; }
/* Mobile: collapsed layer group banner — only active button visible */
@media (max-width: 900px) {
    .tf-layergroup-row {
        position: relative;
        padding: 3px 4px;
        gap: 3px;
    }
    .tf-layergroup-row__label,
    .tf-layergroup-close,
    .tf-layergroup-btn:not(.is-active) {
        display: none;
    }
    .tf-layergroup-btn { font-size: 11px; padding: 4px 10px; }
    /* Expanded state: show all buttons + close in a popup above */
    .tf-layergroup-row.is-expanded {
        flex-direction: column;
        border-radius: 12px;
        padding: 6px;
        gap: 4px;
    }
    .tf-layergroup-row.is-expanded .tf-layergroup-btn:not(.is-active),
    .tf-layergroup-row.is-expanded .tf-layergroup-close {
        display: inline-block;
    }
    .tf-layergroup-row.is-expanded .tf-layergroup-row__label {
        display: block;
        font-size: 10px;
        padding: 0;
    }
}
/* Shared map popup base */
.tf-map-popup {
    display: none;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    border: 1px solid #e9e9e9;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    white-space: normal;
    z-index: 20;
}
.tf-map-popup.is-open { display: block; }
/* Compact variant for inline info popups */
.tf-map-popup--compact {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
/* Dropdown menu variant (slim padding, nowrap) */
.tf-map-popup--menu {
    padding: 6px 0;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,.45);
    white-space: nowrap;
    font-size: 13px;
}
/* Positioned above trigger, centered */
.tf-map-popup--above {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
}
/* Map banner pills (shared base) */
.tf-map-banner {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 199;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    pointer-events: auto;
    white-space: nowrap;
}
.tf-map-banner--route {
    top: 12px;
    background: rgba(254,194,0,.95);
    color: #333;
}
.tf-map-banner--isolate {
    top: 12px;
    z-index: 200;
    background: rgba(41,105,31,.92);
    color: #fff;
}
.tf-map-banner--layergroup {
    bottom: 30px;
    z-index: 200;
    flex-direction: column;
    gap: 8px;
}
.tf-map-banner__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    margin: 0;
}
.tf-map-banner--route .tf-map-banner__close { color: #333; padding-left: 4px; }
.tf-map-banner--isolate .tf-map-banner__close { color: #fff; }
/* Adventure Modes */
.tf-adventure-modes {
    border-top: 1px solid #eee;
    padding-top: 6px;
    margin-top: 4px;
}
.tf-adventure-modes__label {
    font-size: 11px;
    color: #999;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.tf-adventure-modes__info {
    font-size: 10px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}
.tf-adventure-modes__info:hover { color: #666; }
.tf-adventure-modes__info-popup {
    margin: 0 7px 6px;
}
.tf-adventure-modes__list {
    display: flex;
    gap: 4px;
    overflow-x: hidden;
    padding: 0;
}
.tf-adventure-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 45px;
    padding: 4px 3px 3px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s;
    flex-shrink: 0;
}
.tf-adventure-mode-card:hover { background: #f5f5f5; }
.tf-adventure-mode-card.is-active {
    border-color: #29691f;
    background: #f0f7ee;
}
.tf-adventure-mode-card__icon {
    font-size: 20px;
    line-height: 1;
}
.tf-adventure-mode-card__name {
    font-size: 12px;
    margin-bottom: 3px;
    max-width: 52px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tf-adventure-mode-card__radio {
    accent-color: #29691f;
    margin: 0;
    width: 12px;
    height: 12px;
}
/* Vertical-list variant — used by the gaiagps activity panel */
.tf-adventure-modes--vertical .tf-adventure-modes__list {
    flex-direction: column;
    gap: 2px;
}
.tf-adventure-modes--vertical .tf-adventure-mode-card {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: 100%;
    padding: 8px 10px;
    text-align: left;
}
.tf-adventure-modes--vertical .tf-adventure-mode-card__icon {
    font-size: 22px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.tf-adventure-modes--vertical .tf-adventure-mode-card__name {
    font-size: 13px;
    margin-bottom: 0;
    max-width: none;
    flex: 1;
    min-width: 0;
}
.tf-adventure-modes--vertical .tf-adventure-mode-card__radio {
    margin-left: auto;
    flex-shrink: 0;
}
/* Adventure mode active branding in panel header */
.tf-adventure-mode-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0f7ee;
    border-bottom: 1px solid #d4e8cf;
    font-size: 12px;
    font-weight: 600;
    color: #29691f;
}
.tf-adventure-mode-banner__close {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}
.tf-adventure-mode-banner__close:hover { color: #c00; }
.tf-adventure-mode-banner__reset {
    margin-left: auto;
}
.tf-adventure-mode-banner__reset:hover { color: #29691f; }
/* Route color swatch in panel header */
.rp-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(0,0,0,.15);
    cursor: pointer;
    flex-shrink: 0;
}
.rp-color-swatch:hover { border-color: rgba(0,0,0,.35); }
/* Info popup */
.rp-info-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.rp-info-modal {
    position: relative;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.rp-info-modal__header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.rp-info-modal__header h3 { margin: 0; font-size: 17px; font-weight: 600; }
.rp-info-modal__close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: #666; padding: 2px 6px; border-radius: 4px; line-height: 1;
}
.rp-info-modal__close:hover { color: #000; background: rgba(0,0,0,.06); }
.rp-info-modal__body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
    color: #444;
}
.rp-info-modal__body h4 { margin: 16px 0 6px; font-size: 14px; color: #222; }
.rp-info-modal__body h4:first-child { margin-top: 0; }
.rp-info-modal__body kbd {
    display: inline-block;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 12px;
    font-family: inherit;
}
.rp-info-modal__body ul { margin: 4px 0 8px 16px; padding: 0; }
.rp-info-modal__body li { margin-bottom: 4px; }
/* Elevation chart */
#tf-routeplanner-panel #planElevation {
    border-top: 1px solid #eee;
    padding: 10px 0;
}
#tf-routeplanner-panel #showElevationChartButton {
    display: none;
}
/* Sticky bottom bar — lives outside __body so it never scrolls */
.tf-map-floatpanel[data-open-section="routeplanner"] { display: flex; flex-direction: column; }
.tf-map-floatpanel[data-open-section="routeplanner"] .tf-map-floatpanel__body {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 0;
    overflow-x: hidden;
}
#rpStickyBottomHolder {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 10px 14px;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}
/* Tools dropdown in controls bar */
#tf-routing-controls-bar .rp-tools-wrap { position: relative; }
#tf-routing-controls-bar .rp-tools-drop {
    min-width: 180px;
}
#tf-routing-controls-bar .rp-tools-drop.is-open { display: block; }
/* Shared dropdown item style for all controls bar menus */
.rp-drop__item {
    display: block;
    padding: 7px 9px;
    cursor: pointer;
    font-size: 13px;
    color: #444;
    border-bottom: 1px solid #efefef;
}
.rp-drop__item:last-child { border-bottom: none; }
.rp-drop__item:hover { background-color: #1f4b1a; color: #fff; }
.pointByPointControls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}
.pointByPointControls-left,
.pointByPointControls-right {
    display: flex;
    gap: 4px;
}
