/* ems-unify.css (2.11.0): общий знаменатель оформления EMS.
   Подключается из includes/header_theme.php на всех страницах. Правила с приставкой html body, чтобы быть сильнее
   местных стилей страниц, которые писались в разное время. Цвета только из css/variables.css (темы работают). */

/* Переход между страницами без вспышки: браузер плавно сменяет старую страницу новой (Chrome, Opera, Edge). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
html { background-color: var(--bg-body); overflow-y: scroll; }
html body { font-family: Arial, "Segoe UI", sans-serif; font-size: 13px; line-height: 1.5; background-color: var(--bg-body); color: var(--text-color); }

/* Блоки страниц больше не «въезжают» сверху при каждом открытии. */
html body .fade-in, html body .container.fade-in { animation: none !important; opacity: 1 !important; transform: none !important; }

/* ── Меню ─────────────────────────────────────────────────────────── */
html body .tabs-container { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-height: 61px; padding: 10px 190px 10px 20px;
  background-color: var(--bg-table-header); border-bottom: 1px solid var(--border-color); overflow-x: auto; scrollbar-width: none; view-transition-name: ems-nav; }
html body .tabs-container::-webkit-scrollbar { display: none; }
html body .tabs-container .tab { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; border-radius: 8px; white-space: nowrap;
  font-size: 13px; font-weight: 400; line-height: 20px; color: var(--text-color); background-color: transparent; text-decoration: none; transition: background-color .15s ease; }
html body .tabs-container .tab i { width: 16px; text-align: center; font-size: 14px; opacity: .8; }
html body .tabs-container .tab:hover { background-color: var(--bg-hover); }
html body .tabs-container .tab.active { background-color: var(--color-primary); color: #fff; }
html body .tabs-container .tab.active i { opacity: 1; }

/* ── Блок страницы: одна ширина, один отступ, одно скругление ───────── */
html body .container, html body .aw-card, html body .help-card, html body .support-container {
  background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: var(--shadow-md); }
html body > .container { max-width: 1200px; width: auto; margin: 30px auto; padding: 24px; }
html body > .aw-wrap, html body > .help-wrap { margin-top: 30px; padding-top: 0; }
html body > .support-container { margin-top: 30px; }
@media (max-width: 1260px) { html body > .container { margin: 16px 12px; padding: 16px; } }

/* Вложенные «карточки в карточке» (Витрина, Уведомления): шапка раздела без собственной рамки и тени. */
html body > .container > .page-header { background: transparent; box-shadow: none; border: 0; border-radius: 0; padding: 0 0 16px; margin: 0 0 20px; border-bottom: 1px solid var(--border-color); }
html body > .container > .filters-section, html body > .container .settings-section { box-shadow: none; border: 1px solid var(--border-color); border-radius: 10px; }

/* Отчеты: шапка и форма были во всю ширину окна. */
html body > .header { max-width: 1200px; margin: 30px auto 0; padding: 20px 24px; background-color: var(--bg-card); border: 1px solid var(--border-color); border-bottom: 0; border-radius: 10px 10px 0 0; box-shadow: none; }
html body > #reportForm { display: block; max-width: 1200px; margin: 0 auto 30px; padding: 4px 24px 24px; background-color: var(--bg-card); border: 1px solid var(--border-color); border-top: 0; border-radius: 0 0 10px 10px; box-shadow: var(--shadow-md); }
html body > #reportForm > .filters-section, html body > #reportForm > .columns-section, html body > #reportForm > div { box-shadow: none; border-radius: 10px; margin-left: 0; margin-right: 0; }
html body > .header .user-info { display: none; }

/* ── Заголовки ───────────────────────────────────────────────────── */
html body .container h1, html body > .header h1, html body .aw-h1, html body .help-h1 { font-family: inherit; font-size: 24px; font-weight: 700; line-height: 1.25; color: var(--text-color); letter-spacing: 0; }
html body .container h2, html body .support-container h2 { color: var(--text-color); }

/* ── Поля ввода: одна высота и рамка ─────────────────────────────── */
html body .container input[type="date"], html body .container input[type="month"], html body .container input[type="text"], html body .container input[type="search"],
html body .container input[type="number"], html body .container input[type="email"], html body .container select,
html body #reportForm input[type="date"], html body #reportForm select {
  min-height: 34px; padding: 6px 10px; font: inherit; font-weight: 400; color: var(--text-color); background-color: var(--bg-input); border: 1px solid var(--border-input); border-radius: 6px; }
