/* Mergan Chemi — Blue Pool-style header modal (fully namespaced). */
.mergan-live-search {
  --mls-background: #fff;
  --mls-surface: #f8fbfc;
  --mls-foreground: #142f40;
  --mls-muted: #748891;
  --mls-border: #e2eae9;
  --mls-accent: #26927e;
  --mls-primary: #0e2f69;
  position: fixed;
  inset: 0;
  z-index: 999950;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: max(24px, env(safe-area-inset-top)) 18px 24px;
  color: var(--mls-foreground);
  font-family: var(--font-family-app, 'Yekan Bakh', sans-serif);
}
.mergan-live-search[hidden], .mergan-live-search [hidden] { display: none; }
html.mergan-live-search-open { overflow: hidden; }
.mergan-live-search__backdrop { position: absolute; inset: 0; background: rgba(4, 23, 42, .57); backdrop-filter: blur(7px); }
.mergan-live-search__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 900px);
  max-height: min(780px, calc(100dvh - 48px));
  min-width: 0;
  overflow: hidden;
  padding: clamp(16px, 3vw, 30px);
  border: 1px solid var(--mls-border);
  border-radius: 23px;
  background: var(--mls-background);
  box-shadow: 0 26px 90px rgba(5, 25, 41, .24);
  direction: rtl;
}
.mergan-live-search__head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.mergan-live-search__head > div { min-width: 0; }
.mergan-live-search__head span { display: block; color: var(--mls-accent); font-size: 12px; font-weight: 750; margin-bottom: 6px; }
.mergan-live-search__head h2 { margin: 0; color: var(--mls-foreground); font-size: clamp(16px, 2.6vw, 23px); font-weight: 800; line-height: 1.6; }
.mergan-live-search .mergan-live-search__close,
.mergan-live-search .mergan-live-search__clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 43px;
  height: 43px;
  min-width: 43px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 13px;
  background: #ecf3f2;
  color: #486d66;
  cursor: pointer;
  line-height: 1;
  box-sizing: border-box;
  transition: background-color .2s, color .2s;
}
.mergan-live-search .mergan-live-search__close:hover,
.mergan-live-search .mergan-live-search__clear:hover { background: #dcece8; color: #0e6657; }
.mergan-live-search .mergan-live-search__close svg,
.mergan-live-search .mergan-live-search__clear svg { width: 20px; height: 20px; margin: 0; padding: 0; display: block; flex: none; }
.mergan-live-search__field {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  width: 100%;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid var(--mls-accent);
  border-radius: 17px;
  background: var(--mls-background);
  box-shadow: 0 0 0 5px rgba(38, 146, 126, .08);
}
.mergan-live-search .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.mergan-live-search__field > svg { display: block; width: 22px; height: 22px; flex: none; color: var(--mls-accent); }
.mergan-live-search .mergan-live-search__field input[type="search"] {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  border: 0;
  outline: 0;
  box-shadow: none;
  margin: 0;
  padding: 4px 0;
  border-radius: 0;
  background: transparent;
  color: var(--mls-foreground);
  font: inherit;
  font-size: 15px;
  direction: rtl;
}
.mergan-live-search .mergan-live-search__field input[type="search"]::placeholder { color: var(--mls-muted); opacity: 1; }
.mergan-live-search .mergan-live-search__field input[type="search"]::-webkit-search-cancel-button { display: none; }
.mergan-live-search .mergan-live-search__clear { width: 37px; height: 37px; min-width: 37px; border-radius: 50%; }
.mergan-live-search__status { min-height: 33px; flex: none; margin: 14px 4px 4px; color: var(--mls-muted); font-size: 12px; text-align: right; }
.mergan-live-search__results { overflow-x: hidden; overflow-y: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; }
.mergan-live-search__groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 1px; }
.mergan-live-search__group { min-width: 0; border: 1px solid var(--mls-border); border-radius: 20px; padding: 17px; background: var(--mls-surface); }
.mergan-live-search__group-head { display: flex; justify-content: space-between; gap: 9px; align-items: center; margin-bottom: 14px; }
.mergan-live-search__group-head strong { font-size: 14px; font-weight: 800; color: var(--mls-foreground); }
.mergan-live-search__group-head span { font-size: 11px; color: var(--mls-muted); }
.mergan-live-search__list { display: grid; gap: 7px; }
.mergan-live-search a.mergan-live-search__item { display: flex; flex-direction: row; gap: 12px; align-items: center; min-width: 0; padding: 9px; border-radius: 13px; background: transparent; color: var(--mls-foreground); text-decoration: none; transition: background-color .18s; }
.mergan-live-search a.mergan-live-search__item:hover, .mergan-live-search a.mergan-live-search__item:focus-visible { background: rgba(38, 146, 126, .09); }
.mergan-live-search__media { flex: 0 0 66px; width: 66px; height: 66px; display: flex; justify-content: center; align-items: center; border: 1px solid var(--mls-border); border-radius: 13px; overflow: hidden; background: var(--mls-background); }
.mergan-live-search__media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mergan-live-search__placeholder { font-size: 11px; font-weight: 750; color: var(--mls-accent); }
.mergan-live-search__copy { display: flex; flex-direction: column; gap: 3px; flex: 1 1 0; min-width: 0; }
.mergan-live-search__type { color: var(--mls-accent); font-size: 10px; font-weight: 750; }
.mergan-live-search__name { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-width: 0; font-size: 12px; line-height: 1.8; color: var(--mls-foreground); font-weight: 800; }
.mergan-live-search__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mls-muted); font-size: 10.5px; }
.mergan-live-search__price { font-size: 11px; color: var(--mls-accent); font-weight: 750; unicode-bidi: plaintext; }
.mergan-live-search__group .mergan-live-search__empty {
  display: grid;
  place-items: center;
  min-height: 100px;
  min-width: 0;
  margin: 0;
  padding: 18px 12px;
  border: 1px dashed var(--mls-border);
  border-radius: 13px;
  background: var(--mls-background);
  color: var(--mls-muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.mergan-live-search__results.is-loading { opacity: .56; }
.mergan-live-search :focus-visible { outline: 2px solid var(--mls-accent); outline-offset: 3px; }
.mergan-native-search-button { border: 0; background: transparent; color: var(--foreground, #0e2f69); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border-radius: 9px; }
.mergan-native-search-button:hover { background: var(--nav-hover, #edf5f5); }
html.dark .mergan-live-search {
  --mls-background: #142437;
  --mls-surface: #1a2e3d;
  --mls-foreground: #edf8f8;
  --mls-muted: #a1b9c5;
  --mls-border: #385060;
  --mls-accent: #62c8b3;
}
html.dark .mergan-live-search .mergan-live-search__close,
html.dark .mergan-live-search .mergan-live-search__clear { background: #273f49; color: #d1e8e4; }
html.dark .mergan-live-search .mergan-live-search__close:hover,
html.dark .mergan-live-search .mergan-live-search__clear:hover { background: #38535c; color: #fff; }
@media (max-width: 640px) {
  .mergan-live-search { padding: max(12px, env(safe-area-inset-top)) 10px 14px; }
  .mergan-live-search__panel { max-height: calc(100dvh - 26px); padding: 15px 12px; border-radius: 19px; }
  .mergan-live-search__head { margin-bottom: 17px; }
  .mergan-live-search__field { min-height: 62px; padding: 5px 11px; gap: 8px; border-radius: 14px; }
  .mergan-live-search .mergan-live-search__field input[type="search"] { height: 43px; font-size: 12px; }
  .mergan-live-search__groups { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .mergan-live-search__group { padding: 12px; border-radius: 16px; }
  .mergan-live-search__media { width: 60px; height: 60px; flex-basis: 60px; }
}
