body {
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    font-family: sans-serif;
}

#topbar {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #eee;
    border-bottom: 1px solid #ccc;
    align-items: center;
}

#main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#nearby-radius-label {
    font-size: 15px;
    /* or 12px if you want it really small */
}

.slider-hitbox {
    padding: 12px 0;
    /* big invisible touch zone */
}

.slider-hitbox input[type="range"] {
    height: 4px;
    /* keep slider visually tiny */
    margin: 0;
}

/* LEFT COLUMN */
#left {
    width: 280px;
    background: #f4f4f4;
    border-right: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#left h3 {
    margin: 0;
    padding: 10px 10px 0 10px;
    flex-shrink: 0;
    font-size: 16px; /* fsize */
}

#search {
    /* width: 100%; */
    padding: 4px;
    margin-right: 25px;
    margin: 10px;
    flex-shrink: 0;
}

#track-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
    scrollbar-gutter: stable; /* fsize */
}

#left-bottom {
    flex-shrink: 0;
    padding: 10px;
    border-top: 1px solid #ccc;
    background: #f4f4f4;
}

#main-stats {
    margin: 0 0 10px 0;
    font-size: 12px; /* fsize */
    line-height: 1.4;
}

/* both columns */

#main-stats-header,
#overlay-stats-header {
    margin-top: 6px;
    /* or 0 if you want it tight */
    margin-bottom: 6px;
    /* or 0 */
}

/* RIGHT COLUMN */
#right h3 {
    margin: 0;
    padding: 10px 10px 0 10px;
    flex-shrink: 0;
    font-size: 16px; /* fsize */
}

#right {
    width: 280px;
    background: #f4f4f4;
    border-left: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#nearby-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    scrollbar-gutter: stable; /* fsize */
}

#right-bottom {
    flex-shrink: 0;
    padding: 10px;
    border-top: 1px solid #ccc;
    background: #f4f4f4;
}

#overlay-stats {
    margin: 0 0 10px 0;
    font-size: 12px; /* fsize */
    line-height: 1.4;
}

canvas {
    width: 100%;
    height: 140px;
}



/* CENTER */
#center {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#main-elev,
#overlay-elev {
    height: 120px;
    width: 100%;
    display: block;
}

#map {
    flex: 1;
    z-index: 1
}

#terminal {
    height: 50px;
    background: black;
    color: #0f0;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
    overflow-y: auto;
    border-top: 2px solid #444;
}

.list-item {
    padding: 4px;
    cursor: pointer;
    font-size: 14px; /* fsize */
}

.list-item:hover {
    background: #ddd;
}

/* Selected styles */
.selected-main {
    background: rgba(0, 0, 255, 0.10);
    font-weight: bold;
}

.selected-overlay {
    background: rgba(255, 0, 0, 0.10);
}

/* Thumb color (modern browsers) */
.slider-busy {
    accent-color: red;
}

/* Two-line list: date + type pill */
.list-item div:nth-child(2) {
    font-size: 12px !important;
    /* slightly bigger than 11px */
    padding-top: 2px;
    margin-top: 4px;
    color: #666;
}

.activity-type-pill {
    display: inline-block;
    padding: 2px 6px;

    margin-left: 4px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    color: white;

    background-color: grey;
    vertical-align: middle;
    /* <-- align pill with text */
}

/* mountain biking */
.type-mountain-biking,
.type-mountainbikeride {
    background-color: #c02bbd;
}

/* road biking */
.type-road-biking,
.type-ride {
    background-color: #1e90ff;
}

/* running */
.type-running,
.type-run,
.type-virtualrun {
    background-color: #0c770c;
}

/* hiking */
.type-hiking,
.type-hike {
    background-color: #8a2be2;
}

/* walking */
.type-walking,
.type-walk {
    background-color: #d66a17;
}

/* cycling (generic) */
.type-cycling,
.type-ebikeride,
.type-gravelride {
    background-color: #344d6b;
}

/* trail running */
.type-trail-running,
.type-trailrun {
    background-color: #ef0606;
}

/* blue violet */
/* Default pill color for unknown/new types */
.type-unknown {
    background-color: #1d1616;
}




.collapsible {
    position: relative;
    padding-right: 25px;
    /* space for the arrow */
    font-size: 16px; /* fsize */
    color: #333;
    /* default text color */
    transition: color 0.2s ease;
    /* smooth color change on hover */
}

