/* sanjilive 사용자 검색 — 즉각 검색 + 카드 밀도 레이아웃 */

.search-page {
    width: min(100% - 40px, 1280px);
    margin: 0 auto;
    padding: 28px 15px 72px;
    color: #202124;
}

/* 상단 검색바 */
.search-query {
    display: grid;
    grid-template-columns: 44px minmax(120px, 1fr) minmax(280px, 640px);
    align-items: end;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e5e8ee;
}

.search-query__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #dfe2e7;
    border-radius: 50%;
    color: #202124;
    font-size: 22px;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.search-query__back:hover {
    border-color: #dd4a2c;
    color: #dd4a2c;
}

.search-query__back:active,
.search-query__field button:active,
.search-tabs button:active,
.search-pagination a:active {
    transform: scale(0.98);
}

.search-query__copy {
    min-width: 0;
}

.search-query__copy p {
    margin: 0 0 4px;
    color: #dd4a2c;
    font-size: 13px;
    font-weight: 500;
}

.search-query__copy h1 {
    margin: 0;
    font-size: clamp(18px, 2.2vw, 24px);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.search-query__form {
    min-width: 0;
}

.search-query__form > label {
    display: block;
    margin-bottom: 6px;
    color: #5f6672;
    font-size: 13px;
    font-weight: 500;
}

.search-query__field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-width: 0;
    border-bottom: 2px solid #dd4a2c;
}

.search-query__field input {
    min-width: 0;
    width: 100%;
    height: 48px;
    padding: 0 12px 0 2px;
    border: 0;
    color: #202124;
    font-size: 16px;
    outline: 0;
    background: transparent;
}

.search-query__field input::placeholder {
    color: #9097a1;
}

.search-query__field button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 80px;
    height: 48px;
    color: #dd4a2c;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    word-break: keep-all;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.search-page a:focus-visible,
.search-page button:focus-visible,
.search-page input:focus-visible {
    outline: 2px solid #dd4a2c;
    outline-offset: 3px;
}

.search-query__field button i {
    font-size: 18px;
}

/* entry: 검색 필드 중심, 거대 hero 여백 없음 */
.search-page[data-search-state-name="entry"] .search-query {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    border-bottom: 1px solid #e5e8ee;
}

.search-page[data-search-state-name="entry"] .search-query__back {
    display: none;
}

.search-page[data-search-state-name="entry"] .search-query__copy {
    display: none;
}

/* browse (entry) */
.search-browse {
    margin-top: 28px;
}

.search-browse .search-section + .search-section {
    margin-top: 36px;
}

.search-browse__empty {
    margin: 16px 0 0;
    padding: 20px 12px;
    border: 1px solid #e5e8ee;
    border-radius: 8px;
    color: #6f7680;
    font-size: 14px;
    text-align: center;
    background: #f7f8fa;
}

/* loading / results / error */
.search-loading,
.search-results,
.search-state--error {
    margin-top: 28px;
}

.search-loading__heading,
.search-loading__item span,
.search-loading__item i,
.search-loading__item b {
    display: block;
    overflow: hidden;
    background: #eef0f3;
}

.search-loading__heading {
    width: min(42%, 360px);
    height: 24px;
    margin-bottom: 20px;
}

.search-loading__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 14px;
}

.search-loading__item span {
    aspect-ratio: 16 / 10;
    border-radius: 8px;
}

.search-loading__item i {
    width: 42%;
    height: 12px;
    margin-top: 12px;
}

.search-loading__item b {
    width: 78%;
    height: 16px;
    margin-top: 8px;
}

.search-loading__heading::after,
.search-loading__item span::after,
.search-loading__item i::after,
.search-loading__item b::after {
    content: "";
    display: block;
    width: 45%;
    height: 100%;
    background: rgba(255, 255, 255, 0.72);
    animation: search-skeleton 1.25s ease-in-out infinite;
}

@keyframes search-skeleton {
    from { opacity: 0; transform: translateX(-120%); }
    35% { opacity: 0.9; }
    to { opacity: 0; transform: translateX(280%); }
}

.search-state {
    min-width: 0;
    padding: 32px 20px;
    border-top: 1px solid #e5e8ee;
    border-bottom: 1px solid #e5e8ee;
    text-align: center;
}

.search-state > i {
    display: block;
    margin-bottom: 12px;
    color: #a1a7b0;
    font-size: 28px;
}

.search-state strong {
    display: block;
    color: #202124;
    font-size: 16px;
    font-weight: 600;
}

.search-state p {
    margin: 8px 0 0;
    color: #6f7680;
    font-size: 14px;
    line-height: 1.55;
}

.search-state--error {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    text-align: left;
}

.search-state--error > i {
    margin: 0;
    color: #dd4a2c;
}

.search-page[data-search-state-name="empty"] .search-tabs,
.search-page[data-search-state-name="empty"] .search-section,
.search-page[data-search-state-name="empty"] [data-search-filter-empty] {
    display: none;
}

.search-results__head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
}

.search-results__head p {
    min-width: 0;
    margin: 0;
    font-size: clamp(18px, 2.2vw, 24px);
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
}

.search-results__head mark {
    background: transparent;
    color: #dd4a2c;
}

.search-results__head > span {
    flex: 0 0 auto;
    color: #7b838f;
    font-size: 13px;
}

.search-tabs {
    display: flex;
    gap: 8px;
    padding: 14px 0;
    border-top: 1px solid #202124;
    overflow-x: auto;
    scrollbar-width: none;
}

.search-tabs::-webkit-scrollbar {
    display: none;
}

.search-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #d9dde5;
    border-radius: 999px;
    color: #6f7680;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    word-break: keep-all;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.search-tabs button.is-active,
