/*
 * static/css/models.css — the composer's model and effort picker (batch 4, plan R-106, spec §4.1; lane models).
 *
 * One slim row under the composer card (#model-picker, model-picker.js), read as the card's footer: the model's
 * name as a quiet menu button (a plain label when there is only one model), then the effort button ("Effort" and
 * the level's name). The UI overhaul (batch 4 §9 phase 2, brief §6.8) restyled it: no background, the name aligned
 * with the attach button, the menu surface with a check for the selected model; in a read-only chat every part is
 * the tertiary text (AA), not a faded copy. Tokens only (tokens.css + the profile theme); every selector is defined
 * once, here (I7).
 *
 * Plan R-110 (Ray 2026-11-13): the inline slider became the effort button and a small popover beside it
 * (#effort-pop): one stop per level the model offers, each a dot on a neutral line with the level's name under it,
 * the chosen one a filled gold dot. The line is never filled up to the chosen stop, so it reads as a choice of N
 * levels, not a range from Low. The menu's second line is the profile's description of each model.
 */

.model-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 32px;
    padding: 0 8px 0 6px;
    color: var(--c-on-3);
    font: var(--t-label-m);
}

/* The model's name: a quiet pill that opens the menu (static text with one model). */
.model-name-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    max-width: 50%;
    padding: 0 8px 0 10px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--c-on-2);
    font: var(--t-label-m);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--dur-1) var(--ease-standard), color var(--dur-1) var(--ease-standard);
}
.model-name-btn:hover:not(:disabled),
.model-name-btn.is-open { background: var(--c-hover); color: var(--c-on); }
.model-name-btn:disabled { cursor: default; }
.model-name-btn.is-static { padding-left: 4px; padding-right: 4px; }
.model-name-btn.is-static .model-name-chevron { display: none; }
.model-name-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-name-chevron { flex: 0 0 auto; width: 14px; height: 14px; color: var(--c-on-3); transition: transform var(--dur-2) var(--ease-standard); }
.model-name-btn.is-open .model-name-chevron { transform: rotate(180deg); }

/* Read-only (a read-only chat, an ended incognito chat): every part in the tertiary text, no hover; the words stay AA. */
.model-picker.is-readonly .model-name-btn,
.model-picker.is-readonly .effort-btn,
.model-picker.is-readonly .effort-btn-value { color: var(--c-on-3); background: transparent; }

/* The menu: a native popover (top layer) that model-picker.js places above the button; the menu surface. */
.model-menu {
    position: fixed;
    inset: auto;
    width: 240px;
    max-width: calc(100vw - 24px);
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--c-surface-raised);
    color: var(--c-on);
    box-shadow: var(--elev-2);
}
.model-option {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 36px 8px 12px;
    position: relative;
    border-radius: var(--radius-sm);
    color: var(--c-on);
    cursor: pointer;
    outline: none;
}
.model-option:hover,
.model-option:focus-visible { background: var(--c-hover); }
.model-option:focus-visible { box-shadow: inset 0 0 0 2px var(--c-focus); }
/* the selected model: a check at the end of its row */
.model-option[aria-selected="true"]::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    background: var(--c-accent);
    -webkit-mask: var(--icon-check) center / contain no-repeat;
    mask: var(--icon-check) center / contain no-repeat;
}
.model-option-name { font: var(--t-label-l); font-weight: 600; }
.model-option-desc { font: var(--t-body-s); font-size: 0.75rem; color: var(--c-on-3); }

/* Effort: a quiet pill like the model's name: "Effort" in the tertiary text, the level's name, a chevron that points
   at the popover (right of the button, or up when it opens above: model-picker.js sets data-side). */
