/* ===========================================================================
   sm-timepicker — wheel time picker, shared by every time field in the app.
   ---------------------------------------------------------------------------
   Pairs with Scripts/sm-timepicker.js. Colours come from the sendmn-ui.css
   tokens, so it themes with the rest of the app (light and dark) rather than
   carrying its own palette.

   --sm-tp-item MUST match ITEM_H in the script — the snap maths is in pixels.
   =========================================================================== */

:root {
    --sm-tp-item: 40px;
    --sm-tp-visible: 5;
}

/* ── the tappable cards ──────────────────────────────────────────────────── */

.sm-tp-range {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sm-tp-card {
    flex: 1 1 160px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--sm-bd, #e8ebf0);
    background: var(--sm-panel, #fff);
    box-shadow: var(--sm-sh, 0 1px 2px rgba(16, 24, 40, .05));
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: border-color .18s ease, box-shadow .18s ease, transform .12s ease;
}

    .sm-tp-card:hover {
        border-color: var(--sm-acc, #1a6fd4);
    }

    .sm-tp-card:active {
        transform: scale(.995);
    }

    .sm-tp-card:focus-visible {
        outline: none;
        border-color: var(--sm-acc, #1a6fd4);
        box-shadow: 0 0 0 3px rgba(26, 111, 212, .16);
    }

.sm-tp-card-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--sm-tx3, #98a0ae);
}

.sm-tp-card-value {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--sm-tx, #0f1728);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

/* a single input styled to match */
.sm-tp-input {
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}

/* ── sheet ───────────────────────────────────────────────────────────────── */

.sm-tp-scrim {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(8, 14, 26, .42);
    opacity: 0;
    transition: opacity .22s ease;
}

    .sm-tp-scrim.is-open {
        opacity: 1;
    }

.sm-tp-sheet {
    position: fixed;
    z-index: 2001;
    left: 50%;
    top: 50%;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--sm-panel, #fff);
    border: 1px solid var(--sm-bd, #e8ebf0);
    border-radius: 20px;
    box-shadow: 0 28px 70px rgba(8, 14, 26, .3);
    padding: 18px 18px 14px;
    box-sizing: border-box;
    opacity: 0;
    transform: translate(-50%, -46%) scale(.97);
    transition: opacity .24s cubic-bezier(.22, 1, .36, 1), transform .24s cubic-bezier(.22, 1, .36, 1);
}

    .sm-tp-sheet.is-open {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

.sm-tp-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.sm-tp-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--sm-tx, #0f1728);
}

.sm-tp-readout {
    margin-left: auto;
    font-size: 15px;
    font-weight: 600;
    color: var(--sm-acc, #1a6fd4);
    font-variant-numeric: tabular-nums;
}

/* ── wheels ──────────────────────────────────────────────────────────────── */

.sm-tp-wheels {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: calc(var(--sm-tp-item) * var(--sm-tp-visible));
}

/* the rounded highlight the selected row sits inside */
.sm-tp-band {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 50%;
    height: var(--sm-tp-item);
    transform: translateY(-50%);
    border-radius: 12px;
    background: var(--sm-panel2, #f7f9fc);
    border: 1px solid var(--sm-bd2, #f0f2f6);
    pointer-events: none;
}

.sm-tp-slot {
    flex: 0 1 96px;
    min-width: 0;
    height: 100%;
}

.sm-tp-colon {
    font-size: 22px;
    font-weight: 600;
    color: var(--sm-tx3, #98a0ae);
    padding-bottom: 2px;
    pointer-events: none;
}

.sm-tp-col {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    outline: none;
    /* Fade the rows away from the centre. Applied as a mask so it works over
       whatever the sheet's background happens to be, light or dark. */
    -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0,0,0,.4) 16%, #000 36%, #000 64%, rgba(0,0,0,.4) 84%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, rgba(0,0,0,.4) 16%, #000 36%, #000 64%, rgba(0,0,0,.4) 84%, transparent 100%);
}

    .sm-tp-col::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

.sm-tp-spacer {
    flex-shrink: 0;
}

.sm-tp-item {
    height: var(--sm-tp-item);
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    cursor: pointer;
    font-size: 20px;
    font-weight: 500;
    color: var(--sm-tx2, #5a6474);
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
    /* opacity and transform are set per-frame by the script; only the easing
       lives here so a snap glides rather than jumps */
    transition: color .2s ease, font-weight .2s ease;
    will-change: opacity, transform;
}

    .sm-tp-item.is-sel {
        color: var(--sm-tx, #0f1728);
        font-weight: 700;
    }

/* ── validation + actions ────────────────────────────────────────────────── */

.sm-tp-warn {
    margin-top: 10px;
    padding: 8px 11px;
    border-radius: 10px;
    background: var(--sm-bad-bg, #fdeeec);
    color: var(--sm-bad-fg, #b42318);
    font-size: 12px;
    line-height: 1.45;
}

.sm-tp-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.sm-tp-btn {
    flex: 1;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--sm-bd, #e8ebf0);
    background: var(--sm-panel2, #f7f9fc);
    color: var(--sm-tx2, #5a6474);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s ease, opacity .15s ease;
}

.sm-tp-ok {
    background: var(--sm-acc, #1a6fd4);
    border-color: var(--sm-acc, #1a6fd4);
    color: #fff;
}

    .sm-tp-ok:disabled {
        opacity: .45;
        cursor: not-allowed;
    }

.sm-tp-btn:not(:disabled):hover {
    filter: brightness(.97);
}

/* Respect a reduced-motion preference — the wheel still works, it just stops
   animating the snap and the sheet entrance. */
@media (prefers-reduced-motion: reduce) {
    .sm-tp-sheet,
    .sm-tp-scrim,
    .sm-tp-item {
        transition: none;
    }

    .sm-tp-col {
        scroll-behavior: auto;
    }
}

@media (max-width: 420px) {
    .sm-tp-sheet {
        width: auto;
        left: 12px;
        right: 12px;
        transform: translate(0, -46%) scale(.97);
    }

        .sm-tp-sheet.is-open {
            transform: translate(0, -50%) scale(1);
        }
}
