/*
Theme Name: RFCC Customizr
Version: 2.1 - Complete and Verified
*/

/* ===================================================================
   Pagination Styles
=================================================================== */
.route-pagination {
    margin: 30px 0;
    text-align: center;
}

.pagination-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 12px;
    margin: 0 2px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
    display: inline-block;
    text-decoration: none;
    min-width: 40px;
    box-sizing: border-box;
}

.pagination-btn:hover:not(.disabled):not(.pagination-current) {
    background: #e9ecef;
    border-color: #adb5bd;
    text-decoration: none;
}

.pagination-btn.pagination-current {
    background: #007cba;
    border-color: #007cba;
    color: white;
    cursor: default;
    font-weight: bold;
}

.pagination-btn.disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #6c757d;
    display: inline-block;
}

.pagination-info {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

/* Mobile responsive pagination */
@media (max-width: 768px) {
    .pagination-btn {
        padding: 6px 8px;
        font-size: 12px;
        margin: 0 1px;
        min-width: 32px;
    }
    
    .route-pagination {
        margin: 20px 0;
    }
    
    .pagination-info {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .pagination-btn {
        padding: 4px 6px;
        font-size: 11px;
        margin: 0 1px;
        min-width: 28px;
    }
}

/* ===================================================================
   General Filter Container & Header
=================================================================== */
/* Filter Presets Bar */
.filter-presets-bar a:hover {
    background: rgba(255,255,255,0.35) !important;
    text-decoration: none;
}

.filter-presets-bar a:active {
    background: rgba(255,255,255,0.45) !important;
}

.route-filter-container {
    max-width: 100%;
    margin: 0 auto 20px auto;
    background-color: var(--rfcc-filter-background-color, #7A8D7B);
    padding: 12px 18px;
    border-radius: 8px;
    color: #fff;
    position: relative;
    box-sizing: border-box;
    container-type: inline-size; /* Enable container queries */
}
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* Quick Search Section - shown above filter header when collapsed */
.quick-search-section {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.quick-search-section .filter-section {
    margin-bottom: 0;
}

.quick-search-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quick-search-wrapper .search-with-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quick-search-wrapper .rfcc-search-input {
    flex: 1;
}

/* Quick search toggle - ensure consistent styling with main filter toggle */
.quick-search-wrapper .search-scope-toggle {
    flex-shrink: 0;
}

/* Shared search input styling */
#route-search,
.rfcc-search-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-width: 180px;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.3);
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.85rem;
    box-sizing: border-box;
}

#route-search::placeholder,
.rfcc-search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

#route-search:focus,
#quick-route-search:focus,
.rfcc-search-input:focus,
#route-search:focus-visible,
#quick-route-search:focus-visible,
.rfcc-search-input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    background-color: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
}

/* Shared button styling */
.rfcc-btn {
    -webkit-appearance: none;
    appearance: none;
    padding: 6px 16px;
    background-color: var(--rfcc-button-color, rgba(255,255,255,0.2));
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.rfcc-btn:hover {
    background-color: var(--rfcc-button-hover-color, rgba(255,255,255,0.35));
}

/* Responsive adjustments for quick search */
@media (max-width: 600px) {
    .quick-search-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .quick-search-wrapper .rfcc-btn {
        width: 100%;
    }

    .quick-search-wrapper .search-scope-toggle {
        justify-content: center;
        width: auto;
        min-width: 210px;
        align-self: center;
    }
}

.route-filter-container h2 {
    color: #fff;
    font-size: 1.3rem;
    margin: 0;
    flex-grow: 1;
}
.filter-toggle-arrow {
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    margin-left: 10px;
}

/* Bottom rollup arrow - positioned at bottom left, only visible when expanded */
.filter-bottom-arrow {
    position: absolute;
    bottom: 10px;
    left: 15px;
    pointer-events: auto;
}

.filter-toggle-arrow-bottom {
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    color: #fff;
    opacity: 0.8;
}

.filter-toggle-arrow-bottom:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* Hide bottom arrow when filter is collapsed */
.route-filter-container.collapsed .filter-bottom-arrow {
    display: none;
}

.filter-content {
    padding-top: 8px;
    position: relative; /* To contain the absolute positioned bottom arrow */
}
.filter-section {
    margin-bottom: 10px; /* Reduced vertical space */
}
.filter-section:last-of-type {
    margin-bottom: 0;
}

/* Collapsible section styles */
.collapsible-section .section-header {
    cursor: pointer;
    display: block;
    user-select: none;
    transition: opacity 0.2s ease;
    /* Ensure adequate touch target size on mobile */
    min-height: 44px;
    display: flex;
    align-items: center;
    /* Better mobile tap handling */
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
}
/* Use hover only on devices that support it (not touch screens) */
@media (hover: hover) and (pointer: fine) {
    .collapsible-section .section-header:hover {
        opacity: 0.8;
    }
}
.collapsible-section .toggle-arrow {
    font-size: 0.9em;
    margin-left: 4px;
    transition: transform 0.2s ease;
    /* Make arrow easier to see and tap */
    display: inline-block;
    padding: 4px;
}
.collapsible-section .section-header.collapsed .toggle-arrow {
    transform: rotate(0deg);
}
.collapsible-section .filter-preview {
    display: none;
    font-weight: normal;
    opacity: 0.7;
    margin-left: 4px;
}
.collapsible-section .section-header.collapsed .filter-preview {
    display: inline;
}
.collapsible-section .section-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}
.collapsible-section .section-content.collapsing {
    max-height: 0;
    opacity: 0;
}
/* Ensure collapsed sections stay hidden even on mobile with !important rules */
.collapsible-section .section-header.collapsed ~ .section-content,
.collapsible-section .section-header.collapsed ~ .climbing-buttons,
.collapsible-section .section-header.collapsed ~ .route-shortcut-buttons,
.collapsible-section .section-header.collapsed ~ .activity-type-buttons,
.collapsible-section .section-header.collapsed ~ .club-group-buttons,
.collapsible-section .section-header.collapsed ~ .direction-buttons {
    display: none !important;
}
.filter-section label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-weight: 600;
    color: #fff;
}

/* Sort dropdown styling - match translucent theme like inactive climbing buttons */
.sort-dropdown, #sort-results {
    background-color: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.9rem; /* Match other font sizes in filter box */
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
}

.sort-dropdown:hover, #sort-results:hover {
    background-color: rgba(255,255,255,0.3);
}

.sort-dropdown:focus, #sort-results:focus {
    outline: none;
    background-color: rgba(255,255,255,0.3);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}

/* Style dropdown options for better visibility */
.sort-dropdown option, #sort-results option {
    background-color: #2c3e50;
    color: #fff;
    padding: 8px;
}

