/* Meliran's desktop search: neutral glass, forest green details, native Elementor results. */
@media (min-width: 768px) {
  /*
   * Backdrop-filter on B-header creates a stacking context. Lift that context only
   * while desktop search is active so its dropdown paints above the home banner.
   */
  .elementor-location-header.meliran-search-layer-open {
    position: relative;
    z-index: 10000 !important;
    overflow: visible !important;
  }

  .elementor-location-header.meliran-search-layer-open .elementor-14484,
  .elementor-location-header.meliran-search-layer-open .elementor-element-1feed41,
  .elementor-location-header.meliran-search-layer-open .elementor-element-5c52b42 {
    overflow: visible !important;
  }
}

:is(.elementor-14484, .meliran-mobile-search-dialog) .elementor-widget-search.d-search {
  --ms-ink: #243c35;
  --ms-green: var(--e-global-color-b34b75b, #245248);
  --ms-muted: #78867f;
  --e-search-icon-label-color: var(--ms-green);
  --e-search-icon-label-size: 18px;
  --e-search-icon-clear-color: #7d8d84;
  --e-search-icon-clear-size: 12px;
  --e-search-input-and-results-gap: 12px;
  --e-search-results-width: min(400px, calc(100vw - 32px));
  --e-search-results-inset-inline-start: initial;
  --e-search-results-inset-inline-end: 0;
  --e-search-results-transform: none;
  --e-search-results-background-color: transparent;
  --e-search-results-border-width: 0px;
  --e-search-results-padding: 12px;
  --e-search-results-columns: 1;
  --e-search-results-row-gap: 7px;
  --e-search-results-max-height: min(520px, 68vh);
  --e-search-loader-icon-color: var(--ms-green);
  --e-search-loader-icon-size: 25px;
  width: 100%;
  min-width: 0;
  position: relative;
  z-index: 20;
  text-align: right;
}
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search:focus-within { z-index: 100; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-form { position: relative; margin: 0; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-input-wrapper { min-width: 0; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-input {
  width: 100%;
  min-height: 46px;
  height: 46px;
  padding: 10px 45px 10px 34px;
  border: 1px solid rgba(36, 82, 72, .14);
  border-radius: 15px;
  background: rgba(255, 255, 255, .56);
  color: var(--ms-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88), 0 3px 14px rgba(36, 66, 50, .035);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-input:hover { background: rgba(255,255,255,.72); border-color: rgba(36,82,72,.26); }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-input:focus {
  background: rgba(255,255,255,.84);
  border-color: rgba(36,82,72,.47);
  box-shadow: 0 0 0 4px rgba(36,82,72,.065), inset 0 1px 0 white;
  outline: none;
}
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-input::placeholder { color: var(--ms-muted); opacity: 1; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-label { pointer-events: none; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-label > :is(svg, i) { inset-inline-start: 16px; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-input-wrapper > :is(svg, i) { inset-inline-end: 14px; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-results-container { z-index: 1000; border: 0; background: transparent; }
.elementor-14484 .d-search .e-search-results-container { left: 0; right: auto; transform: translateX(var(--ms-panel-shift, 0px)); }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-results-container > .e-search-results:not(:empty),
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-results-container > .e-search-loader {
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 21px;
  background: rgba(250,253,251,.9);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 18px 48px rgba(22,49,34,.13), 0 3px 10px rgba(22,49,34,.04), inset 0 1px 0 white;
  scrollbar-width: thin;
  scrollbar-color: #c7d6cd transparent;
}
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-results:not(:empty)::before {
  content: "نتایج جستجو در ملیران";
  display: block;
  padding: 2px 7px 12px;
  color: #74867b;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-results-list { grid-template-columns: minmax(0, 1fr); }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-loader { padding: 28px; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-nothing-found-message { padding: 24px 16px 30px; color: #6a7b70; font-size: 13px; line-height: 2; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-loop-item { min-width: 0; }
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .meliran-search-loop {
  --padding-top: 0px; --padding-bottom: 0px; --padding-left: 0px; --padding-right: 0px;
  --gap: 0px; --row-gap: 0px; --column-gap: 0px;
  width: 100%;
}
.meliran-search-product {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  min-height: 112px;
  padding: 10px;
  border: 1px solid rgba(69,99,78,.075);
  border-radius: 15px;
  background: rgba(255,255,255,.64);
  color: #243c35;
  direction: rtl;
  text-align: right;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.meliran-search-product:hover,
.meliran-search-product:focus-within { border-color: rgba(36,82,72,.23); background: rgba(255,255,255,.96); box-shadow: 0 4px 14px rgba(30,65,42,.045); }
.meliran-search-product__visual { flex: 0 0 76px; width: 76px; height: 92px; border-radius: 10px; overflow: hidden; background: #f1f4ef; }
.meliran-search-product__visual img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; transition: transform .35s ease; }
.meliran-search-product:hover .meliran-search-product__visual img { transform: scale(1.035); }
.meliran-search-product__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.meliran-search-product__category { color: #829086; font-size: 10px; font-weight: 400; line-height: 1.7; }
.meliran-search-product .meliran-search-product__title { margin: 0; padding: 0; font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.9; }
.meliran-search-product__title a { color: #273e34; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meliran-search-product__title a::after { content: ""; position: absolute; inset: 0; border-radius: 15px; }
.meliran-search-product__title a:focus-visible { outline: none; }
.meliran-search-product__title a:focus-visible::after { outline: 2px solid #245248; outline-offset: 2px; }
.meliran-search-product__details { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.meliran-search-product__price { color: #245248; font-size: 12px; font-weight: 600; line-height: 1.9; }
.meliran-search-product__price :is(ins, del, bdi, span) { font-family: inherit; }
.meliran-search-product__price ins { text-decoration: none; background: transparent; }
.meliran-search-product__price del { color: #9ca59e; font-size: 10px; font-weight: 400; margin-inline-end: 5px; }
.meliran-search-product__price .woocommerce-Price-currencySymbol { font-size: 10px; font-weight: 400; }
.meliran-search-product__price a { position: relative; z-index: 1; }
.meliran-search-product__arrow { flex-shrink: 0; color: #6a8a76; opacity: .6; transition: transform .2s ease, opacity .2s ease; }
.meliran-search-product:hover .meliran-search-product__arrow { transform: translateX(-3px); opacity: 1; }
.meliran-search-product__stock { display: inline-block; padding: 1px 8px; border-radius: 6px; background: #f0f1ed; color: #8a8d80; font-size: 10px; }
@media (min-width: 768px) and (max-width: 1100px) {
  :is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-search-input { font-size: 12px; }
}
@media (max-width: 767px) {
  /* This new desktop-only search has its own container; preserve the mobile header. */
  :is(.elementor-14484, .meliran-mobile-search-dialog) .elementor-element-5c52b42 { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  :is(.elementor-14484, .meliran-mobile-search-dialog) .d-search *, .meliran-search-product * { transition: none !important; }
}

/* Archive stock ribbons should not escape the compact search cards. */
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-loop-item::before,
:is(.elementor-14484, .meliran-mobile-search-dialog) .d-search .e-loop-item::after { content: none !important; display: none !important; }
.meliran-search-product__price .woocommerce-Price-currencySymbol {
  display: inline !important; font-family: inherit !important; font-size: 10px !important;
  width: auto; height: auto; margin-inline-start: 2px;
}

/* The dedicated loop uses its own stock label, independent of archive ribbons. */
.e-loop-item-18825.outofstock { filter: none !important; }
.e-loop-item-18825.outofstock::before,
.e-loop-item-18825.outofstock::after { content: none !important; display: none !important; }
.meliran-search-product__stock { position: static; inset: auto; z-index: auto; }
.meliran-mobile-search-source { display: none !important; }
.meliran-mobile-search-trigger {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; width: 100%; min-height: 47px; padding: 0; border: 0;
  background: transparent !important; color: #243c35 !important;
  font-family: inherit; font-size: 9px; font-weight: 500; line-height: 1.7;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.meliran-mobile-search-trigger svg { width: 20px; height: 20px; }
.meliran-mobile-search-trigger:focus-visible { outline: 2px solid #245248; outline-offset: 2px; border-radius: 12px; }
.meliran-mobile-search-dialog {
  box-sizing: border-box; position: fixed; inset: auto;
  top: var(--ms-viewport-top, 0px); left: 0; right: 0;
  width: min(480px, calc(100vw - 24px)); max-width: calc(100vw - 24px);
  max-height: calc(var(--ms-visible-height, 100dvh) - 24px);
  margin: max(12px, env(safe-area-inset-top)) auto 0; padding: 18px 14px 14px;
  border: 1px solid rgba(255,255,255,.9); border-radius: 24px;
  background: rgba(250,253,251,.94); color: #243c35; direction: rtl; text-align: right;
  box-shadow: 0 18px 60px rgba(22,49,34,.18);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  overflow: auto; overscroll-behavior: contain;
}
.meliran-mobile-search-dialog:not([open]) { display: none; }
.meliran-mobile-search-dialog::backdrop { background: rgba(19,37,28,.3); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.meliran-mobile-search-dialog .meliran-mobile-search-source { display: flex !important; padding: 0; gap: 0; width: 100%; }
.meliran-mobile-search-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.meliran-mobile-search-heading h2 { margin: 0; font: inherit; font-size: 15px; font-weight: 600; }
.meliran-mobile-search-close {
  display: flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px;
  padding: 0; border: 1px solid rgba(36,82,72,.12); border-radius: 12px;
  background: rgba(255,255,255,.6); color: #245248; cursor: pointer;
}
.meliran-mobile-search-close svg { width: 18px; height: 18px; }
.meliran-mobile-search-dialog .elementor-widget-search.d-search { --e-search-results-width: 100%; --e-search-results-padding: 0px; --e-search-results-max-height: max(96px, calc(var(--ms-visible-height, 100dvh) - 186px)); z-index: auto; }
.meliran-mobile-search-dialog .elementor-widget-search.d-search .e-search-input { font-size: 16px; }
.meliran-mobile-search-dialog .elementor-widget-search.d-search .e-search-results-container { position: static; width: 100%; transform: none; margin-top: 14px; }
.meliran-mobile-search-dialog .elementor-widget-search.d-search .e-search-results:not(:empty),
.meliran-mobile-search-dialog .elementor-widget-search.d-search .e-search-loader { border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.meliran-mobile-search-dialog .meliran-search-product { gap: 10px; padding: 8px; min-height: 104px; }
.meliran-mobile-search-dialog .meliran-search-product__visual { flex-basis: 66px; width: 66px; height: 86px; }
.meliran-mobile-search-dialog .meliran-search-product__price { font-size: 11px; }
@media (min-width: 768px) { .meliran-mobile-search-dialog { display: none !important; } }

/* Results remain in flow on mobile; anchor both icons to the 46px input row. */
.meliran-mobile-search-dialog .d-search .e-search-label > :is(svg, i),
.meliran-mobile-search-dialog .d-search .e-search-input-wrapper > :is(svg, i) { inset-block-start: 23px; }
.meliran-mobile-search-dialog .meliran-mobile-search-close:is(:hover, :focus-visible) { background: #edf3ef; color: #245248; border-color: rgba(36,82,72,.3); }
