/* ============================================================
   Smart Collection Search v2 — Frontend Styles
   ============================================================ */

/* ── Wrapper ── */
.scs-wrapper {
    position: relative !important;
    display: block !important;
    width: 100% !important;
}

/* ── Dropdown panel ── */
.scs-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 999999;
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(0,0,0,.06),
        0 4px 6px -1px rgba(0,0,0,.07),
        0 16px 48px -8px rgba(0,0,0,.16);
    overflow: hidden;
    display: none;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
.scs-dropdown.scs-open {
    display: block;
    animation: scsIn .18s cubic-bezier(.22,.68,0,1.15) forwards;
}
@keyframes scsIn {
    from { opacity:0; transform: translateY(-6px) scale(.98); }
    to   { opacity:1; transform: translateY(0)    scale(1);   }
}

.scs-inner {
    padding: 6px 0 10px;
}

/* ── Section headers ── */
.scs-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 4px;
    gap: 8px;
}
.scs-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #aaa;
    font-family: -apple-system, 'Segoe UI', sans-serif;
    line-height: 1;
}
.scs-clear-history {
    font-size: 11px;
    color: #bbb;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: -apple-system, 'Segoe UI', sans-serif;
    transition: color .15s;
    line-height: 1;
}
.scs-clear-history:hover { color: #e8621a; }

/* ── Two-column grid ── */
.scs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 2px 10px 4px;
}
.scs-grid--trending {
    grid-template-columns: 1fr;
}

/* ── Individual item ── */
.scs-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none !important;
    color: #1a1a1a !important;
    font-family: -apple-system, 'Segoe UI', sans-serif;
    font-size: 13.5px;
    line-height: 1.3;
    font-weight: 400;
    transition: background .1s, color .1s;
    cursor: pointer;
    min-width: 0;
    position: relative;
}
.scs-item:hover,
.scs-item:focus,
.scs-item.scs-active {
    background: #fff4ee;
    color: #d95c10 !important;
    outline: none;
    text-decoration: none !important;
}

/* ── Square icon box ── */
.scs-item-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .1s;
}
.scs-item:hover .scs-item-icon,
.scs-item.scs-active .scs-item-icon {
    background: #ffe5d4;
}
.scs-item-icon svg {
    width: 14px; height: 14px;
    stroke: #999;
    transition: stroke .1s;
}
.scs-item:hover .scs-item-icon svg,
.scs-item.scs-active .scs-item-icon svg {
    stroke: #d95c10;
}

/* Trending: fire-orange icon */
.scs-item--trending .scs-item-icon {
    background: #fff0e6;
}
.scs-item--trending .scs-item-icon svg { stroke: #f07030; }
.scs-item--trending:hover .scs-item-icon { background: #ffdfc8; }

/* History: subtle */
.scs-item--history .scs-item-icon { background: #f0f4f8; }
.scs-item--history .scs-item-icon svg { stroke: #94a3b8; }
.scs-item--history:hover .scs-item-icon { background: #ffe5d4; }

/* ── Label ── */
.scs-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.scs-item-label mark {
    background: transparent;
    color: #d95c10;
    font-weight: 600;
    padding: 0;
}

/* ── Delete button (history items) ── */
.scs-item-del {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0;
    transition: opacity .15s, color .15s;
    line-height: 0;
}
.scs-item:hover .scs-item-del { opacity: 1; }
.scs-item-del:hover { color: #e8621a; }
.scs-item-del svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; }

/* ── Loading ── */
.scs-loading {
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scs-spinner {
    width: 20px; height: 20px;
    border: 2px solid #f0f0f0;
    border-top-color: #f07030;
    border-radius: 50%;
    animation: scsSpin .55s linear infinite;
}
@keyframes scsSpin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.scs-empty {
    padding: 20px 16px;
    text-align: center;
    font-size: 13px;
    color: #aaa;
    font-family: -apple-system, 'Segoe UI', sans-serif;
}

/* ── Scrollbar styling ── */
.scs-dropdown::-webkit-scrollbar { width: 4px; }
.scs-dropdown::-webkit-scrollbar-track { background: transparent; }
.scs-dropdown::-webkit-scrollbar-thumb { background: #e8e8e8; border-radius: 4px; }

/* ============================================================
   HARD KILL — native autocomplete dropdowns
   ============================================================ */
.dgwt-wcas-suggestions-wraper,
.dgwt-wcas-suggestion-group,
.autocomplete-suggestions.dgwt-wcas-suggestions,
.live-search-result, .live-search-results,
.woodmart-search-results, .woodmart-search-dropdown,
.woocommerce-product-search-dropdown,
.ui-autocomplete,
.asp_w .probox,
.autocomplete-suggestions,
.search-autocomplete-dropdown {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 640px) {
    .scs-dropdown {
        border-radius: 0 0 16px 16px;
        left: -12px;
        right: -12px;
        top: calc(100% + 4px);
    }
    .scs-grid {
        grid-template-columns: 1fr 1fr;
        padding: 2px 8px 4px;
        gap: 1px;
    }
    .scs-item {
        font-size: 13px;
        padding: 9px 8px;
    }
    .scs-item-icon {
        width: 26px; height: 26px;
    }
}
@media (max-width: 380px) {
    .scs-grid { grid-template-columns: 1fr; }
}
