﻿/* ========================================
   Create Route Page - Bootstrap 5.3 Styles
   ======================================== */

/* Prevent body scrolling on Create Route page - map fills viewport */
body {
    overflow: hidden !important;
    height: 100vh;
    margin: 0;
    padding: 0;
}

/* Ensure modal cleanup doesn't leave unwanted styles */
body:not(.modal-open) {
    overflow: hidden !important;
    padding-right: 0 !important;
}


/* ============================================
   FONT SIZE REDUCTION FOR CREATE ROUTE PAGE
   Everything below header - reduced by ~15%
   ============================================ */


/*font-size: 0.8125rem !important; */ /* 13px for main content */
/*font-size: 0.75rem !important; */ /* 12px for labels/buttons */
/*font-size: 0.875rem !important; */ /* 14px for card titles */

/* Reduce base font size for main content area */
#banner,
.offcanvas-body,
.card,
.form-control,
.form-select,
.btn,
.input-group-text,
.nav-link,
.badge,
.list-group-item,
#map-tools,
#elevation-section {
    font-size: 0.875rem !important; /* Was 1rem (16px), now 14px */
}

/* Smaller labels and helper text */
.form-label,
.form-text,
small,
.text-muted {
    font-size: 0.75rem !important; /* 13px */
}

/* Card titles slightly larger but still reduced */
.card-title,
.card-header,
.offcanvas-title {
    font-size: 1rem !important; /* 16px */
}

/* Button text */
.btn {
    font-size: 0.75rem !important; /* 13px */
    padding: 0.4rem 0.8rem; /* Slightly tighter padding */
}

/* Input fields */
.form-control,
.form-select {
    font-size: 0.875rem !important;
    padding: 0.4rem 0.75rem; /* Adjust padding to match smaller font */
}

/* Map tools panel */
#map-tools .btn,
#map-tools label {
    font-size: 0.8125rem !important;
}

/* Accordion/collapse elements */
.accordion-button,
.collapse-header {
    font-size: 0.875rem !important;
}

/* Tooltips and popovers */
.tooltip,
.popover {
    font-size: 0.8125rem !important;
}

/* Elevation chart text */
#elevation_chart,
#elevation-section * {
    font-size: 0.8125rem !important;
}

/* Distance display */
.distance-display,
#totaldistance {
    font-size: 0.9375rem !important; /* 15px - slightly larger for readability */
}

/* ============================================
   END
   FONT SIZE REDUCTION FOR CREATE ROUTE PAGE
   Everything below header - reduced by ~15%
   ============================================ */


/* ===== Root Variables ===== */
:root {
    --sidebar-width: 300px;
    --navbar-height: 56px;
    --primary-color: #0d6efd;
    --success-color: #198754;
    --secondary-color: #6c757d;
    --transition-speed: 0.3s;
}

/* ===== General Layout ===== */
body {
    overflow-x: hidden;
}

#map-section {
    height: calc(100vh - var(--navbar-height));
    position: relative;
    margin-left: 0;
    transition: margin-left var(--transition-speed) ease, height 0.3s ease;
}

#banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    transition: height 0.3s ease;
}

/* ===== Sidebar Styles ===== */
#mapSidebar {
    width: var(--sidebar-width) !important;
    max-width: 90vw;
}

#sidebar-wrapper {
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    /* padding-bottom: 160px !important; */
}

    /* Sidebar scrollbar styling */
    #sidebar-wrapper::-webkit-scrollbar {
        width: 8px;
    }

    #sidebar-wrapper::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    #sidebar-wrapper::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }

        #sidebar-wrapper::-webkit-scrollbar-thumb:hover {
            background: #555;
        }

/* ===== Compact Sidebar Styling ===== */
/* Further reduce font sizes and spacing specifically for sidebar */
.sidebar-compact {
    font-size: 0.8125rem !important; /* 13px base */
}

.sidebar-compact .sidebar-label {
    font-size: 0.6875rem !important; /* 11px for labels */
    margin-bottom: 0.25rem !important;
}

.sidebar-compact .sidebar-card-header {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8125rem !important; /* 13px */
}

.sidebar-compact .sidebar-card-title {
    font-size: 0.8125rem !important; /* 13px */
}

