/**
 * task_18 — задание 18 (интерфейс как task/9/ex/, лёгкий клиентский редактор)
 */

.task-18-page .task-solve__left {
  min-width: 0;
}

.task-18-editor-widget {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 400px;
}

/* Блок условия (свернуть/развернуть) */
.task-18-statement {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.task-18-statement__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  min-height: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.task-18-statement__collapse-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-18-statement__collapse-btn:hover {
  opacity: 0.8;
}

.task-18-statement__toggle-text {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.task-18-statement__body {
  padding: 1rem;
  max-height: 280px;
  overflow-y: auto;
}

.task-18-statement--collapsed .task-18-statement__body {
  display: none;
}

.task-18-statement__content {
  font-size: 0.9rem;
  line-height: 1.5;
}

.task-18-statement__content p {
  margin: 0 0 0.5rem;
}

.task-18-statement__content p:last-child {
  margin-bottom: 0;
}

/* Обёртка редактора (Univer или placeholder) */
.task-18-editor-wrap {
  flex: 1;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
  background: rgba(0, 0, 0, 0.12);
}

.task-18-editor-wrap .univer-calc-container {
  flex: 1;
  min-height: 300px;
}

.task-18-editor-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
}

.task-18-editor-placeholder__text {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  text-align: center;
}

.task-18-download-link {
  color: var(--green, #05b87d);
  text-decoration: none;
}

.task-18-download-link:hover {
  text-decoration: underline;
}

/* Форма ответа */
.task-18-answer {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, 0.03);
}

.task-18-answer .task-answer-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.task-18-answer .task-answer-form__label {
  margin: 0;
}

.task-18-answer .task-answer-form__input {
  min-width: 120px;
}

/* Текстовое решение на /task18/ — таблицы-иллюстрации на всю ширину панели */
.libreoffice-page-task18 .task-solution-html-wrap__inner .task-wysiwyg__figure--task18-sheet,
.task-18-statement .task-solution-html-source + .task-wysiwyg__figure--task18-sheet {
  margin: 0.75rem 0 1rem;
  width: 100%;
}

.libreoffice-page-task18 .task-solution-html-wrap__inner .task-wysiwyg__image--task18-sheet,
.task-18-page .task-solution-html-wrap__inner .task-wysiwyg__image--task18-sheet {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(72vh, 720px);
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
}

[data-theme="light"] .libreoffice-page-task18 .task-solution-html-wrap__inner .task-wysiwyg__image--task18-sheet {
  border-color: rgba(15, 23, 42, 0.12);
}
