/* ============================================================
   Smart Search – Frontend Styles
   Base layout only. Colors & radii injected via dynamic CSS.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

/* ── Wrapper ───────────────────────────────────────────────── */
.ss-wrap {
    position: relative;
    display:  flex;
    align-items: center;
    width: 100%;
    max-width: 640px;
}

/* ── Input ─────────────────────────────────────────────────── */
.ss-wrap input.ss-input {
    flex: 1 1 auto;
    width: 100%;
    border-style: solid;
    border-right: none;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
    /* right side squared so it meets the button */
    border-top-right-radius:    0 !important;
    border-bottom-right-radius: 0 !important;
    transition: border-color .15s, box-shadow .15s;
}

.ss-wrap input.ss-input:focus {
    border-color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, .15);
}

/* ── Button ────────────────────────────────────────────────── */
.ss-wrap button.ss-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    align-self: stretch !important;
    /* left side squared to meet input */
    border-top-left-radius:    0 !important;
    border-bottom-left-radius: 0 !important;
    transition: background .15s, transform .08s;
}

.ss-wrap button.ss-btn:active {
    transform: scale(.96);
}

/* ── Dropdown ──────────────────────────────────────────────── */
.ss-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 99999;
    overflow: hidden;
    animation: ssSlideIn .15s ease;
}

.ss-dropdown[hidden] {
    display: none;
}

@keyframes ssSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Dropdown items ─────────────────────────────────────────── */
.ss-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background .1s;
    outline: none;
}

.ss-item:focus-visible {
    outline: 2px solid #1e3a8a;
    outline-offset: -2px;
}

.ss-item-img {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #f3f4f6;
}

.ss-item-img-placeholder {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #d1d5db;
}

.ss-item-body {
    flex: 1;
    min-width: 0;
}

.ss-item-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.ss-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.ss-item-price {
    font-size: 13px;
    font-weight: 700;
}

.ss-item-category {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

.ss-item-desc {
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── No results ─────────────────────────────────────────────── */
.ss-no-results {
    padding: 16px;
    text-align: center;
    font-size: 14px;
    color: #9ca3af;
}

/* ── Loading spinner ─────────────────────────────────────────── */
.ss-loading {
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ss-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #1e3a8a;
    border-radius: 50%;
    animation: ssSpin .6s linear infinite;
}

@keyframes ssSpin {
    to { transform: rotate(360deg); }
}

/* ── View All button ─────────────────────────────────────────── */
.ss-view-all {
    display: block;
    width: 100%;
    padding: 11px 14px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: filter .15s;
    outline: none;
}

.ss-view-all:hover,
.ss-view-all:focus-visible {
    filter: brightness(1.1);
}

/* ── Divider between results and view-all ───────────────────── */
.ss-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0;
}

/* ── Highlighted term in title ───────────────────────────────── */
.ss-highlight {
    background: rgba(30, 58, 138, .12);
    border-radius: 2px;
    padding: 0 1px;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 480px) {
    .ss-item-img,
    .ss-item-img-placeholder {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
    }
}