.model-effort { display: inline-flex; align-items: center; min-width: 0; }
.effort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 8px 0 10px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--c-on-3);
    font: var(--t-label-m);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--dur-1) var(--ease-standard), color var(--dur-1) var(--ease-standard);
}
.effort-btn:hover:not(:disabled),
.effort-btn.is-open { background: var(--c-hover); }
.effort-btn:disabled { cursor: default; }
.effort-btn-value { color: var(--c-on-2); font-weight: 600; }
.effort-btn:hover:not(:disabled) .effort-btn-value,
.effort-btn.is-open .effort-btn-value { color: var(--c-on); }
.effort-btn-chevron {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    margin-left: -2px;
    color: var(--c-on-3);
    transition: transform var(--dur-2) var(--ease-standard);
}
.effort-btn.is-open .effort-btn-chevron { transform: rotate(180deg); }
.effort-btn[data-side="top"] .effort-btn-chevron { transform: rotate(-90deg); }
.effort-btn[data-side="top"].is-open .effort-btn-chevron { transform: rotate(90deg); }

/* The popover (top layer; model-picker.js places it): the menu surface around the stops. */
.effort-pop {
    position: fixed;
    inset: auto;
    width: max-content;
    max-width: calc(100vw - 24px);
    margin: 0;
    padding: 6px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--c-surface-raised);
    color: var(--c-on);
    box-shadow: var(--elev-2);
}
/* One column per level; the line runs from the first dot's centre to the last one's, under the dots. */
.effort-scale {
    --effort-stops: 5;
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--effort-stops), minmax(0, 68px));
}
.effort-scale::before {
    content: "";
    position: absolute;
    top: 15px;
    left: calc(100% / (2 * var(--effort-stops)));
    right: calc(100% / (2 * var(--effort-stops)));
    height: 2px;
    margin-top: -1px;
    border-radius: var(--radius-pill);
    background: var(--c-outline-variant);
}
.effort-stop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 7px 2px 5px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--c-on-3);
    font: var(--t-label-m);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color var(--dur-1) var(--ease-standard);
}
.effort-stop:disabled { cursor: default; }
/* a level: a small hollow dot on the line; the chosen one: a gold dot with the surface's ring and a gold hairline */
.effort-stop-dot {
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    border: 2px solid var(--c-outline);
    border-radius: 50%;
    background: var(--c-surface-raised);
    transform: scale(0.625);
    transition: transform var(--dur-2) var(--ease-standard), border-color var(--dur-1) var(--ease-standard);
}
.effort-stop-name { max-width: 100%; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.effort-stop:hover:not(:disabled) { color: var(--c-on); }
.effort-stop:hover:not(:disabled) .effort-stop-dot { border-color: var(--c-accent); }
.effort-stop[aria-checked="true"] { color: var(--c-on); font-weight: 600; }
.effort-stop[aria-checked="true"] .effort-stop-dot {
    border: 3px solid var(--c-surface-raised);
    background: var(--c-accent);
    box-shadow: 0 0 0 1.5px var(--c-accent);
    transform: none;
}

@media (max-width: 560px) {
    .model-picker { gap: var(--space-2); padding: 0 4px 0 2px; }
    .model-name-btn { max-width: 44%; }
    .effort-btn { padding: 0 6px 0 8px; }
    .effort-btn:not([data-side]) .effort-btn-chevron { transform: rotate(-90deg); }   /* opens above on a phone */
}
@media (pointer: coarse) {
    .effort-stop { padding-top: 13px; padding-bottom: 9px; }   /* a 44 px tap row */
    .effort-scale::before { top: 21px; }
}
@media (prefers-reduced-motion: reduce) {
    .model-name-chevron,
    .effort-btn-chevron,
    .effort-stop-dot { transition: none; }
}
@media (forced-colors: active) {
    .model-option[aria-selected="true"]::after { forced-color-adjust: none; background: Highlight; }
    /* keyboard focus: forced colours drop the option's tint (final review client-3) */
    .model-option:focus-visible { outline: 2px solid Highlight; outline-offset: -2px; }
    /* the line and the dots are author colours: system colours keep them, the chosen level in Highlight */
    .effort-scale::before { forced-color-adjust: none; background: GrayText; }
    .effort-stop-dot { forced-color-adjust: none; border-color: ButtonText; background: Canvas; }
    .effort-stop[aria-checked="true"] .effort-stop-dot { border-color: Canvas; background: Highlight; box-shadow: 0 0 0 1.5px Highlight; }
    .effort-stop:disabled .effort-stop-dot { border-color: GrayText; }
}
