/**
 * SmartSearch AI Core - Styles
 *
 * Modern Bento Grid layout with responsive design.
 * No jQuery dependency.
 *
 * @author    4pixel.pl <contact@4pixel.pl>
 * @copyright 2024 4pixel.pl
 * @license   Commercial License
 */

/* =========================================
   CSS Variables (Theming)
   ========================================= */

:root {
    --smartsearch-primary: #1dafec;
    --smartsearch-primary-hover: #189dc8;
    --smartsearch-bg: #ffffff;
    --smartsearch-bg-secondary: #f8fafc;
    --smartsearch-text: #1e293b;
    --smartsearch-text-muted: #64748b;
    --smartsearch-border: #e2e8f0;
    --smartsearch-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --smartsearch-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --smartsearch-radius: 16px;
    --smartsearch-radius-sm: 8px;
    --smartsearch-transition: 0.2s ease;
    --smartsearch-overlay-bg: rgba(15, 23, 42, 0.7);
    --smartsearch-voice-pulse: #ef4444;
    --smartsearch-overlay-padding-top: 8vh;
}

/* =========================================
   Overlay
   ========================================= */

.smartsearch-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--smartsearch-overlay-padding-top) 1rem 1rem;
    background: var(--smartsearch-overlay-bg);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--smartsearch-transition), visibility var(--smartsearch-transition);
}

.smartsearch-overlay.smartsearch-visible {
    opacity: 1;
    visibility: visible;
}

/* =========================================
   Dropdown mode
   ========================================= */

.smartsearch-overlay--dropdown {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    align-items: flex-start;
    justify-content: flex-start;
    pointer-events: none;
}

.smartsearch-overlay--dropdown.smartsearch-visible {
    opacity: 1;
    visibility: visible;
}

/* Container is positioned by JS in dropdown mode */
.smartsearch-overlay--dropdown .smartsearch-container {
    pointer-events: all;
    max-height: min(70vh, 640px);
    transform: translateY(-10px);
    transition: transform var(--smartsearch-transition), opacity var(--smartsearch-transition);
    opacity: 0;
    border-radius: var(--smartsearch-radius);
    box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.18), 0 2px 8px -2px rgba(0, 0, 0, 0.10);
    border: 1px solid var(--smartsearch-border);
}

/* Hide the duplicate input bar — original search input stays visible above the dropdown */
.smartsearch-overlay--dropdown .smartsearch-input-wrapper {
    display: none;
}

.smartsearch-overlay--dropdown.smartsearch-visible .smartsearch-container {
    transform: translateY(0);
    opacity: 1;
}

/* =========================================
   Container
   ========================================= */

.smartsearch-container {
    width: 100%;
    max-width: 1080px;
    max-height: min(88vh, 760px);
    background: var(--smartsearch-bg);
    border-radius: var(--smartsearch-radius);
    box-shadow: var(--smartsearch-shadow);
    overflow: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: transform var(--smartsearch-transition);
    display: flex;
    flex-direction: column;
}

.smartsearch-visible .smartsearch-container {
    transform: translateY(0) scale(1);
}

/* =========================================
   Input Wrapper
   ========================================= */

.smartsearch-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--smartsearch-border);
    background: var(--smartsearch-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.smartsearch-filter-bar {
    padding: 0.5rem 1.25rem 0.25rem;
    border-bottom: 1px solid var(--smartsearch-border);
    background: var(--smartsearch-bg);
}

.smartsearch-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.smartsearch-filter-chip__clear {
    border: 0;
    background: transparent;
    color: inherit;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    line-height: 1;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.smartsearch-filter-chip__clear:hover {
    background: rgba(30, 58, 138, 0.1);
}

.smartsearch-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--smartsearch-text);
    background: transparent;
    padding: 0.5rem 0;
}

.smartsearch-input::placeholder {
    color: var(--smartsearch-text-muted);
    font-weight: 400;
}

/* =========================================
   Buttons
   ========================================= */

