/* ==========================================================================
   Site Search — shared autocomplete + header search
   ========================================================================== */

/* ---- Header search bar ---- */
.header-search {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1100;
}

.header-search-wrap {
    display: flex;
    align-items: stretch;
    border-radius: var(--v2-radius, 8px);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    height: 42px;
}

.header-search-input {
    border: 1px solid #dce3e8;
    border-right: 0;
    background: #fff;
    padding: 0 14px;
    font-size: .95em;
    font-family: inherit;
    outline: none;
    width: 220px;
    min-width: 0;
    color: var(--v2-text, #343434);
    border-radius: var(--v2-radius, 8px) 0 0 var(--v2-radius, 8px);
    transition: border-color .15s, box-shadow .15s;
}

.header-search-input::placeholder {
    color: #aaa;
}

.header-search-input:focus {
    border-color: var(--v2-teal, #1a5c5c);
    box-shadow: inset 0 0 0 1px var(--v2-teal, #1a5c5c);
}

.header-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: linear-gradient(var(--v2-green, #5bae02), var(--v2-green-dark, #4a9600));
    color: #fff;
    padding: 0 14px;
    cursor: pointer;
    border-radius: 0 var(--v2-radius, 8px) var(--v2-radius, 8px) 0;
    transition: opacity .15s;
}

.header-search-btn:hover {
    opacity: .9;
}

.header-search-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
    display: block;
}


/* ---- Autocomplete dropdown (shared) ---- */
.ss-ac {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 340px;
    max-height: 420px;
    overflow-y: auto;
    background: #fff;
    border-radius: 0 0 var(--v2-radius, 8px) var(--v2-radius, 8px);
    box-shadow: 0 12px 40px rgba(0,0,0,.2);
    z-index: 1000;
    text-align: left;
    scrollbar-width: thin;
}

/* When used inside header, align to right */
.header-search .ss-ac {
    left: auto;
    right: 0;
    min-width: 380px;
}

/* When used inside search page wrapper */
.v2-search-ac-wrap .ss-ac {
    left: 0;
    right: 0;
    min-width: 0;
}

.ss-ac-group {
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ss-ac-group:last-of-type {
    border-bottom: none;
}

.ss-ac-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 4px;
    font-size: .68em;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.ss-ac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--v2-text, #343434);
    transition: background .1s;
    cursor: pointer;
}

.ss-ac-item:hover,
.ss-ac-item:visited,
.ss-ac-item:focus {
    text-decoration: none;
    color: var(--v2-text, #343434);
}

.ss-ac-item:hover,
.ss-ac-active {
    background: #f4f8fa;
}

.ss-ac-thumb {
    width: 44px;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.ss-ac-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ss-ac-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ss-ac-label {
    font-size: .9em;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-ac-label mark {
    background: none;
    font-weight: 700;
    color: var(--v2-teal, #1a5c5c);
}

.ss-ac-meta {
    font-size: .75em;
    color: var(--v2-text-muted, #666);
}

.ss-ac-empty {
    padding: 20px 16px;
    text-align: center;
    font-size: .9em;
    color: var(--v2-text-muted, #666);
}

.ss-ac-all {
    display: block;
    padding: 12px 16px;
    text-align: center;
    font-size: .85em;
    font-weight: 600;
    color: var(--v2-teal, #1a5c5c);
    text-decoration: none;
    border-top: 1px solid #f0f0f0;
    transition: background .1s;
}

.ss-ac-all:hover {
    background: #f4f8fa;
    text-decoration: none;
    color: var(--v2-teal, #1a5c5c);
}

.ss-ac-all:visited {
    color: var(--v2-teal, #1a5c5c);
}


/* ---- Mobile: header search ---- */
@media (max-width: 768px) {
    .header-search-input {
        width: 0;
        padding: 0;
        border: 0;
        opacity: 0;
        transition: width .25s ease, opacity .2s ease, padding .25s ease;
    }

    .header-search.open .header-search-input {
        width: 180px;
        padding: 0 14px;
        border: 1px solid #dce3e8;
        border-right: 0;
        opacity: 1;
    }

    .header-search-wrap {
        box-shadow: none;
    }

    .header-search:not(.open) .header-search-btn {
        border-radius: var(--v2-radius, 8px);
    }

    .header-search .ss-ac {
        min-width: 280px;
        right: 0;
        left: auto;
    }
}

@media (max-width: 480px) {
    .header-search.open {
        position: absolute;
        right: 10px;
        left: 10px;
    }

    .header-search.open .header-search-input {
        width: 100%;
        flex: 1;
    }

    .header-search .ss-ac {
        min-width: 0;
        left: 0;
        right: 0;
    }
}
