:root {
    --pad-x: clamp(12px, 3.2vw, 24px);
    --header-height: 84px;
}

html,
body {
    overflow-x: hidden;
    background-color: var(--bgc-app);
    color: var(--text-white);
    font-family: var(--font-family-app);
}

.search-page.page-content {
    margin: 0;
    padding: 0;
    padding: 12px var(--pad-x) 10px;
}

.search-header {
    position: sticky;
    top: 0;
    z-index: 60;
}

.search-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    background-color: var(--bgc-input-div);
    border-radius: var(--border-radius);
}

.search-bar__field {
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}

.search-bar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--size-icons-login-register);
    height: var(--size-icons-login-register);
    color: var(--text-grey);
}

.search-bar__input {
    appearance: none;
    width: var(--full-width);
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-white);
    font-family: var(--font-family-app);
    font-size: max(16px, var(--font-size-text));
}

.search-bar__input::placeholder {
    color: var(--text-grey);
}

.search-chips {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px var(--pad-x);
    overflow-x: auto;
    overflow-y: hidden;
    background: transparent;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}

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

.search-chips::-webkit-scrollbar-thumb {
    background: transparent;
}

.search-chips::-webkit-scrollbar-track {
    background: transparent;
}

.search-chips::before,
.search-chips::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 36px;
    pointer-events: none;
    z-index: 62;
}

.search-chips::before {
    left: 0;
}

.search-chips::after {
    right: 0;
}

.search-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    color: var(--text-grey);
    font-size: var(--font-size-text);
    font-family: var(--font-family-app);
    text-decoration: none;
    white-space: nowrap;
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.search-chip:focus,
.search-chip:focus-visible {
    outline: none;
    color: var(--text-grey);
}

.search-chip.is-active {
    color: var(--text-white);
}

.search-results {
    padding: 8px 0 24px;
}

.search-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.search-empty {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    align-items: center;
    gap: 12px;
    min-height: 25vh;
    padding: 40px var(--pad-x);
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.search-empty-lottie {
    width: 160px;
    height: 160px;
    display: block;
    display: flex;
    justify-content: center;
    text-align: center;
    align-items: center;
}

.search-empty p {
    margin: 0;
    color: var(--danger-error);
}

.search-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px var(--pad-x);
    border-top: 1px solid transparent;
}

.search-row + .search-row {
    border-bottom-color: var(--text-grey);
}

.search-row:hover {
    background: var(--bgc-input-div);
    border-radius: var(--border-radius);
}

.search-row:has(.search-link:focus-visible) {
    outline: none;
    background: var(--bgc-input-div);
}

.search-link {
    display: contents;
    color: inherit;
    text-decoration: none;
}

.search-left {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    overflow: hidden;
    background: var(--pill);
    border: 1px solid var(--hair);
    border-radius: 12px;
}

.search-left img {
    display: block;
    width: var(--full-width);
    height: var(--full-height);
    object-fit: cover;
}

.search-left dotlottie-player {
    display: block;
    width: var(--full-width);
    height: var(--full-height);
}

.search-left--avatar {
    border-radius: var(--full-border);
    background: linear-gradient(180deg, #2b2d31, #1e1f24);
}

.search-left--avatar span {
    color: #fff;
    font-weight: 700;
}

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

.search-item-title {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
}

.search-meta {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-follow-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    border-radius: var(--full-border);
    font-size: 11px;
    font-weight: 600;
}

@media (max-width: 560px) {
    .search-bar__field {
        gap: 8px;
        padding: 9px 12px;
    }

    .search-chips {
        margin-top: 8px;
        padding: 6px var(--pad-x);
    }

    .search-row {
        grid-template-columns: 46px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 10px var(--pad-x);
    }

    .search-left {
        width: 46px;
        height: 46px;
    }

    .search-item-title {
        font-size: 14px;
    }

    .search-meta {
        font-size: 12px;
    }

    .search-chip {
        height: 36px;
        padding: 0 14px;
        font-size: 13px;
    }

    .search-chips::before,
    .search-chips::after {
        display: none;
    }
}

@supports (padding: env(safe-area-inset-bottom)) {
    .search-results {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .search-chips {
        padding-left: calc(var(--pad-x) + env(safe-area-inset-left));
        padding-right: calc(var(--pad-x) + env(safe-area-inset-right));
    }
}
