/*
 * Инструменты поля ввода чата: выбор режима модели (Авто / Быстро / Умно) и меню «/» с навыками и подсказками.
 * Подключается после hermes-shell.css. Цвета — только токены app.css, поэтому светлая и тёмная темы работают сами.
 */

/* Меню «/» привязывается к плашке поля ввода. */
.hermes-dashboard .composer-shell__surface {
    position: relative;
}

/* ---------- режим модели ---------- */

.hermes-dashboard .hermes-modepicker {
    position: relative;
    flex: 0 0 auto;
    align-self: flex-end;
    margin-bottom: 0.25rem;
}

.hermes-dashboard .hermes-modepicker__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    height: 2rem;
    padding: 0 0.625rem 0 0.5rem;
    /* Без обводки: переключатель режима не должен спорить с полем ввода за внимание. */
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--hermes-dim);
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.hermes-dashboard .hermes-modepicker__pill:hover:not(:disabled),
.hermes-dashboard .hermes-modepicker__pill[aria-expanded="true"] {
    color: var(--hermes-text);
    background: var(--hermes-hover);
}

.hermes-dashboard .hermes-modepicker__pill:disabled {
    opacity: 0.45;
    cursor: default;
}

.hermes-dashboard .hermes-modepicker__pill:focus-visible,
.hermes-dashboard .hermes-modepicker__item:focus-visible,
.hermes-dashboard .hermes-slash-menu__save:focus-visible,
.hermes-dashboard .hermes-slash-menu__delete:focus-visible {
    outline: 2px solid var(--hermes-accent-hi);
    outline-offset: 2px;
}

.hermes-dashboard .hermes-modepicker__icon {
    width: 0.9375rem;
    height: 0.9375rem;
    flex: 0 0 auto;
}

.hermes-dashboard .hermes-modepicker__chevron {
    width: 0.875rem;
    height: 0.875rem;
    flex: 0 0 auto;
    opacity: 0.7;
}

.hermes-dashboard .hermes-modepicker__pill[aria-expanded="true"] .hermes-modepicker__chevron {
    transform: rotate(180deg);
}

/* Подложка ловит клик мимо меню, не затемняя страницу. */
.hermes-dashboard .hermes-modepicker__scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.hermes-dashboard .hermes-modepicker__menu {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    z-index: 41;
    display: grid;
    gap: 0.125rem;
    width: 17.5rem;
    max-width: calc(100vw - 2rem);
    padding: 0.375rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.75rem;
    color: var(--hermes-text);
    background: var(--hermes-panel-strong);
    box-shadow: 0 12px 32px rgb(var(--hermes-shadow-rgb) / calc(0.32 * var(--hermes-shadow-a)));
}

.hermes-dashboard .hermes-modepicker__item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .hermes-modepicker__item:hover:not(:disabled) {
    background: var(--hermes-hover);
}

.hermes-dashboard .hermes-modepicker__item.is-selected {
    background: var(--hermes-active);
}

.hermes-dashboard .hermes-modepicker__item.is-locked {
    cursor: default;
}

.hermes-dashboard .hermes-modepicker__text {
    display: grid;
    gap: 0.0625rem;
    min-width: 0;
}

.hermes-dashboard .hermes-modepicker__name {
    font-size: 0.875rem;
    font-weight: 650;
}

.hermes-dashboard .hermes-modepicker__hint {
    color: var(--hermes-dim);
    font-size: 0.75rem;
    line-height: 1.35;
}

.hermes-dashboard .hermes-modepicker__item.is-locked .hermes-modepicker__name,
.hermes-dashboard .hermes-modepicker__item.is-locked .hermes-modepicker__hint,
.hermes-dashboard .hermes-modepicker__item.is-locked .hermes-modepicker__cost {
    opacity: 0.55;
}

.hermes-dashboard .hermes-modepicker__lock {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    margin-top: 0.1875rem;
    color: var(--hermes-warn-ink);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
}

.hermes-dashboard .hermes-modepicker__lock svg {
    width: 0.8125rem;
    height: 0.8125rem;
    flex: 0 0 auto;
}

.hermes-dashboard .hermes-modepicker__cost {
    flex: 0 0 auto;
    padding-top: 0.125rem;
    color: var(--hermes-soft);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- меню «/» ---------- */

.hermes-dashboard .hermes-slash-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.5rem);
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    max-height: min(22rem, 55dvh);
    border: 1px solid var(--hermes-line);
    border-radius: 0.875rem;
    color: var(--hermes-text);
    background: var(--hermes-panel-strong);
    box-shadow: 0 12px 32px rgb(var(--hermes-shadow-rgb) / calc(0.32 * var(--hermes-shadow-a)));
    overflow: hidden;
}

.hermes-dashboard .hermes-slash-menu__list {
    min-height: 0;
    padding: 0.375rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.hermes-dashboard .hermes-slash-menu__group {
    padding: 0.5rem 0.625rem 0.25rem;
    color: var(--hermes-soft);
    font-size: 0.75rem;
    font-weight: 600;
}

.hermes-dashboard .hermes-slash-menu__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.25rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

.hermes-dashboard .hermes-slash-menu__item.is-active {
    background: var(--hermes-active);
}

.hermes-dashboard .hermes-slash-menu__text {
    display: grid;
    gap: 0.0625rem;
    min-width: 0;
}

.hermes-dashboard .hermes-slash-menu__title {
    overflow: hidden;
    font-size: 0.875rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .hermes-slash-menu__desc {
    overflow: hidden;
    color: var(--hermes-dim);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .hermes-slash-menu__delete {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 0.375rem;
    color: var(--hermes-dim);
    background: transparent;
    cursor: pointer;
}

.hermes-dashboard .hermes-slash-menu__delete:hover {
    color: var(--hermes-danger-ink);
    background: var(--hermes-hover);
}

.hermes-dashboard .hermes-slash-menu__delete svg,
.hermes-dashboard .hermes-slash-menu__save svg {
    width: 0.9375rem;
    height: 0.9375rem;
}

.hermes-dashboard .hermes-slash-menu__empty {
    margin: 0;
    padding: 0.625rem;
    color: var(--hermes-dim);
    font-size: 0.8125rem;
}

.hermes-dashboard .hermes-slash-menu__footer {
    display: flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.25rem 0.375rem;
    border-top: 1px solid var(--hermes-line);
}

.hermes-dashboard .hermes-slash-menu__save {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2rem;
    padding: 0.25rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .hermes-slash-menu__save:hover {
    background: var(--hermes-hover);
}

.hermes-dashboard .hermes-slash-menu__hint {
    padding: 0 0.625rem;
    color: var(--hermes-soft);
    font-size: 0.75rem;
}

@media (max-width: 760px) {
    .hermes-dashboard .hermes-modepicker__menu {
        width: min(17.5rem, calc(100vw - 2rem));
    }

    .hermes-dashboard .hermes-slash-menu {
        max-height: min(20rem, 50dvh);
    }

    /* На телефоне клавиатуры нет: подсказку про клавиши не показываем. */
    .hermes-dashboard .hermes-slash-menu__hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hermes-dashboard .hermes-modepicker__pill,
    .hermes-dashboard .hermes-modepicker__chevron {
        transition: none;
    }
}
