.esw-expanding-search,
.esw-ajax-search-field,
.esw-search-results,
.esw-search-results * {
    box-sizing: border-box;
}

.esw-expanding-search {
    --esw-expand-width: 360px;
    --esw-expand-gap: 8px;
    display: inline-flex;
    align-items: center;
    position: relative;
    width: auto;
    max-width: 100%;
    overflow: visible;
}

.esw-expanding-toggle {
    position: relative !important;
    z-index: 3 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    text-decoration: none !important;
    line-height: 1 !important;
    font: inherit !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    -webkit-tap-highlight-color: transparent !important;
    cursor: pointer !important;
    transition: background-color .25s ease, color .25s ease, transform .25s ease;
}

.esw-expanding-toggle svg,
.esw-field-icon svg,
.esw-card-placeholder svg,
.esw-no-results svg,
.esw-card-button svg,
.esw-page-btn svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.esw-expanding-toggle svg,
.esw-expanding-toggle i,
.esw-expanding-toggle img {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.esw-expanding-toggle img {
    display: block;
    object-fit: contain;
}

.esw-expanding-form {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: min(var(--esw-expand-width), calc(100vw - 48px));
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-50%);
    transition: opacity .26s ease, visibility 0s linear .26s;
}

.esw-expanding-form::before,
.esw-expanding-form::after {
    content: none !important;
    display: none !important;
}

/*
 * The toggle always stays in its original position.
 * Only the absolutely-positioned form grows away from the icon.
 */
.esw-open-start .esw-expanding-form {
    inset-inline-end: calc(100% + var(--esw-expand-gap));
}

.esw-open-end .esw-expanding-form {
    inset-inline-start: calc(100% + var(--esw-expand-gap));
}

.esw-expanding-search.is-open .esw-expanding-form {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .26s ease, visibility 0s linear 0s;
}

.esw-expanding-input,
.esw-ajax-input {
    width: 100%;
    min-width: 0;
    margin: 0;
    border: 0;
    outline: none !important;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.esw-expanding-input:focus,
.esw-expanding-input:focus-visible,
.esw-ajax-input:focus,
.esw-ajax-input:focus-visible {
    outline: none !important;
    -webkit-outline: none !important;
    box-shadow: var(--esw-normal-box-shadow, none) !important;
    background-color: var(--esw-normal-background, transparent) !important;
    color: var(--esw-normal-color, inherit) !important;
    border-top-color: var(--esw-normal-border-top-color, transparent) !important;
    border-right-color: var(--esw-normal-border-right-color, transparent) !important;
    border-bottom-color: var(--esw-normal-border-bottom-color, transparent) !important;
    border-left-color: var(--esw-normal-border-left-color, transparent) !important;
    border-top-width: var(--esw-normal-border-top-width, 0px) !important;
    border-right-width: var(--esw-normal-border-right-width, 0px) !important;
    border-bottom-width: var(--esw-normal-border-bottom-width, 0px) !important;
    border-left-width: var(--esw-normal-border-left-width, 0px) !important;
    border-top-style: var(--esw-normal-border-top-style, none) !important;
    border-right-style: var(--esw-normal-border-right-style, none) !important;
    border-bottom-style: var(--esw-normal-border-bottom-style, none) !important;
    border-left-style: var(--esw-normal-border-left-style, none) !important;
}

.esw-expanding-toggle:focus,
.esw-expanding-toggle:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.esw-expanding-input::-webkit-search-cancel-button,
.esw-ajax-input::-webkit-search-cancel-button { display: none; }

.esw-ajax-search-field {
    position: relative;
    width: 100%;
}

.esw-ajax-input {
    width: 100%;
    padding-inline-start: 48px;
    padding-inline-end: 48px;
}

.esw-field-icon {
    position: absolute;
    inset-inline-start: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    pointer-events: none;
    z-index: 2;
}

.esw-field-icon svg { width: 20px; height: 20px; }

.esw-field-loader {
    position: absolute;
    inset-inline-end: 16px;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.esw-ajax-search-field.is-loading .esw-field-loader { opacity: 1; animation: esw-spin .7s linear infinite; }
@keyframes esw-spin { to { transform: rotate(360deg); } }

.esw-search-results { position: relative; width: 100%; }
.esw-results-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    transition: opacity .2s ease;
}
.esw-search-results.is-loading .esw-results-grid,
.esw-search-results.is-loading .esw-results-pagination { opacity: .42; pointer-events: none; }

.esw-results-status {
    min-height: 0;
    margin-bottom: 12px;
    font-size: 13px;
    opacity: .72;
}
.esw-results-status:empty { display: none; }

.esw-result-card {
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0,0,0,.07);
    border-radius: 22px;
    box-shadow: 0 10px 35px rgba(0,0,0,.06);
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease, background-color .28s ease;
}

.esw-result-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 45px rgba(0,0,0,.10);
}

.esw-card-media {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: rgba(0,0,0,.035);
    color: inherit;
}