.smartsearch-voice-btn,
.smartsearch-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--smartsearch-bg-secondary);
    color: var(--smartsearch-text-muted);
    cursor: pointer;
    transition: all var(--smartsearch-transition);
    flex-shrink: 0;
}

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

.smartsearch-voice-btn:hover,
.smartsearch-close-btn:hover {
    background: var(--smartsearch-border);
    color: var(--smartsearch-text);
}

/* Voice listening animation */
.smartsearch-voice-btn.smartsearch-voice--listening {
    background: var(--smartsearch-voice-pulse);
    color: white;
    animation: smartsearch-pulse 1.5s ease-in-out infinite;
}

@keyframes smartsearch-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* =========================================
   Results Layout
   ========================================= */

.smartsearch-results-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    position: relative;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.smartsearch-results-wrap::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.smartsearch-results-wrap.has-more-below::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(248, 250, 252, 0.95));
}

.smartsearch-results {
    padding: 1rem;
    display: block;
}

/* Loading state – disabled (minimal delay, loader felt slower) */
/* .smartsearch-container.smartsearch-loading .smartsearch-results::before { ... } */

/* =========================================
   Result Item
   ========================================= */

.smartsearch-item {
    display: flex;
    flex-direction: row;
    background: var(--smartsearch-bg-secondary);
    border-radius: var(--smartsearch-radius-sm);
    overflow: hidden;
    text-decoration: none;
    color: var(--smartsearch-text);
    transition: all var(--smartsearch-transition);
    border: 1px solid transparent;
    min-height: 108px;
}

.smartsearch-item:hover,
.smartsearch-item.smartsearch-item--active {
    background: white;
    border-color: var(--smartsearch-primary);
    box-shadow: var(--smartsearch-shadow-sm);
}

/* Item Image */
.smartsearch-item__image {
    width: 96px;
    height: 96px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.smartsearch-item__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.25rem;
}

.smartsearch-item__no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--smartsearch-bg-secondary);
}

/* Item Content */
.smartsearch-item__content {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.smartsearch-item__name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: var(--smartsearch-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.smartsearch-mark {
    background: rgba(37, 99, 235, 0.14);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

.smartsearch-item__brand {
    font-size: 0.75rem;
    color: var(--smartsearch-text-muted);
}

.smartsearch-item__index {
    font-size: 0.75rem;
    color: #fe571d;
    font-weight: 600;
}

.smartsearch-item__index-label {
    color: var(--smartsearch-text-muted);
    font-weight: 400;
}

.smartsearch-item__badge {
    align-self: flex-start;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #fff;
    background: var(--smartsearch-primary);
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
    margin-bottom: 0.15rem;
    line-height: 1.2;
}

.smartsearch-item__badge--muted {
    background: #475569;
}

.smartsearch-item__category {
    font-size: 0.75rem;
    color: var(--smartsearch-text-muted);
}

.smartsearch-item__price {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fe571d;
    margin-top: auto;
}

.smartsearch-item__price-tax {
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--smartsearch-text-muted);
}

/* Discounted price layout: <regular struck-through> <current> brutto [-NN%] */
.smartsearch-item__price--discounted {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.smartsearch-item__price-regular {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--smartsearch-text-muted);
    text-decoration: line-through;
}

.smartsearch-item__price-current {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fe571d;
}

.smartsearch-item__price-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.1875rem 0.375rem;
    border-radius: 0.25rem;
    background: #fe571d;
    color: #fff;
    margin-left: 0.25rem;
}

/* =========================================
   Results Layout (Sidebar + Products)
   ========================================= */

.smartsearch-results-layout {
    display: grid;
    grid-template-columns: minmax(250px, 30%) 1fr;
    gap: 1rem;
    align-items: start;
}

.smartsearch-sidebar {
    padding: 0.125rem;
    border-right: 1px solid var(--smartsearch-border);
    padding-right: 1rem;
}

.smartsearch-side-section + .smartsearch-side-section {
    margin-top: 1rem;
}

.smartsearch-side-title {
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
    color: var(--smartsearch-text);
    font-weight: 700;
}

.smartsearch-side-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.smartsearch-side-link {
    border: 0;
    background: transparent;
    color: var(--smartsearch-text);
    font-size: 0.875rem;
    padding: 0.25rem 0;
    text-align: left;
    width: 100%;
}

.smartsearch-side-link:hover {
    color: var(--smartsearch-primary);
}

.smartsearch-side-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.smartsearch-side-chip {
    border: 1px solid var(--smartsearch-border);
    border-radius: 999px;
    background: var(--smartsearch-bg-secondary);
    color: var(--smartsearch-text);
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
}

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

.smartsearch-side-actions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.smartsearch-side-action {
    border: 1px solid var(--smartsearch-border);
    border-radius: 999px;
    background: #fff;
    color: var(--smartsearch-text);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
}

.smartsearch-side-action:hover {
    border-color: var(--smartsearch-primary);
    color: var(--smartsearch-primary);
}

.smartsearch-products-column {
    min-width: 0;
}

.smartsearch-products-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--smartsearch-text);
    margin-bottom: 0.6rem;
}

