/* =========================================================
   ZHIIN PRODUCT SEARCH
   Elementor / WooCommerce / RTL / Mobile First
========================================================= */

html.zps-page-locked { overflow: hidden; }

.zps {
    --zps-primary: #315c49;
    --zps-primary-dark: #244838;
    --zps-text: #242924;
    --zps-muted: #7a817b;
    --zps-border: rgba(49, 92, 73, 0.16);
    --zps-surface: #ffffff;
    --zps-soft: #f8f9f5;
    --zps-danger: #c85058;
    --zps-field-height: 56px;
    --zps-trigger-size: 48px;
    --zps-panel-width: 520px;
    --zps-results-height: 430px;
    --zps-image-size: 68px;
    position: relative;
    width: 100%;
    direction: rtl;
    font-family: inherit;
    color: var(--zps-text);
    box-sizing: border-box;
}

.zps *, .zps *::before, .zps *::after { box-sizing: border-box; }
.zps button, .zps input { font: inherit; }
.zps button { -webkit-tap-highlight-color: transparent; }
.zps--preset-header { width: auto; display: inline-flex; }
.zps--preset-archive { width: 100%; display: block; }

.zps__trigger {
    appearance: none;
    width: var(--zps-trigger-size);
    min-width: var(--zps-trigger-size);
    height: var(--zps-trigger-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0;
    border: 1px solid var(--zps-border);
    border-radius: 15px;
    color: var(--zps-primary);
    background: rgba(255,255,255,.88);
    box-shadow: none;
    cursor: pointer;
    transition: transform .18s ease, color .18s ease, background-color .18s ease, border-color .18s ease;
}

.zps__trigger--has-label { width: auto; padding-inline: 15px; }
.zps__trigger:hover { color: #fff; background: var(--zps-primary); border-color: var(--zps-primary); transform: translateY(-1px); }
.zps__trigger-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.zps__trigger-icon svg, .zps__trigger-icon i { width: 20px; height: 20px; font-size: 20px; line-height: 1; fill: currentColor; }
.zps__trigger-label { font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; }

.zps__surface { z-index: 99999; }
.zps__surface[popover] { margin: 0; padding: 0; border: 0; color: inherit; }
.zps__surface[popover]::backdrop { background: transparent; }
.zps__dialog { position: relative; width: 100%; direction: rtl; }

.zps__close {
    position: absolute;
    z-index: 5;
    top: 16px;
    left: 16px;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--zps-border);
    border-radius: 50%;
    color: var(--zps-text);
    background: #fff;
    cursor: pointer;
    transition: transform .18s ease, color .18s ease, background-color .18s ease, border-color .18s ease;
}

.zps__close:hover {
    color: #fff;
    background: var(--zps-primary);
    border-color: var(--zps-primary);
    transform: rotate(90deg);
}

.zps__close::before, .zps__close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 15px;
    height: 1.5px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
}