html body .container input:focus, html body .container select:focus, html body #reportForm input:focus, html body #reportForm select:focus { outline: 2px solid color-mix(in srgb, var(--color-primary) 35%, transparent); outline-offset: 0; border-color: var(--color-primary); }

/* ── Значки (вместо эмодзи) ─────────────────────────────────────── */
.ems-ic { display: inline-block; width: 1.25em; margin-right: .3em; text-align: center; font-size: .95em; line-height: 1; color: inherit; opacity: .85; }
h1 .ems-ic, h2 .ems-ic, h3 .ems-ic { color: var(--color-primary); opacity: 1; margin-right: .15em; }
.ems-ic-ok { color: var(--color-success); opacity: 1; }
.ems-ic-bad { color: var(--color-danger); opacity: 1; }
.ems-ic-warn { color: var(--color-warning); opacity: 1; }
button .ems-ic, .btn .ems-ic, a.tab .ems-ic, [class*="btn"] .ems-ic { color: inherit; opacity: .95; }

/* Телефон: меню прокручивается пальцем, значок пользователя его не закрывает. */
@media (max-width: 768px) {
  html body .tabs-container { padding: 8px 12px; min-height: 52px; margin-top: 52px; }
  html body .tabs-container .tab { padding: 8px 12px; }
}

/* Витрина: значок поиска был эмодзи из стилей. */
html body .search-box::before, html body .search-wrapper::before, html body .search-input-wrapper::before { content: "\f002"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 13px; color: var(--text-muted); }
html body .search-box input { padding-left: 34px; }
html body .search-box::before { top: auto; bottom: 10px; left: 12px; transform: none; line-height: 1; }
/* Заголовок страницы везде одного цвета и без значка: у части страниц значок был, у части нет. */
html body .container h1, html body > .header h1, html body .al-header h1, html body .aw-h1, html body .help-h1 { color: var(--text-color) !important; }
html body h1 > .ems-ic { display: none; }
/* Смена фильтра без перезагрузки: пока идет запрос, строки слегка бледнеют, высота блока не меняется. */
.ems-soft-wait { opacity: .55; transition: opacity .12s ease; }
/* Отчеты: блок результатов той же ширины, что и остальная страница; широкая таблица прокручивается внутри блока. */
html body > #ems-report-results { max-width: 1200px; margin: 0 auto 30px; }
html body > #ems-report-results .results-content { overflow-x: auto; }
/* Список мероприятий: год, месяц и город в шапке таблицы не сжимаются, когда в строках длинные названия. */
html body #filter-year { min-width: 88px; width: auto; }
html body #filter-month { min-width: 124px; width: auto; }
html body #filter-city, html body #filter-direction { min-width: 130px; }
html body #filter-date { min-width: 150px; }

/* Дата в строке списка не переносится (значок «внесено» остается рядом). */
@media (min-width: 769px) { html body .container table td[data-label="Дата"] { white-space: nowrap; } }

