/**
 * Expertiseweb SmartSearch v2 — Fullscreen overlay + dropdown styles.
 *
 * Both modes use the same card grid layout.
 * - Fullscreen overlay: modal with search bar + filters sidebar + product grid
 * - Dropdown: positioned panel below #search input with product grid (no search field)
 *
 * CSS custom properties (--ss-*) are set dynamically by JS from admin config.
 */

/* ═══════════════════════════════════════════════
   CSS CUSTOM PROPERTIES (color theming)
   ═══════════════════════════════════════════════ */

.smartsearch-overlay,
.smartsearch-dropdown {
    --ss-primary: #2563eb;
    --ss-primary-hover: #1d4ed8;
    --ss-primary-light: #eff6ff;
}


/* ═══════════════════════════════════════════════
   FULLSCREEN OVERLAY
   ═══════════════════════════════════════════════ */

.smartsearch-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    justify-content: center;
    align-items: flex-start;
    padding-top: 5vh;
    opacity: 0;
    transition: opacity 0.2s ease;
    will-change: opacity;
}

.smartsearch-overlay.smartsearch-overlay-open {
    display: flex;
    opacity: 1;
}

body.smartsearch-body-locked {
    overflow: hidden;
}

.smartsearch-overlay-content {
    width: 95%;
    max-width: 1400px;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: smartsearch-slide-in 0.25s ease-out;
}

@keyframes smartsearch-slide-in {
    from { opacity: 0; transform: translateY(-20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Mobile-only elements (hidden on desktop) ── */
.smartsearch-mobile-close,
.smartsearch-mobile-filters-toggle {
    display: none;
}

.smartsearch-close-btn-mobile {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}

.smartsearch-close-btn-mobile:hover {
    color: #333;
}

/* ── Overlay Header — bigger search bar ── */
.smartsearch-overlay-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.smartsearch-overlay-search {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f5f5f5;
    border-radius: 14px;
    padding: 16px 20px;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.smartsearch-overlay-search:focus-within {
    border-color: var(--ss-primary);
    background: #fff;
}

.smartsearch-search-icon {
    flex-shrink: 0;
    color: #888;
    display: flex;
    align-items: center;
}

.smartsearch-overlay-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 22px;
    color: #1a1a1a;
    font-weight: 500;
    line-height: 1.3;
}

.smartsearch-overlay-input::placeholder {
    color: #aaa;
    font-weight: 400;
}

.smartsearch-close-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.smartsearch-close-btn:hover {
    color: #333;
    background: #eee;
}

/* ── Overlay Body ── */
.smartsearch-overlay-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── Loading State ── */
.smartsearch-overlay.smartsearch-loading .smartsearch-overlay-header::after,
.smartsearch-dropdown.smartsearch-loading::before {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--ss-primary), transparent);
    animation: smartsearch-loading 1.2s ease-in-out infinite;
}

.smartsearch-overlay.smartsearch-loading .smartsearch-overlay-header::after {
    margin-top: 20px;
    margin-bottom: -20px;
}

@keyframes smartsearch-loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}


/* ═══════════════════════════════════════════════
   FILTERS SIDEBAR
   ═══════════════════════════════════════════════ */