.smartsearch-products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

/* =========================================
   Footer CTA
   ========================================= */

.smartsearch-footer {
    border-top: 1px solid var(--smartsearch-border);
    background: var(--smartsearch-bg);
    padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom, 0));
}

.smartsearch-see-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: var(--smartsearch-primary);
    border-radius: var(--smartsearch-radius-sm);
    border: 1px solid transparent;
    transition: all var(--smartsearch-transition);
}

.smartsearch-see-all::after {
    content: '\2192';
    display: inline-block;
    font-size: 1.1em;
    transition: transform 0.25s ease;
}

.smartsearch-see-all:hover {
    background: var(--smartsearch-primary-hover);
    color: #fff;
}

.smartsearch-see-all:hover::after {
    transform: translateX(4px);
}

.smartsearch-see-all:focus-visible {
    outline: 2px solid var(--smartsearch-primary);
    outline-offset: 2px;
}

/* =========================================
   No Results
   ========================================= */

.smartsearch-no-results {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--smartsearch-text-muted);
}

.smartsearch-no-results p {
    margin: 1rem 0 0.25rem;
    font-size: 1rem;
    color: var(--smartsearch-text);
}

.smartsearch-no-results span {
    font-size: 0.875rem;
}

.smartsearch-no-results__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.smartsearch-no-results__btn {
    border: 1px solid var(--smartsearch-border);
    border-radius: 999px;
    background: #fff;
    color: var(--smartsearch-text);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
}

.smartsearch-no-results__btn:hover {
    border-color: var(--smartsearch-primary);
    color: var(--smartsearch-primary);
}

/* =========================================
   Trending Section
   ========================================= */

.smartsearch-trending {
    padding: 0.5rem 0;
}

.smartsearch-trending h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--smartsearch-text-muted);
    margin: 0 0 1rem;
    padding: 0 0.25rem;
}

.smartsearch-trending ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.smartsearch-trending li {
    margin: 0;
}

.smartsearch-trending button {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--smartsearch-text);
    background: var(--smartsearch-bg-secondary);
    border: 1px solid var(--smartsearch-border);
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--smartsearch-transition);
}

.smartsearch-trending button:hover {
    background: var(--smartsearch-primary);
    border-color: var(--smartsearch-primary);
    color: white;
}

/* =========================================
   Responsive - Tablet
   ========================================= */

@media (max-width: 768px) {
    .smartsearch-overlay {
        padding: 0;
        align-items: stretch;
    }

    .smartsearch-container {
        max-width: none;
        max-height: none;
        height: 100%;
        border-radius: 0;
        transform: none;
    }

    .smartsearch-results-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .smartsearch-sidebar {
        display: none;
    }

    .smartsearch-products-grid {
        grid-template-columns: 1fr 1fr;
    }

    .smartsearch-submit-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: none;
        border-radius: 50%;
        background: var(--smartsearch-primary);
        color: #fff;
        cursor: pointer;
        flex-shrink: 0;
        transition: background var(--smartsearch-transition);
    }

    .smartsearch-submit-btn:hover,
    .smartsearch-submit-btn:active {
        background: var(--smartsearch-primary-hover);
    }
}

