/* =============================================
   Smart Gift Search — search.css
   ============================================= */

/* Reset & wrapper */
.sgs-wrapper {
    position: relative;
    max-width: 480px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    z-index: 9999;
}

/* ── Search bar ─────────────────────────── */
.sgs-bar {
    display: flex;
    align-items: center;
    background: #f4f5f7;
    border: 1.5px solid #e8e9ec;
    border-radius: 12px;
    padding: 4px 6px 4px 16px;
    gap: 8px;
    transition: border-color .2s, box-shadow .2s;
}

.sgs-bar:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    background: #fff;
}

.sgs-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #1a1a2e;
    outline: none;
    padding: 8px 0;
}

.sgs-input::placeholder { color: #9ca3af; }

.sgs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: #1a1a2e;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s, transform .1s;
}

.sgs-btn:hover  { background: #2563eb; }
.sgs-btn:active { transform: scale(.95); }

.sgs-btn svg { width: 17px; height: 17px; }

/* ── Dropdown shell ─────────────────────── */
.sgs-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #e8e9ec;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.13);
    overflow: hidden;
    animation: sgsSlideIn .18s ease;
}

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

/* ── Panels ─────────────────────────────── */
.sgs-panel { padding: 16px; }

/* ── Category tag grid ──────────────────── */
.sgs-cat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sgs-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 13px;
    border: 1.5px solid #dde1e8;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    color: #1a1a2e;
    text-decoration: none;
    background: #fff;
    transition: border-color .18s, background .18s, color .18s, transform .1s;
    white-space: nowrap;
}

.sgs-cat-tag svg {
    width: 12px; height: 12px;
    opacity: .55;
    flex-shrink: 0;
}

.sgs-cat-tag:hover {
    border-color: #2563eb;
    background: #eff6ff;
    color: #2563eb;
    transform: translateY(-1px);
}

.sgs-cat-tag:hover svg { opacity: 1; }

/* ── Results list ───────────────────────── */
.sgs-results-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #6b7280;
    margin: 0 0 10px;
}

.sgs-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sgs-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
    cursor: pointer;
}

.sgs-result-item:hover { background: #f4f5f7; }

.sgs-result-thumb {
    width: 48px; height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #f0f0f0;
}

.sgs-result-info { flex: 1; min-width: 0; }

.sgs-result-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.sgs-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sgs-rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #16a34a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.sgs-rating-badge svg {
    width: 11px; height: 11px;
    fill: #fff;
}

.sgs-review-cnt {
    font-size: 12px;
    color: #6b7280;
}

/* View all link */
.sgs-view-all {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.sgs-view-all svg { width: 14px; height: 14px; }
.sgs-view-all:hover { text-decoration: underline; }

/* ── Loading spinner ────────────────────── */
.sgs-panel--loading {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.sgs-spinner {
    width: 22px; height: 22px;
    border: 2.5px solid #e8e9ec;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: sgsSpin .7s linear infinite;
    display: block;
}

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

/* ── No results ─────────────────────────── */
.sgs-no-results {
    font-size: 14px;
    color: #6b7280;
    text-align: center;
    padding: 8px 0 4px;
}

/* ── Utility ────────────────────────────── */
[hidden] { display: none !important; }
