/* The header search box's panel (UX S1, Task 6): opened from the timer control, drawn by shared_ui/js/timer-picker.js.
   Fixed under the header, so opening it adds nothing to the header's row. Light surface; colours are tokens
   (tokens.css); logical properties only, so Arabic mirrors it. */
.timer-picker {
    position: fixed;
    inset-block-start: var(--tp-top, calc(var(--header-height, 90px) + 6px));
    z-index: 61;      /* one above the status bubble's 60 */
    box-sizing: border-box;
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-block-end: 12px;
    max-height: calc(100vh - var(--tp-top, 96px) - 64px);
    max-height: var(--tp-max, calc(100dvh - var(--tp-top, 96px) - 64px));      /* --tp-max: what is really visible, set by the script from window.visualViewport */
    background: var(--picker-bg);
    color: var(--ink);
    border: 1px solid var(--picker-border);
    border-radius: 18px;
    box-shadow: var(--picker-shadow);
    font-size: 0.875rem;
    line-height: 1.35;
    text-align: start;
}
.timer-picker[hidden], .timer-picker [hidden] { display: none; }      /* a class that sets display would otherwise beat the hidden attribute */
.timer-picker * { box-sizing: border-box; }

.tp-running { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 4px 4px 10px; margin-block-end: 8px; border-block-end: 1px solid var(--line); }
.tp-running b { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.tp-running small { color: var(--neutral-500); font-size: 0.75rem; min-width: 0; overflow-wrap: anywhere; }
.tp-running a { color: var(--brand-primary); font-size: 0.75rem; font-weight: 600; margin-inline-start: auto; }

.tp-search { display: flex; align-items: center; border: 1.5px solid var(--brand-primary); border-radius: 12px; padding: 9px 12px; }
.tp-search:focus-within { border-color: var(--brand-secondary); box-shadow: 0 0 0 3px var(--picker-focus); }
.tp-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; font-size: 0.9375rem; text-align: start; }

.tp-sec { margin: 12px 4px 4px; color: var(--neutral-500); font-size: 0.75rem; font-weight: 700; }

.tp-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; margin: 0; padding: 8px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.tp-row:hover, .tp-row.is-on { background: var(--picker-row-on); }
.tp-row:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: -2px; }
.tp-row b, .tp-row small, .tp-running b, .tp-running small { text-align: -webkit-match-parent; text-align: match-parent; }      /* each name reads in its own direction (dir=auto) but sits where the row does */
.tp-row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; font-weight: 600; }
.tp-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--neutral-500); font-size: 0.75rem; }
.tp-row em { color: var(--brand-primary); font-size: 0.75rem; font-style: normal; font-weight: 700; }
.tp-dot { display: block; width: 10px; height: 10px; border-radius: 50%; }
.tp-dot--1 { background: var(--series-1); }
.tp-dot--2 { background: var(--series-2); }
.tp-dot--3 { background: var(--series-3); }
.tp-dot--4 { background: var(--series-4); }
.tp-dot--5 { background: var(--series-5); }
.tp-dot--other { background: var(--series-other); }

.tp-new { display: grid; gap: 6px; margin-block-start: 8px; padding: 8px; border: 1px dashed var(--picker-new-border); border-radius: 12px; background: var(--picker-new-bg); }
.tp-new p { margin: 0; color: var(--neutral-500); font-size: 0.75rem; }
.tp-new-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.tp-new-line b { min-width: 0; overflow-wrap: anywhere; font-size: 0.8125rem; }
.tp-new select { max-width: 100%; min-width: 0; padding: 5px 8px; border: 1px solid var(--picker-field-border); border-radius: 8px; background: var(--picker-bg); color: var(--ink); font: inherit; font-size: 0.8125rem; }
.tp-new button, .tp-ask button { padding: 6px 12px; border: 1px solid var(--picker-field-border); border-radius: 8px; background: var(--picker-bg); color: var(--ink); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.tp-new button.tp-primary, .tp-ask button.tp-primary { border-color: var(--brand-primary); background: var(--brand-primary); color: var(--picker-bg); }
.tp-new button:disabled, .tp-ask button:disabled, .tp-row:disabled { opacity: 0.6; cursor: default; }
.tp-note { color: var(--neutral-500); font-size: 0.75rem; }

.tp-ask { display: grid; gap: 8px; padding: 4px; }
.tp-ask p { margin: 0; font-weight: 600; }
.tp-ask-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.tp-error { margin-block-start: 8px; padding: 8px 10px; border: 1px solid var(--timer-say-error-border); border-radius: 10px; background: var(--timer-say-error-bg); color: var(--timer-say-error-text); font-size: 0.8125rem; font-weight: 600; overflow-wrap: anywhere; }

.tp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-block-start: 10px; padding-block-start: 9px; border-block-start: 1px solid var(--line); }
.tp-foot label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.tp-hint { color: var(--neutral-500); font-size: 0.75rem; }

@media (max-width: 767px) {
    .timer-picker {
        inset-inline: 8px;
    }
    .tp-search input { font-size: 16px; }
    .tp-row { min-height: 44px; }
    .tp-new button, .tp-ask button { min-height: 44px; }
    .tp-new select { min-height: 44px; }
    .tp-foot label { min-height: 44px; }
    .tp-foot input { width: 22px; height: 22px; }
    .tp-running a { display: inline-flex; align-items: center; min-height: 44px; }
    .tp-hint { display: none; }
}

@media (min-width: 768px) {
    .timer-picker {
        inset-inline-end: var(--tp-end, 16px);
        width: 380px;
        max-width: calc(100vw - 16px);
    }
}