.collapsible::after {
    content: "▾";
    /* arrow down by default */
    /* position: absolute; */
    margin-left: 25px;
    padding-bottom: 12px;
    /* keep your existing adjustment */
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    font-size: 25px;
    transition: transform 0.2s ease, color 0.2s ease;
    color: inherit;
    /* arrow uses header color */
}

.collapsible.collapsed::after {
    top: 15%;
    /* tweak this value until it looks centered */
    padding-bottom: 12px;
    /* keep your existing adjustment */
    transform: translateY(-50%) rotate(180deg);
    /* rotate arrow left when collapsed */
}

/* Only change arrow color on hover */
.collapsible:hover::after {
    color: #ff0000;
    /* arrow turns blue on hover */
}

.login-ok {
    background: #dff5df;
    border-radius: 4px;
}

/* as mk mn stats */
#statsModal .modal-content {
    background: white;
    padding: 20px;
    margin: 5% auto;
    width: auto;
    /* ⭐ shrink to content */
    max-width: 90%;
    /* prevent overflow on small screens */
    max-height: 80%;
    overflow-y: auto;
    border-radius: 8px;
    display: inline-block;
    /* ⭐ allow natural width */
    vertical-align: middle;
}

#statsModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 9999;
    text-align: center;
    /* ⭐ center inline-block modal */
}


#statsModal::before {
    content: "";
    display: inline-block;
    height: 100%;
    vertical-align: middle;
    /* ⭐ vertical centering */
}


.stats-table {
    width: auto;
    /* shrink to content */
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
    /* allow natural column sizing */
    margin: 0 auto;
    /* center the table */
}

.stats-table th,
.stats-table td {
    border: 1px solid #ccc;
    padding: 6px 10px;
    text-align: left;
    white-space: nowrap;
    /* prevent wrapping */
}

.stats-table th {
    background: #eee;
}

/* Bold the totals row */
.totals-row {
    font-weight: bold;
    background: #f0f0f0;
}

/* Bold the totals column */
.stats-table td:last-child,
.stats-table th:last-child {
    font-weight: bold;
    font-style: italic;
    background-color: rgba(161, 140, 90, 0.3);
}

/* Bold the last row (totals row) */
.stats-table tr:last-child td {
    font-weight: bold;
    font-style: italic;
    background-color: rgba(161, 140, 90, 0.3);
}

/* Login modal */

.modal {
    display: none;
    /* ← FIX */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
}


/* 1. The Container: Force a straight line */
.topbar {
    display: flex;
    /* The most reliable way to align items */
    align-items: center;
    /* Vertically centers everything in the row */
    gap: 8px;
    /* Consistent spacing between buttons */
}

.btn {
    /* 1. DISCONNECT FROM SYSTEM THEME (The most important part) */
    -webkit-appearance: none;
    appearance: none;

    /* 2. FORCE THE ROUNDING */
    border-radius: 4px !important;
    /* Adjust 4px to match your other buttons */

    /* 3. ENSURE SAME BOX MODEL */
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    /* 4. MATCH THE OTHERS */
    height: 28px;
    padding: 0 12px;
    background-color: #ddd;
    border: 1px solid #aaa;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

/* Ensure the form doesn't interfere */
#uploadForm {
    display: flex;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

#uploadResultList {
    /* 1. Use OUTLINE to force all 4 sides to show */
    outline: 1px solid #aaa;
    border: none;
    /* Remove the problematic border */
    background-color: #ddd;
    border-radius: 6px;
    color: #000;

    /* 2. Pull the outline away from the edges so it's visible */
    margin: 20px 2px;
    /* 2px on sides prevents clipping */
    padding: 20px;
    box-sizing: border-box;

    /* 3. Scrolling & Alignment */
    max-height: 280px;
    overflow-y: auto;
    text-align: center;
    white-space: pre-wrap;
    line-height: 1.8;
}

/* 4. Fix the scrollbar thumb so you can see it against #ddd */
#uploadResultList::-webkit-scrollbar {
    width: 8px;
}

#uploadResultList::-webkit-scrollbar-thumb {
    background: #888;
    /* Darker than the background */
    border-radius: 10px;
}


