/* Дополнения к стилям Django admin для страниц ЭКГ-аналитики */

#content { max-width: 100%; }
#content h2.subhead { margin: 1.5em 0 .5em; }

/* формы фильтров */
fieldset.module .form-row select,
fieldset.module .form-row input[type=text],
fieldset.module .form-row input[type=number],
fieldset.module .form-row input[type=search] { width: 100%; max-width: 36em; box-sizing: border-box; }
fieldset.module .form-row select[multiple] { min-height: 9em; }
fieldset.module .flex-container { align-items: flex-start; }
details.module { margin-bottom: 1em; }
details.module > summary {
  cursor: pointer; padding: 8px; font-weight: 400; font-size: .8125rem;
  background: var(--header-bg); color: var(--header-link-color);
  text-transform: uppercase; letter-spacing: .5px; list-style: none;
}
details.module > summary::-webkit-details-marker { display: none; }
details.module > summary::before { content: '▸ '; }
details.module[open] > summary::before { content: '▾ '; }
details.module > table, details.module > .module-body { width: 100%; }
.module-body { padding: 10px; }
.submit-row { text-align: left; }
.submit-row input, .submit-row .button { margin-right: 6px; }

/* блок возможностей и списки текста */
.content ul.plain, .content ol.plain { margin-left: 1.5em; padding: 0; }
.content ul.plain li, .content ol.plain li { list-style: disc; margin: .3em 0; }
.notice { padding: 10px 12px; border-left: 4px solid var(--accent); background: var(--darkened-bg); margin: 0 0 1.5em; }

/* таблицы */
table.wide { width: 100%; }
#result_list td.num, table td.num { text-align: right; white-space: nowrap; }
#result_list td.center, table td.center, table th.center { text-align: center; }
.results { overflow-x: auto; }
table.params th:first-child, table.params td:first-child { text-align: left; }
table.params td { text-align: center; }
table.info th { width: 14em; text-align: left; }

/* кнопки-ссылки рядом с заголовком */
ul.object-tools { float: none; margin: 0 0 10px; text-align: right; position: static; }
ul.object-tools li { float: none; display: inline-block; margin-bottom: 6px; }
.actions-inline .button, a.button { display: inline-block; margin: 0 6px 6px 0; }
.score { font-size: 1.1em; font-weight: 600; }

/* боковое меню: блок примененных фильтров */
#nav-sidebar .applied-filters th { font-weight: 600; }
#nav-sidebar .applied-filters .filter-value { font-weight: 400; color: var(--body-quiet-color); white-space: normal; }

/* оверлей ожидания */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: var(--body-bg); opacity: .95;
}
.loading-overlay[hidden] { display: none; }
.loading-overlay .loading-text { margin-top: 20px; font-size: 1rem; font-weight: 600; text-align: center; max-width: 90%; }
.loading-overlay .loading-timer { color: var(--body-quiet-color); font-variant-numeric: tabular-nums; }
.loading-overlay .loading-hide {
  margin-top: 12px; background: none; border: 1px solid var(--border-color); border-radius: 4px;
  padding: 4px 12px; color: var(--body-quiet-color); cursor: pointer;
}
.spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 6px solid var(--hairline-color); border-top-color: var(--secondary);
  animation: eps-spin 1s linear infinite;
}
@keyframes eps-spin { to { transform: rotate(360deg); } }

/* ход выполнения фоновой задачи */
#task-status .task-stage { font-weight: 600; margin: 0 0 8px; }
#task-status progress { width: 100%; max-width: 40em; height: 1.2em; accent-color: var(--secondary); }
#task-status .task-meta { color: var(--body-quiet-color); font-variant-numeric: tabular-nums; margin: 8px 0 0; }
#task-status .task-count:not(:empty)::after { content: ' · '; }
#task-status:not(.finished) .task-stage::before {
  content: ''; display: inline-block; width: .8em; height: .8em; margin-right: 8px; vertical-align: -1px;
  border-radius: 50%; border: 2px solid var(--hairline-color); border-top-color: var(--secondary);
  animation: eps-spin 1s linear infinite;
}

/* быстрый поиск */
.quick-search { display: flex; gap: 6px; flex-wrap: wrap; margin: 1em 0; }
.quick-search input[type=text] { min-width: 20em; }

/* мобильная версия: админка прячет боковое меню на узких экранах (<768px),
   поэтому открываем его выезжающей панелью по кнопке «☰ Меню» в шапке */
.menu-toggle { display: none; }
@media (max-width: 767px) {
  #header { flex-direction: row; flex-wrap: wrap; align-items: center; }
  #branding { display: flex; align-items: center; gap: 10px; }
  .menu-toggle {
    display: inline-block; padding: 6px 12px; border: 1px solid var(--header-link-color); border-radius: 4px;
    background: transparent; color: var(--header-link-color); font-size: .9375rem; cursor: pointer; white-space: nowrap;
  }
  body.menu-open { overflow: hidden; }
  body.menu-open #nav-sidebar {
    display: block; visibility: visible; position: fixed; top: 0; bottom: 0; left: 0; z-index: 1001;
    width: min(85vw, 320px); max-height: none; margin: 0; padding: 8px; box-sizing: border-box;
    box-shadow: 0 0 16px rgba(0, 0, 0, .3);
  }
  .menu-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .4); }
  .menu-backdrop[hidden] { display: none; }
  #nav-sidebar .module th a { display: block; padding: 4px 0; }
}
