/* =============== Вопросы — базовые токены страницы =============== */

:root {
  --q-border: rgba(15, 23, 42, 0.06);
  --q-border-strong: rgba(15, 23, 42, 0.12);
  --q-card-bg: var(--glass-bg, #ffffff);
  --q-shadow-card: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));
  --q-radius-card: var(--radius-lg, 20px);
}

/* Отступ снизу под футер/табар на этой странице */
.questions-page {
  display: block;
}

.questions-container {
  margin-top: 8px;
  margin-bottom: 80px;
}

@media (max-width: 768px) {
  .questions-container {
    margin-bottom: 56px;
  }
}

/* Список вопросов без маркеров/отступов */
.questions-container ul,
#questionsList {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* =============== Карточка вопроса =============== */

.question-card {
  position: relative;
  background: var(--q-card-bg);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.98));
  border-radius: var(--q-radius-card);
  box-shadow: var(--q-shadow-card);
  padding: 16px 18px;
  color: var(--text-main, #0f172a);
  margin-bottom: 16px;
  overflow: hidden;
  word-wrap: break-word;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.question-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(31, 38, 135, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  .question-card:hover {
    transform: none;
  }
}

/* Шапка карточки */

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.question-header .question-author {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

/* Аватар автора */

.question-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.question-header .avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Буква-заглушка в аватаре */

.question-author-avatar .avatar-letter {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

/* Имя автора и дата */

.question-header .author-info {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-main, #0f172a);
}

.question-header .question-date,
.question-date {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: #9ca3af;
  white-space: nowrap;
}

/* Основной текст вопроса */

.question-text {
  color: var(--text-main, #0f172a);
  white-space: normal;
  word-break: break-word;
}

/* Картинки внутри вопроса/комментариев */

.question-card img {
  max-width: 100%;
  height: auto;
}

.question-text img,
.question-body img,
.question-content img,
.comment-text img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 12px;
  margin: 8px 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Теги вопроса */

.question-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

/* Теги как текстовые хэштеги (без плашек) */
.question-tags .tag,
.question-tags a.tag {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-strong, #3340ff);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  line-height: 1.2;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.question-tags .tag:hover,
.question-tags .tag:focus-visible,
.question-tags a.tag:hover,
.question-tags a.tag:focus-visible {
  color: #0f2a5a;
  border-bottom-color: currentColor;
  outline: none;
}

/* Блок ответа внутри карточки (краткий/развёрнутый) */

.question-answer {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--q-border);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

/* Нижняя панель действий карточки (кнопки) */

.question-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

/* Уводим "Комментарии" вправо */
.question-footer .show-comments-btn {
  margin-left: auto;
}

/* На мобиле кнопки могут делить ширину */
@media (max-width: 768px) {
  .question-footer {
    flex-wrap: wrap;
  }

  .question-footer > * {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    text-align: center;
    font-size: 12px;
  }
}

@media (min-width: 769px) {
  .question-footer > * {
    flex: initial;
    min-width: auto;
    white-space: nowrap;
    text-align: left;
  }
}

/* Кнопка "Смотреть ответ" — вторичный текстовый CTA */

.show-answer-btn {
  background: transparent;
  border: none;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 13.5px;
  color: #1b3a6b;
  opacity: 0.9;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.show-answer-btn.unanswered {
  /* отдельный цвет для вопросов без ответа при желании */
}

.show-answer-btn i {
  font-size: 16px;
}

.show-answer-btn:hover,
.show-answer-btn:focus-visible {
  color: #133670;
  opacity: 1;
  outline: none;
}

/* Кнопка "Комментарии" в том же стиле */

.show-comments-btn,
a.show-comments-btn {
  background: transparent;
  border: none;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 13.5px;
  color: #1b3a6b;
  opacity: 0.9;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.show-comments-btn i,
a.show-comments-btn i {
  font-size: 16px;
}

.show-comments-btn:hover,
a.show-comments-btn:hover,
.show-comments-btn:focus-visible,
a.show-comments-btn:focus-visible {
  color: #133670;
  opacity: 1;
  outline: none;
}

/* =============== Встроенный список комментариев под вопросом =============== */

.question-comments {
  display: none;
  margin-top: 10px;
}

/* Базовая карточка комментария (встроенная) */

.comment-item {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--q-border);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  margin-bottom: 10px;
  padding: 8px 10px;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.comment-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Аватар в комментарии (встроенный) */

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-user {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
}

.comment-date {
  margin-left: auto;
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}

.comment-text {
  margin: 8px 4px 6px;
  font-size: 13px;
  line-height: 1.4;
}

/* Ввод комментария под вопросом */

/* Ввод комментария под вопросом — подчёркиваем только поле ввода */

.question-comments {
  margin-top: 10px;
}

/* контейнер почти прозрачный, только верхняя граница как разделитель */
.comment-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid rgba(209, 213, 219, 0.9);
  background: transparent;
  flex-wrap: wrap;
}

/* именно поле ввода делаем более выразительным */
.comment-input {
  flex: 1;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(156, 163, 175, 0.9); /* заметная граница */
  background: #ffffff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06); /* лёгкая тень, чтобы не сливаться */
}

.comment-input::placeholder {
  color: #9ca3af;
}

.comment-input:focus-visible {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.22);
}

/* кнопку оставляем “прямоугольной”, без плашки-композера вокруг */
.comment-submit {
  border: 0;
  border-radius: 8px; /* как было, не pill */
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  background: #2563eb; /* фирменный синий, без градиента */
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
}
/* commentsModal — круглая кнопка отправки со стрелкой вверх */
#commentsModal .comment-submit {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(135deg, var(--accent), var(--accent-alt));
  color: #ffffff;

  box-shadow: 0 8px 18px rgba(76, 111, 255, 0.35);
  cursor: pointer;

  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#commentsModal .comment-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(76, 111, 255, 0.45);
}

#commentsModal .comment-submit:active {
  transform: scale(0.95);
}

#commentsModal .comment-submit svg,
#commentsModal .comment-submit svg * {
  fill: none;
  stroke: currentColor;
  pointer-events: none;
}

/* =============== Меню "три точки" в карточке =============== */

.question-options {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 5;
  background: transparent;
  border-radius: 8px;
  padding: 4px;
  color: #5b6b95;
  cursor: pointer;
}

.question-options i {
  font-size: 20px;
  line-height: 1;
  transform: rotate(90deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Выпадающее меню с действиями */

.options-menu {
  position: absolute;
  top: 34px;
  right: 8px;
  z-index: 10;
  min-width: 160px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  padding: 6px 0;
  display: none;
}

.options-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.options-menu li {
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
}

.options-menu li:hover {
  background: rgba(15, 23, 42, 0.04);
}

/* =============== Пагинация =============== */

/* =============== Пагинация — "Минимал текст" =============== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-soft, #4b5563);
}

/* Кнопки "Назад" / "Вперёд" как текстовые ссылки */
.page-btn {
  min-width: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
  color: #1b3a6b;
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: rgba(148, 163, 184, 0.75);
  text-underline-offset: 4px;
  transition: color 0.16s ease, text-decoration-color 0.16s ease,
    opacity 0.16s ease;
}

.page-btn:hover,
.page-btn:focus-visible {
  color: #0f2a5a;
  text-decoration-style: solid;
  text-decoration-color: rgba(37, 99, 235, 0.9);
  outline: none;
}

/* Активное состояние здесь не нужно, но оставляем на будущее */
.page-btn.active {
  color: #0f2a5a;
  text-decoration-style: solid;
  text-decoration-color: rgba(37, 99, 235, 0.9);
}

/* Отключённые кнопки "Назад" / "Вперёд" */
.page-btn.disabled,
.page-btn[disabled] {
  opacity: 0.45;
  cursor: default;
  text-decoration: none;
}

/* Убираем стрелочки-псевдоэлементы от старого стиля */
.page-btn.prev::before,
.page-btn.next::after {
  content: none !important;
}

/* Центральный счётчик "Страница X из Y" */
.pagination-info {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #9ca3af);
  white-space: nowrap;
}

/* =============== Модалка с ответом =============== */

#answerModal .modal-content {
  border-radius: 16px 16px 0 0;
  padding: 14px;
}

#answerModal .answer-body,
.answer-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.5;
}

/* Нижняя панель действий в модалке ответа */

#answerModal .answer-actions {
  position: sticky;
  bottom: -1px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 0 6px;
  background: linear-gradient(#fff, #fff 70%, rgba(255, 255, 255, 0.92));
}

/* Кнопки в модалке — «призрачные» */

#answerModal .answer-actions .btn,
#answerModal .answer-actions .btn-primary,
#answerModal .answer-actions .btn-secondary {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #111827;
  padding: 8px 14px;
  border-radius: 10px;
  box-shadow: none;
  font-size: 13px;
  cursor: pointer;
}

#answerModal .answer-actions .btn:hover,
#answerModal .answer-actions .btn-primary:hover,
#answerModal .answer-actions .btn-secondary:hover {
  background: rgba(17, 24, 39, 0.04);
  border-color: #c7cdd6;
}

