/*
 * CWC Search Results — header + "view all" button injected into Elementor Pro's
 * Search widget live-results dropdown (.e-search-results-list).
 * Injected server-side by CWC_Search_Results; see includes/class-cwc-search-results.php.
 */

/*
 * Elementor renders .e-search-results-list as a CSS grid with
 * `grid-auto-rows: 1fr`, which equalizes every row to the tallest product card.
 * That stretches our header/button vertically. Let rows size to their content
 * instead so each item is its natural height.
 */
.elementor-widget-search .e-search-results-list {
    grid-auto-rows: min-content !important;
}

.e-search-results-list .cwc-search-header,
.e-search-results-list .cwc-search-viewall {
    grid-column: 1 / -1;  /* span all columns if the grid has more than one */
    align-self: start;    /* never stretch to fill the row track */
}

.e-search-results-list .cwc-search-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 4px 8px;
    direction: rtl;
    font-family: "IranYekanX", sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--e-global-color-primary, #1D9E75);
}

.e-search-results-list .cwc-search-header__icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.e-search-results-list .cwc-search-viewall {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 4px 0 0;
    padding: 10px 18px;
    min-height: 0;
    direction: rtl;
    background: var(--e-global-color-primary, #1D9E75);
    color: #fff !important;
    border-radius: 12px;
    text-decoration: none;
    font-family: "IranYekanX", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: opacity 0.2s ease;
}

.e-search-results-list .cwc-search-viewall:hover {
    opacity: 0.88;
}

.e-search-results-list .cwc-search-viewall__arrow {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
}

/*
 * Page dim + blur while the search dropdown is open.
 * Overlay sits above page content; the header (and its dropdown) is lifted above
 * the overlay via .cwc-search-elevated (toggled in search-results.js).
 */
.cwc-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

body.cwc-search-open .cwc-search-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cwc-search-elevated {
    z-index: 1001 !important;
}