/* =========================================
   Responsive - Mobile
   ========================================= */

@media (max-width: 480px) {
    .smartsearch-overlay {
        --smartsearch-overlay-padding-top: 0;
    }

    .smartsearch-input-wrapper {
        padding: 0.75rem 1rem;
    }

    .smartsearch-filter-bar {
        padding: 0.45rem 0.75rem 0.25rem;
    }

    .smartsearch-input {
        font-size: 1rem;
    }

    .smartsearch-results {
        padding: 0.75rem;
    }

    .smartsearch-item {
        flex-direction: row;
        min-height: 96px;
    }

    .smartsearch-item__image {
        width: 88px;
        height: 88px;
        flex-shrink: 0;
    }

    .smartsearch-item__content {
        padding: 0.5rem 0.75rem;
    }

    .smartsearch-item__name {
        font-size: 0.8125rem;
    }

    .smartsearch-item__price {
        font-size: 0.875rem;
    }

    .smartsearch-trending button {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .smartsearch-products-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .smartsearch-side-title {
        font-size: 0.85rem;
    }

    .smartsearch-side-actions-list {
        gap: 0.35rem;
    }

    .smartsearch-side-action {
        font-size: 0.72rem;
        padding: 0.32rem 0.5rem;
    }

    .smartsearch-footer {
        padding: 0.625rem 0.75rem max(0.875rem, env(safe-area-inset-bottom, 0));
    }
}

/* =========================================
   Accessibility - Focus States
   ========================================= */

.smartsearch-input:focus {
    outline: none;
}

.smartsearch-voice-btn:focus-visible,
.smartsearch-close-btn:focus-visible {
    outline: 2px solid var(--smartsearch-primary);
    outline-offset: 2px;
}

.smartsearch-item:focus-visible {
    outline: 2px solid var(--smartsearch-primary);
    outline-offset: -2px;
}

.smartsearch-trending button:focus-visible {
    outline: 2px solid var(--smartsearch-primary);
    outline-offset: 2px;
}

/* =========================================
   Reduced Motion
   ========================================= */

@media (prefers-reduced-motion: reduce) {
    .smartsearch-overlay,
    .smartsearch-container,
    .smartsearch-item,
    .smartsearch-voice-btn,
    .smartsearch-close-btn,
    .smartsearch-see-all,
    .smartsearch-trending button {
        transition: none;
    }

    .smartsearch-voice-btn.smartsearch-voice--listening {
        animation: none;
    }

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

/* Dark mode intentionally disabled – shop uses light theme only */

/* =========================================
   Print - Hide overlay
   ========================================= */

@media print {
    .smartsearch-overlay {
        display: none !important;
    }
}

/* =========================================
   SEARCH RESULTS PAGE ENHANCEMENTS
   ========================================= */

.smartsearch-results-header {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 8px 0 16px;
}

.smartsearch-results-header__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.smartsearch-results-header__title {
    margin: 0;
    font-size: 1.35rem;
}

.smartsearch-results-header__count {
    color: #475569;
    font-size: 0.9rem;
    font-weight: 600;
}

.smartsearch-results-header__correction {
    margin-top: 8px;
    font-size: 0.88rem;
    color: #334155;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.smartsearch-results-header__correction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #0ea5e9;
    border-radius: 999px;
    padding: 6px 12px;
    background: #f0f9ff;
    color: #0369a1;
    text-decoration: none;
    font-weight: 700;
}

.smartsearch-results-header__correction-btn:hover {
    background: #e0f2fe;
    border-color: #0284c7;
}

.smartsearch-results-header__correction a {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: 700;
}

.smartsearch-results-header__muted,
.smartsearch-results-header__muted-link {
    color: #64748b !important;
    font-weight: 500 !important;
}

.smartsearch-results-header__related {
    margin-top: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.85rem;
    color: #475569;
}

.smartsearch-chip-link {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 5px 10px;
    color: #0f172a;
    text-decoration: none;
    background: #fff;
    font-weight: 600;
    font-size: 0.8rem;
}

.smartsearch-chip-link:hover {
    border-color: #38bdf8;
    color: #0369a1;
}

.smartsearch-active-filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 8px 10px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
}

.smartsearch-active-filters-bar__label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}