.zps__close::before { transform: translate(-50%,-50%) rotate(45deg); }
.zps__close::after { transform: translate(-50%,-50%) rotate(-45deg); }
.zps__close:hover { color: #fff; background: var(--zps-primary); border-color: var(--zps-primary); transform: rotate(4deg); }

.zps__form {
    position: relative;
    width: 100%;
    height: var(--zps-field-height);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 14px;
    border: 1px solid var(--zps-border);
    border-radius: 16px;
    background: var(--zps-surface);
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.zps__form:focus-within { border-color: rgba(49,92,73,.58); box-shadow: 0 0 0 4px rgba(49,92,73,.08); }

.zps__input {
    min-width: 0;
    flex: 1;
    height: 100%;
    margin: 0;
    padding: 0 6px;
    border: 0 !important;
    outline: 0 !important;
    color: var(--zps-text);
    background: transparent !important;
    box-shadow: none !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-align: right;
    appearance: none;
}

.zps__input::-webkit-search-cancel-button { display: none; }
.zps__input::placeholder { color: var(--zps-muted); opacity: 1; }

.zps__submit {
    width: calc(var(--zps-field-height) - 16px);
    height: calc(var(--zps-field-height) - 16px);
    min-width: calc(var(--zps-field-height) - 16px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    color: var(--zps-primary);
    background: rgba(49,92,73,.09);
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, transform .18s ease;
}

.zps__submit:hover { color: #fff; background: var(--zps-primary); transform: scale(1.03); }
.zps__submit svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.zps__loader {
    position: absolute;
    left: calc(var(--zps-field-height) + 6px);
    top: 50%;
    width: 17px;
    height: 17px;
    margin-top: -8.5px;
    border: 2px solid rgba(49,92,73,.16);
    border-top-color: var(--zps-primary);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: zps-spin .7s linear infinite;
}

.zps--loading .zps__loader { opacity: 1; }
@keyframes zps-spin { to { transform: rotate(360deg); } }

.zps__results-shell { overflow: hidden; background: var(--zps-soft); }
.zps__status { padding: 20px 16px; color: var(--zps-muted); font-size: 13px; font-weight: 500; line-height: 1.9; text-align: center; }

.zps__results {
    max-height: var(--zps-results-height);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(49,92,73,.28) transparent;
}

.zps__results:empty { display: none; }
.zps__results::-webkit-scrollbar { width: 5px; }
.zps__results::-webkit-scrollbar-track { background: transparent; }
.zps__results::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(49,92,73,.25); }

.zps__result {
    position: relative;
    width: 100%;
    display: grid;
    grid-template-columns: var(--zps-image-size) minmax(0,1fr);
    gap: 13px;
    align-items: center;
    margin: 0 0 8px;
    padding: 10px;
    border: 1px solid rgba(49,92,73,.11);
    border-radius: 16px;
    color: inherit;
    background: #fff;
    text-decoration: none !important;
    box-shadow: 0 4px 15px rgba(26,44,33,.025);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.zps__result--no-image { grid-template-columns: minmax(0,1fr); }
.zps__result:last-child { margin-bottom: 0; }
.zps__result:hover, .zps__result:focus-visible, .zps__result.is-active { outline: none; border-color: rgba(49,92,73,.32); background: #fff; box-shadow: 0 8px 24px rgba(26,44,33,.065); transform: translateY(-1px); }

.zps__image { width: var(--zps-image-size); height: var(--zps-image-size); display: block; overflow: hidden; border-radius: 13px; background: #f3f5f1; }
.zps__image img { width: 100%; height: 100%; display: block; margin: 0; padding: 4px; object-fit: contain; object-position: center; }
.zps__result-content { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.zps__result-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.zps__result-title { min-width: 0; display: -webkit-box; overflow: hidden; color: var(--zps-text); font-size: 13px; font-weight: 700; line-height: 1.85; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.zps__sale { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-height: 22px; padding: 3px 8px; border-radius: 999px; color: #a9444b; background: rgba(200,80,88,.09); font-size: 10px; font-weight: 800; line-height: 1; }
.zps__result-meta { overflow: hidden; color: var(--zps-muted); font-size: 11px; font-weight: 500; line-height: 1.6; text-overflow: ellipsis; white-space: nowrap; }
.zps__result-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; }
.zps__price { color: var(--zps-primary); font-size: 13px; font-weight: 800; line-height: 1.6; white-space: nowrap; }
.zps__price del { margin-left: 5px; color: #929892; font-size: .85em; font-weight: 500; opacity: .8; }
.zps__price ins { color: inherit; text-decoration: none; }
.zps__stock { color: var(--zps-muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.zps__stock--instock { color: var(--zps-primary); }
.zps__stock--outofstock { color: var(--zps-danger); }

.zps__view-all {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 12px 16px;
    border-top: 1px solid var(--zps-border);
    color: var(--zps-primary) !important;
    background: rgba(49,92,73,.04);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
    text-decoration: none !important;
    transition: color .18s ease, background-color .18s ease;
}

.zps__view-all:hover { color: #fff !important; background: var(--zps-primary); }
.zps__view-all svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: scaleX(-1); }

/* Inline */
.zps--mode-inline .zps__surface { position: relative; width: 100%; }
.zps--mode-inline .zps__dialog { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.zps--mode-inline .zps__results-shell {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(var(--zps-panel-width), calc(100vw - 24px));
    border: 1px solid var(--zps-border);
    border-radius: 20px;
    box-shadow: 0 22px 60px rgba(21,38,27,.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-7px);
    transition: opacity .18s ease, visibility .18s ease, transform .22s cubic-bezier(.22,1,.36,1);
}

.zps--mode-inline.zps--results-visible .zps__results-shell { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }

/* Expand */
.zps--mode-expand .zps__surface {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(var(--zps-panel-width), calc(100vw - 24px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(.985);
    transform-origin: top right;
    transition: opacity .18s ease, visibility .18s ease, transform .23s cubic-bezier(.22,1,.36,1);
}

.zps--mode-expand .zps__dialog { padding: 62px 16px 16px; border: 1px solid var(--zps-border); border-radius: 22px; background: var(--zps-soft); box-shadow: 0 22px 60px rgba(21,38,27,.15); }
.zps--mode-expand .zps__results-shell { margin-top: 10px; border: 1px solid var(--zps-border); border-radius: 17px; }
.zps--mode-expand.zps--open .zps__surface { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); }

/* Modal / Fullscreen */
.zps--mode-modal .zps__surface,
.zps--mode-fullscreen .zps__surface,
.zps--effective-modal .zps__surface,
.zps--effective-fullscreen .zps__surface {
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--asw-viewport-height, 100vh);
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(22,31,25,.45);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
}

.zps--mode-modal .zps__dialog,
.zps--effective-modal .zps__dialog {
    width: min(var(--zps-panel-width), calc(100vw - 36px));
    max-height: calc(var(--asw-viewport-height, 100vh) - 36px);
    display: flex;
    flex-direction: column;
    padding: 70px 18px 18px;
    overflow: hidden;
    border: 1px solid var(--zps-border);
    border-radius: 24px;
    background: var(--zps-soft);
    box-shadow: 0 28px 90px rgba(16,29,20,.24);
    transform: translateY(12px) scale(.98);
    transition: transform .28s cubic-bezier(.22,1,.36,1);
}

.zps--mode-modal .zps__results-shell, .zps--effective-modal .zps__results-shell { min-height: 0; margin-top: 12px; border: 1px solid var(--zps-border); border-radius: 18px; }

.zps--mode-fullscreen .zps__dialog,
.zps--effective-fullscreen .zps__dialog {
    width: min(940px, calc(100vw - 48px));
    height: min(760px, calc(var(--asw-viewport-height, 100vh) - 48px));
    display: flex;
    flex-direction: column;
    padding: 90px clamp(18px,4vw,54px) 28px;
    overflow: hidden;
    border: 1px solid var(--zps-border);
    border-radius: 28px;
    background: var(--zps-soft);
    box-shadow: 0 28px 90px rgba(16,29,20,.24);
    transform: translateY(12px) scale(.985);
    transition: transform .3s cubic-bezier(.22,1,.36,1);
}

.zps--mode-fullscreen .zps__form, .zps--effective-fullscreen .zps__form { max-width: 760px; margin-inline: auto; }
.zps--mode-fullscreen .zps__results-shell, .zps--effective-fullscreen .zps__results-shell { width: min(760px,100%); min-height: 0; margin: 16px auto 0; border: 1px solid var(--zps-border); border-radius: 20px; }

.zps--mode-modal.zps--open .zps__surface,
.zps--mode-fullscreen.zps--open .zps__surface,
.zps--effective-modal.zps--open .zps__surface,
.zps--effective-fullscreen.zps--open .zps__surface { opacity: 1; visibility: visible; pointer-events: auto; }

.zps--mode-modal.zps--open .zps__dialog,
.zps--mode-fullscreen.zps--open .zps__dialog,
.zps--effective-modal.zps--open .zps__dialog,
.zps--effective-fullscreen.zps--open .zps__dialog { transform: translateY(0) scale(1); }

@media (max-width: 767px) {
    .zps--preset-header { width: auto; max-width: 100%; flex: 0 0 auto; }
    .zps--mobile-modal .zps__surface,
    .zps--mobile-fullscreen .zps__surface { position: fixed; inset: 0; top: 0; right: 0; left: 0; width: 100%; height: var(--asw-viewport-height, 100vh); transform: none; }

    .zps--mobile-modal .zps__dialog { width: calc(100vw - 24px); max-width: 430px; max-height: calc(var(--asw-viewport-height, 100vh) - 24px); padding: 62px 12px 12px; border-radius: 20px; }

    .zps--mobile-fullscreen .zps__surface { padding: 0; background: var(--zps-soft); backdrop-filter: none; -webkit-backdrop-filter: none; }
    .zps--mobile-fullscreen .zps__dialog { width: 100%; height: var(--asw-viewport-height, 100vh); max-width: none; max-height: none; padding: calc(62px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
    .zps--mobile-fullscreen .zps__close { top: calc(12px + env(safe-area-inset-top)); left: 12px; }
    .zps--mobile-fullscreen .zps__results-shell { flex: 1; min-height: 0; margin-top: 10px; border: 1px solid var(--zps-border); border-radius: 17px; }
    .zps--mobile-fullscreen .zps__results { max-height: none; height: 100%; }
    .zps--preset-header.zps--mode-inline { width: min(100%,360px); }

    .zps--mode-inline .zps__results-shell { position: fixed; z-index: 99999; top: auto; right: 12px; bottom: 12px; left: 12px; width: auto; max-height: min(calc(var(--asw-viewport-height, 100vh) * 0.65),520px); transform: translateY(12px); }
    .zps--mode-inline.zps--results-visible .zps__results-shell { transform: translateY(0); }

    .zps__result { grid-template-columns: min(60px,var(--zps-image-size)) minmax(0,1fr); gap: 10px; padding: 8px; border-radius: 14px; }
    .zps__result--no-image { grid-template-columns: minmax(0,1fr); }
    .zps__image { width: min(60px,var(--zps-image-size)); height: min(60px,var(--zps-image-size)); border-radius: 11px; }
    .zps__result-title { font-size: 12px; line-height: 1.75; }
    .zps__form { height: min(54px,var(--zps-field-height)); }
    .zps__results { max-height: min(var(--zps-results-height),calc(var(--asw-viewport-height, 100vh) * 0.52)); }
}

@media (max-width: 390px) {
    .zps__result-top { gap: 6px; }
    .zps__sale { padding-inline: 6px; }
    .zps__result-bottom { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (max-height: 620px) {
    .zps--mode-modal .zps__dialog, .zps--effective-modal .zps__dialog { max-height: calc(var(--asw-viewport-height, 100vh) - 16px); padding-top: 58px; padding-bottom: 10px; }
    .zps__results { max-height: min(var(--zps-results-height),calc(var(--asw-viewport-height, 100vh) * 0.45)); }
}

.zps a:focus-visible, .zps button:focus-visible, .zps input:focus-visible { outline: 2px solid var(--zps-primary) !important; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    .zps *, .zps *::before, .zps *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================
   v1.0.1 — Elementor state controls compatibility
========================================================= */
.zps__trigger-icon,
.zps__trigger-icon svg,
.zps__trigger-icon i,
.zps__submit,
.zps__submit svg {
	color: inherit;
}

.zps__trigger-icon svg {
	fill: currentColor;
}

.zps__submit svg {
	stroke: currentColor;
}

.zps__submit {
	border-width: 1px;
	border-style: solid;
	border-color: transparent;
}

.zps__surface[popover] { max-width: none; max-height: none; }
.zps.zps--effective-modal .zps__surface,
.zps.zps--effective-fullscreen .zps__surface { top: var(--asw-viewport-top, 0px); bottom: auto; }
@media (max-width: 767px) {
 .zps .zps__input { font-size: max(16px, 1em); }
 .zps .zps__form { flex-shrink: 0; }
 .zps .zps__results-shell { overflow: auto; -webkit-overflow-scrolling: touch; }
}
