/* ================================================================
   FriendsByChance — components/time-range-bar.css
   FBC.ui.TimeRangeBar: a slider, its two ends named under it; unfolded,
   the days as fields and the ways to set them; and the selection's row
   (Back, the presets or the Time selected, "+"), which the host places.

   Built for a narrow column (The Map's left pane): the track takes the
   whole width, its ends' names go on the row under it, at either side,
   the unfold button small between them — and what unfolds stacks under
   that, a row per field.
   ================================================================ */

.trb {
    display:        flex;
    flex-direction: column;
    gap:            8px;
    color:          var(--color-text);
    font-size:      0.9rem;
}

/* ── The slider: the track, the whole width; under it its ends, "more"
   between them ──────────────────────────────────────────────────── */
.trb-main {
    display:        flex;
    flex-direction: column;
    gap:            2px;
}
/* Three columns, the outer two alike: the button stays in the middle
   whatever the ends' names' lengths. */
.trb-ends {
    display:               grid;
    grid-template-columns: 1fr auto 1fr;
    align-items:           center;
    gap:                   6px;
}
.trb-end {
    min-width:   0;
    overflow:    hidden;
    text-overflow: ellipsis;
    font-size:   0.78rem;
    font-weight: 600;
    color:       var(--color-text-secondary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.trb-end--to { text-align: right; }
/* Narrow and low: a tab to pull, not one of the pane's square buttons. */
.trb-more-btn.fbc-icon-btn {
    width:         36px;
    height:        20px;
    border-radius: 10px;
}
.trb-more-btn svg           { transition: transform var(--transition, 0.25s ease); }
.trb--expanded .trb-more-btn svg { transform: rotate(180deg); }

.trb-scale {
    min-width:      60px;
    display:        flex;
    flex-direction: column;
    gap:            2px;
    /* Room for half a handle past each end of the track. */
    padding:        0 9px;
}

/* The scale's ticks: only unfolded — folded, the slider is the whole of it. */
.trb:not(.trb--expanded) .trb-ticks { display: none; }

.trb-track {
    position:     relative;
    height:       24px;
    cursor:       pointer;
    /* The track is dragged along, never scrolled: a touch that moves a
       handle must not also scroll the page. */
    touch-action: none;
}
.trb-track::before {
    content:       '';
    position:      absolute;
    left:          0;
    right:         0;
    top:           10px;
    height:        4px;
    border-radius: 2px;
    background:    var(--color-divider);
}
.trb-window {
    position:      absolute;
    top:           8px;
    height:        8px;
    min-width:     4px;
    border-radius: 4px;
    background:    var(--color-primary);
    opacity:       0.75;
    cursor:        grab;
    touch-action:  none;
}
.trb-handle {
    position:      absolute;
    top:           3px;
    width:         18px;
    height:        18px;
    margin-left:   -9px;
    border-radius: 50%;
    border:        2px solid var(--color-primary);
    background:    var(--color-surface);
    box-shadow:    0 1px 3px rgba(0, 0, 0, 0.3);
    cursor:        grab;
    touch-action:  none;
}
.trb-handle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.trb--dragging,
.trb--dragging .trb-handle,
.trb--dragging .trb-window  { cursor: grabbing; }

.trb-ticks {
    position:    relative;
    height:      14px;
    font-size:   0.68rem;
    line-height: 14px;
    color:       var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}
.trb-tick {
    position:    absolute;
    transform:   translateX(-50%);
    white-space: nowrap;
}

/* ── Unfolded: the two days, then the ways to set both ────────────── */
.trb-more {
    display:        flex;
    flex-direction: column;
    gap:            6px;
}

.trb-field {
    display:     flex;
    align-items: center;
    gap:         4px;
}
.trb-field-label {
    flex:           0 0 3.2em;
    font-size:      0.7rem;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color:          var(--color-text-muted);
}
.trb-input {
    flex:          1 1 auto;
    min-width:     0;
    max-width:     8.5em;
    padding:       6px 8px;
    border:        1px solid var(--color-border);
    border-radius: 8px;
    background:    var(--color-input-bg);
    color:         var(--color-text);
    font:          inherit;
    font-variant-numeric: tabular-nums;
}
.trb-input:focus         { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.trb-input--invalid      { border-color: var(--color-danger); }
.trb-pick                { border-color: transparent; }

.trb-tools {
    display:     flex;
    align-items: center;
    flex-wrap:   wrap;
    gap:         6px;
    margin-top:  6px;
}
/* "Days of a time…" — the Time selected: its name, as pressed. */
.trb-time-both {
    max-width:     100%;
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
}
.trb-time-both--on,
.trb-time-both--on:hover {
    background:   var(--color-primary);
    border-color: var(--color-primary);
    color:        var(--color-text-on-primary);
}

/* ── The selection's row: Back, the presets (or the Time), "+" ────── */
.trb-presets {
    display:     flex;
    align-items: center;
    gap:         4px;
    min-width:   0;
}
/* Nothing to go back to: shown, quiet — held, it still brings the default. */
.trb-back--off { opacity: 0.4; }
/* The Time selected, where the presets were: as a pressed one of them. */
.trb-time-chip {
    min-height:    30px;
    min-width:     0;
    max-width:     12em;
    padding:       0 8px;
    border:        1px solid var(--color-primary);
    border-radius: 6px;
    background:    var(--color-primary);
    color:         var(--color-text-on-primary);
    font:          inherit;
    font-size:     0.8rem;
    font-weight:   600;
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
    cursor:        pointer;
}