#answerModal .answer-actions .btn:active,
#answerModal .answer-actions .btn-primary:active,
#answerModal .answer-actions .btn-secondary:active {
  background: rgba(17, 24, 39, 0.06);
  border-color: #b8bfca;
}

#answerModal .answer-actions .btn:focus-visible,
#answerModal .answer-actions .btn-primary:focus-visible,
#answerModal .answer-actions .btn-secondary:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

#answerModal .answer-actions .btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Заголовок абзаца в ответе отдельной строкой */
#answerModal #answerBody strong {
  display: block;
  margin-bottom: 6px;
}

/* =========================================================
   ВСТРОЕННЫЕ КОММЕНТАРИИ ПОД ВОПРОСОМ (comments-list-*)
   ========================================================= */

/* Сам список, который рендерит JS: <ul id="comments-list-..."> */
[id^="comments-list-"] {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

/* Обёртка li вокруг комментария */
[id^="comments-list-"] .comment-item {
  background: transparent;
  border: 0;
  box-shadow: none;
  margin: 8px 0;
  padding: 0;
}

/* Внутренний блок комментария-баббла */
[id^="comments-list-"] .comment.comment--item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-main, #0f172a);
}

/* Аватар слева */
[id^="comments-list-"] .comment__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

[id^="comments-list-"] .comment__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Заглушка, если аватар пустой */
[id^="comments-list-"] .comment__avatar-img[src=""],
[id^="comments-list-"] .comment__avatar-img:not([src]) {
  background: #e5e7eb;
}

