/* 통합 검색 결과 다이얼로그의 항목별 진행·선택 화면. */
.search-type-progress {
    --progress-surface: #f6f8fb;
    --progress-panel: #ffffff;
    --progress-line: #ccd8e5;
    --progress-text: #172f49;
    --progress-muted: #536b83;
    /* The result wrapper owns scrolling.  Keeping this panel as its first
     * document-flow child prevents a sibling flex calculation from shrinking
     * the whole progress surface to nothing when cards arrive. */
    display: block;
    min-block-size: auto;
    padding: 1rem;
    overflow: visible;
    border-bottom: 1px solid var(--progress-line);
    background: var(--progress-surface);
    color: var(--progress-text);
    box-sizing: border-box;
}

.search-type-progress[hidden] {
    display: none !important;
}

/* 결과 창 단위 제한은 유형별 집계 실패가 아니다. 남은 카드가 있을 때만
 * 목록 끝에 작게 이어 불러오기 동작을 제공한다. */
.search-results-load-more {
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    width: 100%;
    max-width: 46rem;
    margin: 0 auto;
    padding: 0.75rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #d7e0e9;
    background: #f7fafc;
    color: #536b83;
    box-sizing: border-box;
    text-align: center;
}

.search-results-load-more[hidden] {
    display: none !important;
}

.search-results-load-more p {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.35;
}

.search-results-load-more button {
    min-height: 44px;
    padding: 0.55rem 1rem;
    border: 1px solid #8db9dd;
    border-radius: 0.62rem;
    background: #ffffff;
    color: #15577f;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 820;
    cursor: pointer;
}

.search-results-load-more button:hover:not(:disabled) {
    border-color: #3a82b4;
    background: #eaf4fb;
}

.search-results-load-more button:focus-visible {
    outline: 3px solid rgba(49, 130, 184, 0.3);
    outline-offset: 2px;
}

.search-results-load-more button:disabled {
    border-color: #c5d2df;
    background: #edf2f6;
    color: #7a8ea3;
    cursor: wait;
}

/* The progress view and card results always share the same scroll surface.
 * Do not reintroduce a state that hides the results while counts settle. */
.results-virtual-wrapper > .search-type-progress {
    display: block;
    flex: none;
    min-block-size: auto;
    max-block-size: none;
}

.results-dialog .results-virtual-wrapper > .search-type-progress {
    position: relative;
    z-index: 2;
}

.search-type-progress__heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    max-inline-size: 86rem;
    margin: 0 auto 0.85rem;
}

.search-type-progress__heading h3 {
    margin: 0;
    color: var(--progress-text);
    font-size: 1rem;
    font-weight: 850;
    letter-spacing: -0.025em;
}

.search-type-progress__status {
    min-inline-size: 0;
    margin: 0;
    color: var(--progress-muted);
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.4;
    text-align: right;
}

.search-type-progress__groups {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) minmax(0, 0.72fr);
    gap: 0.75rem;
    max-inline-size: 86rem;
    margin: 0 auto;
}

.search-type-progress__group {
    --group-rgb: 30, 112, 190;
    min-inline-size: 0;
    padding: 0.75rem;
    border: 1px solid var(--progress-line);
    border-radius: 0.9rem;
    background: var(--progress-panel);
    box-shadow: 0 5px 16px rgba(22, 48, 76, 0.06);
}

.search-type-progress__group[data-group="government_support"] {
    --group-rgb: 103, 75, 181;
}

.search-type-progress__group[data-group="iliya"] {
    --group-rgb: 0, 112, 88;
}

.search-type-progress__group-heading {
    min-inline-size: 0;
    margin-block-end: 0.6rem;
    padding-inline: 0.15rem;
}

.search-type-progress__group-heading h4 {
    margin: 0;
    color: var(--progress-text);
    font-size: 0.9rem;
    font-weight: 850;
    letter-spacing: -0.02em;
}

.search-type-progress__group-heading p {
    margin: 0.12rem 0 0;
    color: var(--progress-muted);
    font-size: 0.69rem;
    font-weight: 600;
    line-height: 1.3;
}

.search-type-progress__items {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.42rem;
}