.sidebar-compact .sidebar-card-body {
    padding: 0.75rem !important;
}

.sidebar-compact .form-control-sm,
.sidebar-compact .form-select-sm {
    font-size: 0.75rem !important; /* 12px */
    padding: 0.25rem 0.5rem !important;
    height: calc(1.5em + 0.5rem + 2px) !important;
}

.sidebar-compact .btn-sm {
    font-size: 0.75rem !important; /* 12px */
    padding: 0.35rem 0.65rem !important;
}

.sidebar-compact .input-group-sm .btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
}

.sidebar-compact .form-check-label {
    font-size: 0.75rem !important;
}

.sidebar-compact .card {
    margin-bottom: 0.5rem !important;
}

.sidebar-compact hr {
    margin: 0.5rem 0 !important;
}

/* Reduce icon sizes in sidebar */
.sidebar-compact .bi {
    font-size: 0.875rem !important;
}

/* Make card headers more compact */
.sidebar-compact .card-header .bi-chevron-down {
    font-size: 0.75rem !important;
    transition: transform 0.3s ease;
}

/* Rotate chevron when collapsed */
.sidebar-compact .card-header.collapsed .bi-chevron-down {
    transform: rotate(-90deg);
}

/* Adjust input group for search location */
.sidebar-compact .input-group-sm {
    height: auto !important;
}

/* Reduce gap in rows */
.sidebar-compact .row.g-1 {
    --bs-gutter-x: 0.25rem;
}

.sidebar-compact .row.g-2 {
    --bs-gutter-x: 0.5rem;
}

/* Textarea in sidebar */
.sidebar-compact textarea.form-control-sm {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
}

/* ===== Sidebar Toggle Button ===== */
#desktop-sidebar-toggle {
    transition: left var(--transition-speed) ease;
    padding: 1.5rem 0.75rem !important;
    height: 80px;
    border-radius: 0 8px 8px 0 !important;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    top: 280px !important;
}

    #desktop-sidebar-toggle:hover {
        box-shadow: 3px 3px 12px rgba(0,0,0,0.3);
    }

#sidebar-toggle-icon {
    font-size: 1.5rem;
}

/* Mobile menu button */
.btn[data-bs-toggle="offcanvas"] {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#mapSidebar {
    transition: transform 0.3s ease;
}

#map-section {
    transition: margin-left 0.3s ease;
}

#desktop-sidebar-toggle {
    transition: left 0.3s ease;
}

/* ===== Card Sections ===== */
.card {
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

    .card-header:hover {
        opacity: 0.9;
    }

    .card-header i.bi-chevron-down {
        transition: transform 0.3s ease;
    }

    .card-header[aria-expanded="false"] i.bi-chevron-down {
        transform: rotate(-90deg);
    }

/* ===== Map Tools Panel ===== */
#map-tools {
    z-index: 1030;
    border-radius: 8px;
    /* box-shadow: 0 4px 12px rgba(0,0,0,0.15); */
    transition: all var(--transition-speed) ease;
}

    /* Map Tools Toggle Button */
    .map-tools-toggle {
        border-radius: 6px;
        padding: 0.3rem 0.5rem;
        float: right;
        font-size: 0.75rem;
    }

        .map-tools-toggle i {
            font-size: 0.85rem;
        }

    /* Map Tools Body - Float right to align with button */
    .map-tools-body {
        max-width: 220px;
        width: 220px;
        float: right;
        clear: both;
    }

    /* Map Tools Action Buttons */
    .map-tools-btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.35rem;
    }

        .map-tools-btn i {
            font-size: 0.8rem;
        }

    /* Map Tools Travel Mode Buttons */
    .map-tools-mode-btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }

        .map-tools-mode-btn i {
            font-size: 0.8rem;
        }

    /* Map Tools Labels */
    .map-tools-label {
        font-size: 0.7rem;
    }

    /* Map Tools Icons */
    .map-tools-icon {
        font-size: 0.75rem;
    }

    /* Map Tools Form Switches */
    .map-tools-switch {
        font-size: 0.8rem;
    }

    /* Map Tools Checkbox Labels */
    .map-tools-check-label {
        font-size: 0.7rem;
    }

    /* Map Tools Select Dropdown */
    .map-tools-select {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    #map-tools .card-header {
        border-radius: 8px 8px 0 0;
        padding: 0.75rem;
    }

    #map-tools .card-body {
        padding: 0.5rem;
    }

    #map-tools .buttons button {
        font-size: 0.7rem;
        padding: 0.25rem 0.35rem;
        transition: all 0.2s ease;
        white-space: nowrap;
    }

        #map-tools .buttons button:hover {
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

    #map-tools .btn-group label {
        padding: 0.25rem 0.5rem;
        cursor: pointer;
        font-size: 0.7rem;
    }

