/* Панель поиска по сайту (лупа в шапке): frontend/web/static/search/site-search.js */

.vz-ss {
  --ss-ink: #21003A;
  --ss-muted: #6E5F7B;
  --ss-accent: #FFD31A;
  --ss-soft: #F8F5FB;
  --ss-hover: #F1EAF7;
  --ss-line: #E9E2EF;
  position: fixed;
  inset: 0;
  /* выше шапки и плавающих виджетов (чат, cookie) */
  z-index: 2147483000;
  font-family: "Circe", sans-serif;
  color: var(--ss-ink);
}

.vz-ss[hidden] {
  display: none;
}

body.vz-ss-open {
  overflow: hidden;
}

.vz-ss__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(33, 0, 58, 0.45);
  animation: vz-ss-fade 0.15s ease-out;
}

.vz-ss__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 1180px;
  max-height: min(86vh, 860px);
  margin: 16px auto 0;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(33, 0, 58, 0.25);
  overflow: hidden;
  animation: vz-ss-drop 0.18s ease-out;
}

@keyframes vz-ss-fade {
  from { opacity: 0; }
}

@keyframes vz-ss-drop {
  from { opacity: 0; transform: translateY(-12px); }
}

/* ---------- строка ввода */

.vz-ss__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 18px 28px;
  border-bottom: 1px solid var(--ss-line);
}

.vz-ss__bar-ico {
  opacity: 0.55;
}

.vz-ss__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 24px;
  font-weight: bold;
  color: var(--ss-ink);
  -webkit-appearance: none;
  appearance: none;
}

.vz-ss__input::placeholder {
  color: #B7AAC2;
  font-weight: normal;
}

.vz-ss__input::-webkit-search-cancel-button {
  display: none;
}

.vz-ss__close {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--ss-soft);
  cursor: pointer;
}

.vz-ss__close::before,
.vz-ss__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  background: var(--ss-ink);
  border-radius: 2px;
}

.vz-ss__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.vz-ss__close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.vz-ss__close:hover {
  background: var(--ss-accent);
}

/* ---------- тело */

.vz-ss__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 28px 28px;
}

.vz-ss__cols {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  grid-template-rows: auto 1fr;
  gap: 0 40px;
}

.vz-ss__main { grid-column: 1; grid-row: 1; }
.vz-ss__other { grid-column: 1; grid-row: 2; }
.vz-ss__side { grid-column: 2; grid-row: 1 / span 2; }

.vz-ss__main:empty,
.vz-ss__side:empty,
.vz-ss__other:empty {
  display: none;
}

.vz-ss__note {
  margin: 18px 0 2px;
  font-size: 15px;
  color: var(--ss-muted);
}

.vz-ss__note b {
  color: var(--ss-ink);
}

.vz-ss__empty {
  margin: 22px 0 6px;
  font-size: 20px;
  font-weight: bold;
}

.vz-ss__group {
  margin-top: 20px;
}

.vz-ss .vz-ss__group-title {
  margin: 0 0 8px;
  font-family: inherit;
  line-height: 1.3;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ss-muted);
}

/* строка-результат */
.vz-ss__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  outline: 0;
}

.vz-ss__item:hover,
.vz-ss__item[aria-selected="true"] {
  background: var(--ss-hover);
}

.vz-ss__thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--ss-soft);
  object-fit: cover;
}

.vz-ss__icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--ss-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.vz-ss__text {
  min-width: 0;
  flex: 1;
}

.vz-ss__title {
  display: block;
  font-size: 17px;
  font-weight: bold;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.vz-ss__title mark,
.vz-ss__chip mark {
  background: none;
  color: inherit;
  box-shadow: inset 0 -0.38em 0 var(--ss-accent);
}

.vz-ss__sub {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  color: var(--ss-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vz-ss__badge {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--ss-accent);
  font-size: 13px;
  font-weight: bold;
}

/* рубрики — чипсы */
.vz-ss__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vz-ss__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 14px 5px;
  border-radius: 10px;
  background: var(--ss-soft);
  color: inherit;
  font-weight: bold;
  text-decoration: none;
  outline: 0;
}

.vz-ss__chip small {
  font-weight: normal;
  color: var(--ss-muted);
}

.vz-ss__chip:hover,
.vz-ss__chip[aria-selected="true"] {
  background: var(--ss-accent);
}

.vz-ss__chip[aria-selected="true"] small,
.vz-ss__chip:hover small {
  color: var(--ss-ink);
}

/* ---------- мобильный: полноэкранный слой */

@media (max-width: 1151.98px) {
  .vz-ss__backdrop {
    display: none;
  }

  .vz-ss__panel {
    height: 100%;
    max-height: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    animation: vz-ss-fade 0.15s ease-out;
  }

  .vz-ss__bar {
    padding: 10px 12px 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  /* 16px и больше — iOS не зумит страницу при фокусе */
  .vz-ss__input {
    font-size: 18px;
  }

  .vz-ss__body {
    padding: 0 16px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .vz-ss__cols {
    display: block;
  }

  .vz-ss__thumb {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
  }

  .vz-ss__title {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vz-ss__backdrop,
  .vz-ss__panel {
    animation: none;
  }
}
