/*
 * Экран «По аналогу» (js/analogi.js, заказчик 15.11.2026: «полностью переделай подбор по аналогам в стиле сайта»).
 * Цвета и скругления — css/tema-sayta.css, движение — кривая iOS из css/redizayn.css. Подключается последним.
 */

/* Прежняя кнопка «Подбор по аналогам» с замком и «Войти» — больше не нужны: сотрудника узнаём по входу на сайте,
   админка — через админку сайта («Подбор насосов»). */
#ps-analog-btn, #ps-userbox { display: none !important; }

/* ---------- переключатель режимов — как сегменты iOS ---------- */
.ps-rezhim {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px;
  border-radius: 999px;
  background: #e8eef7;
}
.ps-rezhim::-webkit-scrollbar { display: none; }
/* в шапке — в одной строке с заголовком, сразу справа от него; «Как пользоваться» — у правого края
   (заказчик, 15.11.2026: «перенеси сюда»). Узко — отдельной строкой под заголовком: оба пункта видны целиком. */
.ps-header { flex-wrap: wrap; }
.ps-rezhim-mesto { flex: 0 1 auto; min-width: 0; margin-right: auto; }
@media (max-width: 1100px) {
  .ps-rezhim-mesto { order: 99; flex: 0 0 100%; margin: 2px 0 0; }
}
.ps-rezhim button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 9px 18px;
  font: 600 14.5px/1.2 Manrope, "Segoe UI", Arial, sans-serif;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--ios-fast, 220ms) var(--ios, ease);
}
.ps-rezhim button[aria-selected="true"] { color: var(--brand); }
.ps-rezhim button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ps-rezhim__begunok {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
  transition: transform var(--ios-dur, 340ms) var(--ios, ease), width var(--ios-dur, 340ms) var(--ios, ease);
}

/* ---------- режим «По аналогу» на странице ---------- */
html.rezhim-analog .ps-controls { display: none !important; }
html.rezhim-analog #ps-sortbar { display: none !important; }
.an2 {
  grid-area: filters;
  min-width: 0;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: ps-ios-vhod var(--ios-dur, 340ms) var(--ios, ease) both;
}
.an2[hidden] { display: none !important; }