select {
    background-color: rgba(0, 150, 255, 0.15);

    /* 2. FORCE THE ROUNDING */
    border-radius: 4px !important;
    /* Adjust 4px to match your other buttons */

    /* 3. ENSURE SAME BOX MODEL */
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    /* 4. MATCH THE OTHERS */
    height: 28px;
    padding: 0 12px;
    border: 1px solid #aaa;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

select:disabled {
    color: #000;
}

/* Password modal overlay */
#pwModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

/* Modal content box */
#pwModal .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    background: white;
    padding: 20px;
    max-width: 400px;
    width: auto;
    border-radius: 8px;
}

/* Hidden state */
.pw-hidden {
    display: none;
}


/* Only affects password modal fields */
.pw-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

#pwStatus {
    margin-top: 12px;
    font-family: inherit;
    font-size: inherit;
}

* {
    cursor: default !important;
}

.menu-btn {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px !important;
    box-sizing: border-box;

    display: inline-flex;
    align-items: center;
    /* vertical centering */
    justify-content: center;
    /* horizontal centering */

    width: 44px;
    height: 28px;
    padding: 0;

    margin-left: 6px;

    background-color: #ddd;
    border: 1px solid #aaa;
    font-family: inherit;
    font-size: 18px;
    /* icon size */
    line-height: 1;
    /* CRITICAL: removes baseline drift */
    cursor: pointer;
}

.menu-btn .garmin {
    color: #0380d3;
    /* Garmin blue */
    font-size: 18px;
    /* resize the triangle */
    line-height: 1;
    /* keeps it vertically centered */
}

.menu-btn .strava {
    color: #d37203;
    /* Strava orange */
    font-size: 18px;
    /* resize the triangle */
    line-height: 1;
    /* keeps it vertically centered */
}

.icon-garmin {
    color: #0380d3;
    /* Garmin blue */
    font-size: 20px;
    line-height: 1;
}

.icon-strava {
    color: #d37203;
    /* Strava orange */
    font-size: 20px;
    line-height: 1;
}


/* This normalizes the emoji box */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 1em;
    height: 1em;
    font-size: 15px;
    line-height: 1;

    transform: translateY(1px);
    /* <-- MAGIC FIX */
}

#uploadForm {
    display: contents;
}

/* Garmin login modal — consistent with pwModal */
#garminModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* same as pwModal */
    z-index: 9999;
}

.gm-hidden {
    display: none;
}

/* Modal content box — same structure as pwModal */
#garminModal .modal-content {
    background: white;
    padding: 20px;
    max-width: 400px;
    margin: 100px auto;
    border-radius: 8px;
    /* matches your modal style */
}

/* Form rows — same as pw-row */
.gm-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

#garminStatus {
    margin-top: 12px;
    font-family: inherit;
    font-size: inherit;
}

/* Buttons — match .menu-btn and .btn */
.gm-btn {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px !important;
    box-sizing: border-box;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 28px;
    padding: 0 12px;
    margin-right: 6px;

    background-color: #ddd;
    border: 1px solid #aaa;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.garmin-ok {
    background: #dff5df;
    border-radius: 4px;
    padding: 6px;
}

.garmin-error {
    background: #f8d0d0;
    border-radius: 4px;
    padding: 6px;
}


#current-user {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    padding: 0 10px;
    /*background: #ddd; */
    color: #000000;
    border-radius: 6px;
    font-size: 14px;
    margin-right: 1px;
    line-height: 14px;
    /* tighten vertical space */
    /* ⭐ moves TEXT down without moving the box */
}

#reset-username {
    width: 120px;
    /* shorter */
}

#reset-email {
    width: 240px;
    /* larger */
}

#forgot-password {
    color: #033e7e;
    cursor: pointer;
    text-decoration: underline;
}

#forgot-password:hover {
    color: #b32d00;
}


/* === Pending Modal (copy of stats modal) === */

#pendingModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 9999;
    text-align: center;
}

#pendingModal::before {
    content: "";
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

#pendingModal .modal-content {
    background: white;
    padding: 20px;
    margin: 5% auto;
    width: auto;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    border-radius: 8px;
    display: inline-block;
    vertical-align: middle;
}

#pendingModal ul {
    text-align: left;
    /* left-align text */
    display: block;
    /* not inline-block */
    margin: 0 auto;
    /* center the block itself */
    padding-left: 30px;
    /* proper bullet indentation */
    width: fit-content;
    /* shrink to content width */
}