.search-tabs button:hover {
    border-color: #202124;
    background: #202124;
    color: #ffffff;
}

.search-tabs button span {
    font-size: 13px;
    font-weight: 500;
}

.search-section {
    min-width: 0;
}

.search-results .search-section {
    border-top: 1px solid #e5e8ee;
}

.search-results .search-section + .search-section {
    margin-top: 36px;
}

.search-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    border-bottom: 1px solid #e5e8ee;
}

.search-section__head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.search-section__head span {
    color: #7b838f;
    font-size: 13px;
}

.search-section__head b {
    font-weight: 600;
}

/* 카드 그리드: desktop 4 */
.search-live-list,
.search-product-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px 14px;
    padding-top: 16px;
}

.search-live-card,
.search-product-card--soldout {
    cursor: not-allowed;
    opacity: 0.78;
    pointer-events: none;
    user-select: none;
}

.search-product-card {
    min-width: 0;
    color: #202124;
}

.search-live-card__media,
.search-product-card__media {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow: hidden;
    border: 1px solid #e5e8ee;
    border-radius: 8px;
    background: #e5e8ee;
    color: #8a919b;
}

.search-live-card__media {
    aspect-ratio: 16 / 10;
}

.search-product-card__media {
    aspect-ratio: 1 / 1;
}

.search-live-card__media img,
.search-product-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-live-card__media i,
.search-product-card__media i {
    font-size: 26px;
}

.search-live-card__media span,
.search-product-card__media span {
    font-size: 12px;
}

.search-live-card__body,
.search-product-card__body {
    min-width: 0;
    padding-top: 10px;
}

.search-live-card__status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 7px;
    border: 1px solid #d9dde5;
    border-radius: 4px;
    color: #202124;
    font-size: 11px;
    font-weight: 600;
    background: #f3f4f6;
}

.search-live-card__status.is-live {
    border-color: #dd4a2c;
    background: #dd4a2c;
    color: #ffffff;
}

.search-live-card__status.is-scheduled {
    border-color: #202124;
    background: #202124;
    color: #ffffff;
}

.search-live-card__status.is-ended {
    border-color: #d9dde5;
    color: #7b838f;
    background: #f3f4f6;
}

.search-live-card__channel,
.search-product-card__category {
    overflow: hidden;
    margin: 8px 0 0;
    color: #7b838f;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-live-card h3,
.search-product-card h3 {
    display: -webkit-box;
    overflow: hidden;
    margin: 6px 0 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.search-live-card:hover h3,
.search-product-card:hover h3 {
    color: #dd4a2c;
}

.search-live-card time {
    display: block;
    overflow: hidden;
    margin: 6px 0 0;
    color: #626a75;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.search-product-card__status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-top: 8px;
    padding: 0 8px;
    border: 1px solid #d9dde5;
    border-radius: 4px;
    color: #5f6672;
    font-size: 12px;
    font-weight: 600;
}

.search-product-card__status.is-soldout,
.search-product-card__status.is-empty {
    background: #f3f4f6;
    color: #7b838f;
}

.search-product-card__status.is-available {
    border-color: #202124;
    color: #202124;
}

.search-product-card__price {
    display: block;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 700;
}

.search-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.search-pagination a,
.search-pagination strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 44px;
    height: 44px;
    border: 1px solid #dfe2e7;
    border-radius: 50%;
    font-size: 14px;
}

.search-pagination a {
    padding: 0 15px;
    border-radius: 999px;
    color: #5f6672;
    transition: border-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.search-pagination a:hover {
    border-color: #dd4a2c;
    color: #dd4a2c;
}

.search-pagination a[aria-disabled="true"] {
    color: #b8bdc5;
    pointer-events: none;
    cursor: default;
}

.search-pagination strong {
    border-color: #202124;
    background: #202124;
    color: #ffffff;
    font-weight: 600;
}

[hidden] {
    display: none !important;
}

/* 카드 그리드: ≤900=2 / 901–1100=3 / >1100=4(기본) */
@media (max-width: 1100px) {
    .search-live-list,
    .search-product-list,
    .search-loading__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .search-query {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .search-query__form {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .search-live-list,
    .search-product-list,
    .search-loading__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 10px;
    }
}

@media (max-width: 768px) {
    .search-page {
        width: min(100% - 24px, 1280px);
        padding: 16px 0 56px;
    }

    .search-query {
        position: sticky;
        top: 0;
        z-index: 20;
        gap: 10px;
        padding: 10px 0 12px;
        background: #ffffff;
        border-bottom: 1px solid #e5e8ee;
    }

    .search-query__copy h1 {
        font-size: 18px;
    }

    .search-browse {
        margin-top: 18px;
    }

    .search-results__head {
        display: block;
    }

    .search-results__head > span {
        display: block;
        margin-top: 6px;
    }

    .search-results .search-section + .search-section,
    .search-browse .search-section + .search-section {
        margin-top: 28px;
    }
}

@media (max-width: 480px) {
    .search-query {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .search-query__field button {
        min-width: 48px;
    }

    .search-query__field button span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .search-loading,
    .search-results,
    .search-state--error {
        margin-top: 20px;
    }

    .search-state--error {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .search-state--error > i {
        margin-bottom: 2px;
    }

    .search-live-card h3,
    .search-product-card h3 {
        font-size: 14px;
    }

    .search-pagination a span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .search-loading__heading::after,
    .search-loading__item span::after,
    .search-loading__item i::after,
    .search-loading__item b::after {
        animation: none;
    }

    .search-query__back:active,
    .search-query__field button:active,
    .search-tabs button:active,
    .search-pagination a:active {
        transform: none;
    }
}
