/* ═══════════════════════════════════════════════
   SuperSearch – Advanced Search Widget CSS
   ═══════════════════════════════════════════════ */

/* ── Wrapper ── */
.supersearch-wrapper {
    position: relative;
    width: 100%;
    max-width: 750px;
    margin: 0 auto;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ── Input area ── */
.supersearch-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 0 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.supersearch-input-wrap:focus-within {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.supersearch-icon-search {
    flex-shrink: 0;
    color: #999;
    margin-right: 10px;
    transition: color 0.2s;
}

.supersearch-input-wrap:focus-within .supersearch-icon-search {
    color: #333;
}

.supersearch-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    line-height: 1.4;
    padding: 12px 0;
    color: #222;
    min-width: 0;
}

.supersearch-input::placeholder {
    color: #aaa;
}

.supersearch-clear {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}

.supersearch-clear:hover {
    background: #f0f0f0;
    color: #333;
}

.supersearch-spinner {
    flex-shrink: 0;
    color: #999;
    display: flex;
    align-items: center;
}

/* ── Dropdown ── */
.supersearch-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    max-height: 480px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Animation: fade */
.supersearch-dropdown.ss-anim-fade {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.supersearch-dropdown.ss-anim-fade.ss-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animation: slide */
.supersearch-dropdown.ss-anim-slide {
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.supersearch-dropdown.ss-anim-slide.ss-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Section headers ── */
.supersearch-section {
    padding: 0;
}

.supersearch-section-title {
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

/* ── Product items ── */
.supersearch-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.12s;
    cursor: pointer;
}

.supersearch-item:last-child {
    border-bottom: none;
}

.supersearch-item:hover,
.supersearch-item.ss-active {
    background: #f5f6f8;
}

.supersearch-item-image {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    background: #f5f5f5;
    margin-top: 2px;
}

.supersearch-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Row 1: Product name – full width, up to 2 lines */
.supersearch-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}

/* Description snippet */
.supersearch-item-desc {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Row 2: Bottom row – price left, stock right */
.supersearch-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 2px;
}

.supersearch-item-bottom-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.supersearch-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
}

.supersearch-item-stock {
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.supersearch-item-stock.ss-in-stock {
    color: #7AC826;
}

.supersearch-item-stock.ss-out-of-stock {
    color: #FFFF00;
}

.supersearch-item-category {
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

.supersearch-item-ref {
    font-family: monospace;
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}

/* ── Highlight matches ── */
.supersearch-highlight {
    background: #fff3cd;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 600;
}

/* ── Category / CMS / Manufacturer items ── */
.supersearch-cat-item,
.supersearch-cms-item,
.supersearch-mfr-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.12s;
    font-size: 14px;
}

.supersearch-cat-item:hover,
.supersearch-cms-item:hover,
.supersearch-mfr-item:hover {
    background: #f7f7f7;
}

.supersearch-type-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #666;
}

/* ── No results ── */
.supersearch-no-results {
    padding: 24px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.supersearch-no-results svg {
    display: block;
    margin: 0 auto 8px;
    color: #ccc;
}

/* ── Popular / Recent ── */
.supersearch-suggestions {
    padding: 0;
}

.supersearch-suggestion-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    text-decoration: none;
    border-bottom: 1px solid #f8f8f8;
    transition: background 0.12s;
}

.supersearch-suggestion-item:hover {
    background: #f7f7f7;
    color: #222;
}

.supersearch-suggestion-icon {
    color: #bbb;
    flex-shrink: 0;
}

/* ── View all link ── */
.supersearch-view-all {
    display: block;
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    background: #fafafa;
    border-top: 1px solid #eee;
    transition: background 0.15s;
}

.supersearch-view-all:hover {
    background: #f0f0f0;
}

/* ── Scrollbar ── */
.supersearch-dropdown::-webkit-scrollbar {
    width: 6px;
}
.supersearch-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.supersearch-dropdown::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* ── Responsive: Mobile ── */
@media (max-width: 768px) {
    .supersearch-wrapper {
        max-width: 100%;
    }

    .supersearch-input-wrap {
        border-radius: 10px;
        padding: 0 12px;
    }

    .supersearch-input {
        font-size: 16px; /* prevents iOS zoom on focus */
        padding: 11px 0;
    }

    /* Product items */
    .supersearch-item {
        padding: 10px 14px;
        gap: 12px;
        min-height: 60px;
    }

    .supersearch-item-image {
        width: 48px;
        height: 48px;
        border-radius: 8px;
    }

    .supersearch-item-name {
        font-size: 14px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.3;
    }

    .supersearch-item-desc {
        display: none;
    }

    .supersearch-item-price {
        font-size: 13px;
    }

    .supersearch-item-stock {
        font-size: 10px;
    }

    /* Section titles */
    .supersearch-section-title {
        padding: 10px 14px 8px;
        font-size: 11px;
        position: sticky;
        top: 0;
        z-index: 1;
        background: #fafafa;
        text-align: left;
    }

    /* Suggestions: left-aligned */
    .supersearch-suggestions {
        text-align: left;
    }

    .supersearch-suggestion-item {
        padding: 12px 14px;
        font-size: 15px;
        min-height: 44px;
        text-align: left;
        justify-content: flex-start;
    }

    /* Category/manufacturer/CMS items */
    .supersearch-cat-item,
    .supersearch-cms-item,
    .supersearch-mfr-item {
        padding: 12px 14px;
        font-size: 15px;
        min-height: 48px;
    }

    /* View all */
    .supersearch-view-all {
        padding: 14px;
        font-size: 15px;
        position: sticky;
        bottom: 0;
        background: #fff;
        border-top: 1px solid #e0e0e0;
    }

    /* No results */
    .supersearch-no-results {
        padding: 40px 20px;
        font-size: 15px;
    }

    .supersearch-section {
        padding: 0;
        text-align: left;
    }
}

/* ═══════════════════════════════════════════════
   RESULTS PAGE – Horizontal list layout
   ═══════════════════════════════════════════════ */

.supersearch-results-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0 40px;
}