.esw-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .55s cubic-bezier(.2,.7,.2,1);
}
.esw-result-card:hover .esw-card-media img { transform: scale(1.045); }

.esw-card-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    opacity: .35;
}
.esw-card-placeholder svg { width: 42px; height: 42px; }

.esw-card-badge {
    position: absolute;
    inset-inline-start: 14px;
    top: 14px;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #111;
    font-size: 12px;
    line-height: 1;
}

.esw-card-content { padding: 20px; }
.esw-card-title { margin: 0 0 12px; font-size: 17px; line-height: 1.8; }
.esw-card-title a { color: inherit; text-decoration: none; }
.esw-card-meta { min-height: 26px; margin-bottom: 18px; font-size: 14px; line-height: 1.8; }
.esw-card-price del { opacity: .5; margin-inline-end: 6px; }
.esw-card-price ins { text-decoration: none; }

.esw-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    background: rgba(0,0,0,.045);
    transition: gap .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
.esw-card-button svg { width: 17px; height: 17px; }
.esw-card-button:hover { gap: 13px; }

.esw-no-results {
    grid-column: 1 / -1;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: 30px;
    border: 1px dashed rgba(0,0,0,.14);
    border-radius: 20px;
}
.esw-no-results-icon { display: inline-flex; margin-bottom: 4px; opacity: .5; }
.esw-no-results-icon svg { width: 38px; height: 38px; }
.esw-no-results strong { font-size: 17px; }
.esw-no-results > span:last-child { font-size: 14px; opacity: .65; }

