/* FirmBaza: быстрый поиск — кнопка-лупа + модальное окно (базы + статьи) */
#headerInner { gap: .5rem; }

#fbQuickSearchBtn { margin-right: .25rem; }

/* ===== Кнопка-лупа в шапке (стиль как у корзины: силуэт без тени) ===== */
#fbQuickSearchBtn,
.fb-qs-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1.5px solid #0f172a;
  border-radius: 12px;
  background: #fff;
  color: #000;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

#fbQuickSearchBtn i,
.fb-qs-btn i { font-size: 1.05rem; }

#fbQuickSearchBtn svg,
.fb-qs-btn svg { width: 20px; height: 20px; display: block; }

#fbQuickSearchBtn:hover,
.fb-qs-btn:hover { background: #f8fafc; transform: translateY(-1px); }

#fbQuickSearchBtn:active,
.fb-qs-btn:active { transform: translateY(0); }

#fbQuickSearchBtn:focus-visible,
.fb-qs-btn:focus-visible { outline: 2px solid #dc2626; outline-offset: 3px; }

.fb-qs-btn--fixed { position: fixed; top: 1rem; right: 1rem; z-index: 1100; }

/* ===== Модальное окно ===== */
.fb-qs-modal { position: fixed; inset: 0; z-index: 1200; }

.fb-qs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fbQsFade .16s ease-out;
}

.fb-qs-dialog {
  position: relative;
  width: min(44rem, calc(100vw - 2rem));
  margin: 8vh auto 0;
  max-height: min(78vh, 44rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 2px solid #0f172a;
  border-radius: 22px;
  box-shadow: 8px 8px 0 #0f172a;
  overflow: hidden;
  animation: fbQsPop .2s cubic-bezier(.22, .61, .36, 1);
}

.fb-qs-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .5rem .5rem 1.1rem;
  border-bottom: 2px solid #0f172a;
  flex-shrink: 0;
}

.fb-qs-field-icon { color: #94a3b8; flex-shrink: 0; display: inline-flex; }
.fb-qs-field-icon svg { width: 20px; height: 20px; display: block; }
.fb-qs-field:focus-within .fb-qs-field-icon { color: var(--jq-coral, #ff5b2e); }

.fb-qs-field-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-sans, inherit);
  font-size: 1.05rem;
  color: #0f172a;
  padding: .55rem 0;
  -webkit-appearance: none;
  appearance: none;
}

.fb-qs-field-input::placeholder { color: #94a3b8; font-weight: 500; }
.fb-qs-field-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.fb-qs-field-clear {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  font-size: .95rem;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.fb-qs-field-clear:hover { background: #e2e8f0; color: #0f172a; }

.fb-qs-results {
  flex: 1;
  min-height: 7rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .5rem;
  scrollbar-width: thin;
}

.fb-qs-results::-webkit-scrollbar { width: 10px; }
.fb-qs-results::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; border: 3px solid #fff; }

.fb-qs-group {
  padding: .7rem .8rem .3rem;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #64748b;
}

.fb-qs-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  padding: .65rem .8rem;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s ease;
}

.fb-qs-item:hover { background: #f1f5f9; }
.fb-qs-item.is-active { background: #f1f5f9; box-shadow: inset 0 0 0 2px #0f172a; }

.fb-qs-ic {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  color: #fff;
  background: #0f172a;
  overflow: hidden;
}

.fb-qs-ic img { width: 100%; height: 100%; object-fit: cover; border-radius: 11px; }

.fb-qs-txt { min-width: 0; flex: 1; }

.fb-qs-title {
  display: block;
  font-size: .95rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-qs-sub {
  display: block;
  font-size: .76rem;
  color: #64748b;
  margin-top: .1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-qs-price { flex-shrink: 0; font-size: .88rem; font-weight: 800; color: #047857; white-space: nowrap; }

.fb-qs-empty { padding: 2rem 1rem; font-size: .9rem; color: #64748b; text-align: center; }

.fb-qs-all {
  display: block;
  width: calc(100% - .4rem);
  margin: .4rem .2rem .2rem;
  padding: .85rem 1rem;
  border: none;
  border-radius: 14px;
  background: #0f172a;
  color: #fff;
  font-family: var(--font-display, inherit);
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background-color .15s ease;
}

.fb-qs-all:hover { background: var(--jq-coral, #ff5b2e); }

.fb-qs mark { background: var(--jq-lime, #c8f04b); color: inherit; padding: 0 .1em; border-radius: 3px; }

.fb-qs-foot {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.25rem;
  padding: .6rem 1.2rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: .72rem;
  color: #64748b;
}

.fb-qs-foot kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: .05rem .35rem;
  margin-right: .15rem;
  font-family: var(--font-mono, monospace);
  font-size: .72rem;
  text-align: center;
  color: #0f172a;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 5px;
}

body.fb-qs-open { overflow: hidden; }

@keyframes fbQsFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fbQsPop { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 640px) {
  .fb-qs-dialog {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .fb-qs-foot { display: none; }
}

/* Десктопная лупа не дублируется на мобильном (там своя, в блоке действий) */
@media (max-width: 767.5px) {
  #fbQuickSearchBtn:not(.fb-qs-btn--fixed) { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .fb-qs-dialog, .fb-qs-backdrop, .fb-qs-btn { animation: none !important; transition: none !important; }
}
