/* ================================================================
   FriendsByChance — times.css
   Times tab (100) — times and combos.
   The chips are the shared TagLike ones (components/taglike.css) —
   everywhere, journeys included.  This file keeps the temporal editor
   blocks ("When" / "Repeats").
   ================================================================ */

/* ── Temporal editor content ──────────────────────────────────────
   Touch-first throughout: the native <select> and number spinner this
   replaced had hit targets a few pixels tall.  The shared controls
   (SegmentedChoice / Stepper / WheelPicker) carry their own styling in
   components/; this file only arranges them. */

.times-temporal-wrap {
    display:        flex;
    flex-direction: column;
    gap:            10px;
    padding:        4px 0 2px;
}

/* "+ Add date" / "+ Add recurrence" toggle */
.times-block-toggle {
    align-self:  flex-start;
    padding:     10px 2px;
    min-height:  44px;
    font-size:   0.9rem;
    border:      none;
    background:  none;
    cursor:      pointer;
    color:       var(--color-primary);
    text-align:  left;
}
.times-block-toggle:hover { text-decoration: underline; }

/* A block whose prerequisite is not met (Repeats without a start — rule
   R1). The title attribute carries the reason. */
.times-block-toggle--disabled {
    opacity: 0.45;
    cursor:  not-allowed;
    text-decoration: none;
}

.times-block {
    border:        1px solid var(--color-divider);
    border-radius: 8px;
    background:    var(--color-bg);
}

.times-block-hdr {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         8px 10px;
    border-bottom:   1px solid var(--color-divider);
}

/* .times-block-title: its look is .fbc-section-title's (components/shared.css). */

.times-block-body {
    padding:        12px 10px;
    display:        flex;
    flex-direction: column;
    gap:            14px;
}

/* ── Precision ───────────────────────────────────────────────────── */

.times-prec-wrap {
    display:        flex;
    flex-direction: column;
    gap:            6px;
}

/* ── From / Until ────────────────────────────────────────────────── */

/* The two fields are siblings of equal width — they are the same kind of
   thing and must not read as primary/secondary. */
.times-dt-host {
    display:        flex;
    flex-direction: column;
    gap:            12px;
}

.times-dt-wrap {
    display:        flex;
    flex-direction: column;
    gap:            5px;
    flex:           1 1 0;
    min-width:      0;
}

.times-dt-label {
    font-size:   0.78rem;
    font-weight: 600;
    color:       var(--color-text-secondary);
}

.times-dt-row {
    display:     flex;
    align-items: stretch;
    gap:         6px;
}

.times-dt-input {
    flex:          1;
    min-width:     0;
    min-height:    44px;
    padding:       8px 10px;
    border:        1px solid var(--color-divider);
    border-radius: 8px;
    background:    var(--color-input-bg);
    color:         var(--color-text);
    font:          inherit;
    font-size:     0.95rem;
    outline:       none;
}
.times-dt-input:focus { border-color: var(--color-primary); }

/* Icon buttons in this row match the field height rather than the
   30px default, so every target in the row is comfortably tappable. */
.times-dt-row .fbc-icon-btn {
    width:      44px;
    height:     auto;
    min-height: 44px;
    border-radius: 8px;
}

.times-now-btn {
    min-height:    44px;
    padding:       0 12px;
    font:          inherit;
    font-size:     0.85rem;
    border:        1px solid var(--color-divider);
    border-radius: 8px;
    background:    var(--color-surface);
    color:         var(--color-primary);
    cursor:        pointer;
    white-space:   nowrap;
}
.times-now-btn:hover { background: var(--color-hover); }

/* ── Repeats ─────────────────────────────────────────────────────── */

.times-repeat-row {
    display:     flex;
    align-items: center;
    flex-wrap:   wrap;
    gap:         8px;
}

/* The unit buttons share the "every N …" row and take what is left of it,
   wrapping inside themselves.  Without this the row would rather wrap the
   whole control group than let the buttons flow onto a second line. */
