/* === БАЗОВЫЕ СТИЛИ === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ==== FIX: белый цвет заголовка в баннере помощника ==== */
.assistant-title {
  color: #fff !important;
}

/* === ОСНОВНОЙ КОНТЕНТ === */
.main-content {
  max-width: 520px;
  margin: 5px auto;
  padding: 5px 8px;
}
/* === БАННЕР-ПОМОЩНИК (компактный) === */
.assistant-banner {
  background: linear-gradient(135deg, #2563eb 0%, #22d3ee 100%);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.assistant-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.3;
  }
}
.assistant-content {
  position: relative;
  z-index: 1;
}

/* Стартовый экран: иконка + заголовок в одной строке */
.assistant-start {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  column-gap: 10px;
  row-gap: 8px;
  text-align: left;
  animation: fadeIn 0.5s ease;
}
.assistant-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  grid-column: 1;
  grid-row: 1;
}
.assistant-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}
.assistant-title {
  grid-column: 2;
  grid-row: 1;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}
.assistant-subtitle {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 13px;
  line-height: 1.35;
  opacity: 0.9;
  margin: 0;
}
/* Кнопка "Начать подбор" — справа, стекло, без переноса */
.start-button {
  grid-column: 2; /* ← в правой колонке грида */
  grid-row: 3;
  justify-self: end; /* прижать к правому краю */
  align-self: start;

  display: inline-flex;
  padding: 8px 22px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;

  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.start-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Экран с вопросами и результатом — компактная типографика */
.assistant-quiz {
  animation: fadeIn 0.5s ease;
}
.quiz-progress {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}
.progress-dot.active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}
.quiz-question {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.25;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.quiz-option {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}
.quiz-option:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fff;
  transform: translateX(4px);
}
.quiz-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}
.nav-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.nav-button:hover {
  background: rgba(255, 255, 255, 0.3);
}
.nav-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.assistant-result {
  animation: fadeIn 0.5s ease;
  text-align: center;
}
.result-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.result-icon svg {
  width: 20px;
  height: 20px;
}
.result-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.result-description {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 16px;
  line-height: 1.35;
}
.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.result-button {
  background: #fff;
  color: #667eea;
  border: none;
  border-radius: 18px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.result-button.secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.result-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Поиск */
.search-container {
  position: relative;
  margin-bottom: 20px;
}
.search-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: #adb5bd;
  width: 20px;
  height: 20px;
}
.search-input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  border-radius: 12px;
  border: 1px solid #e9ecef;
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s ease;
}
.search-input:focus {
  outline: none;
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* Фильтры */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 16px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar {
  display: none;
}
.filter-button {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #495057;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-button:hover {
  background: #f1f3f5;
  border-color: #ced4da;
}
.filter-button.active {
  background: #007aff;
  color: #fff;
  border-color: #007aff;
}

/* Сетка шаблонов */
.templates-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Карточка шаблона */
.template-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(230, 234, 240, 0.8);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;

  /* 💡 Новые тени как в useful.html */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 6px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.template-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12), 0 10px 30px rgba(0, 0, 0, 0.08);
  border-color: rgba(230, 234, 240, 0.8);
}
.template-card:active {
  transform: scale(0.97);
  box-shadow: inset -2px -2px 4px rgba(255, 255, 255, 0.7),
    inset 2px 2px 4px rgba(196, 204, 218, 0.4);
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 122, 255, 0.12);
  border-color: #007aff;
}
.template-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.template-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.template-icon svg {
  width: 22px;
  height: 22px;
  color: #fff;
}
.template-info {
  flex: 1;
}
.template-name {
  font-size: 14px;
  font-weight: 600;
  color: #212529;
  line-height: 1.3;
}
.template-description {
  font-size: 14px;
  color: #6c757d;
  line-height: 1.4;
}