/* "Group by activity type" - sits directly under #sort-results, right-aligned
   under its right edge (the select itself is full-width via the theme's own
   base `select { width: 100% }` reset) rather than left-aligned/full-width
   like every other .filter-section label. Only shown once 2+ Activity Types
   are active - see narrowFiltersToActivityTypes() in simple-route-filter.js. */
#group-by-activity-type-wrap {
    margin-top: -4px;
}
#group-by-activity-type-wrap label {
    display: flex !important;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    width: auto;
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: normal;
}
#group-by-activity-type-wrap input[type="checkbox"] {
    margin: 0;
}

/* ===================================================================
   Inputs, Toggles, and Buttons (with Definitive Layout Fix)
=================================================================== */

/* --- Search Input & Toggle --- */
.search-with-toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
}

/* Enhanced responsive wrapping - triggers when search input gets too narrow */
@container (max-width: 500px) {
    .search-with-toggle {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    
    .search-scope-toggle {
        justify-self: center;
        width: auto;
        min-width: 210px;
    }
}

/* More aggressive fallback for browsers without container query support */
@media (max-width: 600px) {
    .route-filter-container .search-with-toggle {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    
    .route-filter-container .search-scope-toggle {
        justify-self: center;
        width: auto;
        min-width: 210px;
    }
}

/* Emergency fallback - force wrap on very small screens */
@media (max-width: 400px) {
    .search-with-toggle {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    
    .search-scope-toggle {
        justify-self: center !important;
        width: auto !important;
        min-width: 210px !important;
    }
}

/* --- Toggles (Metric/Imperial & Title/Desc) --- */
.unit-toggle-section,
.search-scope-toggle {
    width: 210px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.unit-label,
.scope-label {
    flex-basis: 70px;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    transition: color 0.2s ease;
    white-space: nowrap;
}
.unit-label.unit-label-metric,
.scope-label.scope-title {
    text-align: right;
}
.unit-label.unit-label-imperial,
.scope-label.scope-desc {
    text-align: left;
}
.unit-label.active-unit,
.scope-label.active-unit {
    color: #fff;
}
button.unit-toggle-btn,
button.scope-toggle-btn {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(255,255,255,0.3);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}
button.unit-toggle-btn:hover,
button.scope-toggle-btn:hover {
    background-color: rgba(255,255,255,0.4);
}
.toggle-slider {
    position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.unit-toggle-btn.imperial .toggle-slider,
.scope-toggle-btn.active .toggle-slider {
    transform: translateX(20px);
}


/* --- Filter Button Groups --- */
.grade-buttons,
.club-group-buttons,
.climbing-buttons,
.direction-buttons,
.route-shortcut-buttons,
.activity-type-buttons,
.region-buttons,
.difficulty-buttons,
.tags-buttons {
    display: grid;
    gap: 6px;
}
.grade-buttons {
    grid-template-columns: repeat(6, 1fr);
}
.climbing-buttons,
.route-shortcut-buttons,
.activity-type-buttons,
.region-buttons,
.club-group-buttons,
.direction-buttons,
.difficulty-buttons,
.tags-buttons {
    /* Auto-fit layout with wrapping as last resort - buttons resize first, then wrap */
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
}

/* Ensure direction buttons can wrap on narrow containers */
@media (max-width: 500px) {
    .direction-buttons {
        display: flex !important;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .direction-buttons .direction-btn,
    .direction-buttons .direction-all-none-btn {
        flex: 0 0 auto;
        min-width: 50px;
    }
}
.rfcc-na {
    display: none !important;
}
/* Hides duplicate-named buttons (e.g. two "G1" club-group buttons owned by
   different Definition Groups) once merged by name - see
   applyNameMergeForDimension() in simple-route-filter.js. */
.rfcc-name-merged-hidden {
    display: none !important;
}
.grade-btn,
.club-group-btn,
.climbing-btn,
.direction-btn,
.route-shortcut-btn,
.activity-type-btn,
.region-btn,
.difficulty-btn,
.tag-btn,
.club-group-all-none-btn,
.direction-all-none-btn,
.activity-type-all-none-btn,
.difficulty-all-none-btn,
.tag-clear-btn {
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--rfcc-filter-button-unselected-color, rgba(255,255,255,0.2));
    color: var(--rfcc-filter-button-unselected-text-color, #fff);
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
    text-align: center;
    min-width: 60px; /* Ensures buttons don't get too narrow */
    white-space: nowrap; /* Prevents text wrapping within buttons */
}

/* Special styling for All/None buttons */
.club-group-all-none-btn,
.direction-all-none-btn,
.activity-type-all-none-btn,
.difficulty-all-none-btn,
.tag-clear-btn {
    background-color: rgba(255,255,255,0.15);
    font-style: italic;
    border: 1px solid rgba(255,255,255,0.3);
    /* margin-left removed - flexbox gap handles spacing uniformly */
}
.grade-btn:hover,
.club-group-btn:hover,
.climbing-btn:hover,
.direction-btn:hover,
.route-shortcut-btn:hover,
.activity-type-btn:hover,
.region-btn:hover,
.difficulty-btn:hover,
.tag-btn:hover,
.club-group-all-none-btn:hover,
.direction-all-none-btn:hover,
.activity-type-all-none-btn:hover,
.difficulty-all-none-btn:hover,
.tag-clear-btn:hover {
    background-color: var(--rfcc-filter-button-selected-hover-color, rgba(255,255,255,0.3));
    color: var(--rfcc-filter-button-hover-text-color, #fff);
    transform: translateY(-1px);
}
.grade-btn.active,
.club-group-btn.active,
.climbing-btn.active,
.direction-btn.active,
.route-shortcut-btn.active,
.activity-type-btn.active,
.region-btn.active,
.difficulty-btn.active,
.tag-btn.active {
    background-color: var(--rfcc-filter-button-selected-color, rgba(255,255,255,0.9));
    color: var(--rfcc-filter-button-selected-text-color, #333);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Ensure route shortcut, activity type, climbing profile, and region buttons have consistent font rendering */
.route-shortcut-btn,
.activity-type-btn,
.climbing-btn,
.region-btn,
.difficulty-btn,
.tag-btn {
    font-weight: 500 !important;
    font-size: 0.8rem !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.route-shortcut-btn:not(.active),
.activity-type-btn:not(.active),
.climbing-btn:not(.active),
.region-btn:not(.active),
.difficulty-btn:not(.active),
.tag-btn:not(.active) {
    color: var(--rfcc-filter-button-unselected-text-color, #fff) !important;
}

.route-shortcut-btn.active,
.activity-type-btn.active,
.climbing-btn.active,
.region-btn.active,
.difficulty-btn.active,
.tag-btn.active {
    color: var(--rfcc-filter-button-selected-text-color, #333) !important;
    font-weight: 500 !important;
}

.route-shortcut-btn:hover,
.activity-type-btn:hover,
.climbing-btn:hover,
.region-btn:hover,
.difficulty-btn:hover,
.tag-btn:hover {
    color: var(--rfcc-filter-button-hover-text-color, #fff) !important;
}

/* Tag filter buttons carry the same leading tag icon as the route-page tag
   badges (.rfcc-tag-badge), so the filter reads as "tags" at a glance. */
.tag-btn,
.tag-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tag-btn-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    background-color: currentColor;
    opacity: 0.75;
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMC41OSAxMy40MUwxMSAzLjgzQTIgMiAwIDAgMCA5LjU5IDMuMTdMMyAzdjYuNTlhMiAyIDAgMCAwIC42NiAxLjQxbDkuNTkgOS41OWEyIDIgMCAwIDAgMi44MyAwbDQuNTEtNC41MWEyIDIgMCAwIDAgMC0yLjgzeiIvPjxjaXJjbGUgY3g9IjcuNSIgY3k9IjcuNSIgcj0iMS41IiBmaWxsPSJibGFjayIgc3Ryb2tlPSJub25lIi8+PC9zdmc+");
    mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMC41OSAxMy40MUwxMSAzLjgzQTIgMiAwIDAgMCA5LjU5IDMuMTdMMyAzdjYuNTlhMiAyIDAgMCAwIC42NiAxLjQxbDkuNTkgOS41OWEyIDIgMCAwIDAgMi44MyAwbDQuNTEtNC41MWEyIDIgMCAwIDAgMC0yLjgzeiIvPjxjaXJjbGUgY3g9IjcuNSIgY3k9IjcuNSIgcj0iMS41IiBmaWxsPSJibGFjayIgc3Ryb2tlPSJub25lIi8+PC9zdmc+");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

/* Special styling for "All" type route shortcut buttons */
.route-shortcut-btn.route-shortcut-all {
    border: 1px solid rgba(255,255,255,0.5);
}

/* ===================================================================
   DUAL RANGE SLIDER
=================================================================== */
.range-slider {
    position: relative;
    height: 55px;
    margin: 10px 0;
    background: transparent;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.range-slider input[type=range] {
    position: absolute;
    left: 0;
    top: 20px;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    outline: none;
}
.range-slider input[type=range]:focus {
    outline: none;
}

/* Webkit (Chrome, Safari, Edge) slider styles */
.range-slider input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255,255,255,0.4);
    border-radius: 2px;
    border: 0;
}
.range-slider input[type=range]:focus::-webkit-slider-runnable-track {
    background: rgba(255,255,255,0.5);
}
.range-slider input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--rfcc-slider-thumb-color, #0c55cc);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    pointer-events: all;
    position: relative;
    transition: all 0.2s ease;
}
.range-slider input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Firefox slider styles */
.range-slider input[type=range]::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255,255,255,0.4);
    border-radius: 2px;
    border: 0;
}
.range-slider input[type=range]::-moz-range-thumb {
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--rfcc-slider-thumb-color, #0c55cc);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    pointer-events: all;
    -moz-appearance: none;
    margin-top: 0;
}

/* IE/Edge slider styles */
.range-slider input[type=range]::-ms-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: transparent;
    border: 0;
    color: transparent;
}
.range-slider input[type=range]::-ms-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--rfcc-slider-thumb-color, #0c55cc);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.range-slider input[type=range]::-ms-fill-lower,
.range-slider input[type=range]::-ms-fill-upper {
    background: rgba(255,255,255,0.4);
    border-radius: 2px;
}

/* Range value labels */
.range-values {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 16px;
    pointer-events: none;
    box-sizing: border-box;
}
.value-label {
    position: absolute;
    top: 0;
    font-size: 0.75rem;
    color: #fff;
    font-weight: 600;
    background: rgba(0,0,0,0.6);
    padding: 3px 6px;
    border-radius: 3px;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    border: none;
    min-width: 40px;
    text-align: center;
    max-width: calc(100% - 10px);
    box-sizing: border-box;
}
.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #fff;
    font-weight: 500;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}
.slider-labels span {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    outline: none;
}

/* ===================================================================
   NEAR A PLACE FILTER (location discovery Phase 2)
   Follows the same rgba(255,255,255,x)-on-branded-background idiom as
   every other control in this sidebar (search input, .rfcc-btn, etc) -
   the sidebar's own background color already handles dark/light modes,
   see dark-mode.css's generic input[type] overrides for .route-filter-container.
=================================================================== */
.near-place-search-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.near-place-search-row .near-place-input {
    flex: 1 1 auto;
    min-width: 0;
}
.near-place-locate-btn {
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background-color: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.near-place-locate-btn:hover {
    background-color: rgba(255,255,255,0.35);
}
.near-place-locate-btn.is-loading {
    opacity: 0.6;
    pointer-events: none;
}
.near-place-status {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.75);
    margin-top: 4px;
    min-height: 1em;
}
.near-place-status.is-error {
    color: #ffb3b3;
}
.near-place-results {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 4px;
    background-color: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
}
.near-place-result-btn {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 8px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    line-height: 1.35;
}
.near-place-results li:last-child .near-place-result-btn {
    border-bottom: none;
}
.near-place-result-btn:hover,
.near-place-result-btn:focus {
    background-color: rgba(255,255,255,0.15);
    outline: none;
}
.near-place-result-count {
    display: block;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.7);
    margin-top: 2px;
}
.near-place-chip-wrap {
    margin-top: 6px;
}
.near-place-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background-color: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 6px 8px 6px 12px;
}
.near-place-chip-label {
    font-size: 0.8rem;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.near-place-chip-clear {
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255,255,255,0.25);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
}
.near-place-chip-clear:hover {
    background-color: rgba(255,255,255,0.4);
}
.near-place-radius-row {
    margin-top: 10px;
}
.near-place-radius-row label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    margin-bottom: 4px;
}
.near-place-radius-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.4);
    outline: none;
    cursor: pointer;
}
.near-place-radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--rfcc-slider-thumb-color, #0c55cc);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.near-place-radius-slider::-moz-range-thumb {
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--rfcc-slider-thumb-color, #0c55cc);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.near-place-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    margin-top: 8px;
}

/* Range fill - the colored area between min and max values */
.range-fill {
    position: absolute;
    height: 4px;
    background: var(--rfcc-slider-fill-color, #0c55cc);
    border-radius: 2px;
    top: 20px;
    pointer-events: none;
    transition: all 0.1s ease;
    z-index: 1;
    left: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Base z-index for range sliders - will be dynamically managed by JavaScript */
.range-slider input[type=range]:nth-of-type(1) {
    z-index: 3;
}
.range-slider input[type=range]:nth-of-type(2) {
    z-index: 2;
}

/* Fix for range inputs that might be invisible */
.range-slider input[type=range] {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Ensure sliders are interactive and visible with correct layering */
.range-slider input[type=range]:nth-of-type(1) {
    pointer-events: all;
}
.range-slider input[type=range]:nth-of-type(2) {
    pointer-events: all;
}

/* Ensure proper slider container layout */
.range-slider {
    padding: 5px;
    margin-left: 0;
    margin-right: 0;
}

/* Ensure parent container doesn't allow overflow */
.filter-section {
    overflow: hidden;
    box-sizing: border-box;
}

/* Make sure value labels are visible and properly positioned */
.value-label {
    background: rgba(0,0,0,0.8) !important;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Ensure range fill is always visible when it should be */
.range-fill {
    min-width: 2px; /* Ensure even very small ranges show something */
}


/* ===================================================================
   Action Buttons & Grid/Table Styles
=================================================================== */

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 16px;
}
.btn {
    -webkit-appearance: none;
    appearance: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}
.btn-primary {
    background-color: #0c55cc;
    color: #fff;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.btn-primary:hover {
    background-color: #0a4ba8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.btn-secondary {
    background-color: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}
.btn-secondary:hover {
    background-color: rgba(255,255,255,0.3);
}

.filter-results, #loading-more, .route-count, .no-routes-found {
    text-align: center;
}
/* Block theme compatibility: prevent is-layout-constrained (TT4, TT5, etc.) from
   capping plugin containers at the theme's narrow contentSize (~620–800px) */
.is-layout-constrained > .route-filter-container,
.is-layout-constrained > .route-grid,
.is-layout-constrained > #simple-route-list {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.route-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
    width: 100%;
    box-sizing: border-box;
}
.route-item {
    background: #fff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
.route-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}
.route-item .map-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-bottom: 1px solid #eee;
}
.route-item .map-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.leaflet-map.WPLeafletMap[id^="map_for_"] {
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
}
.route-item-content {
    padding: 20px !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}
.route-item-content h3 {
    font-size: 1.3rem !important;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    color: #333 !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
}
.route-item-content .grade-badge {
    margin-bottom: 10px;
    display: inline-block;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 20px;
    color: #fff;
}
/*.grade-badge.grade-1 { background: linear-gradient(45deg, #28a745, #20c997); }
.grade-badge.grade-2 { background: linear-gradient(45deg, #17a2b8, #6f42c1); }
.grade-badge.grade-2_5 { background: linear-gradient(45deg, #ffc107, #fd7e14); }
.grade-badge.grade-3 { background: linear-gradient(45deg, #fd7e14, #dc3545); }
.grade-badge.grade-4 { background: linear-gradient(45deg, #dc3545, #6f42c1); }
.grade-badge.grade-5 { background: linear-gradient(45deg, #6f42c1, #495057); }*/


/* Grade badges */
/* Route tag badges - deliberately shaped like a "tag" (leading tag icon,
   pill with a visible border) so they read as distinct from the plain
   region badge and the colour-coded difficulty/grade badges next to them.
   Uses the shared --rf-* theme tokens (dark-mode.css) rather than fixed
   colours, since tags have no admin-configurable colour of their own. */
.rfcc-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.2em 0.6em 0.2em 0.5em;
  margin: 0 0.3em 0.3em 0;
  background: var(--rf-bg-tertiary, #e9ecef);
  color: var(--rf-text-secondary, #6c757d);
  border: 1px solid var(--rf-border-color, #dee2e6);
  border-radius: 3em;
  font-size: 0.8em;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
/* Tag icon, drawn via CSS mask (not inline <svg>) so it survives
   wp_kses_post() wherever this badge markup gets output/sanitised, and
   tints with currentColor so it still follows the badge's own colour
   (and therefore dark mode) without a separate dark-mode override. */
.rfcc-tag-badge-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  background-color: var(--rf-accent-secondary, #0066cc);
  -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMC41OSAxMy40MUwxMSAzLjgzQTIgMiAwIDAgMCA5LjU5IDMuMTdMMyAzdjYuNTlhMiAyIDAgMCAwIC42NiAxLjQxbDkuNTkgOS41OWEyIDIgMCAwIDAgMi44MyAwbDQuNTEtNC41MWEyIDIgMCAwIDAgMC0yLjgzeiIvPjxjaXJjbGUgY3g9IjcuNSIgY3k9IjcuNSIgcj0iMS41IiBmaWxsPSJibGFjayIgc3Ryb2tlPSJub25lIi8+PC9zdmc+");
  mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMC41OSAxMy40MUwxMSAzLjgzQTIgMiAwIDAgMCA5LjU5IDMuMTdMMyAzdjYuNTlhMiAyIDAgMCAwIC42NiAxLjQxbDkuNTkgOS41OWEyIDIgMCAwIDAgMi44MyAwbDQuNTEtNC41MWEyIDIgMCAwIDAgMC0yLjgzeiIvPjxjaXJjbGUgY3g9IjcuNSIgY3k9IjcuNSIgcj0iMS41IiBmaWxsPSJibGFjayIgc3Ryb2tlPSJub25lIi8+PC9zdmc+");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* Itinerary steps (rfcc_render_route_itinerary() output) - shared by v1
   (frontend/single-route.php) and v2 (frontend/rfcc-v2.php). Steps sit dimmed
   by default and light up as the visitor scrolls past them - the "active"
   class is toggled by rfcc_echo_route_itinerary_script()'s IntersectionObserver,
   with the first step active by default server-side so there's no flash of
   unstyled content before the script runs. */
.rfcc-itinerary-list {
  margin: 0;
  padding-left: 44px;
  list-style: none !important;
  position: relative;
}
.rfcc-itinerary-list::before {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 14px;
  width: 2px;
  background: var(--rf-border-color, #dee2e6);
}
.rfcc-itinerary-step {
  position: relative;
  margin-bottom: 18px;
  cursor: pointer;
}
.rfcc-itinerary-step:last-child {
  margin-bottom: 0;
}
/* Dimming ("grey unless active") is applied per content element rather than
   to the whole <li> - the <li> itself also owns the numbered circle below
   via ::before, and opacity on a parent dims its pseudo-elements too as one
   compositing group with no way to opt a child back out, which washed the
   inactive circle out to a pale, illegible pink instead of solid red. */
.rfcc-itinerary-step-heading,
.rfcc-itinerary-step-km,
.rfcc-itinerary-step-desc {
  opacity: 0.55;
  transition: opacity 0.25s ease;
}
.rfcc-itinerary-step.active .rfcc-itinerary-step-heading,
.rfcc-itinerary-step.active .rfcc-itinerary-step-km,
.rfcc-itinerary-step.active .rfcc-itinerary-step-desc {
  opacity: 1;
}
/* Numbered circle marker per step - reads the same data-step-index the
   scroll/click JS already keys off of, so no extra markup or script is
   needed. Mirrors the "inverted" active/inactive styling of the numbered
   map markers in routes-map-full-view.php for a consistent visual language
   between the list and the map. Colour is admin-configurable (Styles tab,
   "Itinerary Markers") via --rfcc-itinerary-marker-color, set globally in
   route-finder.php's rfcc_output_itinerary_marker_color_style(); the SAME
   var drives the map markers too, so list and map always match.
   !important throughout: the active theme (Customizr Pro) styles ::before
   on list items with its own counter-based numbering (content, display,
   background etc.), which otherwise wins this cascade and replaces our
   circle with its own plain numbered-counter style. */
.rfcc-itinerary-step::before {
  content: attr(data-step-index) !important;
  position: absolute !important;
  left: -44px !important;
  top: 0 !important;
  z-index: 1 !important;
  box-sizing: border-box !important;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  font-family: inherit !important;
  background: var(--rfcc-itinerary-marker-color, var(--rf-accent-primary, #d30b4c)) !important;
  color: #fff !important;
  border: 3px solid #fff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}
.rfcc-itinerary-step.active::before {
  background: #fff !important;
  border-color: var(--rfcc-itinerary-marker-color, var(--rf-accent-primary, #d30b4c)) !important;
  color: var(--rfcc-itinerary-marker-color, var(--rf-accent-primary, #d30b4c)) !important;
  transform: scale(1.1) !important;
}
.rfcc-itinerary-step-heading {
  margin: 0;
  font-size: var(--rfcc-itinerary-heading-size, 20px);
  font-weight: var(--rfcc-itinerary-heading-weight, 700);
  text-transform: var(--rfcc-itinerary-heading-transform, none);
  color: var(--rf-text-secondary, #6c757d);
  transition: color 0.25s ease;
  line-height: 1.3;
}
.rfcc-itinerary-step.active .rfcc-itinerary-step-heading {
  color: var(--rf-text-primary, #212529);
}
.rfcc-itinerary-step-km {
  display: inline-block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 0.8em;
  color: var(--rf-text-secondary, #6c757d);
  white-space: nowrap;
}
.rfcc-itinerary-step-desc {
  margin-top: 6px;
  color: var(--rf-text-secondary, #6c757d);
  font-size: 0.95em;
  line-height: 1.5;
}

.grade-badge {
  display: inline-block;
  position: relative;
  min-width: 2em;
  padding: 0.2em 0.5em;
  margin-right: 0.3em;
  text-align: center;
  color: #fff;
  border-radius: 0.25em;
  font-weight: bold;
  cursor: help;
}
.grade-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: inherit;
  color: #fff;
  padding: 0.4em;
  white-space: normal;
  border-radius: 0.25em;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  pointer-events: none;
  z-index: 10;
  max-width: 350px;
  min-width: 200px;
}
.grade-badge:hover::after {
  opacity: 1;
  pointer-events: auto;
}
.grade-g1 { background-color: blue; }
.grade-g2 { background-color: darkgreen; }
.grade-g2-5 { background-color: green; }
.grade-g3 { background-color: lightgreen; }
.grade-g4 { background-color: #ffbf00; }
.grade-g5 { background-color: #cc9900; }



/* Grade badges in tables (group output page) */
td .grade-badge,
table .grade-badge {
    display: inline-block !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.85em !important;
    font-weight: bold !important;
    color: white !important;
    margin-right: 4px !important;
    margin-bottom: 2px !important;
    position: relative !important;
    cursor: pointer !important;
}

/* Grade colors for table badges */
td .grade-g1, table .grade-g1 { background-color: blue !important; }
td .grade-g2, table .grade-g2 { background-color: darkgreen !important; }
td .grade-g2-5, table .grade-g2-5 { background-color: green !important; }
td .grade-g3, table .grade-g3 { background-color: lightgreen !important; }
td .grade-g4, table .grade-g4 { background-color: #ffbf00 !important; }
td .grade-g5, table .grade-g5 { background-color: #cc9900 !important; }

/* Tooltip styles for table badges */
td .grade-badge::after,
table .grade-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: inherit;
    color: #fff;
    padding: 0.4em;
    white-space: nowrap;
    border-radius: 0.25em;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    z-index: 10;
    max-width: 350px;
    white-space: normal;
}

td .grade-badge:hover::after,
table .grade-badge:hover::after {
    opacity: 1;
    pointer-events: auto;
}

/* Club Group badges styling */
.club-group-badge {
    display: inline-block;
    position: relative;
    padding: 4px 8px;
    margin-right: 4px;
    margin-bottom: 2px;
    background-color: #0073aa;
    color: white;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: help;
    text-decoration: none;
}

.club-group-badge:hover {
    background-color: #005a87;
    color: white;
}

/* Club Group badge tooltips */
.club-group-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 0.5em;
    white-space: nowrap;
    border-radius: 0.25em;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    z-index: 10;
    max-width: 350px;
    white-space: normal;
    font-size: 12px;
    font-weight: normal;
}

.club-group-badge:hover::after {
    opacity: 1;
    pointer-events: auto;
}

/* Club Group badges in tables */
td .club-group-badge,
table .club-group-badge {
    display: inline-block !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.85em !important;
    font-weight: bold !important;
    color: white !important;
    background-color: #0073aa !important;
    margin-right: 4px !important;
    margin-bottom: 2px !important;
    position: relative !important;
    cursor: help !important;
}

td .club-group-badge:hover,
table .club-group-badge:hover {
    background-color: #005a87 !important;
    color: white !important;
}

/* Club Group badge tooltips in tables */
td .club-group-badge::after,
table .club-group-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 0.5em;
    white-space: nowrap;
    border-radius: 0.25em;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    z-index: 10;
    max-width: 350px;
    white-space: normal;
    font-size: 12px;
    font-weight: normal;
}

td .club-group-badge:hover::after,
table .club-group-badge:hover::after {
    opacity: 1;
    pointer-events: auto;
}


.route-item-content .route-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 0;
    flex-wrap: nowrap;
}
.route-item-content .stat {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 0.3rem;
    white-space: nowrap;
}
.route-item-content .stat-icon {
    font-size: 1rem;
    color: #667eea;
}
.route-item-content .stat-value {
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}
.rfcc-dest-into-route {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 4px 6px;
    font-size: 0.82rem;
    color: var(--rf-text-secondary, #777);
    margin: 0 0 8px;
    padding: 0;
    line-height: 1.4;
}
.rfcc-dest-into-route .fa-map-marker {
    color: var(--rf-accent-primary, #d30b4c);
    font-size: 0.9em;
    flex-shrink: 0;
    margin-top: 0.2em;
}
/* The name span: selected by exclusion (not :first-of-type) since a route
   with more than one main destination repeats name+distance spans within
   the same container, and each stop's own name still needs this treatment. */
.rfcc-dest-into-route span:not(.unit-metric):not(.unit-imperial) {
    font-weight: 600;
    color: var(--rf-text-primary, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
}
/* Distance text wraps to its own new line as a whole unit (via the parent's
   flex-wrap) rather than breaking mid-phrase, which previously overlapped
   the row below on narrower cards. */
.rfcc-dest-into-route span.unit-metric,
.rfcc-dest-into-route span.unit-imperial {
    white-space: nowrap;
    flex-shrink: 0;
}
/* Forces the second stop (when a route has exactly two main destinations)
   onto its own row within the same wrapping flex container. */
.rfcc-dest-into-route-sep {
    flex-basis: 100%;
    height: 0;
}
body.rf-dark-mode .rfcc-dest-into-route {
    color: var(--rf-text-secondary, #adb5bd);
}
body.rf-dark-mode .rfcc-dest-into-route span:not(.unit-metric):not(.unit-imperial) {
    color: var(--rf-text-primary, #e9ecef);
}

/* "N stops" expandable list (route has more than 2 main destinations) */
.rfcc-dest-stops-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--rf-text-primary, #333);
    cursor: pointer;
}
.rfcc-dest-stops-toggle:hover { color: var(--rf-accent-primary, #d30b4c); }
.rfcc-dest-stops-toggle-icon { transition: transform 0.15s ease; flex-shrink: 0; }
.rfcc-dest-stops-toggle[aria-expanded="true"] .rfcc-dest-stops-toggle-icon { transform: rotate(180deg); }
.rfcc-dest-stops-list {
    margin: -2px 0 8px;
    padding: 4px 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.rfcc-dest-stops-list[hidden] { display: none; }
.rfcc-dest-stops-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--rf-text-secondary, #777);
}
.rfcc-dest-stops-row-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
body.rf-dark-mode .rfcc-dest-stops-toggle { color: var(--rf-text-primary, #e9ecef); }
body.rf-dark-mode .rfcc-dest-stops-row { color: var(--rf-text-secondary, #adb5bd); }

/* User-facing show/hide toggle (icon next to the v2 sort dropdown) — hides
   only the "always show destination info" block added above; the single
   highlighted stop shown while filtering by a specific destination is
   unaffected, since that reflects the active filter itself. */
body.rfcc-v2-hide-card-stops .rfcc-dest-into-route-always,
body.rfcc-v2-hide-card-stops .rfcc-dest-stops-list {
    display: none !important;
}

.route-item-content p {
    font-size: 0.9rem;
    color: #777;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.route-item-content .view-route-button {
    display: inline-block;
    background-color: #0c55cc;
    color: #fff;
    padding: 10px 15px;
    border-radius: 5px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    margin-top: auto;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.route-item-content .view-route-button:hover {
    background-color: #0a4ba8;
    transform: translateY(-2px);
}
.route-grid.loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#loading-more {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}
.no-routes-found {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 8px;
}
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.route-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.9rem;
    min-width: 700px;
    table-layout: fixed;
}
@media (max-width: 768px) {
    .route-table {
        font-size: 0.8rem;
        min-width: 600px;
    }
    .route-table th, .route-table td {
        padding: 8px 6px;
    }
    .route-table th:nth-child(1), .route-table td:nth-child(1) {
        width: 30%;
    }
    .route-table th:nth-child(4), .route-table td:nth-child(4) {
        width: 35%;
    }
    .description-text {
        font-size: 0.8rem;
    }
    .view-route-button.btn-small {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    /* Enhanced wrapping behavior on smaller screens - switch to flexbox for natural wrapping */
    /* BUT respect collapsed state - don't show when parent section header is collapsed */
    .collapsible-section .section-header:not(.collapsed) ~ .climbing-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .route-shortcut-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .activity-type-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .region-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .club-group-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .direction-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .difficulty-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .tags-buttons,
    /* Also handle when section-content wrapper exists */
    .collapsible-section .section-header:not(.collapsed) ~ .section-content > .climbing-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .section-content > .route-shortcut-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .section-content > .activity-type-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .section-content > .region-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .section-content > .club-group-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .section-content > .direction-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .section-content > .difficulty-buttons,
    .collapsible-section .section-header:not(.collapsed) ~ .section-content > .tags-buttons,
    /* And handle non-collapsible sections */
    .filter-section:not(.collapsible-section) .climbing-buttons,
    .filter-section:not(.collapsible-section) .route-shortcut-buttons,
    .filter-section:not(.collapsible-section) .activity-type-buttons,
    .filter-section:not(.collapsible-section) .region-buttons,
    .filter-section:not(.collapsible-section) .club-group-buttons,
    .filter-section:not(.collapsible-section) .direction-buttons,
    .filter-section:not(.collapsible-section) .difficulty-buttons,
    .filter-section:not(.collapsible-section) .tags-buttons {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    /* Ensure buttons have consistent sizing and can wrap naturally */
    .climbing-buttons .climbing-btn,
    .route-shortcut-buttons .route-shortcut-btn,
    .activity-type-buttons .activity-type-btn,
    .activity-type-buttons .activity-type-all-none-btn,
    .region-buttons .region-btn,
    .club-group-buttons .club-group-btn,
    .club-group-buttons .club-group-all-none-btn,
    .direction-buttons .direction-btn,
    .direction-buttons .direction-all-none-btn {
        flex: 0 0 auto;
        min-width: 60px;
    }
}

/* Fix for table view search box */
#route-table-search {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    box-sizing: border-box;
}
#route-table-search::placeholder {
    color: rgba(255, 255, 255, 0.7);
}


/* target only the "area" under the slope chart */
.elevation-control .profile-slope .area {
  fill: url(#linearGradient) !important;
}

/* ===================================================================
   Leaflet Map Control Fixes
=================================================================== */

/* Fix zoom control button text rendering to prevent double-line appearance */
.leaflet-control-zoom a {
    text-decoration: none !important;
    line-height: 26px !important;
    text-align: center !important;
    display: block !important;
}

/* Ensure zoom button icons render correctly */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    position: relative !important;
}

/* Remove any pseudo-elements that might create double lines */
.leaflet-control-zoom-in::before,
.leaflet-control-zoom-in::after,
.leaflet-control-zoom-out::before,
.leaflet-control-zoom-out::after {
    content: none !important;
}

/* Reset button styling - matches Leaflet controls */
.leaflet-control-reset {
    margin-top: 10px !important;
}

.leaflet-control-reset-button {
    display: block !important;
    width: 26px;
    height: 26px;
    line-height: 26px !important;
    text-align: center !important;
    text-decoration: none !important;
    font-size: 18px !important;
    font-weight: bold !important;
    color: #333 !important;
    background: #fff !important;
    border-bottom: 1px solid #ccc !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
}

.leaflet-control-reset-button:hover {
    background: #f4f4f4 !important;
    color: #000 !important;
}

.leaflet-control-reset-button:last-child {
    border-bottom: none !important;
    border-bottom-left-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
}

/* Dark mode support for reset button */
.rf-dark-mode .leaflet-control-reset-button,
[data-rf-theme="dark"] .leaflet-control-reset-button {
    background-color: rgba(42, 42, 42, 0.95) !important;
    color: #e0e0e0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.rf-dark-mode .leaflet-control-reset-button:hover,
[data-rf-theme="dark"] .leaflet-control-reset-button:hover {
    background-color: rgba(60, 60, 60, 0.95) !important;
    color: #ffffff !important;
}

/* Mini/card map controls (.map-container - the results grid, group cards) are
   often configured much shorter than a full-size map (as low as 120px on the
   groups page), where the standard 26px/18px reset button and Leaflet's own
   26px zoom buttons take up a disproportionate share of the visible map. */
.map-container .leaflet-control-reset-button {
    width: 20px !important;
    height: 20px !important;
    line-height: 20px !important;
    font-size: 13px !important;
}
.map-container .leaflet-control-zoom a {
    width: 20px !important;
    height: 20px !important;
    line-height: 20px !important;
    font-size: 14px !important;
}

/* "Locked until tapped" mini map overlay button (see renderMapFromData() in
   simple-route-filter.js) - a single small control in the same corner the
   zoom/reset controls occupy once revealed, so the transition from locked to
   unlocked doesn't jump to a different position. */
.rfcc-minimap-unlock-btn {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    background: var(--rf-bg-card, #fff);
    color: var(--rf-text-primary, #333);
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}
.rfcc-minimap-unlock-btn:hover {
    background: var(--rf-bg-hover, #f4f4f4);
}

/* ===================================================================
   Map Attribution Styling - Full Attributions with Smaller Text & Transparency
=================================================================== */

/* Standard attribution control styling - more transparent, smaller text, full attribution display */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.5) !important;
    color: #333 !important;
    font-size: 0.7rem !important;
    line-height: 1.3 !important;
    padding: 2px 5px !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    backdrop-filter: blur(3px) !important;
    -webkit-backdrop-filter: blur(3px) !important;
}

/* Attribution links styling */
.leaflet-control-attribution a {
    color: #0078a8 !important;
    text-decoration: none !important;
    font-size: 0.7rem !important;
}

.leaflet-control-attribution a:hover {
    text-decoration: underline !important;
    color: #005a78 !important;
}

/* Attribution prefix (Leaflet link) styling */
.leaflet-control-attribution .leaflet-control-attribution-flag {
    display: inline !important;
    font-size: 0.7rem !important;
}

/* Specific styling for mini maps - even smaller and more transparent */
.route-item .leaflet-control-attribution,
.route-grid .leaflet-control-attribution,
#routes-map .leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.4) !important;
    font-size: 0.6rem !important;
    padding: 1px 3px !important;
    line-height: 1.2 !important;
}

.route-item .leaflet-control-attribution a,
.route-grid .leaflet-control-attribution a,
#routes-map .leaflet-control-attribution a {
    font-size: 0.6rem !important;
}

/* Group maps and large maps - slightly larger but still transparent */
.leaflet-map-wrapper .leaflet-control-attribution,
.group-route-view .leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.55) !important;
    font-size: 0.75rem !important;
    padding: 3px 6px !important;
    line-height: 1.3 !important;
}

.leaflet-map-wrapper .leaflet-control-attribution a,
.group-route-view .leaflet-control-attribution a {
    font-size: 0.75rem !important;
}

/* Make sure attribution doesn't interfere with other controls */
.leaflet-control-attribution {
    z-index: 1000 !important;
    max-width: 80% !important;
    word-wrap: break-word !important;
    white-space: normal !important;
    overflow: visible !important;
}

/* Single route map — prevent attribution from wrapping */
.rfcc-map-wrapper .leaflet-control-attribution {
    white-space: nowrap !important;
    max-width: none !important;
}

/* On very small screens, make attribution even more compact */
@media (max-width: 480px) {
    .leaflet-control-attribution {
        font-size: 0.55rem !important;
        padding: 1px 3px !important;
        max-width: 75% !important; /* Allow more space on mobile too */
        line-height: 1.2 !important;
    }
    
    .leaflet-control-attribution a {
        font-size: 0.55rem !important;
    }
    
    /* Mini maps on mobile */
    .route-item .leaflet-control-attribution,
    .route-grid .leaflet-control-attribution {
        font-size: 0.5rem !important;
        padding: 1px 2px !important;
        line-height: 1.1 !important;
    }
    
    .route-item .leaflet-control-attribution a,
    .route-grid .leaflet-control-attribution a {
        font-size: 0.5rem !important;
    }
}

/* External Services Links Styling */
.external-service-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 12px;
    text-decoration: none !important;
    color: var(--rfcc-copy-link-button-color, #0066cc) !important;
    transition: color 0.2s ease;
}

.external-service-link:hover {
    text-decoration: none !important;
    color: var(--rfcc-copy-link-button-hover-color, #0052a3) !important;
}

.external-service-link i {
    font-size: 1em;
}

/* Platform-specific icon colors */
.external-service-link[href*="strava.com"] i {
    color: #fc4c02;
}

.external-service-link[href*="garmin.com"] i {
    color: #007cc3;
}

.external-service-link[href*="ridewithgps.com"] i {
    color: #00a651;
}

.external-service-link[href*="komoot.com"] i {
    color: #6aa127;
}

.external-service-link[href*="mapmyride.com"] i {
    color: #ed6b00;
}

.external-service-link[href*="wahoo.com"] i {
    color: #00aeef;
}

/* Dark mode - use calculated legible colors (lightened if too dark) */
@media (prefers-color-scheme: dark) {
    :root:not([data-rf-theme="light"]) .external-service-link {
        color: var(--rfcc-copy-link-button-color-dark, #4da3ff) !important;
    }

    :root:not([data-rf-theme="light"]) .external-service-link:hover {
        color: var(--rfcc-copy-link-button-hover-color-dark, #66b3ff) !important;
    }

    :root:not([data-rf-theme="light"]) .external-service-link i {
        /* Icons keep their brand colors in dark mode, slightly brighter */
        filter: brightness(1.2);
    }
}

/* Manual dark mode toggle */
:root[data-rf-theme="dark"] .external-service-link {
    color: var(--rfcc-copy-link-button-color-dark, #4da3ff) !important;
}

:root[data-rf-theme="dark"] .external-service-link:hover {
    color: var(--rfcc-copy-link-button-hover-color-dark, #66b3ff) !important;
}

:root[data-rf-theme="dark"] .external-service-link i {
    filter: brightness(1.2);
}

/* Route Info Table Links - Consistent Styling */
/* Apply to all links in route info tables on single and group pages */
.ride-table a,
.route-info-table a,
.route-details-table a {
    text-decoration: none !important;
    color: var(--rfcc-copy-link-button-color, #0066cc) !important;
    transition: color 0.2s ease;
}

.ride-table a:hover,
.route-info-table a:hover,
.route-details-table a:hover {
    text-decoration: none !important;
    color: var(--rfcc-copy-link-button-hover-color, #0052a3) !important;
}

/* Dark mode - use calculated legible colors (lightened if too dark) */
@media (prefers-color-scheme: dark) {
    :root:not([data-rf-theme="light"]) .ride-table a,
    :root:not([data-rf-theme="light"]) .route-info-table a,
    :root:not([data-rf-theme="light"]) .route-details-table a {
        color: var(--rfcc-copy-link-button-color-dark, #4da3ff) !important;
    }

    :root:not([data-rf-theme="light"]) .ride-table a:hover,
    :root:not([data-rf-theme="light"]) .route-info-table a:hover,
    :root:not([data-rf-theme="light"]) .route-details-table a:hover {
        color: var(--rfcc-copy-link-button-hover-color-dark, #66b3ff) !important;
    }
}

/* Manual dark mode toggle */
:root[data-rf-theme="dark"] .ride-table a,
:root[data-rf-theme="dark"] .route-info-table a,
:root[data-rf-theme="dark"] .route-details-table a {
    color: var(--rfcc-copy-link-button-color-dark, #4da3ff) !important;
}

:root[data-rf-theme="dark"] .ride-table a:hover,
:root[data-rf-theme="dark"] .route-info-table a:hover,
:root[data-rf-theme="dark"] .route-details-table a:hover {
    color: var(--rfcc-copy-link-button-hover-color-dark, #66b3ff) !important;
}

/* Icons in table links should maintain their color */
.ride-table a i,
.route-info-table a i,
.route-details-table a i {
    margin-right: 4px;
}

/* GPX "How to use this" Link Styling */
.gpx-how-to-link {
    font-size: 0.85em !important;
    opacity: 0.75 !important;
    display: inline-block;
    margin-top: 4px;
}

.gpx-how-to-link:hover {
    opacity: 1 !important;
}

/* Ensure the link inherits the proper colors from parent table link styles */
/* Light mode colors already inherited from .ride-table a, .route-info-table a, .route-details-table a */

/* Dark mode - ensure the link uses the same colors as other table links */
@media (prefers-color-scheme: dark) {
    :root:not([data-rf-theme="light"]) .gpx-how-to-link {
        color: var(--rfcc-copy-link-button-color-dark, #4da3ff) !important;
    }

    :root:not([data-rf-theme="light"]) .gpx-how-to-link:hover {
        color: var(--rfcc-copy-link-button-hover-color-dark, #66b3ff) !important;
    }
}

/* Manual dark mode toggle */
:root[data-rf-theme="dark"] .gpx-how-to-link {
    color: var(--rfcc-copy-link-button-color-dark, #4da3ff) !important;
}

:root[data-rf-theme="dark"] .gpx-how-to-link:hover {
    color: var(--rfcc-copy-link-button-hover-color-dark, #66b3ff) !important;
}

/* ── Rebuild GPX from location link ──────────────────────────────────────── */
.rfcc-gpx-rebuild-link {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.9em;
}

.rfcc-info-tip {
    display: inline-block;
    margin-left: 5px;
    color: #999;
    cursor: help;
    vertical-align: middle;
    font-size: 0.85em;
}

.rfcc-info-tip:hover {
    color: #555;
}

/* ── Single route map: tighter spacing between topleft controls ──────────── */
.leaflet-map-wrapper .leaflet-top.leaflet-left .leaflet-control {
    margin-top: 4px !important;
}
.leaflet-map-wrapper .leaflet-top.leaflet-left .leaflet-control:first-child {
    margin-top: 10px !important;
}

/* ── Current location (geolocation) control ───────────────────────────────── */
.rfcc-locate-control a {
    line-height: 26px !important;
    text-align: center !important;
    font-size: 14px !important;
    color: #444 !important;
    text-decoration: none !important;
}

.rfcc-locate-control a:hover {
    color: #000 !important;
    background: #f4f4f4 !important;
}

.rfcc-locate-control a.rfcc-locate-active {
    color: #4285F4 !important;
    background: #e8f0fe !important;
}

/* ── Scroll zoom toggle control ──────────────────────────────────────────── */
.rfcc-scrollzoom-control a {
    line-height: 26px !important;
    text-align: center !important;
    font-size: 13px !important;
    color: #444 !important;
    text-decoration: none !important;
}

.rfcc-scrollzoom-control a:hover {
    color: #000 !important;
    background: #f4f4f4 !important;
}

.rfcc-scrollzoom-control a.rfcc-scrollzoom-ctrl {
    color: #e67e22 !important;
    background: #fef3e2 !important;
}

.rf-dark-mode .rfcc-scrollzoom-control a,
[data-rf-theme="dark"] .rfcc-scrollzoom-control a {
    color: #ccc !important;
    background: rgba(42, 42, 42, 0.95) !important;
}

.rf-dark-mode .rfcc-scrollzoom-control a:hover,
[data-rf-theme="dark"] .rfcc-scrollzoom-control a:hover {
    color: #fff !important;
    background: rgba(60, 60, 60, 0.95) !important;
}

.rf-dark-mode .rfcc-scrollzoom-control a.rfcc-scrollzoom-ctrl,
[data-rf-theme="dark"] .rfcc-scrollzoom-control a.rfcc-scrollzoom-ctrl {
    color: #f0a44d !important;
    background: rgba(80, 50, 10, 0.95) !important;
}

/* Dark mode support */
.rf-dark-mode .rfcc-locate-control a,
[data-rf-theme="dark"] .rfcc-locate-control a {
    color: #ccc !important;
    background: rgba(42, 42, 42, 0.95) !important;
}

.rf-dark-mode .rfcc-locate-control a:hover,
[data-rf-theme="dark"] .rfcc-locate-control a:hover {
    color: #fff !important;
    background: rgba(60, 60, 60, 0.95) !important;
}

.rf-dark-mode .rfcc-locate-control a.rfcc-locate-active,
[data-rf-theme="dark"] .rfcc-locate-control a.rfcc-locate-active {
    color: #7baaf7 !important;
    background: rgba(30, 50, 90, 0.95) !important;
}

/* Single route page: reduce oversized theme h1 title */
.single-rfcc_route .entry-title,
.single-rfcc_route h1.entry-title {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
    margin-bottom: 2px !important;
}

/* ── Back-to-top button (shared by v1 + v2 route finder pages) ───────────────
   Fixed bottom-right, small, semi-transparent square with a slightly curved
   edge and an up chevron. Hidden until the page is scrolled down. */
.rfcc-backtotop {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, background 0.2s ease;
    z-index: 9998;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    -webkit-appearance: none;
    appearance: none;
}
.rfcc-backtotop.visible {
    opacity: 0.6;
    visibility: visible;
    transform: translateY(0);
}
/* Slightly less opaque on hover/focus */
.rfcc-backtotop.visible:hover,
.rfcc-backtotop.visible:focus {
    opacity: 0.4;
    outline: none;
}
.rfcc-backtotop i { pointer-events: none; }

@media (max-width: 768px) {
    .rfcc-backtotop {
        bottom: 16px;
        right: 16px;
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
}