.smartsearch-active-filters-bar__chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.smartsearch-active-filter-chip {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
}

.smartsearch-active-filter-chip > span:last-child {
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.5;
}

.smartsearch-active-filter-chip:hover > span:last-child {
    opacity: 1;
}

.smartsearch-clear-all-filters {
    border: 0;
    background: transparent;
    color: #0ea5e9;
    font-size: 0.78rem;
    font-weight: 700;
}

.smartsearch-empty-state {
    margin: 10px 0 16px;
    padding: 0;
    background: transparent;
}

.smartsearch-empty-state h2 {
    margin: 0 0 6px;
}

.smartsearch-empty-state p {
    margin: 0 0 12px;
    color: #64748b;
}

.smartsearch-empty-state__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.smartsearch-empty-state__related {
    margin-top: 12px;
}

.smartsearch-empty-state__related > span {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 600;
}

.smartsearch-empty-state__reco {
    margin-top: 18px;
}

.smartsearch-empty-state__reco-loading {
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 12px;
    color: #475569;
    font-size: 0.88rem;
}

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

.smartsearch-mobile-filters-close {
    display: none;
}

/* Clean search mode: avoid duplicated title/count blocks from theme */
body.smartsearch-clean-search .page-title,
body.smartsearch-clean-search #main h1.h1,
body.smartsearch-clean-search h1.page-title-section,
body.smartsearch-clean-search [data-page-title-section] {
    display: none !important;
}

body.smartsearch-clean-search #js-product-list-top .total-products,
body.smartsearch-clean-search .products-selection .total-products {
    display: none !important;
}

/* Search results page: keep only filter block in left column */
body.page-search #left-column > * {
    display: none !important;
}

body.page-search #left-column > #amazzing_filter,
body.page-search #left-column > #search_filters_wrapper,
body.page-search #left-column > #search_filters {
    display: block !important;
}

/* Hide native "not found" blocks when SmartSearch no-results layout is active */
body.smartsearch-no-results-page .page-content--not-found,
body.smartsearch-no-results-page #js-product-list-header h1.page-title-section,
body.smartsearch-no-results-page #content.page-content--not-found > p {
    display: none !important;
}

/* No-results layout: hide left filters column and stretch content */
body.smartsearch-no-results-page #left-column,
body.smartsearch-no-results-page #search_filters_wrapper,
body.smartsearch-no-results-page #search_filters,
body.smartsearch-no-results-page .left-column,
body.smartsearch-no-results-page #columns #left-column {
    display: none !important;
}

body.smartsearch-no-results-page #content-wrapper,
body.smartsearch-no-results-page #content {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

body.smartsearch-no-results-page #content-wrapper[class*="col-"],
body.smartsearch-no-results-page #content[class*="col-"],
body.smartsearch-no-results-page #content-wrapper,
body.smartsearch-no-results-page #content {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* On no-results, keep only dedicated SmartSearch recommendations block */
body.smartsearch-no-results-page section.ps-featuredproducts,
body.smartsearch-no-results-page section.smartsearch-reco[data-frame-code="category_recommended"] {
    display: none !important;
}

