/* sse-doc-picker.css — Document picker modal styles */

/* ── Modal card override ─────────────────────────────────── */

.dp-modal {
    width: 920px;
    max-width: calc(100vw - 40px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.dp-header {
    background: #efefef;
    padding: 20px 30px 12px 30px;
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Close button moves into the header flex row instead of being absolutely
   positioned over the card. */
.dp-header .app-dialog__close {
    position: static;
    top: auto;
    right: auto;
}

/* ── Body ─────────────────────────────────────────────────── */

.dp-body {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.dp-body--two-col {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 20px;
    overflow: hidden;
}

.dp-filter-col {
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f9f9f9;
    border-radius: 10px;
    padding: 12px;
}

.dp-filter-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
}

.dp-filter-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dp-filter-section__legend {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
}

/* White rounded box that holds each section's controls — sits on the
   grey filter column, matching the Figma layered look. */
.dp-filter-section__box {
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 44px;
}

.dp-filter-chips {
    flex-wrap: wrap;
}

/* Free-text filter input inside the white box — borderless because the box
   itself supplies the visual frame. */
.dp-filter-section__box .dp-filter-input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 0;
    border: none;
    font-size: 13px;
    font-family: inherit;
    background: transparent;
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
}

.dp-filter-section__box .dp-filter-input::placeholder {
    color: var(--app-text-placeholder, rgba(17, 24, 39, 0.35));
}

.dp-filter-section__box .dp-filter-input:focus {
    outline: none;
}

/* Categories cloned from the page: drop the per-group fieldset border/padding
   so they read as one continuous list inside the surrounding white box. */
.dp-filter-categories {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dp-filter-section__box .dp-filter-categories fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.dp-filter-section__box .dp-filter-categories legend {
    /* Outer .dp-filter-section__legend already says "Categories"; only show
       the inner per-group legend when there's more than one group (it carries
       the group's name then). For the common single-group case it's redundant. */
    display: none;
}

.dp-filter-section__box .dp-filter-categories fieldset + fieldset legend {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--app-text-secondary, #878787);
    margin-top: 6px;
}

.dp-search-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}

/* ── Search controls ──────────────────────────────────────── */

.dp-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.dp-search-input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.dp-search-btn {
    flex-shrink: 0;
    min-width: 80px;
}

.dp-config-select {
    flex-shrink: 0;
    min-width: 120px;
    padding: 5px 8px;
    font-family: inherit;
    font-size: 13px;
    border: 1px solid var(--dlg-color-border, hsla(0, 0%, 40%, 0.15));
    border-radius: 6px;
    background: var(--app-bg-primary, #fff);
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
}

/* ── Inline message (no-results / error) ─────────────────── */

.dp-message {
    font-size: 13px;
    color: var(--app-text-secondary, #666);
    flex-shrink: 0;
}

.dp-message--error {
    color: var(--app-text-alert, #dc172e);
}

/* ── Results list ─────────────────────────────────────────── */

.dp-results {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* ── Document card ────────────────────────────────────────── */

.dp-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
}

/* Thumbnail */
.dp-card__thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(102, 102, 102, 0.15);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dp-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Text block */
.dp-card__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dp-card__title-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.dp-card__title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dp-card__title-row .dp-card__check {
    margin-top: 0;
}

.dp-card__id {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dp-card__brief {
    font-size: 13px;
    line-height: 18px;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 2px;
}

/* Checkbox */
.dp-card__check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--dlg-color-primary, #141b9b);
}

/* ── Footer ───────────────────────────────────────────────── */

.dp-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--dlg-color-border, hsla(0, 0%, 40%, 0.15));
}

.dp-selected-count {
    flex: 1;
    font-size: 13px;
    color: #555;
}

/* ── Selected doc chips (on the main page) ────────────────── */

.sse-advanced__doc-picker {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.sse-selected-docs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sse-selected-docs:empty {
    display: none;
}

/* Neutral grey pill from the design's Tag component: Background/Light Grey,
   borderRadiusSM, controlPaddingHorizontalSM and the SM/Medium text style. */
.sse-doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #efefef;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
    max-width: 250px;
}

.sse-doc-chip__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scoped with .dlg-page so it outweighs the blanket `.dlg-page button` rule in
   dialogue.css, which would otherwise give the chip's × the full legacy button
   look — 9x16 padding, border and white background. */
.dlg-page .sse-doc-chip__remove,
.sse-doc-chip__remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    color: #777b84;
    line-height: 1;
    flex-shrink: 0;
}

.dlg-page .sse-doc-chip__remove:hover,
.sse-doc-chip__remove:hover {
    background: none;
    border-color: transparent;
    color: var(--app-text-alert, #dc172e);
}
