/* tool-config-page.css — profile-scope tool configuration */

.tc-section {
    margin-bottom: 2rem;
}

/*
 * Tighter than the shared .dlg-page h2: the hint line sits directly beneath
 * the heading and reads as part of it.
 */
.tc-section h2 {
    margin-bottom: 0.25rem;
}

.tc-section__hint {
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.85rem;
    margin: 0 0 1rem;
    max-width: 60ch;
}

/*
 * Rounded frame separating the Publish section from the tool-use half of the
 * page — the same treatment as the Setup & Run detail card (.eval-detail).
 */
.tc-section--boxed {
    box-sizing: border-box;
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 8px;
    padding: 20px;
}

.tc-section--boxed h1 {
    margin-top: 0;
}

/* A box wrapping several sections: keep spacing between them, but don't
   let the last section's margin pad the box bottom further. */
.tc-section--boxed > .tc-section:last-child {
    margin-bottom: 0;
}

.tc-section--boxed {
    margin-bottom: 1.5rem;
}

/* ── Fields ───────────────────────────────────────────── */

.tc-field {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.tc-field--hidden {
    display: none;
}

.tc-field__label {
    width: 14rem;
    flex: none;
    padding-top: 0.35rem;
}

.tc-field__input {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tc-field__input .dlg-value {
    flex: 1;
    min-width: 0;
}

.tc-field__input input[type="checkbox"].dlg-value {
    flex: none;
}

/*
 * Checkbox rows have no tall input to align to, so the label's top padding
 * (meant for text/number fields) leaves the box sitting higher than its label.
 * Center the row and drop that padding so box and label line up.
 */
.tc-field:has(input[type="checkbox"]) {
    align-items: center;
}

.tc-field:has(input[type="checkbox"]) .tc-field__label {
    padding-top: 0;
}

/*
 * Field typography follows the Setup & Run edit form (eval-page.css):
 * Geist for every input — overriding the browser's monospace textarea
 * default — hairline borders, 8px radius, and the shared focus ring.
 */
.tc-page .tc-field__label {
    font-weight: 600;
    color: var(--app-text-secondary, #919191);
}

.tc-field__input textarea.dlg-value {
    font-family: inherit;
    font-size: 14px;
    line-height: 22px;
    padding: 9px 12px;
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 8px;
    background: var(--app-bg-primary, #fff);
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
    resize: vertical;
    min-height: 5rem;
    box-sizing: border-box;
}

.tc-field__input textarea.dlg-value:focus,
.tc-field__input input.dlg-value:focus {
    outline: 2px solid var(--app-focus-ring, rgba(20, 27, 155, 0.6));
    outline-offset: -2px;
}

.tc-field__input input[type="checkbox"].dlg-value {
    accent-color: var(--app-action-primary, #212121);
}

.tc-link {
    font-size: 0.85rem;
}

/* ── "What the LLM receives" (Publish section) ────────── */
/* Styled here on the section's own terms — muted summary line and hints
   matching .tc-section__hint — rather than importing the tf-schema look. */

.tc-llm-view {
    margin-top: 0.25rem;
}

.tc-llm-view__summary {
    cursor: pointer;
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.85rem;
}

.tc-llm-view__body {
    margin-top: 0.5rem;
}

.tc-llm-view__body .tc-section__hint {
    margin-bottom: 0.5rem;
}

.tc-llm-view__json {
    margin: 0 0 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--dlg-color-border, #e2e2e6);
    border-radius: 8px;
    background: var(--dlg-color-bg-secondary, #f9f9f9);
    font-size: 13px;
    line-height: 1.5;
    max-height: 24rem;
    overflow: auto;
}

/* ── Enabled/disabled filter ──────────────────────────── */

.tc-filter {
    display: inline-flex;
    gap: 0;
    margin-bottom: 0.75rem;
    border: 1px solid var(--dlg-color-border, #e2e2e6);
    border-radius: 8px;
    overflow: hidden;
}

/*
 * Scoped with .dlg-page to outweigh the blanket `.dlg-page button` rules in
 * dialogue.css — including :hover, which the pressed rule below must beat.
 */
.dlg-page .tc-filter__btn {
    border: none;
    border-radius: 0;
    background: var(--dlg-color-bg-secondary, #f9f9f9);
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.85rem;
    padding: 0.35rem 0.9rem;
    cursor: pointer;
}

.dlg-page .tc-filter__btn + .tc-filter__btn {
    border-left: 1px solid var(--dlg-color-border, #e2e2e6);
}

.dlg-page .tc-filter__btn[aria-pressed="true"] {
    background: var(--app-action-primary, #212121);
    color: var(--app-bg-primary, #fff);
}

/* Rows outside the active filter, and groups left empty by it. */
.tc-row--filtered,
.tc-group--empty {
    display: none;
}

/* ── Function groups ──────────────────────────────────── */

.tc-group {
    margin-bottom: 1.25rem;
}

.tc-group__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.4rem;
}

/* Sits in a flex row beside its link, so it drops the shared bottom margin. */
.tc-group__title {
    margin: 0;
}

/*
 * One container per group, rows told apart by their leading icon — same
 * treatment as the Retrieval Tools panel, so a function looks the same
 * wherever it is listed.
 */
.tc-group__rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--dlg-color-border, #e2e2e6);
    border-radius: 12px;
    background: var(--dlg-color-bg-secondary, #f9f9f9);
}

.tc-empty {
    color: var(--dlg-color-text-muted, #6b6b70);
}

/*
 * The Details expander spans the full column width — under the enable dropdown
 * too — so it drops the shared icon-width indent, and tucks up close to the name
 * with a small top margin.
 */
.tc-page .tf-row__config {
    margin-left: 0;
    margin-top: 0.35rem;
}

/* Section heading above the parameter collapsibles. */
.tc-page .tf-params-heading {
    font-weight: 600;
    margin-bottom: 0.35rem;
}

/*
 * Each parameter is its own closed collapsible: the summary shows name (type),
 * and expanding reveals the description plus every remaining schema field.
 * Tight vertical rhythm so a long parameter list stays scannable when collapsed.
 */
.tc-page .tf-param {
    margin-top: 0;
    margin-bottom: 0.1rem;
}

.tc-page .tf-param__head {
    font-weight: 400;
}

.tc-page .tf-param[open] > .tf-param__head {
    margin-bottom: 0.2rem;
}

.tc-page .tf-param__name {
    font-weight: 600;
}

.tc-page .tf-param__type {
    color: var(--dlg-color-text-muted, #6b6b70);
    font-size: 0.85rem;
}

/* The expanded body hangs indented under the summary. */
.tc-page .tf-param__body {
    padding-left: 1rem;
}

.tc-page .tf-param__desc {
    font-size: 0.85rem;
    margin: 0.1rem 0;
}

.tc-page .tf-param__field {
    font-size: 0.8rem;
    color: var(--dlg-color-text-muted, #6b6b70);
    overflow-wrap: anywhere;
}

.tc-page .tf-param__key {
    font-weight: 500;
}