/* ===== Elevation Chart ===== */
#elevation-section {
    max-width: 100%;
    background: white;
}

#elevationChartHead {
    cursor: pointer;
    user-select: none;
}

    #elevationChartHead:hover {
        background-color: #f8f9fa;
    }

#elevation-chevron {
    transition: transform 0.3s ease;
}

#elevation_chart {
    height: 148px;
    padding: 1rem;
    overflow-x: auto;
}

/* ===== Form Controls ===== */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: all 0.2s ease;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    }

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ===== Buttons ===== */
.btn {
    border-radius: 6px;
    transition: all 0.2s ease;
}

    .btn:hover {
        transform: translateY(-1px);
    }

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.save-btn {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Fix for btn-custom - Override Bootstrap 5.3 CSS variables */
.btn-custom {
    /* Set Bootstrap's button CSS variables */
    --bs-btn-color: white;
    --bs-btn-bg: var(--medium-green);
    --bs-btn-border-color: var(--medium-green);
    
    --bs-btn-hover-color: white;
    --bs-btn-hover-bg: var(--medium-dark-green);
    --bs-btn-hover-border-color: var(--medium-dark-green);
    
    --bs-btn-focus-color: white;
    --bs-btn-focus-bg: var(--medium-dark-green);
    --bs-btn-focus-border-color: var(--medium-dark-green);
    --bs-btn-focus-shadow-rgb: 96, 131, 14; /* medium-green RGB */
    
    --bs-btn-active-color: white;
    --bs-btn-active-bg: var(--medium-dark-green);
    --bs-btn-active-border-color: var(--medium-dark-green);
    
    --bs-btn-disabled-color: white;
    --bs-btn-disabled-bg: var(--medium-green);
    --bs-btn-disabled-border-color: var(--medium-green);
    
    /* Also set the direct properties as fallback */
    color: white;
    background-color: var(--medium-green);
    border-color: var(--medium-green);
}

.btn-custom:hover,
.btn-custom:focus {
    color: white;
    background-color: var(--medium-dark-green);
    border-color: var(--medium-dark-green);
}

.btn-custom:active,
.btn-custom.active {
    color: white;
    background-color: var(--medium-dark-green);
    border-color: var(--medium-dark-green);
}

.btn-custom:disabled,
.btn-custom.disabled {
    color: white;
    background-color: var(--medium-green);
    border-color: var(--medium-green);
    opacity: 0.65;
}

/* ===== Loading Overlay ===== */
#Overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.3);
    z-index: 9999;
}

/* ===== Utility Classes ===== */
.rotate-180 {
    transform: rotate(180deg);
}

.transition-all {
    transition: all var(--transition-speed) ease;
}

.pointer {
    cursor: pointer;
}

.shadow-soft {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== Animation Classes ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ===== Responsive Design ===== */

/* Desktop (≥ 992px) */
@media (min-width: 992px) {
    /* Remove the fixed margin - let JavaScript control it */
    #map-section {
        /* margin-left: var(--sidebar-width); - REMOVED, JS controls this */
    }

    #mapSidebar {
        position: fixed !important;
        top: var(--navbar-height);
        left: 0;
        height: calc(100vh - var(--navbar-height));
        /* transform: none !important; - REMOVED, JS controls this */
        visibility: visible !important;
        border-right: 1px solid rgba(0,0,0,0.1);
    }

        /* Keep sidebar visible and in place when Bootstrap adds .show class */
        #mapSidebar:not([style*="translateX"]) {
            transform: translateX(0);
        }

    .offcanvas-backdrop {
        display: none !important;
    }

    #map-tools {
        right: 20px;
    }
}