@media (max-width: 991px) {
    body.smartsearch-no-results-page #search_filters_wrapper,
    body.smartsearch-no-results-page #search_filters {
        display: none !important;
    }

    #search_filters_wrapper,
    #search_filters {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(86vw, 360px);
        z-index: 80;
        background: #fff;
        transform: translateX(102%);
        transition: transform 0.2s ease;
        overflow-y: auto;
        padding-top: 48px;
    }

    body.smartsearch-filters-open #search_filters_wrapper,
    body.smartsearch-filters-open #search_filters {
        transform: translateX(0);
    }

    .smartsearch-filters-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.45);
        z-index: 70;
    }

    body.smartsearch-filters-open .smartsearch-filters-backdrop {
        display: block;
    }

    .smartsearch-mobile-filters-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border: 0;
        border-radius: 999px;
        background: #f1f5f9;
        color: #334155;
        font-size: 22px;
        line-height: 1;
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 2;
    }
}

@media (max-width: 640px) {
    .smartsearch-results-header {
        padding: 12px;
    }

    .smartsearch-results-header__title {
        font-size: 1.1rem;
    }

    body.smartsearch-clean-search .smartsearch-results-header__count {
        font-size: 0.82rem;
    }
}

/* =========================================
   RECOMMENDATIONS v2 — Frames System
   Supports: slider, grid, modal layouts
   ========================================= */

/* --- Base section --- */
.smartsearch-reco {
    margin: 2rem 0;
    clear: both;
    position: relative;
}

.smartsearch-reco__title {
    margin: 0 0 1rem;
}

/* --- Grid layout --- */
.smartsearch-reco--grid .smartsearch-reco__products {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

/* --- Slider layout --- */
.smartsearch-reco--slider {
    position: relative;
}

.smartsearch-reco__slider {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
}

.smartsearch-reco__slider::-webkit-scrollbar {
    display: none;
}

.smartsearch-reco__slider > .smartsearch-reco__item,
.smartsearch-reco__slider > div {
    flex: 0 0 auto;
    width: calc((100% - 5rem) / 6);
    min-width: 160px;
    scroll-snap-align: start;
}

/* Slider navigation */
.smartsearch-reco__nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    transform: translateY(-50%);
    z-index: 2;
    padding: 0 0.25rem;
}

.smartsearch-reco__nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--smartsearch-bg, #fff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    pointer-events: auto;
    transition: opacity 0.2s, transform 0.2s;
    color: var(--smartsearch-text, #1e293b);
}

.smartsearch-reco__nav-btn:hover {
    transform: scale(1.1);
}

.smartsearch-reco__nav-btn:disabled {
    opacity: 0;
    pointer-events: none;
}

/* --- Item wrapper (for source badges, ai-reason) --- */
.smartsearch-reco__item {
    position: relative;
}