/* ── Фильтры списков (2.11.3): одна тонкая строка без рамки ───────────── */
html body .ems-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 10px 0 12px; padding: 0; background: none; border: 0; }
html body .ems-filters .ef-month { position: relative; display: inline-flex; align-items: stretch; height: 34px; border: 1px solid var(--border-input); border-radius: 8px; background: var(--bg-input); overflow: visible; }
html body .ems-filters .ef-step, html body .ems-filters .ef-month-label { margin: 0; padding: 0; border: 0; background: none; color: var(--text-color); font: inherit; cursor: pointer; line-height: 32px; box-shadow: none; }
html body .ems-filters .ef-step { width: 30px; font-size: 18px; color: var(--text-secondary); border-radius: 7px; }
html body .ems-filters .ef-month-label { min-width: 132px; padding: 0 6px; font-weight: 700; text-align: center; white-space: nowrap; }
html body .ems-filters .ef-step:hover, html body .ems-filters .ef-month-label:hover { background: var(--bg-hover); }
html body .ems-filters .ef-step:disabled { opacity: .3; cursor: default; background: none; }
html body .ems-filters .ef-month-pop { position: absolute; z-index: 50; top: 38px; left: 0; display: flex; gap: 8px; padding: 10px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: var(--shadow-lg); }
html body .ems-filters .ef-month-pop[hidden] { display: none; }
html body .ems-filters .ef-month-pop select { min-width: 0; width: auto; }
html body .ems-filters select.ef-select { width: auto; min-width: 150px; max-width: 240px; height: 34px; margin: 0; border-radius: 8px; }
html body .ems-filters .ef-reset { font-size: 12px; color: var(--text-link); text-decoration: underline; white-space: nowrap; }
html body .ems-filters .ef-reset[hidden] { display: none; }
html body .ems-filters .ef-count { margin-left: 6px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
html body .ems-filters .ef-count strong { color: var(--text-color); font-size: 14px; }
html body .ems-filters .ef-more { margin: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; color: var(--text-link); text-decoration: underline; cursor: pointer; box-shadow: none; }
html body .ems-filters .ef-more::after { content: " \25BE"; text-decoration: none; display: inline-block; }
html body .ems-filters .ef-more[aria-expanded="true"]::after { content: " \25B4"; }
html body .ems-filters .ef-online { margin-left: auto; min-width: 0; }
html body .ems-filters .ef-online .visited-users-box { margin: 0; padding: 0; }
html body .ems-filters.ems-soft-wait, html body .ems-filters .ems-soft-wait { opacity: 1; }
/* Сводка «волонтеры и часы»: открывается кнопкой «подробнее» в строке фильтров, собственной шапки больше нет. */
html body details#volstats > summary { display: none; }
html body details#volstats:not([open]) { display: none; }
html body details#volstats[open] { margin: 0 0 12px; }
/* Подсказка про «Анонсировать» с крестиком. */
html body .an-hint { display: flex; align-items: flex-start; gap: 10px; }
html body .an-hint > span { flex: 1; }
html body .an-hint .an-hint-x { flex: none; width: 22px; height: 22px; margin: -2px 0 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-muted); font-size: 18px; line-height: 20px; cursor: pointer; box-shadow: none; }
html body .an-hint .an-hint-x:hover { background: var(--bg-hover); color: var(--text-color); }
@media (max-width: 768px) {
  html body .ems-filters .ef-month { width: 100%; }
  html body .ems-filters .ef-month-label { flex: 1; }
  html body .ems-filters select.ef-select { flex: 1 1 calc(50% - 5px); max-width: none; min-width: 120px; }
  html body .ems-filters .ef-count { margin-left: 0; white-space: normal; }
  html body .ems-filters .ef-online { margin-left: 0; width: 100%; }
}
/* Пустой список: сообщение по центру таблицы. */
html body #ems-list-body td[colspan] { text-align: center !important; padding: 22px 12px !important; color: var(--text-muted); }
/* Окно выбора месяца должно лежать поверх «липкой» шапки таблицы. */
html body .ems-filters { position: relative; z-index: 300; }
html body .ems-filters .ef-month-pop { z-index: 1000; }
html body .container table thead, html body .container table thead th { z-index: 20; }

/* ── Статистика (2.11.4): период одной строкой, график на остаток окна ───── */
html body .ems-filters .ef-custom { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12px; }
html body .ems-filters .ef-custom[hidden] { display: none; }
html body .ems-filters .ef-custom input[type="date"] { height: 34px; min-height: 34px; width: 140px; min-width: 0; margin: 0; border-radius: 8px; }
html body .ems-filters .ef-count.stats-wrap { display: block; margin: 0 0 0 auto; padding: 0; background: none; border: 0; box-shadow: none; }
html body .ems-filters .ef-count .stat-sub { margin: 0; font-size: 12px; color: var(--text-muted); }
html body .stat-charts { display: flex; gap: 16px; align-items: flex-start; }
html body .stat-chart-main { position: relative; flex: 1 1 auto; min-width: 0; height: calc(100vh - 290px); min-height: 340px; }
/* Общее правило canvas { margin: auto } сжимало график до 300 px: библиотека вычитает поля из ширины блока. */
html body .stat-chart-main canvas, html body .stat-chart-side canvas { margin: 0 !important; }
html body #participantChart { display: none !important; }
html body .stat-chart-side { position: relative; flex: 0 0 22%; min-width: 0; }
@media (max-width: 768px) {
  html body .stat-charts { flex-direction: column; }
  html body .stat-chart-main { width: 100%; height: auto; min-height: 0; }
  html body .stat-chart-side { flex: none; width: 100%; }
  html body .ems-filters .ef-count.stats-wrap { margin-left: 0; white-space: normal; }
}