.esw-results-pagination { margin-top: 30px; }
.esw-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}
.esw-page-btn {
    min-width: 40px;
    height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 10px;
    background: transparent;
    color: inherit;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    text-decoration: none !important;
    transition: transform .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
.esw-page-btn:hover { transform: translateY(-2px); }
.esw-page-btn.is-active { background: #111; color: #fff; border-color: #111; }
.esw-page-btn svg { width: 16px; height: 16px; }

@media (max-width: 1024px) {
    .esw-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .esw-expanding-search { max-width: 100%; width: auto; }
    .esw-results-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .esw-card-content { padding: 16px; }
}


/*
 * Hard isolation from Elementor Kit / theme focus rules.
 * These selectors intentionally use high specificity + !important so the
 * widget keeps the exact Normal-state appearance while an input is focused.
 */
html body .elementor .elementor-element .esw-expanding-search input.esw-expanding-input:focus,
html body .elementor .elementor-element .esw-expanding-search input.esw-expanding-input:focus-visible,
html body .elementor .elementor-element .esw-expanding-search input.esw-expanding-input:active,
html body .elementor .elementor-element .esw-ajax-search-field input.esw-ajax-input:focus,
html body .elementor .elementor-element .esw-ajax-search-field input.esw-ajax-input:focus-visible,
html body .elementor .elementor-element .esw-ajax-search-field input.esw-ajax-input:active,
body .elementor-element .esw-expanding-search input[type="search"].esw-expanding-input:focus,
body .elementor-element .esw-expanding-search input[type="search"].esw-expanding-input:focus-visible,
body .elementor-element .esw-ajax-search-field input[type="search"].esw-ajax-input:focus,
body .elementor-element .esw-ajax-search-field input[type="search"].esw-ajax-input:focus-visible {
    outline: 0 !important;
    outline-width: 0 !important;
    outline-style: none !important;
    outline-color: transparent !important;
    outline-offset: 0 !important;
    -webkit-tap-highlight-color: transparent !important;
    box-shadow: var(--esw-normal-box-shadow, none) !important;
    -webkit-box-shadow: var(--esw-normal-box-shadow, none) !important;
    background: var(--esw-normal-background, transparent) !important;
    background-color: var(--esw-normal-background, transparent) !important;
    color: var(--esw-normal-color, inherit) !important;
    border-top-color: var(--esw-normal-border-top-color, transparent) !important;
    border-right-color: var(--esw-normal-border-right-color, transparent) !important;
    border-bottom-color: var(--esw-normal-border-bottom-color, transparent) !important;
    border-left-color: var(--esw-normal-border-left-color, transparent) !important;
    border-top-width: var(--esw-normal-border-top-width, 0px) !important;
    border-right-width: var(--esw-normal-border-right-width, 0px) !important;
    border-bottom-width: var(--esw-normal-border-bottom-width, 0px) !important;
    border-left-width: var(--esw-normal-border-left-width, 0px) !important;
    border-top-style: var(--esw-normal-border-top-style, none) !important;
    border-right-style: var(--esw-normal-border-right-style, none) !important;
    border-bottom-style: var(--esw-normal-border-bottom-style, none) !important;
    border-left-style: var(--esw-normal-border-left-style, none) !important;
}

html body .elementor .elementor-element .esw-expanding-search:focus-within,
html body .elementor .elementor-element .esw-expanding-form:focus-within,
html body .elementor .elementor-element .esw-ajax-search-field:focus-within {
    outline: 0 !important;
    box-shadow: none !important;
}

html body .elementor .elementor-element .esw-expanding-toggle:focus,
html body .elementor .elementor-element .esw-expanding-toggle:focus-visible,
html body .elementor .elementor-element .esw-expanding-toggle:active {
    outline: 0 !important;
    outline-width: 0 !important;
    outline-style: none !important;
    outline-color: transparent !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

/* The search trigger is intentionally not a native <button>.
 * This keeps Elementor Kit / theme global button styles from touching it. */
.elementor .esw-expanding-toggle[role="button"] {
    text-transform: none !important;
    letter-spacing: normal !important;
}


html body .elementor .elementor-element .esw-page-btn[role="button"]:focus,
html body .elementor .elementor-element .esw-page-btn[role="button"]:focus-visible,
html body .elementor .elementor-element .esw-page-btn[role="button"]:active {
    outline: 0 !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

/* =========================================================
 * Always-visible field mode
 * Field and icon are two completely separate flex items.
 * The icon never overlaps the input and each item can be sized
 * independently from Elementor.
 * ======================================================= */
.esw-expanding-search.esw-display-inline {
    --esw-inline-width: 100%;
    --esw-inline-gap: 10px;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
}

.esw-expanding-search.esw-display-inline .esw-expanding-form.esw-inline-form {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    transition: none !important;
    display: flex !important;
    align-items: center !important;
    gap: var(--esw-inline-gap) !important;
    direction: ltr !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-align-left .esw-inline-form {
    justify-content: flex-start !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-align-center .esw-inline-form {
    justify-content: center !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-align-right .esw-inline-form {
    justify-content: flex-end !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-align-stretch .esw-inline-form {
    justify-content: flex-start !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-icon-right .esw-inline-form {
    flex-direction: row !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-icon-left .esw-inline-form {
    flex-direction: row-reverse !important;
}

.esw-expanding-search.esw-display-inline .esw-inline-field-wrap {
    position: relative !important;
    display: block !important;
    flex: 0 1 var(--esw-inline-width) !important;
    width: var(--esw-inline-width) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    direction: rtl !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-align-stretch .esw-inline-field-wrap {
    flex-grow: 0 !important;
}

.esw-expanding-search.esw-display-inline .esw-expanding-input {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    inset: auto !important;
}

.esw-expanding-search.esw-display-inline .esw-expanding-toggle.esw-inline-submit {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: 5 !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* No Elementor/global button styling can leak into the detached search trigger. */
html body .elementor .elementor-element .esw-display-inline .esw-inline-submit[role="button"],
html body .elementor .elementor-element .esw-display-inline .esw-inline-submit[role="button"]:hover,
html body .elementor .elementor-element .esw-display-inline .esw-inline-submit[role="button"]:focus,
html body .elementor .elementor-element .esw-display-inline .esw-inline-submit[role="button"]:focus-visible,
html body .elementor .elementor-element .esw-display-inline .esw-inline-submit[role="button"]:active {
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1 !important;
    outline: 0 !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}


/* =========================================================
 * v1.1.2 — Persian RTL fields + inline button placement
 * ======================================================= */
.esw-expanding-input,
.esw-ajax-input {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: plaintext !important;
}

.esw-expanding-input::placeholder,
.esw-ajax-input::placeholder {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: plaintext !important;
    opacity: 1 !important;
}

.esw-expanding-search.esw-display-inline {
    --esw-inside-edge: 6px;
    --esw-icon-box-width: 44px;
}

/* Outside = detached field and button, as before. */
.esw-expanding-search.esw-display-inline.esw-inline-button-outside .esw-inline-form {
    gap: var(--esw-inline-gap) !important;
}

/* Inside = button is positioned inside the field boundary. */
.esw-expanding-search.esw-display-inline.esw-inline-button-inside .esw-inline-form {
    gap: 0 !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-button-inside .esw-inline-field-wrap {
    overflow: visible !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-button-inside .esw-inline-submit {
    position: absolute !important;
    top: 50% !important;
    z-index: 7 !important;
    width: var(--esw-icon-box-width) !important;
    min-width: var(--esw-icon-box-width) !important;
    max-width: var(--esw-icon-box-width) !important;
    margin: 0 !important;
    transform: translateY(-50%) !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-button-inside.esw-inline-icon-right .esw-inline-submit {
    right: var(--esw-inside-edge) !important;
    left: auto !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-button-inside.esw-inline-icon-left .esw-inline-submit {
    left: var(--esw-inside-edge) !important;
    right: auto !important;
}

/* Reserve enough typing space so Persian text never runs under the inside button. */
.esw-expanding-search.esw-display-inline.esw-inline-button-inside.esw-inline-icon-right .esw-expanding-input {
    padding-right: calc(var(--esw-icon-box-width) + var(--esw-inside-edge) + 10px) !important;
}

.esw-expanding-search.esw-display-inline.esw-inline-button-inside.esw-inline-icon-left .esw-expanding-input {
    padding-left: calc(var(--esw-icon-box-width) + var(--esw-inside-edge) + 10px) !important;
}
