/* ==========================================================================
   New design (Carrot, Oct 2026): search page (screen 19)
   Search line that draws in on focus, filter chips, "Browse collections" rows, results in product
   cards with the typed words underlined. Values from the delivered prototype (app.css .search-bar,
   .chip, .browse-row, .flow-empty). Loaded only for Preview users.
   ========================================================================== */

.s2-search {
    /* flow-root keeps the search bar's top margin inside the page (it would merge with the page's own) */
    display: flow-root;
    background: #fff;
    font-family: var(--s2-font);
}

/* ---------- Search bar ---------- */
.s2-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 16px 4px;
    padding: 6px 0 10px;
    border-bottom: 1px solid var(--s2-border);
    color: var(--s2-indigo);
}
.s2-search-bar > svg {
    flex-shrink: 0;
}
.s2-search-bar input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-family: var(--s2-font);
    font-size: 18px;
    font-weight: 500;
    color: var(--s2-indigo);
    -webkit-appearance: none;
    appearance: none;
}
.s2-search-bar input::placeholder {
    color: var(--s2-text-faint);
    font-weight: 400;
}
.s2-search-bar input::-webkit-search-cancel-button {
    display: none;
}
/* Navy line that draws in from the left while typing */
.s2-search-line {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--s2-indigo);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.45s var(--s2-ease-in-out);
}
.s2-search-bar:focus-within .s2-search-line {
    transform: scaleX(1);
}
.s2-search-clear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    color: var(--s2-indigo);
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.3s var(--s2-ease-spring);
}
.s2-search-clear.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* ---------- Chips ---------- */
.s2-chip-row {
    display: flex;
    gap: 6px;
    padding: 14px 16px 6px;
    overflow-x: auto;
    scrollbar-width: none;
}
.s2-chip-row::-webkit-scrollbar {
    display: none;
}
.s2-chip {
    flex-shrink: 0;
    padding: 7px 12px;
    border: 1px solid var(--s2-indigo);
    border-radius: 0;
    background: #fff;
    font-family: var(--s2-font);
    font-size: 12px;
    font-weight: 600;
    line-height: normal;
    color: var(--s2-indigo);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.25s ease, color 0.25s ease;
    animation: s2SlideIn 0.5s var(--s2-ease-out) calc(var(--d, 0) * 40ms) both;
}
.s2-chip.is-active {
    background: var(--s2-indigo);
    color: #fff;
}

/* ---------- Heading above the list / results ---------- */
.s2-list-head.s2-search-head {
    margin-top: 10px;
}

/* ---------- Browse collections ---------- */
.s2-browse-list {
    border-top: 1px solid var(--s2-border);
}
.s2-browse-row {
    display: grid;
    grid-template-columns: 1fr auto 16px;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--s2-border);
    background: #fff;
    color: var(--s2-indigo);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    animation: s2LogoRise 0.5s var(--s2-ease-out) calc(0.2s + var(--d, 0) * 40ms) both;
}
.s2-browse-row:active {
    background: var(--s2-sky-bg);
}
.s2-browse-row[hidden] {
    display: none;
}
.s2-browse-name {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}
.s2-browse-count {
    font-size: 12px;
    color: var(--s2-text-muted);
}

/* ---------- Results: the typed words underlined in the names ---------- */
.s2-card-name mark {
    background: none;
    color: inherit;
    box-shadow: inset 0 -2px 0 var(--s2-sky);
}

/* ---------- No results ---------- */
.s2-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 32px 8px;
    text-align: center;
}
.s2-search-empty[hidden] {
    display: none;
}
.s2-search-empty-title {
    margin: 0 0 6px;
    font-family: var(--s2-font);
    font-size: 16px;
    font-weight: 700;
    color: var(--s2-indigo);
    animation: s2LogoRise 0.6s var(--s2-ease-out) 0.25s both;
}
.s2-search-empty-text {
    margin: 0 0 20px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--s2-text-muted);
    animation: s2LogoRise 0.6s var(--s2-ease-out) 0.32s both;
}

@keyframes s2SlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .s2-chip, .s2-browse-row, .s2-search-empty-title, .s2-search-empty-text { animation: none; }
}
