/* Styling for app-specific classes */

/* Give a fixed width space for the activity count in the year range sliders */
.nstrava-activity-count {
    flex: none;
    min-inline-size: 16ch;
    white-space: nowrap;
}

/* A borderless button - not for clicking but for displaying information in a tooltip */
.nstrava-button-borderless {
    background: transparent;
    border: none;
    color: var(--ui-blue);
}

/* Add a '·' to the left of the button */
.nstrava-button-borderless::before {
    content: '·';
    margin-inline-end: 0.5em;
    color: white;
}

/* Add a chevron to the right of the button */
.nstrava-button-borderless::after {
    content: '';
    display: inline-block;
    width: 0.4em;
    height: 0.4em;
    margin-inline-start: 0.45em;
    vertical-align: 0.2em;
    border-right: 1px solid white;
    border-bottom: 1px solid white;
    transform: rotate(45deg);
}

/* Dim the text while hovering */
.nstrava-button-borderless:hover {
    color: color-mix(in srgb, var(--ui-blue) 75%, transparent);
}

/* Hide the chevon during hover */
.nstrava-button-borderless:hover::after {
    visibility: hidden;
}

/* A collapsible content with a border that's hidden by default */
.nstrava-collapsible-section {
    border: 2px var(--nathan-yellow) solid;
    border-radius: 4px;
    display: none;
    margin: 10px 10px 0 10px;
    padding-top: 10px;
}

/* To display a dcc.Checklist in a specific number of columns */
.nstrava-columns {
    column-count: var(--col);
}

.cols-2 { --col: 2; }
.cols-3 { --col: 3; }
.cols-4 { --col: 4; }
.cols-5 { --col: 5; }

/* For times when we generate a clickable element that isn't obvious to the browser */
.nstrava-cursor-pointer {
    cursor: pointer;
}

/* Move the cycle find button up and to the left for space amongst the cycle charts */
.nstrava-cycle-button {
    right: var(--triple-sunburst-offset-right);
    top: var(--triple-sunburst-offset-top);
}

/* For rendering code diff blocks to look like GitHub */
.nstrava-diff-box {
    width: 100%;
    max-height: 400px;
    overflow: auto;

    background: var(--dark-background);
    color: var(--ui-blue);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.35;

    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.12);

    white-space: pre;
    margin-top: 5px;
    margin-left: 40px;
}

.nstrava-diff-line {
    display: block;
    padding: 0 6px;
}

.nstrava-diff-add {
    background: rgba(46, 160, 67, 0.18);
    color: #a6ffb5;
}
.nstrava-diff-del {
    background: rgba(248, 81, 73, 0.18);
    color: #ffd0d0;
}
.nstrava-diff-hunk {
    background: rgba(56, 139, 253, 0.16);
    color: #cbe3ff;
}
.nstrava-diff-file {
    background: rgba(240, 246, 252, 0.08);
    color: rgba(240, 246, 252, 0.95);
    font-weight: 600;
}
.nstrava-diff-neutral {
    /* Keep neutral lines readable */
    color: rgba(240, 246, 252, 0.85);
}

/* Keep the single-chart find button above the flag thumbnail. */
.nstrava-find-button {
    display: block !important;
    margin: 0 auto;
    color: white !important;
    position: relative;
    top: calc(var(--sunburst-height) / 2 - 75px);
    z-index: 2;
}

/* Position the flag thumbnail near the vertical center of the chart. */
.nstrava-flag-thumbnail-fancybox {
    display: block;
    height: 0;
    position: relative;
    text-align: center;
    top: calc(var(--sunburst-height) / 2 - 25px);
    z-index: 2;
}

/* A light gray 1px border with curved corners to go around an element */
.nstrava-image-border {
    border: 1px solid var(--light-border);
    border-radius: 0.5rem;
}

/* Hide the AG Grid header when needed. E.g. Admin->Inspect->Code Analysis */
.nstrava-hide-ag-header .ag-header {
    display: none;
}

/* Expand size a little to emphasize clickability */
.nstrava-hover-expand:hover {
    transform: scale(1.1);
}

/* Expand the size of a large object a tiny bit */
.nstrava-hover-expand-large:hover {
    transform: scale(1.01);
}

/* For adding a header and horizontal line to HTML tooltips */
.nstrava-large-bold-header {
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid white;
    padding-bottom: 5px;
}

/* Draw a light gray box around an element */
.nstrava-light-box {
    border-radius: 5px;
    border: 1px var(--disabled-gray) solid;
    padding: 5px;
}