/* Tablets (portrait) */
@media (max-width: 991px) {
    #map-section {
        margin-left: 0;
        height: calc(100vh - var(--navbar-height));
    }

    #map-tools {
        right: 10px;
        top: 70px;
        max-width: 220px;
        width: 220px;
    }

    #desktop-sidebar-toggle {
        display: none !important;
    }
}

/* Mobile devices */
@media (max-width: 767px) {
    #map-tools {
        position: fixed;
        top: 220px !important;
        bottom: auto;
        right: 10px;
        left: auto;
        max-width: none;
        width: auto;
        max-height: 70vh;
        overflow-y: auto;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important; /* Right-align everything */
    }

        #map-tools .card-body {
            padding: 0.5rem !important;
            width: auto !important;
            max-width: 260px !important; /* Constrain width */
        }

        /* FORCE 2-column layout on mobile - override Bootstrap responsive behavior */
        #map-tools .buttons .row {
            gap: 0.25rem !important;
            display: flex !important;
            flex-wrap: wrap !important;
            width: 100% !important; /* Fill card-body */
            max-width: 100% !important;
            margin: 0 !important;
        }

        #map-tools .buttons .col-6,
        #map-tools .buttons [class*="col-6"],
        #map-tools .buttons .col-sm-6,
        #map-tools .buttons .col-md-6 {
            flex: 0 0 calc(50% - 0.125rem) !important;
            max-width: calc(50% - 0.125rem) !important;
            width: calc(50% - 0.125rem) !important;
            margin: 0 !important;
            padding: 0 !important;
        }
        
        /* Make buttons fill their container width */
        #map-tools .buttons button {
            width: 100% !important;
            margin: 0 !important;
        }
        
        /* Ensure Travel Mode and Distance Units sections stay within card-body */
        #map-tools .control-group {
            width: 100% !important;
            max-width: 100% !important;
        }

    #elevation-section.show {
        display: block;
        /*
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            z-index: 1040;
                */
    }

    .btn[data-bs-toggle="offcanvas"] {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

/* Very small mobile devices */
@media (max-width: 576px) {
    #map-tools .card-header h5 {
        font-size: 1rem;
    }

    #map-tools .buttons button {
        font-size: 0.7rem;
        padding: 0.25rem 0.375rem;
    }

        #map-tools .buttons button i {
            font-size: 0.9rem;
        }

    .card-header h6 {
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

/* ===== Print Styles ===== */
@media print {
    #mapSidebar,
    #map-tools,
    #desktop-sidebar-toggle,
    .btn[data-bs-toggle="offcanvas"] {
        display: none !important;
    }

    #map-section {
        margin-left: 0 !important;
        height: 100vh !important;
    }
}

/* ===== Accessibility ===== */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================================================
   positions for mobile hamburger menu for left side partial popover
   =================================================================== 
    */
/* Mobile menu button positioning */
.mobile-map-menu-btn {
    top: 70px; /* Default positioning */
}

/* Mobile devices - move button down to avoid Google Maps controls */
@media (max-width: 767px) {
    .mobile-map-menu-btn {
        top: 70px !important; /* Adjusted to clear map controls */
    }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 991px) {
    .mobile-map-menu-btn {
        top: 20px !important;
    }
}

/* ===================================================================
   CSS-ONLY POSITIONING SOLUTION (Alternative to JavaScript)
   =================================================================== 
   
   This is a simpler, more reliable alternative that uses only CSS.
   No JavaScript calculations needed.
   
   Add this to your create-route.css file
*/

/* Force the ad container to a fixed height */
/*
.ad-banner-container {
    height: 106px !important;
    max-height: 106px !important;
    overflow: hidden !important;
    display: block !important;
}*/

    /* Ensure the ad wrapper doesn't expand */
    .ad-banner-container > div,
    .ad-banner-container > script + ins {
        max-height: 90px !important;
    }

/* COMMENTED OUT - Using JavaScript positioning instead
.ad-banner-container > div,
.ad-banner-container > script + ins {
    max-height: 90px !important;
}

:root {
    --header-height: 96px;
    --ad-height: 106px;
    --total-top-offset: calc(var(--header-height) + var(--ad-height));
}

#map-tools {
    top: var(--total-top-offset) !important;
}

#map-section {
    height: calc(100vh - var(--total-top-offset)) !important;
}

#desktop-sidebar-toggle {
    top: var(--total-top-offset) !important;
}

button[data-bs-target="#mapSidebar"].d-lg-none {
    top: var(--total-top-offset) !important;
}

@media (max-width: 767px) {
    #map-tools {
        top: auto !important;
        bottom: 20px !important;
    }

    button[data-bs-target="#mapSidebar"].d-lg-none {
        top: var(--header-height) !important;
    }
}
*/