.search-type-progress__group[data-group="government_support"] .search-type-progress__items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.search-type-progress__group[data-group="iliya"] .search-type-progress__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-type-progress__topic {
    display: grid;
    grid-template-rows: 2.15rem auto auto;
    justify-items: center;
    align-content: start;
    gap: 0.18rem;
    min-inline-size: 0;
    min-block-size: 6.2rem;
    margin: 0;
    padding: 0.52rem 0.32rem;
    border: 1px solid #d6e0ea;
    border-radius: 0.72rem;
    background: #f2f5f8;
    color: #425970;
    box-sizing: border-box;
    font: inherit;
    text-align: center;
    appearance: none;
    cursor: default;
    transition: border-color 220ms ease, background-color 220ms ease,
        color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.search-type-progress__icon {
    display: inline-grid;
    inline-size: 2.15rem;
    block-size: 2.15rem;
    place-items: center;
    border-radius: 0.68rem;
    background: #e3e9ef;
    font-size: 1.25rem;
    line-height: 1;
    filter: grayscale(1) saturate(0);
    opacity: 0.58;
    transition: filter 220ms ease, opacity 220ms ease, background-color 220ms ease,
        box-shadow 220ms ease, transform 220ms ease;
}

.search-type-progress__label,
.search-type-progress__detail,
.search-type-progress__count {
    inline-size: 100%;
    min-inline-size: 0;
    overflow-wrap: anywhere;
}

.search-type-progress__label {
    color: inherit;
    font-size: 0.74rem;
    font-weight: 820;
    line-height: 1.2;
}

.search-type-progress__detail {
    color: #61778d;
    font-size: 0.59rem;
    font-weight: 600;
    line-height: 1.2;
}

.search-type-progress__detail[hidden] {
    display: none;
}

.search-type-progress__count {
    align-self: end;
    color: #536a81;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    font-weight: 760;
    line-height: 1.2;
}

.search-type-progress__topic[data-state="pending"] .search-type-progress__count::after {
    display: inline-block;
    inline-size: 0.34rem;
    block-size: 0.34rem;
    margin-inline-start: 0.3rem;
    border-radius: 50%;
    background: currentColor;
    content: "";
    animation: search-progress-pulse 1.15s ease-in-out infinite alternate;
    vertical-align: 0.08rem;
}

.search-type-progress__topic[data-state="complete"] {
    border-color: rgba(var(--group-rgb), 0.62);
    background: rgba(var(--group-rgb), 0.09);
    color: rgb(var(--group-rgb));
    box-shadow: inset 0 0 0 1px rgba(var(--group-rgb), 0.08);
    cursor: pointer;
}

.search-type-progress__topic[data-state="complete"] .search-type-progress__icon {
    background: rgba(var(--group-rgb), 0.14);
    box-shadow: 0 4px 10px rgba(var(--group-rgb), 0.13);
    filter: none;
    opacity: 1;
}

.search-type-progress__topic[data-state="complete"] .search-type-progress__detail,
.search-type-progress__topic[data-state="complete"] .search-type-progress__count {
    color: #2d4c69;
}

.search-type-progress__topic[data-state="complete"]:hover {
    border-color: rgb(var(--group-rgb));
    background: rgba(var(--group-rgb), 0.14);
    transform: translateY(-1px);
}

.search-type-progress__topic[data-state="complete"]:focus-visible {
    outline: 3px solid rgba(var(--group-rgb), 0.38);
    outline-offset: 2px;
}

.search-type-progress__topic[data-state="error"] {
    border-color: #d7a84c;
    background: #fff8e8;
    color: #73500d;
}

.search-type-progress__topic[data-state="error"] .search-type-progress__count,
.search-type-progress__topic[data-state="error"] .search-type-progress__detail {
    color: #73500d;
}

.search-type-progress__topic[data-state="excluded"] {
    border-color: #91a6ba;
    border-style: solid;
    background: linear-gradient(135deg, #eef3f7 0%, #e4ebf1 100%);
    color: #334b62;
    box-shadow: inset 0 0 0 1px rgba(70, 94, 117, 0.08);
}

.search-type-progress__topic[data-state="excluded"] .search-type-progress__count,
.search-type-progress__topic[data-state="excluded"] .search-type-progress__detail {
    color: #405a72;
}

.search-type-progress__topic[data-state="excluded"] .search-type-progress__icon {
    position: relative;
    background: #d4e0ea;
    filter: grayscale(1) saturate(0);
    opacity: 0.88;
}

.search-type-progress__topic[data-state="excluded"] .search-type-progress__icon::after {
    position: absolute;
    right: -0.18rem;
    bottom: -0.12rem;
    display: inline-grid;
    inline-size: 0.9rem;
    block-size: 0.9rem;
    place-items: center;
    border: 2px solid var(--progress-panel);
    border-radius: 50%;
    background: #60788f;
    color: #ffffff;
    content: "\2212";
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
}

@keyframes search-progress-pulse {
    from { opacity: 0.28; transform: scale(0.78); }
    to { opacity: 0.88; transform: scale(1); }
}

html[data-theme="dark"] .search-type-progress {
    --progress-surface: #0c1524;
    --progress-panel: #152237;
    --progress-line: #344760;
    --progress-text: #edf5ff;
    --progress-muted: #b6c8dc;
}

html[data-theme="dark"] .search-results-load-more {
    border-top-color: #344760;
    background: #101b2d;
    color: #c0d0e1;
}

html[data-theme="dark"] .search-results-load-more button {
    border-color: #4b8dbd;
    background: #172b42;
    color: #e2f2ff;
}

html[data-theme="dark"] .search-results-load-more button:hover:not(:disabled) {
    border-color: #7db9e7;
    background: #203d5b;
}

html[data-theme="dark"] .search-results-load-more button:disabled {
    border-color: #40566e;
    background: #1a293b;
    color: #9db2c7;
}

html[data-theme="dark"] .search-type-progress__group {
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .search-type-progress__topic {
    border-color: #3a4c64;
    background: #111d2f;
    color: #c4d2e1;
}

html[data-theme="dark"] .search-type-progress__icon {
    background: #26354a;
}

html[data-theme="dark"] .search-type-progress__detail,
html[data-theme="dark"] .search-type-progress__count {
    color: #aebfd2;
}

html[data-theme="dark"] .search-type-progress__topic[data-state="complete"] {
    border-color: rgba(var(--group-rgb), 0.94);
    background: rgba(var(--group-rgb), 0.22);
    color: #f2f8ff;
}

html[data-theme="dark"] .search-type-progress__topic[data-state="complete"] .search-type-progress__icon {
    background: rgba(var(--group-rgb), 0.38);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .search-type-progress__topic[data-state="complete"] .search-type-progress__detail,
html[data-theme="dark"] .search-type-progress__topic[data-state="complete"] .search-type-progress__count {
    color: #d6e7f8;
}

html[data-theme="dark"] .search-type-progress__topic[data-state="complete"]:hover {
    background: rgba(var(--group-rgb), 0.3);
}

html[data-theme="dark"] .search-type-progress__topic[data-state="error"] {
    border-color: #b18031;
    background: #35280f;
    color: #ffe3a4;
}

html[data-theme="dark"] .search-type-progress__topic[data-state="error"] .search-type-progress__count,
html[data-theme="dark"] .search-type-progress__topic[data-state="error"] .search-type-progress__detail {
    color: #ffe3a4;
}

html[data-theme="dark"] .search-type-progress__topic[data-state="excluded"] {
    border-color: #627991;
    background: linear-gradient(135deg, #1c2b3e 0%, #23354a 100%);
    color: #d4e1ed;
}

html[data-theme="dark"] .search-type-progress__topic[data-state="excluded"] .search-type-progress__count,
html[data-theme="dark"] .search-type-progress__topic[data-state="excluded"] .search-type-progress__detail {
    color: #bfd0df;
}

html[data-theme="dark"] .search-type-progress__topic[data-state="excluded"] .search-type-progress__icon {
    background: #354b62;
}

html[data-theme="dark"] .search-type-progress__topic[data-state="excluded"] .search-type-progress__icon::after {
    border-color: var(--progress-panel);
    background: #8aa0b5;
    color: #0b1725;
}

@media (max-width: 980px) {
    .search-type-progress__groups {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .search-type-progress {
        padding: 0.7rem;
    }

    .search-type-progress__heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.2rem;
        margin-bottom: 0.58rem;
    }

    .search-type-progress__heading h3 {
        font-size: 0.94rem;
    }

    .search-type-progress__status {
        font-size: 0.72rem;
        text-align: left;
    }

    .search-type-progress__groups {
        gap: 0.52rem;
    }

    .search-type-progress__group {
        padding: 0.58rem;
        border-radius: 0.78rem;
    }

    .search-type-progress__group-heading {
        margin-block-end: 0.45rem;
    }

    .search-type-progress__group-heading h4 {
        font-size: 0.82rem;
    }

    .search-type-progress__group-heading p {
        font-size: 0.64rem;
    }

    .search-type-progress__items {
        gap: 0.32rem;
    }

    .search-type-progress__topic {
        grid-template-rows: 1.9rem auto auto;
        min-block-size: 5.45rem;
        padding: 0.42rem 0.18rem;
        border-radius: 0.62rem;
    }

    .search-type-progress__icon {
        inline-size: 1.9rem;
        block-size: 1.9rem;
        font-size: 1.08rem;
    }

    .search-type-progress__label {
        font-size: 0.66rem;
    }

    .search-type-progress__detail {
        font-size: 0.53rem;
    }

    .search-type-progress__count {
        font-size: 0.61rem;
    }
}

@media (max-width: 359px) {
    .search-type-progress__group[data-group="bid_status"] .search-type-progress__items {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-height: 568px) {
    .search-type-progress {
        padding-block: 0.55rem;
    }

    .search-type-progress__topic {
        min-block-size: 4.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .search-type-progress__topic,
    .search-type-progress__icon {
        transition: none;
    }

    .search-type-progress__topic[data-state="pending"] .search-type-progress__count::after {
        animation: none;
    }
}