/* All Activities -> Start/End Locations map */
.nstrava-location-map-layout {
    display: grid;
    grid-template-columns: minmax(220px, 0.15fr) minmax(0, 0.85fr);
    align-items: start;
    gap: 5px 16px;
    margin-right: 10px;
}

.nstrava-location-map-sidebar,
.nstrava-location-map-activity-types,
.nstrava-location-map-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.nstrava-location-map-sidebar > hr {
    align-self: stretch;
    margin: 4px 0;
}

.nstrava-location-map-scatter {
    --location-map-top: 0px;  /* Set in 12-location-map.js */
    --location-map-height: max(360px, calc(100dvh - var(--location-map-top, 400px) - 32px));
    --location-map-aspect-ratio: 1.45;
    width: min(100%, calc(var(--location-map-height) * var(--location-map-aspect-ratio)));
    justify-self: start;
    margin-top: 5px;
}

@media (min-width: 992px) {
    .nstrava-location-map-layout {
        grid-template-rows: max-content 1fr;
    }

    .nstrava-location-map-sidebar {
        grid-area: 1 / 1 / span 2;
    }

    .nstrava-location-map-grid {
        grid-area: 1 / 2;
    }

    .nstrava-location-map-scatter {
        grid-area: 2 / 2;
    }

    .nstrava-location-map-grid[hidden] ~ .nstrava-location-map-scatter {
        grid-row: 1 / span 2;
    }
}

.nstrava-location-map-controls {
    gap: 16px;
}

.nstrava-location-map-basemap {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    white-space: nowrap;
}

.nstrava-location-map-basemap > :last-child {
    min-width: 0;
}

@media (max-width: 991px) {
    .nstrava-location-map-layout {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 16px;
    }

    .nstrava-location-map-activity-types,
    .nstrava-location-map-controls {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 16px;
    }
}

/* Make the modal dialogs take 90% of the width of the screen */
.nstrava-modal .modal-dialog {
    --bs-modal-width: 90vw;
}

/* If there's only one location chart, we have to move the above elements to the side */
.nstrava-offset-left {
    right: min(38%, 50% - 85px);
}

/* Round the corners of anything, link an image */
.nstrava-rounded {
    border-radius: 4px;
}

/* Holder for Sunburst charts, dynamically sized */
.nstrava-sunburst-tab {
    container-type: inline-size;
    /* Fallback when sunburst_div() does not supply a width-based height. */
    --sunburst-subplot-height: 100dvh;
    /* Leave room for the tabs, controls, chart hint, and copyright footer. */
    --sunburst-height: min(var(--sunburst-subplot-height), max(440px, 100dvh - 235px));
}

/* The gap between two location charts is widest near the top. */
.nstrava-sunburst-tab .nstrava-find-button:not(.nstrava-offset-left, .nstrava-cycle-button) {
    top: 20px;
}

/* For slightly rounded tab borders */
.nstrava-tab-left {
    border-radius: 4px 0 0 4px;
}

.nstrava-tab-right {
    border-radius: 0 4px 4px 0;
}

/* A textarea to display many lines of output with a scrollbar */
.nstrava-text-area, .nstrava-text-area-full {
    width: 51%;
    height: 400px;
    background-color: var(--dark-background);
    color: var(--ui-blue);
    margin-top: 5px;
    font-family: monospace;
    --Dash-Fill-Interactive-Strong: var(--dark-gray);  /* Border on select */
}

/* A version that takes all the width, used with display: flex */
.nstrava-text-area-full {
    width: 100%;
}

/* All Activities -> By Time Zone */
.nstrava-time-zone-map {
    /* sizeTimeZoneLayout() in 13-tz_map.js overrides this with the layout's document offset. */
    --time-zone-map-top: 250px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: calc(100dvh - var(--time-zone-map-top) - 32px);
}

.nstrava-time-zone-map #tz-map {
    flex: 1 0 360px;
    min-width: 0;
}

/* E.g. for making a button that toggles from + to - */
.nstrava-toggle-button {
    border: none;
    background: transparent;
    color: white;
    font-size: large;
    cursor: pointer;
}

/* Override Bootstrap hover over-dimming */
.nstrava-toggle-button:hover {
    color: var(--almost-white);
    background: transparent;
}

.nstrava-toggle-button:focus, .nstrava-toggle-button:active {
    color: white;
    background: transparent;
    box-shadow: none;
    outline: none;
}

/* A drag-n-drop target/upload link box */
.nstrava-upload-box {
    width: 50%;
    height: 60px;
    line-height: 60px;
    border-width: 1px;
    border-style: dashed;
    border-radius: 5px;
    text-align: center;
    margin: 10px;
}

/* Expand them a little bit on hover */
.nstrava-upload-box:hover {
    transform: scale(1.01);
}