.smartsearch-filters {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid #eee;
    overflow: hidden;
    padding: 16px 0;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.smartsearch-filters:empty {
    display: none;
}

.smartsearch-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.smartsearch-filters-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.smartsearch-clear-filters {
    background: none;
    border: none;
    color: var(--ss-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.smartsearch-clear-filters:hover {
    background: var(--ss-primary-light);
}

.smartsearch-filter-group {
    padding: 0 16px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.smartsearch-filters-header + .smartsearch-filter-group {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.smartsearch-filter-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #333;
    user-select: none;
    border-bottom: 1px solid #f0f0f0;
}

.smartsearch-filter-title:hover {
    color: #1a1a1a;
}

.smartsearch-filter-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.smartsearch-filter-collapsed .smartsearch-filter-chevron {
    transform: rotate(-90deg);
}

.smartsearch-filter-options {
    padding: 8px 0;
    max-height: 200px;
    overflow-y: auto;
}

.smartsearch-filters-header + .smartsearch-filter-group .smartsearch-filter-options {
    max-height: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.smartsearch-filter-collapsed .smartsearch-filter-options {
    display: none;
}

.smartsearch-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 13px;
    color: #444;
    transition: color 0.15s ease;
}

.smartsearch-filter-option:hover {
    color: #1a1a1a;
}

.smartsearch-filter-option.is-child {
    padding-left: 28px;
}

.smartsearch-filter-option.is-parent .smartsearch-filter-label {
    font-weight: 600;
}

.smartsearch-filter-checkbox {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--ss-primary);
    cursor: pointer;
}

.smartsearch-filter-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smartsearch-filter-count {
    color: #999;
    font-size: 12px;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════
   CHIPS MODE (horizontal filters)
   ═══════════════════════════════════════════════ */

.smartsearch-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.smartsearch-chips:empty {
    display: none;
}

.smartsearch-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.smartsearch-chip-group-label {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    margin-right: 2px;
    white-space: nowrap;
}

.smartsearch-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #ddd;
    font-size: 13px;
    cursor: pointer;
    background: #fff;
    transition: all 0.15s ease;
    white-space: nowrap;
    user-select: none;
}

.smartsearch-chip:hover {
    border-color: var(--ss-primary);
    color: var(--ss-primary);
}

.smartsearch-chip.active {
    background: var(--ss-primary);
    color: #fff;
    border-color: transparent;
}

.smartsearch-chip-count {
    font-size: 11px;
    opacity: 0.7;
}

.smartsearch-chip-clear {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #ddd;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    color: #888;
    transition: all 0.15s ease;
    align-self: flex-start;
}

.smartsearch-chip-clear:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: #fef2f2;
}


/* ═══════════════════════════════════════════════
   RESULTS AREA + PRODUCT GRID (shared by both modes)
   ═══════════════════════════════════════════════ */

.smartsearch-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

.smartsearch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* ── Product Card ── */
.smartsearch-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
    position: relative;
}

.smartsearch-card:hover,
.smartsearch-card.smartsearch-card-active {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #ddd;
}

.smartsearch-card-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.smartsearch-card-link:hover,
.smartsearch-card-link:focus {
    text-decoration: none;
    color: inherit;
}

.smartsearch-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    background: #fafafa;
    margin-bottom: 10px;
    max-height: 260px;
}

.smartsearch-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.smartsearch-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.35;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-transform: capitalize;
    margin-bottom: 6px;
    width: 100%;
}

.smartsearch-card-name mark {
    background-color: #fef3c7;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.smartsearch-card-sku {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
    font-family: monospace;
    text-align: center;
}

.smartsearch-card-price {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    margin-bottom: 4px;
}

.smartsearch-regular-price { color: #1a1a1a; }

.smartsearch-price-from {
    font-size: 11px;
    font-weight: 400;
    color: #666;
    font-style: italic;
}

.smartsearch-old-price {
    color: #999;
    text-decoration: line-through;
    font-weight: 400;
    font-size: 12px;
    margin-right: 4px;
}

.smartsearch-special-price {
    color: #dc2626;
    font-weight: 700;
}

.smartsearch-price-suffix {
    font-size: 11px;
    color: #888;
    margin-left: 2px;
}

.smartsearch-price-excl {
    font-size: 11px;
    color: #888;
    margin-top: 1px;
    text-align: center;
}

.smartsearch-card-category {
    font-size: 11px;
    color: #888;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    margin-bottom: 8px;
}

/* ── Swatches ── */
.smartsearch-swatches {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}
.smartsearch-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #e5e5e5;
    cursor: default;
    transition: border-color 0.15s ease, transform 0.15s ease;
    box-sizing: border-box;
    display: inline-block;
}
.smartsearch-swatch:hover {
    border-color: var(--ss-primary);
    transform: scale(1.15);
}
.smartsearch-swatch-img {
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.smartsearch-swatch-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.smartsearch-swatch-text {
    width: auto;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1.4;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e5e5;
}
.smartsearch-swatch-text:hover {
    border-color: var(--ss-primary);
}
.smartsearch-swatch[data-child-image] {
    cursor: pointer;
}
.smartsearch-swatch.smartsearch-swatch-selected {
    border-color: var(--ss-primary);
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--ss-primary-light);
}
.smartsearch-swatch-text.smartsearch-swatch-selected {
    border-color: var(--ss-primary);
    background: var(--ss-primary-light);
    color: var(--ss-primary);
    transform: none;
    box-shadow: none;
}