.times-repeat-row > .fbc-segchoice {
    flex:      1 1 140px;
    min-width: 0;
}

.times-pattern-row {
    display:     flex;
    align-items: center;
    gap:         6px;
}

/* One button: unset it reads as a prompt, set it reads as the choice. */
.times-pattern-btn {
    flex:          1;
    min-height:    44px;
    padding:       0 14px;
    font:          inherit;
    font-size:     0.88rem;
    border:        1px dashed var(--color-divider);
    border-radius: 8px;
    background:    var(--color-surface);
    color:         var(--color-text-secondary);
    cursor:        pointer;
    text-align:    left;
}
.times-pattern-btn:hover:not(:disabled) { background: var(--color-hover); }
/* Kept in place rather than removed when no pattern applies to the unit:
   the block must not change shape as the user cycles through units. */
.times-pattern-btn:disabled {
    opacity: 0.45;
    cursor:  not-allowed;
}
.times-pattern-btn--set {
    border-style: solid;
    border-color: var(--color-primary);
    color:        var(--color-text);
    font-weight:  600;
}


/* ── Recurrence chain ────────────────────────────────────────────
   A time can hold several repeat windows, each its own block.  They
   stack, with the later ones stepped in slightly so the chain reads as
   "then, then" rather than as three unrelated sections. */

.times-chain {
    display:        flex;
    flex-direction: column;
    gap:            10px;
}

/* ── Its clock: fixed to a zone, or floating ─────────────────────── */

.times-clock {
    display:        flex;
    flex-direction: column;
    gap:            6px;
}

.times-clock-row {
    display:     flex;
    flex-wrap:   wrap;
    align-items: center;
    gap:         8px;
}

/* The zone's name can be long ("America/Argentina/Buenos Aires"): it wraps
   in its button rather than pushing the row sideways. */
.times-clock-zone {
    min-height:  44px;
    max-width:   100%;
    white-space: normal;
    text-align:  left;
}

.times-clock-hint {
    font-size: 0.8rem;
    color:     var(--color-text-secondary);
}

/* Under "How long": the length in words, as the overlay says it. */
.times-lasts-words {
    margin-top: 4px;
    font-size:  0.8rem;
    color:      var(--color-text-secondary);
}

.times-window + .times-window .times-block {
    border-left: 3px solid var(--color-divider);
}

/* Why the first window has no "from" field of its own. */
.times-window-note {
    font-size:  0.8rem;
    color:      var(--color-text-secondary);
    margin:     0 0 8px;
}

/* ── Pattern sheet ───────────────────────────────────────────────
   Several filters in one overlay — months, days of the month, weekdays —
   each a labelled grid of toggles. */

.times-pattern-section        { margin-bottom: 18px; }
.times-pattern-section:last-child { margin-bottom: 0; }

/* The question needs air between it and the answers.  .times-dt-label is
   an inline span — it sits beside the stepper on the "every" row, where a
   margin would be wrong — so the block display is scoped to here rather
   than added to the label itself. */
.times-pattern-section > .times-dt-label {
    display:       block;
    margin-bottom: 8px;
}

.times-pattern-nth-row { margin-bottom: 10px; }

/* 31 day numbers need narrower cells than four-per-row would give. */
.fbc-optgrid--dense {
    grid-template-columns: repeat(4, 1fr);
}
@media (min-width: 380px) {
    .fbc-optgrid--dense { grid-template-columns: repeat(7, 1fr); }
}
.fbc-optgrid--dense .fbc-optgrid-btn {
    min-height: 44px;
    padding:    6px 4px;
    font-size:  0.85rem;
}

/* Running total of the weekday picks, across every ordinal: switching the
   ordinal changes which buttons light up, and without this the earlier
   choices would look lost. */
.times-pattern-chosen {
    margin-top:  8px;
    font-size:   0.82rem;
    color:       var(--color-text-secondary);
    min-height:  1.2em;
}
