/* assets/site-search.css — віджет пошуку у шапці. */

.site-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.site-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: var(--sh-blue);
  transition: background .15s ease;
  padding: 0;
}
.site-search-toggle:hover,
.site-search.open .site-search-toggle {
  background: rgba(30, 74, 140, .08);
}
.site-search-toggle svg { width: 18px; height: 18px; display: block; }

/* Поле пошуку: випадає панеллю ПІД іконкою (праворуч), щоб НЕ перекривати
   пункти навігації. Раніше воно «висувалося вліво» поверх меню — на ноутбуках
   це накладалося на кнопки хедера. */
.site-search-form {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  left: auto;
  display: flex;
  align-items: center;
  width: min(380px, calc(100vw - 32px));
  background: var(--sh-surface);
  border: 1px solid var(--sh-border, #E5E7EB);
  border-radius: 24px;
  box-shadow: 0 12px 32px rgba(13,42,85,.16);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .24s cubic-bezier(.2,.7,.3,1), visibility .18s;
  z-index: 130;
}
/* «Місток» між іконкою та панеллю — щоб hover не зривався у проміжку */
.site-search-form::before {
  content: '';
  position: absolute;
  top: -14px; left: 0; right: 0; height: 14px;
}
.site-search:hover .site-search-form,
.site-search:focus-within .site-search-form,
.site-search.open .site-search-form {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.site-search-input {
  flex: 1;
  border: 0;
  outline: none;
  padding: 9px 14px 9px 18px;
  font-size: 14px;
  background: transparent;
  color: var(--sh-blue);
  font-family: inherit;
}
.site-search-input::placeholder { color: var(--sh-gray); }
.site-search-form .site-search-submit {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 8px 12px;
  color: var(--sh-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.site-search-form .site-search-submit svg { width: 16px; height: 16px; }

/* Випадайка з результатами — під полем пошуку, що вже випало нижче хедера */
.site-search-results {
  position: absolute;
  right: 0;
  top: calc(100% + 62px);
  width: min(380px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--sh-surface);
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0,0,0,.18);
  display: none;
  z-index: 129;
}
.site-search.open .site-search-results.has-results { display: block; }

.ss-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--sh-gray-900);
  border-bottom: 1px solid var(--sh-border, #f0f2f6);
  transition: background .12s ease;
}
.ss-item:last-of-type { border-bottom: 0; }
.ss-item:hover,
.ss-item.is-active { background: var(--sh-blue-pale); }
.ss-thumb {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--sh-surface-2);
  display: flex; align-items: center; justify-content: center;
}
.ss-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.ss-noimg {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, #d8def0, #bfc9e0);
  border-radius: 4px; opacity: .7;
}
.ss-meta { flex: 1; min-width: 0; }
.ss-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  color: var(--sh-blue);
  margin: 0 0 3px;
}
.ss-snip {
  font-size: 12px;
  line-height: 1.4;
  color: var(--sh-gray);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ss-cat {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--sh-gray);
  background: var(--sh-surface-2);
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.ss-cat.c-service  { background: #e7f1ff; color: var(--sh-blue); }
.ss-cat.c-product  { background: #fff4e0; color: #a66700; }
.ss-cat.c-blog     { background: #ecfaee; color: #2c7a3a; }
.ss-cat.c-calc     { background: #f3e8ff; color: #6b34c0; }

.ss-empty {
  padding: 22px 16px;
  text-align: center;
  color: var(--sh-gray);
  font-size: 14px;
}
.ss-all {
  display: block;
  padding: 11px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--sh-blue);
  text-decoration: none;
  background: var(--sh-blue-pale);
  border-top: 1px solid var(--sh-border, #e7eaf2);
}
.ss-all:hover { background: var(--sh-blue-pale); }

mark {
  background: #fff2c2;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* ── Мобільний пошук у мобільному меню ─────────────────────────────────── */
.mobile-search {
  margin: 4px 0 14px;
  position: relative;
}
.mobile-search-form {
  display: flex;
  align-items: center;
  background: var(--sh-surface-2);
  border-radius: 22px;
  padding: 4px 4px 4px 16px;
}
.mobile-search-input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 15px;
  padding: 10px 6px;
  color: var(--sh-blue);
  font-family: inherit;
}
.mobile-search-submit {
  border: 0;
  background: #1E4A8C;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mobile-search-submit svg { width: 16px; height: 16px; }
.mobile-search .site-search-results {
  position: static;
  width: 100%;
  max-width: 100%;
  margin-top: 8px;
  box-shadow: none;
  border: 1px solid var(--sh-border, #e7eaf2);
}

/* На малих екранах ховаємо весь desktop-віджет — у мобільному меню є власний пошук */
@media (max-width: 900px) {
  .site-search { display: none; }
}