/* ===== Compact Tools Button & Panel ===== */
#map-tools {
    transition: all 0.3s ease;
}

    #map-tools button[data-bs-toggle="collapse"] {
        white-space: nowrap;
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    /* Only show shadow on toolsBody when expanded */
    #map-tools #toolsBody.show {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

    #map-tools #toolsBody {
        opacity: 0.95;
        backdrop-filter: blur(8px);
    }

        #map-tools #toolsBody:hover {
            opacity: 1;
        }
/* Mobile - position tools at top-right, below Google Maps fullscreen button */
@media (max-width: 767px) {
    #map-tools {
        position: fixed !important;
        top: 220px !important;
        bottom: auto !important;
        right: 10px !important;
        left: auto !important;
        max-width: none !important;
        width: auto !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important; /* Right-align everything */
    }

        /* Keep toggle button compact and consistent */
        #map-tools button[data-bs-toggle="collapse"] {
            width: auto !important;
            min-width: max-content !important;
            white-space: nowrap !important;
        }

        #map-tools #toolsBody {
            width: auto !important;
            max-width: 260px !important; /* Constrain width */
            max-height: 60vh;
            overflow-y: auto;
        }
        
        /* Constrain the card body width */
        #map-tools .card-body {
            width: auto !important;
            max-width: 260px !important; /* Constrain width */
            padding: 0.5rem !important;
        }
        
        /* FORCE 2-column button layout on mobile */
        #map-tools .buttons .row {
            display: flex !important;
            flex-wrap: wrap !important;
            width: 100% !important; /* Fill card-body */
            max-width: 100% !important;
            margin: 0 !important;
            gap: 0.25rem !important;
        }
        
        #map-tools .buttons .col-6,
        #map-tools .buttons [class*="col-6"],
        #map-tools .buttons .col-sm-6,
        #map-tools .buttons .col-md-6 {
            flex: 0 0 calc(50% - 0.125rem) !important;
            max-width: calc(50% - 0.125rem) !important;
            width: calc(50% - 0.125rem) !important;
            padding: 0 !important;
            margin: 0 !important;
        }
        
        /* Make buttons fill their container width */
        #map-tools .buttons button {
            width: 100% !important;
            margin: 0 !important;
        }
        
        /* Ensure Travel Mode and Distance Units sections stay within card-body */
        #map-tools .control-group {
            width: 100% !important;
            max-width: 100% !important;
        }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    #map-tools {
        right: 10px !important;
        max-width: 220px !important;
    }

        #map-tools #toolsBody {
            max-width: 220px !important;
            width: 220px !important;
        }
}

/* Only shadow when collapsed */
#map-tools button[data-bs-toggle="collapse"].collapsed {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* No shadow when expanded */
#map-tools button[data-bs-toggle="collapse"]:not(.collapsed) {
    box-shadow: none;
}

/* ============================================= */
/* ===== Distance Display Box (Center Top) ===== */
/* ============================================= */

#distance-display-box {
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    padding: 5px 24px !important;
    top: 70px;
    z-index: 1025;
    opacity: 0.95;
    backdrop-filter: blur(8px);
    min-width: 140px;
    transition: all 0.3s ease;
    font-size: 3.5rem !important;
    opacity: .9 !important;
    border: 1px solid silver !important;
}

    #distance-display-box h3 {
        font-size: 3.5rem !important;
        color: #535353;
    }

/* Mobile adjustments for distance display */
@media (max-width: 767px) {
    #distance-display-box {
        /* top: 10px !important; */
        font-size: 0.9rem;
        padding: 5px 20px !important;
    }

        #distance-display-box small {
            font-size: 0.6rem !important;
        }

        /* #distance-display-box h5 {
            font-size: 0.95rem !important;
        }*/

        #distance-display-box h3 {
            font-size: 2.5rem !important;
        }
}


