/* eval-page.css — Setup & Run page layout */

/* ── Page root ──────────────────────────────────────────────── */

.eval-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-family: var(--app-font-primary, "Geist", sans-serif);
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
    font-size: 14px;
    line-height: 22px;
    overflow: hidden;
    max-width: 1800px;
}

/* ── Top bar ────────────────────────────────────────────────── */

.eval-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    flex-shrink: 0;
    gap: 10px;
}

/* Right column header — right-align the single child (+ New Test Case). */
.eval-topbar--right {
    justify-content: flex-end;
}

/* Page title in a flex topbar: shared scale, no trailing margin. */
.eval-topbar__title {
    margin: 0;
}

.eval-topbar__suite {
    display: flex;
    align-items: center;
    gap: 12px;
}

.eval-topbar__suite-label {
    font-weight: 400;
}

/* Look comes from the shared select.dlg-select rules in dialogue.css
   (this page's root isn't .dlg-page, so the blanket doesn't reach it). */
.eval-topbar__suite-select {
    cursor: pointer;
    min-width: 160px;
}

/* ── Split button ───────────────────────────────────────────── */

.eval-split-btn {
    position: relative;
    display: inline-flex;
}

.eval-split-btn__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.eval-split-btn__arrow {
    font-size: 14px;
    line-height: 1;
    margin-left: 4px;
    padding: 9px 12px 9px 10px;
    margin-top: -9px;
    margin-bottom: -9px;
    margin-right: -16px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.eval-dropdown__menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 180px;
    background: var(--app-bg-primary, #fff);
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 4px;
    flex-direction: column;
}

.eval-dropdown__menu.open {
    display: flex;
}

.eval-dropdown__item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--app-text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 22px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.eval-dropdown__item:hover {
    background-color: var(--app-bg-hover, #f5f5f5);
}

.eval-dropdown__divider {
    height: 1px;
    background: var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    margin: 4px 0;
}

/* ── Panels ─────────────────────────────────────────────────── */

.eval-panels {
    display: flex;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

@media (max-width: 1399px) {
    .eval-panels {
        flex-direction: column;
    }
}

/* ── Left column (top bar above bordered table card) ────────── */

.eval-left {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

/* The bordered card wraps just the table + bottom bar — the column
   header (title + suite) sits above it without chrome. */
.eval-table-card {
    display: flex;
    flex-direction: column;
    /* Hug the content: the card only grows as tall as its rows need, so the
     * bottom bar sits right under the last row. flex-shrink still caps it at
     * the column height, which keeps internal scrolling for long lists. */
    flex: 0 1 auto;
    min-height: 0;
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 8px;
    overflow: hidden;
}

/* ── Questions table ────────────────────────────────────────── */

.eval-table-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: var(--app-bg-secondary, #f9f9f9);
    font-weight: 600;
    flex-shrink: 0;
}

.eval-table-header__title {
    flex: 1;
    min-width: 0;
}

.eval-table-header__tests {
    width: 80px;
    text-align: center;
    flex-shrink: 0;
}

.eval-table-scroll {
    flex: 0 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.eval-table-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

/* Zebra striping per the design — rows are separated by alternating
 * background, not borders. Must precede :hover/.selected so those win. */
.eval-table-row:nth-child(even) {
    background-color: var(--app-bg-secondary, #f9f9f9);
}

.eval-table-row:hover {
    background-color: rgba(20, 27, 155, 0.05);
}

.eval-table-row.selected {
    background-color: var(--app-bg-selected, rgba(20, 27, 155, 0.11));
}

.eval-table-row__check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    accent-color: var(--app-action-primary, #212121);
}

.eval-table-row__question {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eval-table-row__tests {
    width: 80px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Bottom bar (inside left column) ────────────────────────── */

.eval-bottombar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    background: var(--app-bg-primary, #fff);
    flex-shrink: 0;
}

.eval-bottombar__filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eval-bottombar__filter-label {
    font-weight: 400;
}

/* Look comes from the shared select.dlg-select rules in dialogue.css. */
.eval-bottombar__filter-select {
    cursor: pointer;
}

/* The description is the only flexible item in the bar, so it gives up the
 * width the checkbox needs for its own breathing room. */
.eval-bottombar__nocache {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 16px;
    white-space: nowrap;
}

.eval-bottombar__description {
    flex: 1;
    min-width: 0;
    margin: 0 16px;
    padding: 6px 10px;
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 6px;
    background: var(--app-bg-primary, #fff);
    font-family: inherit;
    font-size: 14px;
}

/* ── Right column (top bar above bordered detail card) ──────── */

.eval-right {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.eval-detail {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 8px;
}

@media (max-width: 1399px) {
    .eval-detail {
        max-height: 50vh;
    }
}

.eval-detail__empty {
    color: var(--app-text-secondary, #919191);
    text-align: center;
    padding: 40px 20px;
}

/* ── Detail sections ────────────────────────────────────────── */

.eval-detail-section {
    margin-bottom: 16px;
}

.eval-detail-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.eval-detail-section__title {
    margin: 0;
}

.eval-detail-field {
    display: flex;
    gap: 12px;
    padding: 6px 0;
}

.eval-detail-field__label {
    font-weight: 600;
    min-width: 100px;
    flex-shrink: 0;
    color: var(--app-text-secondary, #919191);
}

.eval-detail-field__value {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    word-break: break-word;
    overflow: hidden;
}

/* ── Test checkboxes in detail ──────────────────────────────── */

.eval-detail-tests {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.eval-detail-test {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eval-detail-test input[type="checkbox"] {
    accent-color: var(--app-action-primary, #212121);
}

/* ── Results section ──────────────────────────────────────────
   Sits below Test Case Details, no rule separator — visual grouping is
   provided by the gray .eval-section boxes inside (loaded from
   inquiry-tree.css). Boxes are spaced via a small gap. */

.eval-results {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eval-results__title {
    margin: 0;
}

.eval-results__reply {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 22px;
}

.eval-score {
    padding: 4px 0;
}

.eval-score__label {
    font-weight: 500;
}

.eval-score--pass {
    color: #16a34a;
}

.eval-score--fail {
    color: var(--app-text-alert, #dc172e);
}

/* ── Buttons ────────────────────────────────────────────────── */

.eval-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 22px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border: none;
    text-decoration: none;
}

.eval-btn--primary {
    background-color: var(--app-action-primary, #212121);
    color: var(--app-text-white, #f5f5f5);
}

.eval-btn--primary:hover {
    background-color: var(--app-action-hover, #141b9b);
}

.eval-btn--secondary {
    background-color: var(--app-bg-primary, #fff);
    color: var(--app-text-primary);
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
}

.eval-btn--secondary:hover {
    background-color: var(--app-bg-hover, #f5f5f5);
}

.eval-btn--icon {
    padding: 9px 12px 9px 12px;
}

/* Text + leading icon variant (e.g. "✎ Edit"). The icon is rendered as the
   first character of the button content so no extra markup is needed. */
.eval-btn--text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
}

/* Wrapper for multiple action buttons in a section header. */
.eval-detail-section__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Positioned wrapper so .eval-dropdown__menu anchors to the overflow button. */
.eval-overflow {
    position: relative;
}

/* Dropdown item with a leading icon (e.g. trash + "Delete question"). */
.eval-dropdown__item--with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eval-dropdown__item-icon {
    flex-shrink: 0;
}

/* ── Form elements (edit/create mode) ───────────────────────── */

/* Shared base for all form inputs */
.eval-form-input,
.eval-form-textarea,
.eval-form-select {
    padding: 9px 12px;
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 8px;
    background-color: var(--app-bg-primary, #fff);
    color: var(--app-text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 22px;
    box-sizing: border-box;
}

/* Inputs as direct children of the flex row need flex:1 */
.eval-form-input {
    flex: 1;
    min-width: 0;
}

/* Textareas stretch to fill available space */
.eval-form-textarea,
.eval-detail-field textarea,
.eval-detail-field__value textarea {
    display: block;
    width: 100%;
    min-width: 0;
    resize: vertical;
    padding: 9px 12px;
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 8px;
    background-color: var(--app-bg-primary, #fff);
    color: var(--app-text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 22px;
    box-sizing: border-box;
}

/* When textarea is a direct flex child (e.g. Comments without wrapper) */
.eval-detail-field > textarea,
.eval-detail-field > .eval-form-textarea {
    flex: 1;
}

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

.eval-form-add-test {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.eval-form-select {
    padding: 9px 12px;
    border: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
    border-radius: 8px;
    background-color: var(--app-bg-primary, #fff);
    color: var(--app-text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 22px;
    cursor: pointer;
    min-width: 160px;
}

.eval-form-help {
    margin-top: 12px;
    font-size: 13px;
    color: var(--app-text-secondary, #919191);
}

.eval-form-help summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--app-text-primary);
}

.eval-form-help__content {
    padding: 8px 0 0 0;
}

.eval-form-help__content h4 {
    margin: 8px 0 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text-primary);
}

.eval-form-help__content ul {
    margin: 0;
    padding-left: 20px;
}

.eval-form-help__content li {
    padding: 2px 0;
    font-family: monospace;
    font-size: 12px;
}

.eval-form-help__content p {
    margin: 4px 0;
}

.eval-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--app-stroke-primary, hsla(0, 0%, 40%, 0.15));
}

/* ── Search results ─────────────────────────────────────────── */

.eval-search-results {
    margin-top: 12px;
}

.eval-search-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid hsla(0, 0%, 40%, 0.08);
}

.eval-search-result__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eval-search-result__link {
    flex-shrink: 0;
    color: var(--app-action-hover, #141b9b);
    text-decoration: none;
    font-weight: 500;
}

.eval-search-result__link:hover {
    text-decoration: underline;
}