/* Градиенты иконок */
.icon-contract {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.icon-claim {
  background: linear-gradient(135deg, #ff8c42 0%, #ff3c5f 100%);
}
.icon-proxy {
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
}
.icon-application {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}
.icon-business {
  background: linear-gradient(135deg, #868f96 0%, #596164 100%);
}

/* Пусто */
.no-results {
  display: none;
  text-align: center;
  padding: 40px 20px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e9ecef;
} /* Tabs в "Шаблоны" как в макете */
.filter-bar {
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0 10px;
}
.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-bar .filter-button {
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #dfe3ea; /* базовый контур */
  background: #ffffff; /* без подложки */
  color: #0b2559;
  box-shadow: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.filter-bar .filter-button:hover {
  border-color: #9db8ff; /* только контур, без заливки */
  background: #ffffff;
}

.filter-bar .filter-button.active {
  background: #f5f9ff; /* мягкий голубой фон */
  border-color: #4d8bf0; /* насыщённый синий контур */
  color: #0b2559;
  box-shadow: none; /* без инсет-рингов */
}
/* Tabs = как теги */
.filter-bar {
  gap: 12px;
}

/* базовый чип */
.filter-bar .filter-button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #dfe3ea;
  background: #fff;
  color: var(--q-accent, #133670);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  box-shadow: none;
}

/* hover без заливки */
.filter-bar .filter-button:hover {
  border-color: #9db8ff;
  background: #fff;
}

/* актив: ПРОЗРАЧНЫЙ фон + акцентный контур/текст */
.filter-bar .filter-button.active {
  background: transparent !important;
  border-color: var(--q-accent, #133670) !important;
  color: var(--q-accent, #133670) !important;
  box-shadow: none !important;
} /* ==== Поиск в шаблонах: как в макете KB ==== */
.search-container {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  max-width: 1200px;
  margin: 18px auto 0;
  padding: 0 16px;
}

.search-container .search-input {
  height: 44px;
  width: 100%;
  padding: 0 44px;
  border-radius: 14px;
  border: 1px solid #dfe3ea;
  background: #ffffff;
  color: #133670;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.06);
}

.search-container .search-input::placeholder {
  color: #8a93a4;
}

.search-container .search-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  width: 18px;
  height: 18px;
  stroke: #8a93a4;
  transform: translateY(-50%);
  pointer-events: none;
}

/* фильтр-кнопка справа от поля, как в knowledge.css */
.search-container .filter-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid #dfe3ea;
  background: #ffffff;
  display: inline-grid;
  place-items: center;
  color: #8a93a4;
  cursor: pointer;
  transition: background 0.2s;
}
.search-container .filter-icon-btn:hover {
  background: #f6f7fb;
}
/* ==== ВРЕМЕННО СКРЫВАЕМ ПОЛЕ ПОИСКА НА СТРАНИЦЕ ШАБЛОНОВ ==== */
.search-container {
  display: none !important;
}
/* === Bottom-sheet ассистента документов === */
#assistantModal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(17, 24, 39, 0.45);
  z-index: 5000;
}
#assistantModal.open {
  display: flex;
}

/* лист модалки */
#assistantModal .assistant-sheet {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform 0.22s ease;
  background: linear-gradient(135deg, #2563eb 0%, #22d3ee 100%);
  color: #fff;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}
#assistantModal.open .assistant-sheet {
  transform: translateY(0);
}

/* хэндл и крестик */
#assistantModal .modal-drag-area {
  display: flex;
  justify-content: center;
  margin: 6px 0 8px;
}
#assistantModal .modal-drag {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}
#assistantModal .modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 24px;
  color: #fff;
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* блокировка скролла фона при открытии */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}
/* Белые заголовки внутри наших градиентных панелей и шитов */
.assistant-banner h1,
.assistant-banner h2,
.assistant-banner h3,
#assistantModal h1,
#assistantModal h2,
#assistantModal h3,
#assistantModal .assistant-title,
#assistantModal .quiz-question,
#assistantModal .result-title,
#advisorModal h1,
#advisorModal h2,
#advisorModal h3,
.svc-advisor-cta .svc-advisor-cta__title,
#filtersModal .modal-content h3 {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important; /* перекрыть gradient text */
  background-image: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
}
/* Смещение контента под мобильный fixed-header на этой странице */
@media (max-width: 1024px) {
  header.main-header + main.main-content {
    margin-top: calc(var(--mobile-header-height) + var(--safe-area-top));
  }
}

/* === Fix: remove extra top spacing under header on mobile (templates) === */
@media (max-width: 1024px) {
  header.main-header + main.main-content {
    margin-top: 0 !important;
  }
  header.main-header {
    margin-bottom: 0;
    padding-bottom: 0;
  }
}

/* === A11y: visible focus and tappable targets === */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* === Touch: bottom-sheet drag should not hijack scroll === */
#assistantModal .modal-drag,
#assistantModal .modal-drag-area {
  touch-action: pan-y;
}
/* Отступ между контентом и футером */
.main-content {
  margin-bottom: 40px; /* регулируй при необходимости */
}

@media (max-width: 768px) {
  .main-content {
    margin-bottom: 50px; /* чуть больше для мобильного нижнего меню */
  }
}
/* === FIX: фон баннера-помощника на /templates === */
/* 1) Даём фоновую картинку (та же, что на сервисах/главной) */
.assistant-banner {
  background: none !important;
  background-image: url("/images/ask-banner-bg-services.png") !important; /* рабочий файл */
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  color: #fff; /* на всякий */
}

/* 2) Убираем серый градиент-оверлей, если он был */
.assistant-banner::before,
.assistant-banner::after {
  content: none !important;
  background: none !important;
  opacity: 0 !important;
}

/* 3) Блок контента внутри — белый текст и без затемнения */
.assistant-banner .assistant-content,
.assistant-banner .assistant-title,
.assistant-banner .assistant-subtitle {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important; /* на случай градиентного текста */
  filter: none !important;
}
/* === ДЕСКТОПНАЯ АДАПТАЦИЯ /templates === */
@media (min-width: 768px) {
  /* основной контейнер страницы */
  .main-content {
    max-width: 1120px;
    margin: 32px auto 64px;
    padding: 0 24px;
  }

  /* баннер-помощник на десктопе */
  .assistant-banner {
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 32px;
  }

  /* фильтры: без горизонтального скролла, центрируем и даём перенос строк */
  .filter-bar {
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 8px;
    margin-bottom: 24px;
  }

  .filter-bar .filter-button {
    flex-shrink: 0;
  }

  /* сетка шаблонов: несколько колонок */
  .templates-grid {
    max-width: 1120px;
    margin: 0 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  .template-card {
    height: 100%;
  }
}

/* чуть шире сетка на очень больших экранах (опционально) */
@media (min-width: 1200px) {
  .templates-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* === Унифицированные тени для карточек шаблонов (как в knowledge-article.css) === */
.template-card {
  box-shadow: 0 8px 24px rgba(31, 38, 135, 0.15);
}

.template-card:hover {
  box-shadow: 0 8px 24px rgba(31, 38, 135, 0.25);
}

.template-card:active {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
