/* ═══════════════════════════════════════════════════════════════════
   Summerland Smart Search — search.css
   Version 1.0.0
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    --sls-accent:       rgb(16, 132, 126);
    --sls-accent-dark:  rgb(12, 99, 95);
    --sls-accent-light: rgba(16, 132, 126, 0.10);
    --sls-bg:           #ffffff;
    --sls-border:       #e8e8e8;
    --sls-border-focus: rgb(16, 132, 126);
    --sls-text:         #1a1a2e;
    --sls-text-muted:   #888;
    --sls-hover:        #f5fafa;
    --sls-shadow:       0 8px 40px rgba(0,0,0,.12);
    --sls-radius:       9999px;
    --sls-radius-sm:    8px;
    --sls-transition:   0.15s ease-in-out;
    --sls-font:         -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    --sls-height:       52px;
    --sls-z:            99999;
}

/* ── Reset inside widget ── */
.sls-search-wrap *,
.sls-search-wrap *::before,
.sls-search-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ══════════════════════════════════════════
   SEARCH WRAP
   ══════════════════════════════════════════ */
.sls-search-wrap {
    position: relative;
    width: 100%;
    font-family: var(--sls-font);
}

.sls-form {
    position: relative;
    width: 100%;
}

/* ══════════════════════════════════════════
   INPUT ROW
   ══════════════════════════════════════════ */
.sls-input-row {
    display: flex;
    align-items: center;
    background: var(--sls-bg);
    border: 1.5px solid var(--sls-border);
    border-radius: 9999px !important;
    height: var(--sls-height);
    overflow: visible;
    transition: border-color var(--sls-transition), box-shadow var(--sls-transition);
    position: relative;
    z-index: calc(var(--sls-z) + 1);
    padding-right: 52px !important;
}

.sls-search-wrap.sls-focused .sls-input-row {
    border-color: var(--sls-border-focus);
    box-shadow: none !important;
}

/* Results open: keep pill shape always — no radius override */

/* ── Category Custom Dropdown ── */
.sls-cat-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 100%;
}

.sls-cat-select-wrap::before,
.sls-cat-select-wrap::after {
    display: none !important;
    content: none !important;
}

/* The trigger button */
.sls-cat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 16px 0 20px;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
    font-family: var(--sls-font);
    font-size: 12px;
    font-weight: 700;
    color: var(--sls-text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 130px;
}

.sls-cat-btn::before,
.sls-cat-btn::after {
    display: none !important;
    content: none !important;
}

.sls-cat-arrow {
    display: flex;
    align-items: center;
    color: var(--sls-text-muted);
    flex-shrink: 0;
    transition: transform var(--sls-transition);
}

.sls-cat-select-wrap.sls-cat-open .sls-cat-arrow {
    transform: rotate(180deg);
}

/* The dropdown panel */
.sls-cat-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--sls-border);
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    z-index: calc(var(--sls-z) + 10);
    max-height: 300px;
    overflow-y: auto;
    padding: 6px 0;
    display: none;
    animation: sls-drop var(--sls-transition) both;
    scrollbar-width: thin;
    scrollbar-color: var(--sls-border) transparent;
}

.sls-cat-select-wrap.sls-cat-open .sls-cat-panel {
    display: block;
}

.sls-cat-option {
    display: block;
    width: 100%;
    padding: 10px 18px;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    text-align: left;
    font-family: var(--sls-font);
    font-size: 14px;
    font-weight: 400;
    color: var(--sls-text);
    cursor: pointer;
    transition: background var(--sls-transition);
    white-space: nowrap;
}

.sls-cat-option::before,
.sls-cat-option::after {
    display: none !important;
    content: none !important;
}

.sls-cat-option:hover {
    background: var(--sls-hover) !important;
}

.sls-cat-option-active {
    font-weight: 700 !important;
    color: var(--sls-accent) !important;
}

/* ── Divider ── */
.sls-divider {
    width: 1px;
    height: 24px;
    background: var(--sls-border);
    flex-shrink: 0;
}

/* ── Search Input ── */
.sls-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.sls-input-wrap::before,
.sls-input-wrap::after {
    display: none !important;
    content: none !important;
}