/* ── View Options Button (configurable products) ── */
.smartsearch-viewoptions-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    color: var(--ss-primary);
    border: 1px solid var(--ss-primary);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
    margin-top: auto;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
}
.smartsearch-viewoptions-btn:hover {
    background: var(--ss-primary);
    color: #fff;
    text-decoration: none;
    transform: scale(1.02);
}
.smartsearch-viewoptions-btn:active { transform: scale(0.98); }

/* ── Add to Cart Button ── */
.smartsearch-addtocart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    background: var(--ss-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: auto;
}

.smartsearch-addtocart-btn:hover { background: var(--ss-primary-hover); transform: scale(1.02); }
.smartsearch-addtocart-btn:active { transform: scale(0.98); }
.smartsearch-addtocart-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.smartsearch-addtocart-btn.smartsearch-addtocart-success { background: #16a34a; }
.smartsearch-addtocart-btn.smartsearch-addtocart-error { background: #dc2626; }

.smartsearch-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: smartsearch-spin 0.6s linear infinite;
}

@keyframes smartsearch-spin {
    to { transform: rotate(360deg); }
}


/* ═══════════════════════════════════════════════
   FOOTER: SEE ALL
   ═══════════════════════════════════════════════ */

.smartsearch-footer {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 0 4px;
    margin-top: 8px;
    border-top: 1px solid #eee;
}

.smartsearch-see-all-link {
    color: var(--ss-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.smartsearch-see-all-link:hover {
    color: var(--ss-primary-hover);
    text-decoration: underline;
}

/* ── Infinite scroll spinner ── */
.smartsearch-scroll-loader {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.smartsearch-scroll-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #eee;
    border-top-color: var(--ss-primary);
    border-radius: 50%;
    animation: smartsearch-spin 0.7s linear infinite;
}

.smartsearch-empty {
    padding: 48px 16px;
    text-align: center;
    color: #888;
    font-size: 15px;
    grid-column: 1 / -1;
}

/* ── Scrollbars ── */
.smartsearch-results::-webkit-scrollbar,
.smartsearch-filters::-webkit-scrollbar,
.smartsearch-filter-options::-webkit-scrollbar {
    width: 5px;
}

.smartsearch-results::-webkit-scrollbar-track,
.smartsearch-filters::-webkit-scrollbar-track,
.smartsearch-filter-options::-webkit-scrollbar-track {
    background: transparent;
}

.smartsearch-results::-webkit-scrollbar-thumb,
.smartsearch-filters::-webkit-scrollbar-thumb,
.smartsearch-filter-options::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.smartsearch-results::-webkit-scrollbar-thumb:hover,
.smartsearch-filters::-webkit-scrollbar-thumb:hover,
.smartsearch-filter-options::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}


/* ═══════════════════════════════════════════════
   DROPDOWN MODE
   Identical card grid as overlay, positioned
   absolutely below #search input via JS.
   Appended to <body> for theme-agnostic compat.
   ═══════════════════════════════════════════════ */

.smartsearch-dropdown {
    display: none;
    position: absolute;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    max-height: 75vh;
    overflow: hidden;
    animation: smartsearch-slide-in 0.2s ease-out;
}

.smartsearch-dropdown.smartsearch-open {
    display: block;
}

/* Dropdown body: flex layout identical to overlay body */
.smartsearch-dropdown-body {
    display: flex;
    height: 100%;
    max-height: 75vh;
}

/* Dropdown inherits overlay sizes — only structural overrides here */
.smartsearch-dropdown .smartsearch-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-width: 0;
}

.smartsearch-dropdown .smartsearch-filters {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid #eee;
    overflow-y: auto;
    padding: 12px 0;
}

.smartsearch-dropdown .smartsearch-empty {
    padding: 24px 16px;
}


/* ═══════════════════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════════════════ */

@media (max-width: 900px) {
    .smartsearch-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .smartsearch-filters {
        width: 240px;
    }
}


/* ═══════════════════════════════════════════════
   RESPONSIVE — MOBILE (< 768px)
   ═══════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Overlay full screen */
    .smartsearch-overlay {
        padding-top: 0;
    }

    .smartsearch-overlay-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .smartsearch-mobile-close {
        display: flex;
        padding: 0 0 8px;
    }

    .smartsearch-close-btn {
        display: none;
    }

    .smartsearch-overlay-header {
        padding: 12px 16px;
    }

    .smartsearch-overlay-search {
        padding: 12px 14px;
    }

    .smartsearch-overlay-input {
        font-size: 17px;
    }

    .smartsearch-overlay-body {
        flex-direction: column;
    }

    /* Mobile: filters as collapsible accordion (hidden by default) */
    .smartsearch-filters {
        display: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        max-height: 50vh;
        overflow-y: auto;
        padding: 8px 0;
    }

    .smartsearch-filters.smartsearch-filters-mobile-open {
        display: block;
    }

    /* Mobile filters toggle button */
    .smartsearch-mobile-filters-toggle {
        display: block;
        padding: 0 0 8px;
    }

    .smartsearch-filters-toggle-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        background: none;
        border: 1px solid #e5e5e5;
        border-radius: 20px;
        padding: 7px 14px;
        font-size: 13px;
        font-weight: 600;
        color: #555;
        cursor: pointer;
        transition: all 0.15s;
    }

    .smartsearch-filters-toggle-btn:hover,
    .smartsearch-filters-toggle-btn.smartsearch-toggle-active {
        border-color: var(--ss-primary);
        color: var(--ss-primary);
        background: var(--ss-primary-light);
    }

    .smartsearch-toggle-chevron {
        transition: transform 0.2s;
    }

    .smartsearch-toggle-active .smartsearch-toggle-chevron {
        transform: rotate(180deg);
    }

    /* Mobile: hide chips, use accordion filters instead */
    .smartsearch-chips {
        display: none !important;
    }

    .smartsearch-results {
        padding: 12px;
    }

    .smartsearch-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .smartsearch-card {
        padding: 10px;
    }

    .smartsearch-card-image {
        max-height: 140px;
    }

    .smartsearch-card-name {
        font-size: 12px;
    }

    .smartsearch-card-price {
        font-size: 13px;
    }

    .smartsearch-addtocart-btn {
        padding: 7px 10px;
        font-size: 12px;
    }

    /* Dropdown mobile: full-width bottom sheet */
    .smartsearch-dropdown {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        max-height: 75vh;
        border-radius: 16px 16px 0 0;
        border: none;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    }

    .smartsearch-dropdown-body {
        flex-direction: column;
        max-height: 75vh;
    }

    .smartsearch-dropdown .smartsearch-filters {
        display: none;
    }

    .smartsearch-dropdown .smartsearch-filters.smartsearch-filters-mobile-open {
        display: block;
    }

    .smartsearch-dropdown .smartsearch-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Swatches compact on mobile */
    .smartsearch-swatch { width: 20px; height: 20px; }
    .smartsearch-swatches { gap: 3px; margin-bottom: 4px; }
    .smartsearch-swatch-text { font-size: 9px; padding: 1px 4px; }
    .smartsearch-viewoptions-btn { padding: 7px 10px; font-size: 12px; }

    /* Compact suggestions on mobile */
    .smartsearch-suggestions {
        padding: 16px 12px;
    }
    .smartsearch-suggestions-section {
        margin-bottom: 14px;
    }
    .smartsearch-suggestions-chips {
        gap: 6px;
    }
    .smartsearch-suggestion-chip {
        padding: 6px 12px;
        font-size: 12px;
    }
}


