/* ask-question.css — новая версия в концепции Langard */

/* ===== БАЗА СТРАНИЦЫ "Задать вопрос" ===== */

.ask-page {
  margin-top: 18px;
  margin-bottom: var(--section-gap, 34px);
}

/* Оболочка формы — стеклянная карточка как hero/quick-action */
.form-container {
  width: 100%;
  max-width: var(--content-max, 1040px);
  margin: 0 auto;
  padding: 18px 16px 18px;

  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-lg, 20px);
  box-shadow: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));

  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  font-family: var(
    --font-sans,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "Segoe UI",
    sans-serif
  );
  font-size: var(--fs-body-sm, 14px);
  color: var(--text-main, #0f172a);
}

/* Внутренний ритм */
.form-container > * {
  margin-bottom: 10px;
}

/* Заголовок блока (h4 с typing-эффектом) */
.form-container h4 {
  margin: 0 !important;
  padding: 0 0 4px 0 !important;
  display: flex;
  align-items: center;
  gap: 10px;

  font-size: var(--fs-section-title, 16px);
  font-weight: 600;
  color: #111827;
}

.form-container h4 i {
  font-size: 18px;
  color: var(--accent, #4c6fff);
}

/* Подзаголовок под заголовком */
.form-container > p {
  margin: 0;
  padding: 0;
  color: var(--text-soft, #4b5563);
  font-size: var(--fs-body-sm, 14px);
  line-height: 1.5;
}

/* Подсказки "как лучше описать ситуацию" — стиль инфо-карточки */
.form-container .tips {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-md, 16px);
  background: rgba(248, 250, 252, 0.95);
  border: 1px dashed rgba(148, 163, 184, 0.55);
  box-shadow: none;

  font-size: var(--fs-caption, 13px);
  color: var(--text-soft, #4b5563);
}

.form-container .tips ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.form-container .tips li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0;
}

.form-container .tips li i {
  margin-top: 2px;
  font-size: 16px;
  color: var(--accent, #4c6fff);
}

/* ===== ПОЛЕ ВОПРОСА ===== */

.field-label {
  margin: 4px 2px 4px;
  font-weight: 600;
  font-size: var(--fs-caption, 13px);
  color: #111827;
}

/* Обёртка для textarea + placeholder + счетчик */
.textarea-wrapper {
  position: relative;
  min-height: 140px;
  margin: 0;
}

/* Само поле вопроса */
#questionText {
  width: 100% !important;
  min-height: 160px;
  max-height: 60svh;

  padding: 14px 14px 26px !important;
  border-radius: var(--radius-md, 16px);
  border: 1px solid rgba(148, 163, 184, 0.6) !important;
  background: #ffffff !important;

  font-family: inherit;
  font-size: var(--fs-body-sm, 14px);
  line-height: 1.45;
  resize: none;

  box-shadow: var(--shadow-ink-sm, 0 6px 18px rgba(0, 0, 0, 0.08));
  transition: height 0.05s linear, border-color 0.18s ease,
    box-shadow 0.18s ease;
  overflow: hidden;
}

@supports (height: 100dvh) {
  #questionText {
    max-height: 60dvh;
  }
}

#questionText:focus {
  outline: none;
  border-color: var(--accent, #4c6fff) !important;
  box-shadow: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));
}

#questionText::placeholder {
  color: var(--text-muted, #9ca3af);
  opacity: 1;
}

/* Плавающий пример-валидный вопрос (typing-placeholder) */
.typing-placeholder {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  font-size: var(--fs-body-sm, 14px);
  color: #6b7280;
  display: flex;
  gap: 8px;
  pointer-events: none;
  z-index: 1;
}

.placeholder-text::after,
.typing::after {
  content: "|";
  animation: blink 1s infinite;
  color: var(--accent, #4c6fff);
  font-weight: 600;
  margin-left: 2px;
}

/* Счётчик символов внизу поля */
.counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 12px;
  color: #6b7280;
}

/* ===== ПРОГРЕСС ЗАПОЛНЕНИЯ ВОПРОСА ===== */

.progress-bar-container {
  width: 100%;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(226, 232, 240, 0.9);
}