.an2-shapka { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.an2-zag { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.an2-pod { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.an2-admin { flex: none; padding: 6px 12px; border-radius: 999px; background: #eef4ff; color: var(--brand); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.an2-admin:hover { background: #dce8ff; }

/* поиск */
.an2-poisk { position: relative; }
.an2-poisk input {
  width: 100%;
  height: 50px;
  box-sizing: border-box;
  padding: 0 14px 0 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f7f9fc;
  font: 500 16px/1 Manrope, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  transition: border-color var(--ios-fast, 220ms) var(--ios, ease), box-shadow var(--ios-fast, 220ms) var(--ios, ease), background-color var(--ios-fast, 220ms) var(--ios, ease);
}
.an2-poisk input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(11, 99, 229, .14); }
.an2-lupa { position: absolute; left: 14px; top: 14px; width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2; pointer-events: none; }
.an2-sug {
  position: absolute;
  left: 0;
  right: 0;
  top: 56px;
  z-index: 20;
  max-height: 340px;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
  opacity: 0;
  transform: translateY(-4px) scale(.98);
  transform-origin: top;
  pointer-events: none;
  transition: opacity var(--ios-fast, 220ms) var(--ios, ease), transform var(--ios-dur, 340ms) var(--ios, ease);
}
.an2-sug.on { opacity: 1; transform: none; pointer-events: auto; }
.an2-sug__i { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 9px 12px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.an2-sug__i:hover, .an2-sug__i.on { background: #f1f6ff; }
.an2-sug__i small { color: var(--muted); font-size: 12px; }
.an2-sug__net { padding: 10px 12px; font-size: 14px; color: var(--muted); }

.an2-primery { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.an2-primery button { border: 1px dashed #c9d6e8; background: #fff; border-radius: 999px; padding: 4px 10px; font: 500 13px/1.3 Manrope, "Segoe UI", Arial, sans-serif; color: var(--text); cursor: pointer; transition: border-color var(--ios-fast, 220ms) var(--ios, ease), transform var(--ios-fast, 220ms) var(--ios, ease); }
.an2-primery button:hover { border-color: var(--brand); }
.an2-primery button:active { transform: scale(.97); }

/* шаги */
.an2-shagi { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.an2-shagi summary { cursor: pointer; list-style: none; color: var(--brand); font-weight: 600; font-size: 14px; }
.an2-shagi summary::-webkit-details-marker { display: none; }
.an2-kroshki { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.an2-kroshki button { border: 0; background: #eef4ff; color: var(--brand); border-radius: 999px; padding: 5px 12px; font: 600 13px/1.2 Manrope, "Segoe UI", Arial, sans-serif; cursor: pointer; }
.an2-etap { margin: 8px 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.an2-chipy { display: flex; flex-wrap: wrap; gap: 6px; max-height: 260px; overflow: auto; }
.an2-chipy button { border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 7px 11px; font: 600 13.5px/1.2 Manrope, "Segoe UI", Arial, sans-serif; color: var(--text); cursor: pointer; transition: border-color var(--ios-fast, 220ms) var(--ios, ease), transform var(--ios-fast, 220ms) var(--ios, ease); }
.an2-chipy button:hover { border-color: var(--brand); }
.an2-chipy button:active { transform: scale(.97); }
.an2-chipy i { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 5px; }

/* карточка модели другой марки */
.an2-kartochka { margin-top: 16px; padding: 14px; border-radius: 16px; background: #f7f9fc; animation: ps-ios-vhod var(--ios-dur, 340ms) var(--ios, ease) both; }
.an2-marka { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.an2-kartochka h3 { margin: 4px 0 2px; font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.an2-kod { font-size: 12.5px; color: var(--muted); }
.an2-svoystva { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 8px; }
.an2-svoystva div { padding: 8px 10px; border-radius: 12px; background: #fff; }
.an2-svoystva span { display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.an2-svoystva b { font-size: 14.5px; }

.an2-tiho { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.an2-oshibka { margin: 10px 0 0; color: #c2372b; font-size: 14px; }
.an2-zagruzka { padding: 14px 4px; color: var(--muted); }
.an2-ssylka { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; text-decoration: underline; cursor: pointer; }

/* закрыто */
.an2-zakryto { padding: 10px 4px; text-align: center; }
.an2-zamok { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #eef1f5; color: var(--muted); font-size: 12px; font-weight: 700; }
.an2-zakryto .an2-zag { margin: 10px 0 6px; }
.an2-zakryto p { margin: 0 auto 14px; max-width: 520px; color: var(--muted); }
.an2-knopka { display: inline-block; border: 0; border-radius: 12px; padding: 11px 20px; background: var(--t-accent, #ff5b35); color: #fff; font: 700 14.5px/1.2 Manrope, "Segoe UI", Arial, sans-serif; text-decoration: none; cursor: pointer; transition: background-color var(--ios-fast, 220ms) var(--ios, ease), transform var(--ios-fast, 220ms) var(--ios, ease); }
.an2-knopka:hover { background: var(--t-accent-dark, #e8461f); }
.an2-knopka:active { transform: scale(.97); }
.an2-knopka:disabled { background: #9aa6b2; cursor: default; }

/* график сравнения — картинка с сервера, появляется плавно */
.an2-grafik { display: block; width: 100%; height: auto; opacity: 0; transition: opacity var(--ios-dur, 340ms) var(--ios, ease); }
.an2-grafik.on { opacity: 1; }

/* фото (16.11.2026): карточка модели — рядом с названием; сравнение — две рамки одного размера над графиком */
.an2-kart-shapka { display: flex; gap: 12px; align-items: center; }
.an2-kart-foto { flex: none; width: 76px; height: 76px; border-radius: 12px; background: #fff; border: 1px solid #e3e8ef; overflow: hidden; }
.an2-kart-foto img { width: 100%; height: 100%; object-fit: contain; padding: 5px; box-sizing: border-box; }
.an2-foto-para { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 12px; }
.an2-foto { margin: 0; min-width: 0; }
.an2-foto__ramka { height: 170px; border-radius: 12px; background: #fff; border: 1px solid #e3e8ef; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.an2-foto__ramka img { width: 100%; height: 100%; object-fit: contain; padding: 10px; box-sizing: border-box; }
.an2-foto__ramka.zagr { background: #f3f6fa; }
.an2-foto__ramka.zagr img { opacity: 0; }
.an2-foto__ramka.net span { color: #9aa4b0; font-size: 13px; }
.an2-foto figcaption { margin-top: 6px; font-size: 13px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.an2-foto figcaption small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 600px) { .an2-foto__ramka { height: 130px; } .an2-kart-foto { width: 60px; height: 60px; } }

@media (max-width: 600px) {
  .ps-rezhim { display: grid; width: 100%; grid-auto-columns: 1fr; }
  .ps-rezhim button { padding: 8px 10px; font-size: 13px; white-space: normal; line-height: 1.2; text-align: center; }
  .an2 { padding: 14px; }
  .an2-shapka { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .ps-rezhim__begunok, .an2, .an2-sug, .an2-kartochka, .an2-grafik, .ps-rezhim button { transition: none !important; animation: none !important; }
}

/* Свободный ввод модели: этапы «от бесплатного к платному», найдено в интернете, остаток Kimi администратору (15.11.2026) */
.an2-admin-ryad { display: inline-flex; gap: 6px; align-items: center; flex: none; }
.an2-kimi { display: none; padding: 6px 10px; border-radius: 999px; background: #f2f5f9; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.an2-kimi.on { display: inline-block; }
.an2-knopka--mal { padding: 7px 12px; font-size: 13px; margin: 6px 0 2px; }
.an2-sug__pod { display: block; color: var(--muted); font-size: 12px; }
.an2-etapy { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.an2-etapy span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #f2f5f9; color: var(--muted); font-size: 12.5px; }
.an2-etapy span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #c3ccd8; }
.an2-etapy span.ok::before { background: #1f9d55; }
.an2-etapy span.on { color: var(--text); }
.an2-etapy span.on::before { background: var(--brand); animation: an2-puls 1.1s var(--ios, ease) infinite; }
@keyframes an2-puls { 50% { transform: scale(1.5); opacity: .5; } }
.an2-set { margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: #fff7e6; color: #8a5a00; font-size: 12.5px; }
.an2-set a { color: inherit; }
.an2-nashi { margin: 6px 0 0; padding-left: 18px; }
@media (prefers-reduced-motion: reduce) { .an2-etapy span.on::before { animation: none; } }
/* этапы поиска в интернете — мелко, по ходу работы */
.an2-hod { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.an2-hod li { display: flex; gap: 8px; align-items: baseline; animation: ps-ios-vhod var(--ios-dur, 340ms) var(--ios, ease) both; }
.an2-hod li::before { content: "✓"; color: #1f9d55; font-weight: 700; flex: none; width: 12px; }
.an2-hod li.on { color: var(--text); }
.an2-hod li.on::before { content: "•"; color: var(--brand); animation: an2-puls 1.1s var(--ios, ease) infinite; }
.an2-hod li i { font-style: normal; color: #9aa6b2; margin-left: auto; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .an2-hod li, .an2-hod li.on::before { animation: none; } }

/* уточнение свойств найденной модели — кнопки-фильтры */
.an2-utoch { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px; border-radius: 16px; background: #f1f6ff; animation: ps-ios-vhod var(--ios-dur, 340ms) var(--ios, ease) both; }
.an2-utoch > b { font-size: 14.5px; }
.an2-utoch__r { display: flex; flex-direction: column; gap: 4px; }
.an2-utoch__r > span { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.an2-utoch .an2-chipy button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.an2-utoch__b { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (prefers-reduced-motion: reduce) { .an2-utoch { animation: none; } }

/* переключатель режимов — только с доступом к подбору по аналогам (до ответа сервера скрыт, без доступа — убран) */
.ps-rezhim-mesto { display: none; }
html.analog-dostup .ps-rezhim-mesto { display: block; animation: ps-ios-vhod var(--ios-dur, 340ms) var(--ios, ease) both; }
.an2-sug__serii { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.an2-sug__serii button { border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 5px 10px; font: 600 13px/1.2 Manrope, "Segoe UI", Arial, sans-serif; cursor: pointer; }
.an2-sug__serii button:hover { border-color: var(--brand); }
.an2-sug__nashi { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; }
@media (prefers-reduced-motion: reduce) { html.analog-dostup .ps-rezhim-mesto { animation: none; } }