/* ═══════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (< 480px)
   ═══════════════════════════════════════════════ */

@media (max-width: 480px) {
    .smartsearch-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .smartsearch-card {
        padding: 8px;
    }

    .smartsearch-card-image {
        max-height: 120px;
    }

    .smartsearch-card-name {
        font-size: 11px;
    }

    .smartsearch-card-price {
        font-size: 12px;
    }

    .smartsearch-addtocart-btn {
        padding: 6px 8px;
        font-size: 11px;
    }

    .smartsearch-dropdown .smartsearch-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ═══════════════════════════════════════════════
   SKELETON LOADING
   ═══════════════════════════════════════════════ */

.smartsearch-skeleton { pointer-events: none; border-color: transparent; }
.smartsearch-skeleton-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: smartsearch-shimmer 1.5s infinite;
}
.smartsearch-skeleton-line {
    height: 14px;
    border-radius: 4px;
    margin: 8px auto 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: smartsearch-shimmer 1.5s infinite;
}
.smartsearch-skeleton-btn {
    height: 36px;
    border-radius: 8px;
    margin-top: 12px;
    width: 100%;
}
@keyframes smartsearch-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ═══════════════════════════════════════════════
   STAGGER ANIMATION (cards)
   ═══════════════════════════════════════════════ */

.smartsearch-card {
    opacity: 0;
    animation: smartsearch-card-in 0.3s ease forwards;
}
@keyframes smartsearch-card-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ═══════════════════════════════════════════════
   SUGGESTIONS PANEL
   ═══════════════════════════════════════════════ */

