/* ============================================
   Search Pill — Floating mobile search
   Hidden on desktop (≥1024px)
   ============================================ */

.search-pill {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hide pill on scroll down */
.search-pill.is-scroll-hidden {
    transform: translateY(80px);
    opacity: 0;
    pointer-events: none !important;
}

/* ===== CLOSED STATE (pill button) ===== */
.search-pill__toggle {
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--hv2-orange, #D97706);
    border: none;
    border-radius: 26px;
    height: 52px;
    padding: 0 6px 0 18px;
    box-shadow: 0 4px 20px rgba(217, 119, 6, 0.35);
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.search-pill__toggle:hover {
    box-shadow: 0 6px 24px rgba(217, 119, 6, 0.45);
}

.search-pill__toggle:active {
    transform: scale(0.96);
}

.search-pill__toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--hv2-orange-light, #FEF3C7), 0 4px 20px rgba(217, 119, 6, 0.35);
}

.search-pill__toggle-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-pill__toggle-icon svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

/* Hide toggle when panel is open */
.search-pill.is-open .search-pill__toggle {
    display: none;
}

/* ===== OPEN STATE (panel) ===== */
.search-pill__panel {
    pointer-events: all;
    display: none;
    flex-direction: column;
    gap: 10px;
    width: calc(100vw - 32px);
    max-width: 400px;
    background: #fff;
    border: 1.5px solid var(--hv2-grey-200, #E7E5E4);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.14);
    animation: searchPillIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-pill.is-open .search-pill__panel {
    display: flex;
}

@keyframes searchPillIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel header */
.search-pill__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-pill__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--hv2-dark, #1C1917);
}

.search-pill__close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--hv2-grey-100, #F5F5F4);
    color: var(--hv2-grey-700, #44403C);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.1s;
}

.search-pill__close:hover {
    background: var(--hv2-grey-200, #E7E5E4);
}

.search-pill__close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--hv2-orange-light, #FEF3C7);
}

/* Search row */
.search-pill__search-row {
    display: flex;
    gap: 8px;
}

.search-pill__input {
    flex: 1;
    height: 48px;
    border: 2px solid var(--hv2-grey-200, #E7E5E4);
    border-radius: 14px;
    padding: 0 16px;
    font-size: 16px; /* 16px prevents iOS zoom */
    font-family: inherit;
    outline: none;
    color: var(--hv2-dark, #1C1917);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-pill__input:focus {
    border-color: var(--hv2-orange, #D97706);
    box-shadow: 0 0 0 3px var(--hv2-orange-light, #FEF3C7);
}

.search-pill__input::placeholder {
    color: var(--hv2-grey-500, #78716C);
}

.search-pill__submit {
    width: 48px;
    height: 48px;
    background: var(--hv2-orange, #D97706);
    border: none;
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.search-pill__submit:hover {
    background: var(--hv2-orange-hover, #B45309);
}

.search-pill__submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--hv2-orange-light, #FEF3C7);
}

.search-pill__submit svg {
    width: 20px;
    height: 20px;
}

/*
 * Autocomplete results in pill.
 * The pill panel is fixed to the bottom of the viewport and grows upward.
 * Results appear between the header and the input row using flex order.
 * Panel order: header(1) → results(2) → search-row(3) → tags(4)
 */
.search-pill__header   { order: 1; }
.search-pill__results  { order: 2; }
.search-pill__search-row { order: 3; }
.search-pill__tags     { order: 4; }

.search-pill__results {
    display: none;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
    border-bottom: 1px solid var(--hv2-grey-200, #E7E5E4);
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.search-pill__results.has-results {
    display: flex;
}

.search-pill__result-item {
    display: block;
    padding: 10px 12px;
    font-size: 15px;
    color: var(--hv2-dark, #1C1917);
    text-decoration: underline;
    text-decoration-color: var(--hv2-grey-300, #D6D3D1);
    text-underline-offset: 3px;
    border-bottom: 1px solid var(--hv2-grey-100, #F5F5F4);
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: background 0.1s;
}

.search-pill__result-item:hover {
    background: var(--hv2-grey-50, #FAFAF9);
    color: var(--hv2-orange, #D97706);
    text-decoration-color: var(--hv2-orange, #D97706);
}

.search-pill__result-item:last-child {
    border-bottom: none;
}

/* Tags */
.search-pill__tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.search-pill__tag {
    font-size: 13px;
    padding: 8px 14px;
    background: var(--hv2-grey-100, #F5F5F4);
    border-radius: 10px;
    color: var(--hv2-grey-700, #44403C);
    border: none;
    cursor: pointer;
    font-family: inherit;
    min-height: 36px;
    transition: background 0.1s, color 0.1s;
    text-decoration: none;
}

.search-pill__tag:hover {
    background: var(--hv2-orange-light, #FEF3C7);
    color: var(--hv2-orange, #D97706);
    text-decoration: none;
}

/* ===== HIDE ON DESKTOP ===== */
@media (min-width: 1024px) {
    .search-pill {
        display: none;
    }
}