@media (max-width: 580px) {
    #distance-display-box {
        padding: 5px 10px !important;
        min-width: 110px;
    }

        #distance-display-box h3 {
            font-size: 1.8rem !important;
        }
}

@media (max-width: 500px) {
    #distance-display-box {
        padding: 5px 10px !important;
        min-width: 110px;
    }

        #distance-display-box h3 {
            font-size: 1.4rem !important;
        }
}

/* ============================================= */
/* ===== Compact Tools Button & Panel - Shadow Fix ===== */
/* ============================================= */
#map-tools {
    transition: all 0.3s ease;
}

    /* Only show shadow on button when tools body is collapsed */
    #map-tools button[data-bs-toggle="collapse"].collapsed {
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    /* No shadow on button when expanded */
    #map-tools button[data-bs-toggle="collapse"]:not(.collapsed) {
        box-shadow: none;
    }

    #map-tools button[data-bs-toggle="collapse"] {
        white-space: nowrap;
        font-weight: 600;
    }

    /* Only show shadow on toolsBody when expanded */
    #map-tools #toolsBody.show {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

    #map-tools #toolsBody {
        opacity: 0.95;
        backdrop-filter: blur(8px);
    }

        #map-tools #toolsBody:hover {
            opacity: 1;
        }

/* Mobile - position tools at bottom */
@media (max-width: 767px) {
    #map-tools {
        position: fixed !important;
        top: auto !important;
        bottom: 20px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: none !important;
    }

        #map-tools button[data-bs-toggle="collapse"] {
            width: 100%;
            float: none !important;
        }

        #map-tools #toolsBody {
            width: 100% !important;
            max-width: 100% !important;
            max-height: 50vh;
            overflow-y: auto;
        }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    #map-tools {
        right: 10px !important;
        max-width: 220px !important;
    }

        #map-tools #toolsBody {
            max-width: 220px !important;
            width: 220px !important;
        }
}

/* Elevation Section - Hidden by default, slides up when visible */
#elevation-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1034;
    transform: translateY(100%);
    transition: transform 0.3s ease, left 0.3s ease;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

    #elevation-section.elevation-visible {
        transform: translateY(0) !important;
    }

/* Elevation toggle button */
#elevation-toggle-btn {
    transition: left 0.3s ease, bottom 0.3s ease;
}

    #elevation-toggle-btn:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
        transform: translateY(-2px);
    }

/* Mobile adjustments */
@media (max-width: 767px) {
    #elevation-section {
        max-height: 40vh;
    }

    #elevation-toggle-btn {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 767px) {
    body {
        overflow: auto !important;
    }

    #sidebar-wrapper {
        /* padding-bottom: 180px !important; */
    }
}


/* ===================================================================
   Mobile Navbar Z-Index - Simple fix for menu over buttons
   =================================================================== */

/* On mobile/tablet, ensure the navbar menu appears above the map buttons */
@media (max-width: 991.98px) {
    /* Navbar needs higher z-index than map tools and buttons */
    nav.navbar.sticky-top {
        z-index: 1050 !important;
    }
    
    .navbar-collapse {
        z-index: 1050 !important;
        background-color: var(--medium-green);
    }
    
    /* Map tools and menu button have lower z-index */
    #map-tools {
        z-index: 1020 !important;
    }
    
    .btn[data-bs-target="#mapSidebar"],
    button[data-bs-target="#mapSidebar"] {
        z-index: 1020 !important;
    }
}

/* ===================================================================
   Make toggle switch white when checked so it's visible on blue bar
   =================================================================== */

/* Unchecked state - lighter for visibility */
.workout-toggle {
    /*background-color: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important; */
    color: rgb(33, 37, 41);
    background-color: rgb(226, 230, 234) !important;
    border-color: rgb(255, 255, 255) !important;
    width: 40px !important;
    height: 20px !important;
    margin-right: 10px;
}

    .workout-toggle:checked {
        /*background-color: #fff !important;
        border-color: #fff !important;*/
        color: rgb(33, 37, 41);
        background-color: rgb(255, 193, 7) !important;
        border-color: rgb(255, 255, 255) !important;
    }

        /* Ensure toggle circle/knob is visible */
        .workout-toggle:checked::before {
            background-color: rgb(255, 193, 7) !important;
        }