.supersearch-page-title {
    font-family: inherit;
    font-size: 24px;
    font-weight: 600;
    color: #232323;
}

/* ── Top bar ── */
.ss-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ss-topbar-count {
    font-size: 14px;
    color: #7a7a7a;
}

.ss-topbar-search {
    flex-shrink: 0;
}

.ss-search-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.ss-search-wrap input {
    border: none;
    outline: none;
    padding: 8px 12px;
    font-size: 14px;
    color: #333;
    width: 220px;
    background: transparent;
}

.ss-search-wrap button {
    border: none;
    background: #232323;
    color: #fff;
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}

.ss-search-wrap button:hover {
    background: #444;
}

/* ── Quick link pills ── */
.ss-quicklinks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.ss-pill {
    display: inline-block;
    padding: 5px 14px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    transition: all 0.15s;
}

.ss-pill:hover {
    background: #232323;
    border-color: #232323;
    color: #fff;
    text-decoration: none;
}

.ss-pill--brand {
    border-color: #c8d6e5;
    background: #eef3f9;
    color: #2c5282;
}

.ss-pill--brand:hover {
    background: #2c5282;
    border-color: #2c5282;
    color: #fff;
}

/* ── Product list (horizontal rows) ── */
.ss-product-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ss-product-row {
    display: grid;
    grid-template-columns: 220px 1fr 200px;
    gap: 0;
    border: 1px solid #eee;
    border-bottom: none;
    background: #fff;
    transition: background 0.15s;
    align-items: start;
}

.ss-product-row:last-child {
    border-bottom: 1px solid #eee;
}

.ss-product-row:hover {
    background: #fafbfc;
}

/* Column 1: Image */
.ss-product-col-img {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #f0f0f0;
    min-height: 180px;
}