.smartsearch-suggestions {
    padding: 24px;
    grid-column: 1 / -1;
}
.smartsearch-suggestions-section {
    margin-bottom: 20px;
}
.smartsearch-suggestions-section:last-child {
    margin-bottom: 0;
}
.smartsearch-suggestions-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.smartsearch-suggestions-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.smartsearch-suggestions-chips::-webkit-scrollbar {
    display: none;
}
.smartsearch-suggestion-chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e5e5e5;
    background: #fff;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.smartsearch-suggestion-chip:hover {
    border-color: var(--ss-primary);
    color: var(--ss-primary);
    background: var(--ss-primary-light);
}
.ss-chip-popular {
    background: #f8f9fa;
}


/* ═══════════════════════════════════════════════
   REFORMULATION BANNER
   ═══════════════════════════════════════════════ */

.smartsearch-reformulated {
    padding: 8px 16px;
    font-size: 13px;
    color: #666;
    background: var(--ss-primary-light);
    border-radius: 8px;
    margin-bottom: 12px;
}
.smartsearch-reformulated strong {
    color: var(--ss-primary);
}


/* ═══════════════════════════════════════════════
   VOICE SEARCH BUTTON
   ═══════════════════════════════════════════════ */

.smartsearch-voice-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.smartsearch-voice-btn:hover {
    color: #333;
    background: #eee;
}

.smartsearch-voice-btn .ss-voice-icon-stop {
    display: none;
}

/* Listening state: red pulse + swap mic→stop */
.smartsearch-voice-btn.ss-voice-listening {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
    animation: ss-voice-pulse 1.5s ease-in-out infinite;
}

.smartsearch-voice-btn.ss-voice-listening .ss-voice-icon-mic {
    display: none;
}

.smartsearch-voice-btn.ss-voice-listening .ss-voice-icon-stop {
    display: block;
}

@keyframes ss-voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); transform: scale(1); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); transform: scale(1.08); }
}

/* Processing state: spin mic icon in primary color */
.smartsearch-voice-btn.ss-voice-processing {
    color: var(--ss-primary);
}

.smartsearch-voice-btn.ss-voice-processing .ss-voice-icon-mic {
    animation: smartsearch-spin 0.6s linear infinite;
}

/* Mobile voice button */
@media (max-width: 768px) {
    .smartsearch-voice-btn svg {
        width: 20px;
        height: 20px;
    }

    .smartsearch-voice-btn {
        padding: 4px;
    }
}


/* ═══════════════════════════════════════════════
   HIDE NATIVE MAGENTO AUTOCOMPLETE
   ═══════════════════════════════════════════════ */

.smartsearch-open ~ .search-autocomplete,
.block-search .search-autocomplete {
    display: none !important;
}