.sls-input {
    width: 100% !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-family: var(--sls-font) !important;
    font-size: 15px !important;
    color: var(--sls-text) !important;
    padding: 0 12px 0 16px !important;
    height: 100% !important;
    min-width: 0 !important;
}

.sls-input::-webkit-search-decoration,
.sls-input::-webkit-search-cancel-button,
.sls-input::-webkit-search-results-button,
.sls-input::-webkit-search-results-decoration {
    -webkit-appearance: none !important;
}

.sls-input::before,
.sls-input::after {
    display: none !important;
    content: none !important;
}

.sls-input::placeholder {
    color: #b0b0b0 !important;
    font-weight: 400 !important;
}

/* ── Spinner (Summerland AI ring) ── */
.sls-spinner {
    position: absolute;
    right: 72px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: none;
    pointer-events: none;
    flex-shrink: 0;
    animation: sls-ai-spin 2s linear infinite;
    z-index: 4;
}

.sls-spinner svg {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.sls-search-wrap.sls-loading .sls-spinner {
    display: block;
}

@keyframes sls-ai-spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to   { transform: translateY(-50%) rotate(360deg); }
}

/* ── Submit Button ── */
.sls-btn {
    position: absolute !important;
    top: -1.5px !important;
    bottom: -1.5px !important;
    right: -1.5px !important;
    width: 52px !important;
    height: auto !important;
    border-radius: 0 9999px 9999px 0 !important;
    border: none !important;
    background: var(--sls-accent) !important;
    color: #fff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--sls-transition);
    margin: 0 !important;
    box-shadow: none !important;
    z-index: 3;
    background-image: none !important;
}

.sls-btn svg {
    display: block !important;
}

.sls-btn::before,
.sls-btn::after {
    display: none !important;
    content: none !important;
}

.sls-btn:hover {
    background: var(--sls-accent-dark) !important;
}

/* removed active transform */

/* ══════════════════════════════════════════
   RESULTS DROPDOWN
   ══════════════════════════════════════════ */
.sls-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--sls-bg);
    border: 1.5px solid var(--sls-border);
    border-radius: 16px !important;
    box-shadow: 0 12px 48px rgba(0,0,0,.14);
    z-index: var(--sls-z);
    max-height: 520px;
    overflow: hidden;
    display: none;
    animation: sls-drop var(--sls-transition) both;
}

.sls-search-wrap.sls-has-results .sls-results {
    display: block;
}

@keyframes sls-drop {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.sls-results-inner {
    max-height: 520px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--sls-border) transparent;
}

.sls-results-inner::-webkit-scrollbar {
    width: 4px;
}
.sls-results-inner::-webkit-scrollbar-track {
    background: transparent;
}
.sls-results-inner::-webkit-scrollbar-thumb {
    background: var(--sls-border);
    border-radius: 2px;
}

/* ── Section Headers ── */
.sls-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sls-text-muted);
    padding: 14px 20px 6px;
}

/* ── Category Pills ── */
.sls-cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 12px;
}

.sls-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--sls-accent-light);
    border: 1px solid rgba(0,168,150,.2);
    border-radius: var(--sls-radius-sm) !important;
    font-size: 12px;
    font-weight: 600;
    color: var(--sls-accent-dark);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--sls-transition), color var(--sls-transition);
}

.sls-cat-pill:hover,
.sls-cat-pill.sls-active {
    background: var(--sls-accent);
    color: #fff;
    border-color: var(--sls-accent);
}

.sls-cat-pill-count {
    font-size: 10px;
    opacity: 0.75;
    font-weight: 400;
}

/* ── Separator ── */
.sls-sep {
    height: 1px;
    background: var(--sls-border);
    margin: 2px 20px;
}

/* ── Product Item ── */
.sls-product-list {
    list-style: none;
    padding: 6px 0;
}

.sls-product-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--sls-transition);
    position: relative;
}

.sls-product-item.sls-active {
    background: var(--sls-hover);
}

.sls-product-item.sls-active .sls-product-title {
    color: var(--sls-accent);
}

/* ── Product Image ── */
.sls-product-img {
    width: 52px;
    height: 52px;
    border-radius: var(--sls-radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: #f0f0f0;
    border: 1px solid var(--sls-border);
}

.sls-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Product Info ── */
.sls-product-info {
    flex: 1;
    min-width: 0;
}

.sls-product-cat {
    font-size: 11px;
    color: var(--sls-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 2px;
}

.sls-product-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--sls-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--sls-transition);
    line-height: 1.3;
    margin-bottom: 3px;
}

