/* COSMOS 2026 — Search Hub v3 (capsule + dropdowns) */

/* === ОТДЕЛЬНЫЙ ВИЗУАЛЬНЫЙ МОДУЛЬ === */
.cn-sh-module {
  display: block;
  background:
    radial-gradient(ellipse at top left, rgba(255, 204, 0, .04), transparent 60%),
    linear-gradient(180deg, rgba(13, 19, 36, .8) 0%, rgba(13, 19, 36, .5) 100%);
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 24px;
  padding: 24px 24px 22px;
  margin: 0 0 40px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, .45),
    inset 0 1px 0 rgba(255, 255, 255, .03);
  /* COSMOS 2026-06-15: модуль должен быть ВЫШЕ iframe-баннеров и других composited layers.
     z-index работает только в одинаковых stacking contexts; iframe часто рисуются в
     собственных compositor layers и перекрывают обычный CSS, поэтому даём transform
     для создания собственного composited layer. */
  position: relative;
  z-index: 100;
  isolation: isolate;
}
/* состояние «открыт дропдаун» — поднимаем модуль ещё выше и переводим его в свой layer */
.cn-sh-module.cn-sh-open,
.cn-sh-module:has(.cn-sh3-dd:not([hidden])) {
  z-index: 9999;
  transform: translateZ(0);
  will-change: transform;
}

/* iframe-баннеры рекламной карусели не должны перекрывать поисковые дропдауны:
   баннеры идут после хаба в DOM и из-за compositor layer могут «всплывать». */
/* COSMOS 2026-06-15: НЕ трогаем position у .cn-ad-slide — он у них absolute по дизайну.
   Перекрытие iframe решается через portal в body (см. search-hub.js). */

/* подсветка поля при пустом submit */
.cn-sh3-inp--empty {
  animation: cn-sh3-shake .4s ease-in-out;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, .55) inset;
  border-radius: 12px;
}
@keyframes cn-sh3-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.cn-sh-module + * {
  margin-top: 12px;
}
.cn-sh-module::after {
  content: '';
  display: block;
  height: 2px;
  margin: 24px -24px -22px;
  background: linear-gradient(90deg, transparent, rgba(255, 204, 0, .35), transparent);
}

.cn-sh2 {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  position: relative;
}

/* universal hidden override for hub-internal elements */
.cn-sh2 [hidden] { display: none !important; }

/* compact/mini больше не используем — всегда полная капсула */
.cn-sh2-mini { display: none !important; }
.cn-sh2-body { display: block; }

/* ============ MAIN CAPSULE ============ */
.cn-sh3-capsule {
  display: flex; align-items: stretch;
  background: #171e32;
  border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 999px;
  padding: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
  position: relative;
  margin: 0;
}
/* COSMOS 2026-06-15: type вынесен из формы — формы становятся flex-row внутри капсулы */
.cn-sh3-form {
  display: flex; align-items: stretch;
  flex: 1 1 auto; min-width: 0;
  margin: 0; padding: 0; background: transparent; border: 0;
}
.cn-sh3-form[hidden] { display: none !important; }
.cn-sh3-form--ya { gap: 0; }
.cn-sh3-sep {
  display: block; width: 1px; align-self: center;
  height: 28px; background: rgba(148, 163, 184, .20); flex: none;
}

.cn-sh3-segment { position: relative; display: flex; align-items: center; }
.cn-sh3-segment--type { flex: none; }
.cn-sh3-segment--input { flex: 1 1 auto; min-width: 0; padding: 0 14px; gap: 10px; }
.cn-sh3-segment--region { flex: none; }