.ss-product-col-img a {
    display: block;
    text-decoration: none;
}

.ss-product-col-img img {
    max-width: 180px;
    max-height: 180px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.ss-no-img {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    border-radius: 4px;
}

/* Column 2: Info */
.ss-product-col-info {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ss-product-name {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
}

.ss-product-name a {
    color: #232323;
    text-decoration: none;
    transition: color 0.15s;
}

.ss-product-name a:hover {
    color: #0066cc;
    text-decoration: none;
}

.ss-product-desc {
    font-size: 14px;
    color: #7a7a7a;
    line-height: 1.5;
    font-family: 'Ubuntu', sans-serif;
    /* Force full display - override any theme restrictions */
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    text-overflow: unset !important;
    white-space: normal !important;
    height: auto !important;
}

.ss-product-desc br {
    display: block !important;
    content: "" !important;
    margin: 0 !important;
}

.ss-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #232323;
    margin-top: 6px;
    font-family: 'Work Sans', sans-serif;
}

.ss-product-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 2px;
}

.ss-product-ref {
    font-size: 12px;
    color: #999;
    font-family: monospace;
}

.ss-product-cat {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 3px;
}

/* Column 3: Actions */
.ss-product-col-actions {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 14px;
    border-left: 1px solid #f0f0f0;
}

.ss-stock {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ss-stock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.ss-stock--in_stock {
    color: #7AC826;
}

.ss-stock--in_stock .ss-stock-dot {
    background: #7AC826;
}

.ss-stock--out_of_stock {
    color: #FFFF00;
}

.ss-stock--out_of_stock .ss-stock-dot {
    background: #FFFF00;
}

.ss-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #232323;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}

.ss-view-btn:hover {
    background: #444;
    color: #fff;
    text-decoration: none;
}

/* ── Pagination ── */
.ss-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 28px 0 8px;
}

.ss-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    background: #fff;
    transition: all 0.15s;
}

.ss-page-btn:hover {
    background: #f5f5f5;
    border-color: #232323;
    color: #232323;
    text-decoration: none;
}

.ss-page-active {
    background: #232323;
    color: #fff;
    border-color: #232323;
    font-weight: 600;
}

.ss-page-prev,
.ss-page-next {
    font-size: 18px;
    font-weight: 600;
}

.ss-pagination-info {
    text-align: center;
    font-size: 13px;
    color: #7a7a7a;
    margin-bottom: 16px;
}

/* ── Empty state ── */
.ss-empty {
    text-align: center;
    padding: 60px 20px;
    color: #7a7a7a;
}

.ss-empty svg {
    display: block;
    margin: 0 auto 16px;
    color: #ccc;
}

.ss-empty h2 {
    font-size: 20px;
    color: #333;
    margin: 0 0 8px;
}

.ss-empty p {
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ss-product-row {
        grid-template-columns: 120px 1fr;
        grid-template-rows: auto auto;
    }

    .ss-product-col-img {
        grid-row: 1 / 3;
        padding: 12px;
        min-height: auto;
    }

    .ss-product-col-img img {
        max-width: 100px;
        max-height: 100px;
    }

    .ss-product-col-info {
        padding: 12px 14px 6px;
        border-right: none;
    }

    .ss-product-col-actions {
        grid-column: 2;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        padding: 6px 14px 12px;
        border-left: none;
        border-top: none;
    }

    .ss-product-name {
        font-size: 14px;
    }

    .ss-product-desc {
        font-size: 13px;
    }

    .ss-product-price {
        font-size: 16px;
    }

    .ss-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ss-search-wrap input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ss-product-row {
        grid-template-columns: 90px 1fr;
    }

    .ss-product-col-img {
        padding: 8px;
    }

    .ss-product-col-img img {
        max-width: 75px;
        max-height: 75px;
    }

    .ss-product-desc {
        display: none;
    }

    .ss-view-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}