.progress-bar {
  height: 6px;
  width: 0%;
  border-radius: inherit;
  transition: width 0.25s ease;
  background: linear-gradient(
    90deg,
    var(--accent, #4c6fff),
    var(--accent-alt, #2bc5d9)
  );
}

.progress-bar.red {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.progress-bar.orange {
  background: linear-gradient(90deg, #f97316, #facc15);
}

.progress-text {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-soft, #4b5563);
}

/* ===== БЛОК ДЕЙСТВИЙ (ПРИВАТНОСТЬ + КНОПКА) ===== */

.form-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* чекбокс "сделать вопрос приватным" */
.private-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body-sm, 14px);
  color: var(--text-soft, #4b5563);
  cursor: pointer;
  position: relative;
}

.private-checkbox {
  transform: scale(1.05);
}

/* tooltip к чекбоксу */
.tooltip-icon {
  font-size: 13px;
  color: var(--text-muted, #9ca3af);
}

.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  padding: 6px 10px;
  border-radius: 8px;

  background: #111827;
  color: #f9fafb;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
  z-index: 20;
}

.private-label:hover .tooltip-text {
  display: block;
}

/* Кнопка отправки — в стиле hero-primary/btn */
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 16px;
  border-radius: var(--radius-btn, 15px);
  border: 1px solid rgba(255, 255, 255, 0.95);

  font-size: var(--fs-ui, 14px);
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;

  background: linear-gradient(
    130deg,
    var(--accent, #4c6fff),
    var(--accent-alt, #2bc5d9)
  );
  box-shadow: var(--shadow-glass-strong, 0 8px 24px rgba(31, 38, 135, 0.25));

  cursor: pointer;
  transition: transform var(--transition-fast, 0.16s ease-out),
    box-shadow var(--transition-fast, 0.16s ease-out), filter 0.18s ease;
}

.submit-button i {
  font-size: 14px;
}

@media (hover: hover) {
  .submit-button:hover {
    filter: brightness(1.03);
    box-shadow: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));
    transform: translateY(-1px);
  }
}

.submit-button:active {
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
}

/* Inline-кнопка (ПК) */
.submit-button--inline {
  min-width: 220px;
  height: 48px;
}

/* Состояния кнопки в нижней панели */
.submit-bar .submit-button[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.submit-bar .submit-button.loading {
  position: relative;
}

.submit-bar .submit-button.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 999px;
  right: 16px;
  animation: spin 0.8s linear infinite;
}

/* ===== МОБИЛЬНАЯ FIXED-ПАНЕЛЬ ОТПРАВКИ ===== */

.submit-bar {
  border-top: 1px solid rgba(15, 23, 42, 0.05);
  background: rgba(248, 250, 252, 0.98);
}

/* Мобайл/планшет: фиксируем снизу */
@media (max-width: 1024px) {
  .form-actions .submit-button--inline {
    display: none !important;
  }

  .submit-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;

    z-index: 1200;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .submit-bar .submit-button {
    width: 100%;
    height: 52px;
    border-radius: 14px;
    font-size: 15px;
  }

  /* резерв снизу под панель на мобильных */
  .container.container--narrow {
    padding-bottom: calc(52px + 24px + env(safe-area-inset-bottom)) !important;
  }
}

/* ПК: блок действий и без фикс-панели */
@media (min-width: 1025px) {
  .submit-bar {
    display: none !important;
  }

  .form-actions {
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
  }

  .form-actions .private-label {
    flex: 1;
  }
}

/* ===== МОДАЛКА УСПЕШНОЙ ОТПРАВКИ / ОШИБКИ ===== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1600;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  align-items: center;
  justify-content: center;
}

.modal-content {
  width: 90%;
  max-width: 460px;
  margin: 0 auto;

  background: #ffffff;
  border-radius: 18px;
  padding: 24px 22px 22px;

  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
  text-align: center;
  animation: fadeInUp 0.28s ease-out;
}

.modal-icon i {
  font-size: 40px;
  margin-bottom: 14px;
}

.modal-icon i.success {
  color: #10b981;
}

.modal-icon i.error {
  color: #ef4444;
}

.modal-content h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

#modalSubtext {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-soft, #4b5563);
}

/* Контент при успехе — аккуратный список преимуществ */
.modal-success-block {
  text-align: left;
  font-size: 14.5px;
  color: #1f2933;
  padding-top: 4px;
}

.modal-success-block p {
  margin: 0 0 10px;
}

.modal-success-block p strong {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.modal-success-block .modal-feature-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.modal-success-block .modal-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #eef0f4;
  line-height: 1.5;
}

.modal-success-block .modal-feature-list li:last-child {
  border-bottom: none;
}

.modal-success-block .modal-feature-list i {
  font-size: 18px;
  margin-top: 2px;
  color: var(--accent, #4c6fff);
}

.modal-success-block a {
  color: var(--accent, #4c6fff);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Кнопка внутри модалки */
.modal-content button {
  margin-top: 18px;
  width: 100%;
  height: 48px;

  border-radius: var(--radius-btn, 15px);
  border: 1px solid rgba(255, 255, 255, 0.95);

  background: linear-gradient(
    130deg,
    var(--accent, #4c6fff),
    var(--accent-alt, #2bc5d9)
  );
  box-shadow: var(--shadow-glass-strong, 0 8px 24px rgba(31, 38, 135, 0.25));

  font-size: 15px;
  font-weight: 600;
  color: #ffffff;

  cursor: pointer;
  transition: transform var(--transition-fast, 0.16s ease-out),
    box-shadow var(--transition-fast, 0.16s ease-out), filter 0.18s ease;
}

@media (hover: hover) {
  .modal-content button:hover {
    filter: brightness(1.02);
    box-shadow: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));
    transform: translateY(-1px);
  }
}

.modal-content button:active {
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
}

/* Мобильная модалка как bottom sheet */
@media (max-width: 768px) {
  .modal {
    align-items: flex-end;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 24px 18px 18px;
  }

  .modal-content::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #d1d5db;
    margin: 0 auto 10px;
  }
}

/* ===== СОСТОЯНИЯ ПОЛЯ (ОШИБКИ) ===== */

.field-error {
  margin-top: 6px;
  font-size: 12.5px;
  color: #dc2626;
}

.is-invalid #questionText {
  border-color: #dc2626 !important;
}

/* ===== АНИМАЦИИ ===== */

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
