/*
 * tool-function-row.css — the shared tool-function row.
 *
 * Used by the Tools Config page and the Retrieval Config page's Retrieval Tools
 * tab. Styles the row itself only; the container a page puts rows in belongs to
 * that page's own stylesheet.
 */

.tf-row {
    padding: 8px;
}

.tf-row__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

/* The bullet: a dark tile with a light glyph, as in the design. */
.tf-row__icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--app-action-primary, #212121);
    color: var(--app-bg-primary, #fff);
}

.tf-row__icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.tf-row__text {
    flex: 1;
    min-width: 0;
}

.tf-row__name {
    font-weight: 600;
}

/* The function id trailing the display name. */
.tf-row__id {
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.85rem;
    font-weight: 400;
}

/* First line of the description under the name: one line, ellipsized. */
.tf-row__subtitle {
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.85rem;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tf-row__desc {
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.tf-row__enable {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: none;
}

.tf-row__enable .tf-row__enable-select {
    width: 11rem;
}

/*
 * Color the select by what its selection resolves to (override, or the
 * default when inheriting): green when the function is effectively on,
 * plain black — deliberately not red — when off. Set server-side and kept
 * current by the page's JS on change.
 */
.tf-row__enable-select.tf-enable--on {
    color: #2e7d32;
    border-color: #2e7d32;
}

.tf-row__enable-select.tf-enable--off {
    color: var(--dlg-color-text, #212121);
}

/* The state color belongs to the closed control only — the options in the
   opened list would otherwise inherit it. */
.tf-row__enable-select option {
    color: var(--dlg-color-text, #212121);
}

/* Align the expander with the row's text, past the icon bullet. */
.tf-row__config {
    margin-top: 0.6rem;
    margin-left: 46px;
}

.tf-row__config-summary {
    cursor: pointer;
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.85rem;
}

.tf-row__config-body {
    margin-top: 0.5rem;
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/*
 * Stack label -> instruction -> input vertically. The shared .dlg-field default
 * is a label-beside-input row; inside the expander each field becomes a column.
 */
.tf-row__config-body .dlg-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
}

.tf-row__config-body .dlg-label {
    width: auto;
    color: var(--dlg-color-text);
}

.tf-row__config-body textarea.dlg-value,
.tf-row__config-body input[type="text"].dlg-value {
    width: 100%;
    box-sizing: border-box;
}

.tf-row__config-body textarea.dlg-value {
    font-family: var(--dlg-font-mono, monospace);
    min-height: 3rem;
}

.tf-hint {
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.78rem;
    margin: 0 0 0.25rem;
}

.tf-schema summary {
    cursor: pointer;
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.8rem;
}

.tf-schema__body {
    margin-top: 0.4rem;
}

.tf-schema pre {
    max-height: 16rem;
    overflow: auto;
    background: var(--dlg-color-code-bg, #f0f0f3);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
}
