/* SolverTech brand colours: the logo orange and its complementary green. */
:root {
    --juno-orange: #e57e0d;
    --juno-orange-soft: #f6d3a6;
    /* Paler than the selection orange, so a parking intersection is not mistaken for a selected one. */
    --juno-orange-pale: #fbeed9;
    --juno-orange-pale-line: #f0b356;
    --juno-green: #156e1c;
    --juno-green-soft: #bfe0c2;
    --juno-ink: #2b2f33;
    --juno-line: #d7dbe0;
    --juno-surface: #ffffff;
    --juno-surface-muted: #f5f6f8;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--juno-ink);
    background: var(--juno-surface-muted);
}

.juno-startup {
    padding: 2rem;
    color: #6b7178;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.75rem 1rem;
    background: var(--juno-orange-soft);
    border-top: 2px solid var(--juno-orange);
}

/* Layout: top bar above a row of left bar, editor and right bar. A column flexbox rather than fixed grid
   rows, so the body takes all the remaining height whether or not the message bar is showing. */
.juno-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.juno-body {
    display: grid;
    grid-template-columns: 17rem 1fr 19rem;
    flex: 1;
    min-height: 0;
}

.juno-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--juno-surface);
    border-bottom: 1px solid var(--juno-line);
}

.juno-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.5rem;
    text-wrap: nowrap;
}

.juno-logo-mark {
    display: block;
    height: 1.9rem;
    width: auto;
}

.juno-logo-text {
    font-weight: 500;
    letter-spacing: 0.08em;
    font-size: 0.95rem;
    color: var(--juno-green);
}

.juno-logo-accent {
    font-weight: 700;
    color: var(--juno-orange);
}

.juno-map-picker {
    min-width: 16rem;
}

.juno-topbar-spacer {
    flex: 1;
}

/* The account icon is a bare button rather than a DxButton: the top bar wants an icon the size of the
   text next to it, not a themed command. */
.juno-account-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.juno-account-button:hover {
    background: var(--juno-surface-muted);
    border-color: var(--juno-line);
}

.juno-account-button img {
    width: 1.1rem;
    height: 1.1rem;
    /* The asset is solid black; soften it to the body ink. */
    opacity: 0.72;
}

.juno-account {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* A long display name or UPN must wrap inside the dialog rather than widen it. */
    overflow-wrap: anywhere;
}

.juno-account-name {
    font-weight: 600;
}

.juno-account-upn {
    color: #6b7178;
    font-size: 0.875rem;
}

.juno-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--juno-surface);
    overflow-y: auto;
}

.juno-sidebar-left {
    border-right: 1px solid var(--juno-line);
}

/* The stop list scrolls on its own, so the bar itself stays put and keeps the speeds and buttons in view. */
.juno-sidebar-right {
    border-left: 1px solid var(--juno-line);
    overflow-y: hidden;
}

.juno-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7178;
    margin-bottom: 0.5rem;
}

.juno-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.juno-field label {
    font-size: 0.85rem;
}

.juno-field-value {
    font-variant-numeric: tabular-nums;
    color: #6b7178;
}

.juno-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.juno-hint {
    font-size: 0.8rem;
    color: #6b7178;
}

/* Only a file input can open the file picker, so the button is a label wrapping one. The input keeps its
   size so it stays reachable by keyboard, and is only made invisible. */
.juno-file-button {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--juno-line);
    border-radius: 0.25rem;
    background: var(--juno-surface-muted);
    font-size: 0.875rem;
    cursor: pointer;
}

.juno-file-button:hover {
    border-color: var(--juno-orange);
}

.juno-file-button:focus-within {
    outline: 2px solid var(--juno-orange);
    outline-offset: 1px;
}

/* Load and remove side by side above the background sliders. */
.juno-background-buttons {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
}

/* Background sliders: the label, the track and the readout on one row, with the track taking the slack. */
.juno-slider-field {
    margin-top: 0.5rem;
}

.juno-slider {
    flex: 1;
    min-width: 0;
    accent-color: var(--juno-orange);
}

.juno-slider:disabled {
    opacity: 0.45;
}

.juno-slider-field .juno-field-value {
    min-width: 3.25rem;
    text-align: right;
}

.juno-file-button input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.juno-message {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--juno-orange);
    background: var(--juno-orange-soft);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.juno-message-close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

/* Editor canvas: the zoom control above the window the map is scrolled inside. The SVG is sized in pixels
   and its view box in millimeters, so a click position converts to map coordinates by a single scale
   factor. The window is what gets measured, hence the padding lives on the outer element and never counts
   towards the space the map may use. */