.cn-sh3-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; color: #e2e8f0;
  font-size: 14px; font-family: inherit; cursor: pointer;
  padding: 8px 14px; border-radius: 999px;
  transition: background-color .15s;
}
.cn-sh3-btn:hover { background: #1e2740; }
.cn-sh3-btn[aria-expanded="true"] { background: #1e2740; }
.cn-sh3-btn[aria-expanded="true"] .cn-sh3-arr { transform: rotate(180deg); }

.cn-sh3-arr { font-size: 11px; color: #94a3b8; transition: transform .2s; }

.cn-sh3-type-icon { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; color: #94a3b8; }
.cn-sh3-type-icon.is-letter { font-weight: 700; color: #94a3b8; }
.cn-sh3-type-icon.is-ya { font-weight: 700; color: #ef4444; }
.cn-sh3-type-label { font-weight: 500; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

.cn-sh3-inp-ico { color: #94a3b8; font-size: 16px; flex: none; }
.cn-sh3-inp {
  flex: 1; min-width: 0; border: 0; background: transparent; color: #fff;
  font-size: 15px; outline: none; padding: 12px 0;
}
.cn-sh3-inp::placeholder { color: #64748b; }

.cn-sh3-region-ico { color: #ffcc00; font-size: 15px; }
.cn-sh3-region-stack { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.cn-sh3-region-cap { font-size: 10px; color: #94a3b8; margin-bottom: 2px; }
.cn-sh3-region-val { font-size: 14px; color: #fff; font-weight: 500; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.cn-sh3-region-val #cn-sh2-loc-radius { color: #ffcc00; margin-left: 4px; font-size: 11px; }

.cn-sh3-find {
  background: #ffcc00; color: #0a0f1c;
  font-weight: 700; font-size: 14px; font-family: inherit;
  border: 0; padding: 0 30px; border-radius: 999px;
  cursor: pointer; transition: background-color .15s;
  box-shadow: 0 0 15px rgba(255, 204, 0, .15);
  flex: none;
}
.cn-sh3-find:hover { background: #e6b800; }

/* ============ DROPDOWNS ============ */
.cn-sh3-dd {
  position: absolute; top: calc(100% + 10px); z-index: 500;
  /* собственный compositing layer — поднимает дропдаун над iframe баннеров */
  transform: translateZ(0);
  will-change: transform;
  background: #171e32;
  border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, .55);
  padding: 16px;
  animation: cn-sh3-pop .18s ease-out;
}
.cn-sh3-dd[hidden] { display: none !important; }

@keyframes cn-sh3-pop {
  from { opacity: 0; transform: scale(.97) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* type dd */
.cn-sh3-dd--type {
  left: 0;
  width: 280px;
  padding: 8px;
}
.cn-sh3-dd-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: transparent; border: 0; color: #cbd5e1;
  font-size: 14px; font-family: inherit; cursor: pointer; text-align: left;
  transition: background-color .12s, color .12s;
}
.cn-sh3-dd-item:hover { background: #1e2740; color: #fff; }
.cn-sh3-dd-item.is-active { background: rgba(255, 204, 0, .06); color: #ffcc00; }
.cn-sh3-dd-icon {
  width: 22px; height: 22px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #94a3b8; font-weight: 700;
}
.cn-sh3-dd-icon--letter { color: #94a3b8; }
.cn-sh3-dd-icon--ya { color: #ef4444; }

/* region dd */
.cn-sh3-dd--region {
  right: 0;
  width: 380px;
  max-width: calc(100vw - 24px);
}
.cn-sh3-dd-section { margin-bottom: 14px; }
.cn-sh3-dd-section:last-child { margin-bottom: 0; }
.cn-sh3-dd-lbl {
  display: block; font-size: 11px; color: #94a3b8;
  margin-bottom: 6px; font-weight: 500;
}
.cn-sh3-dd-inp {
  width: 100%; box-sizing: border-box;
  background: #0f1423; border: 1px solid rgba(148, 163, 184, .20);
  border-radius: 12px; padding: 10px 14px; color: #fff;
  font-size: 14px; font-family: inherit; outline: none;
}
.cn-sh3-dd-inp:focus { border-color: #ffcc00; }

.cn-sh3-city-list {
  max-height: 300px; overflow-y: auto; margin-top: 8px;
  background: #0f1423; border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 10px; padding: 4px;
}
.cn-sh3-city-list::-webkit-scrollbar { width: 6px; }
.cn-sh3-city-list::-webkit-scrollbar-track { background: transparent; }
.cn-sh3-city-list::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }
.cn-sh3-city-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 8px;
  background: transparent; border: 0; color: #cbd5e1;
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background-color .12s, color .12s;
}
.cn-sh3-city-item:hover { background: #1e2740; color: #fff; }
.cn-sh3-city-item.is-active { background: rgba(255, 204, 0, .08); color: #ffcc00; font-weight: 600; }
.cn-sh3-city-item[hidden] { display: none; }
.cn-sh3-hl { background: transparent; color: #ffcc00; font-weight: 600; font-style: normal; }
.cn-sh3-no-results { margin: 8px 12px; font-size: 13px; color: #64748b; }

/* radius check + slider */
.cn-sh3-check {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none; margin-bottom: 10px;
}
.cn-sh3-check input { position: absolute; opacity: 0; pointer-events: none; }
.cn-sh3-check-box {
  width: 18px; height: 18px; flex: none;
  border: 1px solid rgba(148, 163, 184, .35); border-radius: 4px;
  background: #0f1423; display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .12s, border-color .12s;
}
.cn-sh3-check-box i { font-size: 11px; color: #0a0f1c; opacity: 0; transition: opacity .12s; }
.cn-sh3-check input:checked + .cn-sh3-check-box { background: #ffcc00; border-color: #ffcc00; }
.cn-sh3-check input:checked + .cn-sh3-check-box i { opacity: 1; }
.cn-sh3-check-txt { font-size: 13px; color: #cbd5e1; }

.cn-sh3-radius { opacity: .5; pointer-events: none; transition: opacity .15s; }
.cn-sh3-radius.is-on { opacity: 1; pointer-events: auto; }
.cn-sh3-radius-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cn-sh3-radius-cap { font-size: 11px; color: #94a3b8; }
.cn-sh3-radius-val { font-size: 11px; font-weight: 700; background: #1e2740; color: #fff; padding: 4px 8px; border-radius: 6px; }
.cn-sh3-range {
  width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
  background: #0f1423; border-radius: 999px; outline: none; cursor: pointer;
}
.cn-sh3-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: #ffcc00; cursor: pointer; border: 0;
}
.cn-sh3-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #ffcc00; cursor: pointer; border: 0; }
.cn-sh3-range:disabled::-webkit-slider-thumb { background: #475569; }
.cn-sh3-range-marks { display: flex; justify-content: space-between; font-size: 10px; color: #64748b; margin-top: 4px; }

.cn-sh3-dd-foot { margin-top: 6px; }
.cn-sh3-apply {
  width: 100%; padding: 11px 14px;
  background: #ffcc00; color: #0a0f1c;
  border: 0; border-radius: 12px;
  font-weight: 700; font-size: 14px; font-family: inherit; cursor: pointer;
  transition: background-color .15s;
}
.cn-sh3-apply:hover { background: #e6b800; }

/* ============ TAGS ROW (alpha + categories) ============ */
.cn-sh3-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 12px; padding: 0 6px;
}
.cn-sh3-tagwrap { position: relative; }
.cn-sh3-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(23, 30, 50, .55);
  border: 1px solid rgba(148, 163, 184, .15);
  color: #94a3b8;
  font-size: 13px; font-family: inherit;
  padding: 6px 14px; border-radius: 999px;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.cn-sh3-tag:hover { background: #171e32; color: #e2e8f0; }
.cn-sh3-tag[aria-expanded="true"] { background: #1e2740; border-color: rgba(148, 163, 184, .35); color: #fff; }
.cn-sh3-tag-ico { color: #ffcc00; font-size: 12px; }
.cn-sh3-tag--reset { color: #f87171; }
.cn-sh3-tag--reset:hover { color: #fca5a5; }
.cn-sh3-tag--collapse { margin-left: auto; }

/* alpha dd */
.cn-sh3-dd--alpha {
  left: 0; width: 460px; max-width: calc(100vw - 24px);
  padding: 16px 18px;
}
.cn-sh3-alpha-tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: #0f1423; border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 10px; margin-bottom: 14px;
}
.cn-sh3-alpha-tab {
  padding: 6px 14px; border-radius: 7px;
  background: transparent; border: 0; color: #94a3b8;
  font-size: 12px; font-weight: 500; font-family: inherit; cursor: pointer;
  transition: background-color .12s, color .12s;
}
.cn-sh3-alpha-tab:hover { color: #fff; }
.cn-sh3-alpha-tab.is-active { background: #334155; color: #fff; }
.cn-sh3-alpha-pane { display: none; flex-wrap: wrap; gap: 6px; }
.cn-sh3-alpha-pane.is-active { display: flex; }
.cn-sh3-alpha-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #0f1423; border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 8px; color: #cbd5e1;
  font-size: 13px; font-weight: 500;
  text-decoration: none !important;
  transition: background-color .12s, color .12s;
}
.cn-sh3-alpha-btn:hover { background: #ffcc00; color: #0a0f1c; }

/* categories dd */
/* COSMOS 2026-06-15: dropdown «Категории бизнеса» — растянут на всю ширину хаба */
.cn-sh3-tagwrap--cat { position: static; }
.cn-sh3-dd--cat {
  left: 0; right: 0; width: auto; max-width: none;
  padding: 20px;
}
.cn-sh3-dd-h {
  margin: 0 0 14px; display: flex; align-items: center; gap: 8px;
  color: #fff; font-size: 15px; font-weight: 700;
}
.cn-sh3-dd-h i { color: #ffcc00; }

/* фильтр-поиск внутри дропдауна категорий */
.cn-sh3-cat-filter {
  position: relative; margin-bottom: 12px;
}
.cn-sh3-cat-filter i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: 13px; pointer-events: none;
}
/* ID-селектор: перебивает legacy-override.css */
#cn-sh2-cat-filter,
#cn-sh2-city-filter {
  width: 100% !important; box-sizing: border-box !important;
  background: #0f1423 !important;
  border: 1px solid rgba(148, 163, 184, .20) !important;
  border-radius: 12px !important;
  padding: 10px 14px 10px 42px !important;
  color: #fff !important;
  font-size: 14px !important; font-family: inherit !important;
  outline: none !important; margin: 0 !important; height: auto !important;
}
#cn-sh2-cat-filter:focus,
#cn-sh2-city-filter:focus { border-color: #ffcc00 !important; }

/* двухколоночный аккордеон */
.cn-sh3-cat-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  max-height: 55vh; overflow-y: auto; padding-right: 4px;
  align-content: start;
}
.cn-sh3-cat-list::-webkit-scrollbar { width: 6px; }
.cn-sh3-cat-list::-webkit-scrollbar-track { background: transparent; }
.cn-sh3-cat-list::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }

.cn-sh3-cat-group { align-self: start; }
.cn-sh3-cat-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: #0f1423; border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 12px; color: #cbd5e1;
  font-size: 13px; font-family: inherit; font-weight: 500;
  padding: 11px 14px; cursor: pointer; text-align: left;
  transition: background-color .15s, color .15s, border-color .15s;
}
.cn-sh3-cat-head:hover { background: #1e2740; border-color: rgba(148, 163, 184, .35); color: #fff; }
.cn-sh3-cat-head-name { flex: 1; min-width: 0; }
.cn-sh3-cat-head-cnt {
  flex: none; min-width: 22px; padding: 2px 7px; text-align: center;
  background: rgba(255, 204, 0, .10); color: #ffcc00;
  border-radius: 999px; font-size: 11px; font-weight: 700;
}
.cn-sh3-cat-arr { color: #94a3b8; font-size: 11px; transition: transform .2s; }
.cn-sh3-cat-group.is-open .cn-sh3-cat-arr { transform: rotate(180deg); color: #ffcc00; }
.cn-sh3-cat-group.is-open .cn-sh3-cat-head { background: #1e2740; color: #fff; border-color: rgba(255, 204, 0, .25); }

.cn-sh3-cat-sub {
  margin: 4px 0 8px 14px;
  border-left: 2px solid rgba(255, 204, 0, .15);
  padding: 4px 0 4px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.cn-sh3-cat-sub[hidden] { display: none !important; }
.cn-sh3-cat-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent;
  border-radius: 8px; color: #94a3b8;
  font-size: 12.5px; font-family: inherit;
  padding: 7px 10px; cursor: pointer;
  text-decoration: none !important;
  transition: background-color .12s, color .12s;
}
.cn-sh3-cat-item:hover { background: rgba(255, 204, 0, .06); color: #ffcc00; }
.cn-sh3-cat-item i { color: #475569; font-size: 10px; }
.cn-sh3-cat-item:hover i { color: #ffcc00; }

/* picked-cat chip */
.cn-sh3-picked {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 6px 12px;
  background: rgba(255, 204, 0, .08);
  border: 1px solid rgba(255, 204, 0, .25);
  border-radius: 999px;
  color: #fde68a; font-size: 13px;
}
.cn-sh3-picked button {
  background: transparent; border: 0; color: #f87171;
  cursor: pointer; font-family: inherit; font-size: 12px;
  text-decoration: underline;
}

/* ============ RESPONSIVE ============ */
/* tablet & narrow desktop (with sidebar): wrap capsule */
@media (max-width: 1100px) {
  .cn-sh3-capsule { flex-wrap: wrap; border-radius: 28px; padding: 8px; row-gap: 6px; }
  .cn-sh3-form { flex-wrap: wrap; flex: 1 1 100%; row-gap: 6px; }
  .cn-sh3-sep { display: none; }
  .cn-sh3-segment--type { order: 1; }
  .cn-sh3-segment--input {
    order: 2; flex: 1 1 100%;
    padding: 10px 14px;
    background: #0f1423;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .12);
  }
  .cn-sh3-segment--region { order: 3; }
  .cn-sh3-find { order: 4; margin-left: auto; padding: 12px 22px; }
  .cn-sh3-region-val { max-width: 130px; }
}

@media (max-width: 720px) {
  .cn-sh3-type-label { display: none; }
  .cn-sh3-region-cap { display: none; }
  .cn-sh3-region-val { max-width: 110px; font-size: 13px; }

  .cn-sh3-dd--type, .cn-sh3-dd--alpha, .cn-sh3-dd--cat, .cn-sh3-dd--region {
    left: 0; right: 0; width: auto; max-width: calc(100vw - 24px);
  }
  .cn-sh3-cat-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .cn-sh3-find { padding: 10px 18px; font-size: 13px; }
  .cn-sh3-btn { padding: 6px 10px; font-size: 13px; }
  .cn-sh3-tag { font-size: 12px; padding: 5px 12px; }
}