/* Правый столбец: контент комментария */
[id^="comments-list-"] .comment__content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Имя + дата */
[id^="comments-list-"] .comment__header {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

[id^="comments-list-"] .comment__author-name {
  font-weight: 600;
  font-size: 13px;
  color: #111827;
}

[id^="comments-list-"] .comment__date {
  margin-left: auto;
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}

/* Пузырь с текстом комментария */
[id^="comments-list-"] .comment__bubble {
  margin-top: 4px;
  background: #f0f2f5;
  border-radius: 10px;
  padding: 8px 10px;
}

[id^="comments-list-"] .comment__body {
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-line; /* переносы как в исходном тексте */
  word-wrap: break-word;
}

/* Нижняя строчка «меты» — тип, статус и т.п. */
[id^="comments-list-"] .comment__meta {
  margin-top: 4px;
  font-size: 11.5px;
  color: #9ca3af;
}

/* Текст «Комментарии ниже» / служебный заголовок над списком */
.comment-header-text {
  margin: 6px 0 8px;
  font-size: 12.5px;
  color: #9ca3af;
}
/* ==== Единый стиль аватарок вопроса и комментариев ==== */

/* Одинавая «капсула» под аватар */
.question-author-avatar,
[id^="comments-list-"] .comment__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Картинка внутри круга */
.question-header .avatar,
[id^="comments-list-"] .comment__avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Буква-заглушка — общий стиль и для вопроса, и для комментариев */
.question-author-avatar .avatar-letter,
[id^="comments-list-"] .comment__avatar-letter,
[id^="comments-list-"] .comment__avatar span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

/* Если у комментария img без src — прячем его, чтобы не мешал букве */
[id^="comments-list-"] .comment__avatar-img[src=""],
[id^="comments-list-"] .comment__avatar-img:not([src]) {
  display: none;
}

.questions-page {
  display: block;
  padding-top: 0;
  padding-bottom: 80px; /* запас под мобильный таббар */
}

.questions-page .qa-hero {
  margin-bottom: 16px;
}

.qa-hero__wrap {
  border-radius: var(--radius-lg, 20px);
  padding: 16px 16px 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));
}

.qa-hero__title {
  font-size: var(--fs-hero-title, 22px);
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--text-main, #0f172a);
}

.qa-hero__subtitle {
  font-size: var(--fs-body, 14px);
  line-height: 1.4;
  color: var(--text-soft, #4b5563);
  max-width: 640px;
}

.qa-hero__actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