.juno-canvas {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.juno-canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

/* Wide enough to pick a zoom from, but it gives way before the readout and the button do. */
.juno-canvas-zoom {
    flex: 0 1 12rem;
}

.juno-canvas-toolbar .juno-field-value {
    min-width: 3.5rem;
    text-align: right;
}

.juno-canvas-viewport {
    flex: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

/* Centred while the map is smaller than the window, by auto margins rather than the flexbox centring
   properties, because those push what overflows out of the reach of the scrollbars. */
.juno-canvas-viewport > * {
    flex: 0 0 auto;
    margin: auto;
}

/* The frame around the map. It is drawn here rather than on the SVG, whose pixel size has to stay the size
   the scale is worked out from - a border would take two pixels of it for itself. */
.juno-canvas-stage {
    background: var(--juno-surface);
    border: 1px solid var(--juno-line);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* No line box under the map, which would make the frame taller than what is in it. */
.juno-canvas svg {
    display: block;
}

.juno-canvas-background {
    fill: transparent;
}

.juno-grid-line {
    stroke: #c0c0c0;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.juno-edge {
    stroke: #98a1aa;
    stroke-width: 6;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
}

.juno-edge.juno-selected {
    stroke: var(--juno-orange);
    stroke-width: 8;
}

/* Where the next vertex would be created. */
.juno-crosshair line,
.juno-crosshair circle {
    fill: none;
    stroke: var(--juno-orange);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.juno-vertex {
    fill: var(--juno-surface);
    stroke: #5b636b;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
}

/* An intersection the trolley may be left at. One class only, so the selection colour still wins. The green
   is taken by the locations, so this is a pale shade of the logo orange. */
.juno-vertex-parking {
    fill: var(--juno-orange-pale);
    stroke: var(--juno-orange-pale-line);
    stroke-width: 3;
}

/* The one selected entity can be dragged around the map. */
.juno-vertex.juno-selected,
.juno-location.juno-selected {
    cursor: grab;
}

.juno-vertex.juno-selected {
    fill: var(--juno-orange-soft);
    stroke: var(--juno-orange);
    stroke-width: 3;
}

.juno-location {
    fill: var(--juno-green-soft);
    stroke: var(--juno-green);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
}

.juno-location.juno-selected {
    fill: var(--juno-orange-soft);
    stroke: var(--juno-orange);
    stroke-width: 3;
}

.juno-terminal-marker {
    fill: none;
    stroke: var(--juno-green);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

/* The font size comes from the element's own attribute, because the view box is in millimeters. */
.juno-marker-label {
    font-weight: 700;
    fill: var(--juno-green);
    pointer-events: none;
}

/* Right bar: the tour order, reordered by dragging. */
.juno-location-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-height: 4rem;
}

.juno-location-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--juno-line);
    border-radius: 0.25rem;
    background: var(--juno-surface-muted);
    cursor: grab;
    font-size: 0.9rem;
}

.juno-location-item.juno-selected {
    border-color: var(--juno-orange);
    background: var(--juno-orange-soft);
}

.juno-location-item.juno-dragging {
    opacity: 0.45;
}

/* Where the dragged location would land: the list it is aimed at, and the item it would go in front of. */
/* Shrinks to whatever height the bar has left over and scrolls when the tour outgrows it. A short
   tour keeps its natural height, so the controls below it stay right under the list. */
.juno-tour-stops {
    flex: 0 1 auto;
    overflow-y: auto;
    /* The drop outline sits outside the items, so leave it room inside the scrolling box. */
    padding: 2px;
}

.juno-location-list.juno-drop-zone {
    outline: 2px dashed var(--juno-orange);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

.juno-location-item.juno-drop-before {
    border-top-color: var(--juno-orange);
    box-shadow: inset 0 2px 0 0 var(--juno-orange);
}

.juno-list-placeholder {
    padding: 0.5rem 0.6rem;
    border: 1px dashed var(--juno-line);
    border-radius: 0.25rem;
    font-size: 0.8rem;
    color: #6b7178;
}

.juno-location-order {
    font-variant-numeric: tabular-nums;
    color: #6b7178;
    min-width: 1.5rem;
}

.juno-location-role {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--juno-green);
}

.juno-tour-length {
    font-size: 0.85rem;
    color: var(--juno-green);
    font-weight: 600;
}

/* Fills the list above them: one stop at a time, or a whole random tour. */
.juno-stop-buttons {
    display: flex;
    align-self: start;
    gap: 0.4rem;
}

.juno-stop-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Where the trolley waits while this stop is served, in the parking colour of the canvas. */
.juno-stop-parking {
    font-size: 0.7rem;
    color: var(--juno-orange);
}

.juno-stop-remove {
    margin-left: auto;
    border: none;
    background: transparent;
    color: #6b7178;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
}

.juno-stop-remove:hover {
    color: var(--juno-orange);
}