.sls-product-title mark {
    background: none;
    color: var(--sls-accent);
    font-weight: 700;
}

.sls-product-sku {
    font-size: 11px;
    color: var(--sls-text-muted);
    font-family: 'SF Mono', 'Menlo', monospace;
}

/* ── Product Price ── */
.sls-product-price {
    text-align: right;
    flex-shrink: 0;
}

.sls-product-price ins {
    text-decoration: none;
}

.sls-product-price .amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--sls-text);
}

.sls-product-price del .amount {
    font-size: 12px;
    color: var(--sls-text-muted);
    font-weight: 400;
}

.sls-product-price del {
    display: block;
    font-size: 11px;
}

/* ── Badges ── */
.sls-badges {
    display: flex;
    gap: 4px;
    flex-direction: column;
    align-items: flex-end;
}

.sls-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: var(--sls-radius-sm) !important;
}

.sls-badge-sale {
    background: #ff6b6b;
    color: #fff;
}

.sls-badge-out {
    background: #ddd;
    color: #888;
}

/* ── No Results ── */
.sls-no-results {
    padding: 32px 20px;
    text-align: center;
    color: var(--sls-text-muted);
}

.sls-no-results-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    color: #ddd;
}

.sls-no-results-icon svg {
    width: 100%;
    height: 100%;
}

.sls-no-results-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--sls-text);
    margin-bottom: 4px;
}

.sls-no-results-sub {
    font-size: 13px;
    color: var(--sls-text-muted);
}

/* ── View All Header ── */
.sls-view-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--sls-border);
    background: var(--sls-hover);
    text-decoration: none;
    transition: background var(--sls-transition);
    gap: 8px;
}

.sls-view-all.sls-active {
    background: var(--sls-accent-light);
}

.sls-view-all-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--sls-accent);
}

.sls-view-all-query {
    font-style: italic;
    font-weight: 700;
}

.sls-view-all-count {
    font-size: 12px;
    color: var(--sls-text-muted);
    margin-left: auto;
}

.sls-view-all-arrow {
    color: var(--sls-accent);
    display: flex;
    align-items: center;
}

/* ══════════════════════════════════════════
   GLOBAL OVERLAY MODE
   ══════════════════════════════════════════ */
.sls-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    animation: sls-fade 0.2s ease both;
}

@keyframes sls-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.sls-overlay.sls-open {
    display: flex;
}

.sls-overlay .sls-search-wrap {
    max-width: 700px;
    width: 94%;
}

.sls-overlay .sls-results {
    max-height: 60vh;
}

.sls-overlay .sls-results-inner {
    max-height: 60vh;
}

/* ── Close overlay when clicking backdrop ── */
#sls-global-overlay {
    cursor: default;
}
#sls-global-overlay .sls-search-wrap {
    cursor: default;
}

/* ══════════════════════════════════════════
   KEYBOARD NAVIGATION
   ══════════════════════════════════════════ */
.sls-product-item:focus-visible,
.sls-view-all:focus-visible {
    outline: 2px solid var(--sls-accent);
    outline-offset: -2px;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 600px) {
    :root {
        --sls-height: 48px;
    }

    .sls-cat-select {
        min-width: 100px;
        font-size: 11px;
        padding: 0 28px 0 14px;
    }

    .sls-input {
        font-size: 14px;
        padding: 0 44px 0 14px;
    }

    .sls-product-img {
        width: 42px;
        height: 42px;
    }

    .sls-product-title {
        font-size: 13px;
    }

    .sls-overlay {
        padding-top: 60px;
    }
}

/* ══════════════════════════════════════════
   TOP PROGRESS BAR (View All navigation)
   ══════════════════════════════════════════ */
#sls-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--sls-accent);
    z-index: 9999999;
    border-radius: 0 9999px 9999px 0;
    box-shadow: 0 0 8px rgba(16, 132, 126, 0.6);
    transition: width 0.3s ease, opacity 0.4s ease;
    opacity: 0;
    pointer-events: none;
}

#sls-progress-bar.sls-progress-active {
    opacity: 1;
}