.pending-row {
    display: flex;
    justify-content: space-between;
    /* name left, buttons right */
    align-items: center;
    width: 320px;
    /* keeps row centered */
    margin: 10px auto;
    /* center the whole row */
}

.pending-name {
    text-align: left;
    flex: 1;
    /* take up left space */
}

.pending-buttons {
    display: flex;
    gap: 10px;
    /* space between buttons */
}

.btn-approve {
    padding: 6px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-approve:hover {
    background: #45a049;
}

.btn-reject {
    padding: 6px 12px;
    background: #d9534f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-reject:hover {
    background: #c9302c;
}

.kdtree-btn {
    padding: 6px 12px;
    border: none;
    color: white;
    font-weight: bold;
    border-radius: 4px;
}



.user-ok {
    /* background-color: rgba(4, 129, 4, 0.25); */
    background-color: #ddd;
    /* subtle green */
}

.user-missing {
    background-color: rgba(129, 20, 20, 0.25);
    /* subtle red */
}

#current-user {
    padding: 2px 6px;
    border-radius: 4px;
}


#layerSwitcher3d {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 999999;
    font-family: sans-serif;
}

#layerIcon3d {
    background: white;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    font-size: 55px;

    /* NEW: make it behave like Leaflet */
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    position: relative;
}

#layerIcon3d::before {
    content: "";
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: -10px;
    right: -10px;
}


#layerMenu3d {
    display: none;
    position: absolute;
    top: 65px;
    /* below the 44px button */
    right: 0;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    z-index: 999999;
}

#layerMenu3d div {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #cacaca;
    white-space: nowrap;
}

#layerMenu3d div:last-child {
    border-bottom: none;
}

#layerMenu3d div:hover {
    background: #c7c6c6;
}

.menu-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}


.play-btn-3d {
    position: absolute;
    bottom: 70px;
    left: 20px;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 18px;
    cursor: pointer;
}

.play-btn-3d:hover {
    background: rgba(0, 0, 0, 0.8);
}

.speed-box-3d {
    position: absolute;
    bottom: 70px;
    left: 90px;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 16px;
    border-radius: 6px;
    color: white;
    font-size: 18px;

    display: flex;
    /* horizontal layout */
    align-items: center;
    /* vertically centered */
    gap: 10px;
    /* space between label + slider */
}

.speed-label {
    font-size: 14px;
    white-space: nowrap;
}

.speed-box-3d input[type="range"] {
    width: 120px;
}
.speed-slider-3d {
    position: absolute;
    bottom: 30px;
    left: 120px;
    width: 120px;
    z-index: 9999;
}

#deleteUserModal::before {
    content: "";
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

#deleteUserModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 9999;
    text-align: center;
}

#deleteUserModal .modal-content {
    background: white;
    padding: 20px;
    margin: 5% auto;
    width: auto;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    border-radius: 8px;
    display: inline-block;
    vertical-align: middle;
}

#confirmDeleteModal::before {
    content: "";
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

#confirmDeleteModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 9999;
    text-align: center;
}

#confirmDeleteModal .modal-content {
    background: white;
    padding: 20px;
    margin: 5% auto;
    width: auto;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    border-radius: 8px;
    display: inline-block;
    vertical-align: middle;
}

#infoModal::before {
    content: "";
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

#infoModal .modal-content {
    background: white;
    padding: 20px;
    margin: 5% auto;
    width: auto;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    border-radius: 8px;
    display: inline-block;
    vertical-align: middle;
}

#infoModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 9999;
    text-align: center;
}

#confirmDeleteModal .modal-content {
    background: white;
    padding: 20px;
    margin: 5% auto;
    width: auto;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    border-radius: 8px;
    display: inline-block;
    vertical-align: middle;
}


#stravaModal::before {
    content: "";
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

#stravaModal .modal-content {
    background: white;
    padding: 20px;
    margin: 5% auto;
    width: auto;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    border-radius: 8px;
    display: inline-block;
    vertical-align: middle;
}

#stravaModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 9999;
    text-align: center;
}

/* disable edit button, so no editing of activity names */
/*
    .edit-btn {
        display: none !important;
    }
*/