/* --- AI Reason badge --- */
.smartsearch-reco__reason {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(37, 99, 235, 0.9);
    color: #fff;
    border-radius: 4px;
    font-size: 0.6875rem;
    line-height: 1.3;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smartsearch-reco__reason-icon {
    flex-shrink: 0;
    font-size: 0.75rem;
}

/* --- Contextual fill label (pdp_similar fill from other frames) --- */
.smartsearch-reco__fill-label {
    margin-top: 6px;
    padding: 2px 8px;
    display: inline-block;
    font-size: 0.6rem;
    line-height: 1.4;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* --- Skeleton loading --- */
.smartsearch-reco__skeleton {
    background: var(--smartsearch-bg-secondary, #f8fafc);
    border-radius: var(--smartsearch-radius-sm, 8px);
    overflow: hidden;
    min-height: 200px;
}

.smartsearch-reco__skeleton-image {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: smartsearch-shimmer 1.5s infinite;
}

.smartsearch-reco__skeleton-text {
    margin: 0.75rem 0.75rem 0;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: smartsearch-shimmer 1.5s infinite;
}

.smartsearch-reco__skeleton-text--title {
    height: 14px;
    width: 80%;
}

.smartsearch-reco__skeleton-text--price {
    height: 16px;
    width: 40%;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
}

@keyframes smartsearch-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Load More button --- */
.smartsearch-reco__load-more-wrapper {
    text-align: center;
    margin-top: 1.5rem;
}

.smartsearch-reco__load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.smartsearch-reco__load-more-btn--loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Placeholder grid for skeletons */
.smartsearch-reco--placeholder .smartsearch-reco__products {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

/* Slider placeholder — horizontal scroll */
.smartsearch-reco--placeholder.smartsearch-reco--slider .smartsearch-reco__products {
    display: flex;
    gap: 1rem;
    overflow: hidden;
}

.smartsearch-reco--placeholder.smartsearch-reco--slider .smartsearch-reco__skeleton {
    flex: 0 0 calc((100% - 5rem) / 6);
    min-width: 160px;
}

/* =========================================
   RECOMMENDATION MODAL (add-to-cart upsell)
   ========================================= */

.smartsearch-reco-inline {
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(0, 0, 0, .08);
}

.smartsearch-reco-inline .smartsearch-reco__title {
    margin-bottom: .5rem;
}

.smartsearch-reco-inline .smartsearch-reco--grid .smartsearch-reco__products,
.smartsearch-reco-inline .smartsearch-reco-inline__products {
    display: flex;
    flex-wrap: nowrap;
    gap: .75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding: 0 .125rem .5rem;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #e2e8f0;
}

.smartsearch-reco-inline .smartsearch-reco__item {
    min-width: 0;
    flex: 0 0 calc((100% - 2.25rem) / 4);
    scroll-snap-align: start;
}

.smartsearch-reco-inline .smartsearch-reco--grid .smartsearch-reco__products::-webkit-scrollbar,
.smartsearch-reco-inline .smartsearch-reco-inline__products::-webkit-scrollbar {
    height: 8px;
}

.smartsearch-reco-inline .smartsearch-reco--grid .smartsearch-reco__products::-webkit-scrollbar-track,
.smartsearch-reco-inline .smartsearch-reco-inline__products::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 999px;
}

.smartsearch-reco-inline .smartsearch-reco--grid .smartsearch-reco__products::-webkit-scrollbar-thumb,
.smartsearch-reco-inline .smartsearch-reco-inline__products::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 999px;
}

.smartsearch-reco-inline .smartsearch-reco__item .product-miniature {
    margin-bottom: 0;
}

.smartsearch-reco-inline .smartsearch-reco__item .thumbnail-container {
    min-height: 100%;
}

@media (max-width: 991px) {
    .smartsearch-reco-inline .smartsearch-reco--grid .smartsearch-reco__products,
    .smartsearch-reco-inline .smartsearch-reco-inline__products {
        gap: .625rem;
    }

    .smartsearch-reco-inline .smartsearch-reco__item {
        flex-basis: calc((100% - 1.25rem) / 3);
    }
}

@media (max-width: 767px) {
    .smartsearch-reco-inline {
        margin-top: .75rem;
        padding-top: .5rem;
    }

    .smartsearch-reco-inline .smartsearch-reco--grid .smartsearch-reco__products,
    .smartsearch-reco-inline .smartsearch-reco-inline__products {
        gap: .5rem;
        padding-bottom: .375rem;
    }

    .smartsearch-reco-inline .smartsearch-reco__item {
        flex-basis: calc((100% - .5rem) / 2);
    }
}

.smartsearch-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.smartsearch-modal--active {
    opacity: 1;
    visibility: visible;
}

.smartsearch-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
}

.smartsearch-modal__content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s;
}

.smartsearch-modal--active .smartsearch-modal__content {
    transform: translateY(0) scale(1);
}

/* Modal header */
.smartsearch-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.smartsearch-modal__check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    flex-shrink: 0;
}

.smartsearch-modal__header-text {
    flex: 1;
    min-width: 0;
}

.smartsearch-modal__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #16a34a;
}

.smartsearch-modal__subtitle {
    margin: 2px 0 0;
    font-size: 0.8125rem;
    color: #64748b;
}

.smartsearch-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.smartsearch-modal__close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Modal products */
.smartsearch-modal__products {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.smartsearch-modal__product {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    background: #f8fafc;
}

.smartsearch-modal__product-image {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

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

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

.smartsearch-modal__product-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.smartsearch-modal__product-name:hover {
    color: #2563eb;
}

.smartsearch-modal__reason {
    font-size: 0.6875rem;
    color: #64748b;
    font-style: italic;
}

.smartsearch-modal__product-price {
    display: flex;
    align-items: center;
    gap: 6px;
}

.smartsearch-modal__price-old {
    font-size: 0.75rem;
    color: #94a3b8;
    text-decoration: line-through;
}

.smartsearch-modal__price-current {
    font-size: 0.875rem;
    font-weight: 700;
    color: #2563eb;
}

.smartsearch-modal__add-to-cart {
    align-self: flex-start;
    font-size: 0.75rem;
    padding: 4px 12px;
    margin-top: 2px;
}

.smartsearch-modal__add-to-cart.btn-success {
    background: #16a34a;
    border-color: #16a34a;
}

/* Modal footer */
.smartsearch-modal__footer {
    display: flex;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid #e2e8f0;
}

.smartsearch-modal__footer .btn {
    flex: 1;
    font-size: 0.8125rem;
    padding: 8px 16px;
}

/* =========================================
   Responsive — Recommendations
   ========================================= */

@media (max-width: 1200px) {
    .smartsearch-reco--grid .smartsearch-reco__products,
    .smartsearch-reco--placeholder .smartsearch-reco__products {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .smartsearch-reco--grid .smartsearch-reco__products,
    .smartsearch-reco--placeholder .smartsearch-reco__products {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .smartsearch-reco__slider > .smartsearch-reco__item,
    .smartsearch-reco__slider > div {
        width: 160px;
    }

    .smartsearch-reco__nav {
        display: none;
    }
}

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

    .smartsearch-modal__content {
        width: 95%;
        border-radius: 8px;
    }

    .smartsearch-modal__products {
        max-height: 240px;
    }

    .smartsearch-modal__footer {
        flex-direction: column;
    }
}

/* =========================================
   Header search widget (replaces ybc_blocksearch / Total Search)
   Rendered by hookDisplayNav1 — sits between logo and icons.
   ========================================= */

/* Hide native ps_searchbar — SmartSearch provides its own widget */
#_desktop_ps_searchbar,
#_mobile_ps_searchbar,
.ps-searchbar--mobile {
    display: none !important;
}

.ets_search_block_top {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    flex: 1 1 auto;
}

.ets_search_block_top .ybc_searchbox {
    position: relative;
    width: 100%;
}

.ets_search_block_top .search_query_top {
    background-color: #fff;
    float: left;
    font-size: 13px;
    height: 40px;
    padding: 5px 50px 5px 10px;
    width: 100%;
    border-radius: 0;
    border: 1px solid #d0d0d0;
    outline: none;
    color: #333;
}

.ets_search_block_top .search_query_top:focus {
    border-color: #ccc;
    box-shadow: none;
}

.ets_search_block_top .search_query_top::placeholder {
    color: #929292;
}

.ets_search_block_top .btn.button-search {
    background-color: #1dafec;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 40px;
    width: 40px;
    padding: 10px 0;
    outline: none;
    position: absolute;
    right: 0;
    top: 0;
    text-align: center;
    transition: all 0.4s ease 0s;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    overflow: hidden;
    cursor: pointer;
}

.ets_search_block_top .btn.button-search svg {
    width: 19px;
    fill: #fff !important;
}

.ets_search_block_top .btn.button-search:hover {
    background-color: #189dc8;
}

@media (max-width: 767px) {
    .ets_search_block_top {
        padding: 0 10px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .smartsearch-reco__skeleton-image,
    .smartsearch-reco__skeleton-text {
        animation: none;
    }

    .smartsearch-modal,
    .smartsearch-modal__content {
        transition: none;
    }
}

/* Legacy compatibility — old class name */
.smartsearch-recommendations {
    margin: 2rem 0;
    clear: both;
}
