/* =========================================================
   1. БАЗОВЫЕ НАСТРОЙКИ
   ========================================================= */

/* box-sizing: border-box позволяет учитывать padding и border
   внутри заданной ширины/высоты элемента */
* {
  box-sizing: border-box;
}


/* Общие настройки страницы:
   - убираем стандартные внешние отступы
   - минимальная высота страницы — 100%
   - основной шрифт — Arial
   - основной цвет текста — #111 */
html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: #111;
}


/* Белый фон всей страницы */
body {
  background: #fff;
}

/* =========================================================
   1.1. ОБЩАЯ ШИРИНА КОНТЕЙНЕРА СТРАНИЦЫ
   ========================================================= */

/* Единая ширина центральной части страницы */
:root {
  --container-width: 990px;
}


/* =========================================================
   2. ВЕРХНЯЯ СИНЯЯ ШАПКА
   ========================================================= */

/* Вся верхняя синяя полоса */
.topbar {
  height: 60px;
  background: #243f8e;
  color: #aebee8;
}


/* Внутренний контейнер шапки.
   width: 680px — ширина содержимого
   margin: 0 auto — центрирование по горизонтали
   display:flex — элементы стоят в одну строку */
.topbar-inner {
  width: var(--container-width);
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;

  font-family: "Conv_NGT65", Arial, Helvetica, sans-serif;
}


/* =========================================================
   3. ЛОГОТИП / НАЗВАНИЕ В ШАПКЕ
   ========================================================= */

/* Контейнер логотипа и названия */
.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}


/* Символ/иконка рядом с названием */
.brand-mark {
  width: 50px;
  height: 50px;
  display: block;
  flex-shrink: 0;
}


/* =========================================================
   4. ВЕРХНЕЕ МЕНЮ
   ========================================================= */

/* Само меню навигации */
nav {
  display: flex;
  gap: 13px;
  align-items: center;
  flex: 1;
}


/* Ссылки верхнего меню и иконки */
nav a,
.icons a {
  color: #aebee8;
  text-decoration: none;
  white-space: nowrap;
}


/* Цвет ссылки при наведении мыши */
nav a:hover,
.icons a:hover {
  color: #fff;
}


/* Контейнер иконок справа в шапке */
.icons {
  display: flex;
  gap: 10px;
  font-size: 18px;
  align-items: center;
}


/* =========================================================
   5. ОСНОВНАЯ ЧАСТЬ СТРАНИЦЫ
   ========================================================= */

/* Минимальная высота основной области */
.page {
  min-height: 404px;
}


/* Центральный контейнер основного содержимого */
.content {
  width: var(--container-width);
  margin: 51px auto 0;
}


/* =========================================================
   6. ГЛАВНЫЙ ЗАГОЛОВОК
   ========================================================= */

/* Заголовок страницы <h1>
   Здесь можно менять:
   - font-family — шрифт
   - font-size — размер
   - font-weight — жирность
   - margin — расстояния вокруг заголовка */
h1 {
  font-family: "Scada", sans-serif;
  font-size: 40px;
  font-weight: normal;
  margin: 40px 0 38px;
}


/* =========================================================
   7. ТАБЛИЦА АПОСТИЛЯ
   ========================================================= */

/* Контейнер всей таблицы */
.record {
  width: 100%;
  margin-left: 0;
}


/* Одна строка таблицы.
   Таблица сделана через CSS Grid.

   grid-template-columns:
   260px — левая колонка
   1fr   — правая колонка */
.row {
  display: grid;
  grid-template-columns: 350px 1fr;
  min-height: 23px;
  border-bottom: 1px solid #d8dadd;
  font-size: 12px;
  color: #777;
}


/* Верхняя граница первой строки таблицы */
.row:first-child {
  border-top: 1px solid #d8dadd;
}


/* Левая колонка таблицы:
   здесь находятся названия параметров */
.label {
  padding: 4px 10px 4px 2px;
  border-right: 1px solid #cfd2d5;
  color: #4e4e4e;
  font-family: "Roboto", 'helveticaneuecyr_light', sans-serif;
  font-size: 16px;
  font-weight: normal;
}


/* Правая колонка таблицы:
   здесь находятся значения из базы данных */
.value {
  padding: 4px 8px;
  font-family: "Roboto", 'helveticaneuecyr_light', sans-serif;
  font-size: 16px;
  font-weight: light;
}


/* =========================================================
   8. СОСТОЯНИЯ ЗАГРУЗКИ / ОШИБКИ
   ========================================================= */

/* Текст "Загрузка..." и "Запись не найдена" */
.loading,
.not-found {
  padding: 20px 0;
  color: #777;
}


/* =========================================================
   9. НИЖНИЙ FOOTER
   ========================================================= */

/* Вся нижняя серая область */
.footer {
  height: 260px;
  background: #f0f2f3;
  margin-top: 40px;
}


/* Контейнер содержимого footer */
.footer-inner {
  width: var(--container-width);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 200px 200px 1fr;
  gap: 0;
  align-content: center;
  font-size: 15px;
  line-height: 19px;
  font-family: "Roboto", 'helveticaneuecyr_light', sans-serif;
}


/* Ссылки внутри footer */
.footer a {
  display: block;
  color: #7795d0;
  text-decoration: none;
  margin-bottom: 6px
}


/* Подчеркивание ссылок footer при наведении */
.footer a:hover {
  text-decoration: underline;
}



/* =========================================================
   10. КНОПКА "НАПИШИТЕ НАМ"
   ========================================================= */

/* Плавающая кнопка в правом нижнем углу */
.chat {
 position: fixed;
  right: 18px;
  bottom: 17px;
  border: 0;
  border-radius: 13px;
  background: #4D6BBC;
  color: #fff;
  padding: 14px 14px;
  font-size: 21px;
  box-shadow: 0 2px 7px #999;
  cursor: pointer;
}


/* Иконка внутри кнопки */
.chat img {
  width: 32px;
  height: 32px;
  margin-left: 8px;
  vertical-align: middle;
}


/* =========================================================
   11. АДМИНКА — ФОН
   ========================================================= */

/* Фон страницы админки */
.admin-page {
  background: #f5f6f8;
}


/* =========================================================
   12. АДМИНКА — ВЕРХНЯЯ ПАНЕЛЬ
   ========================================================= */

/* Верхняя панель админки */
.admin-header {
  height: 58px;
  background: #243f8e;
  color: #fff;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}


/* Ссылка в верхней панели админки */
.admin-header a {
  color: #dbe4ff;
  text-decoration: none;
}


/* =========================================================
   13. АДМИНКА — ОСНОВНОЙ КОНТЕЙНЕР
   ========================================================= */

/* Основная область админки */
.admin-main {
  max-width: 1100px;
  margin: 35px auto;
  padding: 0 20px;
}


/* =========================================================
   14. АДМИНКА — ПАНЕЛЬ ЗАГОЛОВКА
   ========================================================= */

/* Строка с заголовком "Записи апостиля"
   и кнопкой "+ Новая запись" */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}


/* Заголовок внутри админки */
.admin-toolbar h1 {
  font-family: Arial, sans-serif;
  font-size: 25px;
  margin: 0;
}


/* =========================================================
   15. АДМИНКА — КНОПКИ
   ========================================================= */

/* Общие параметры всех кнопок
   и ссылок в блоке действий */
.primary,
.ghost,
.actions button,
.actions a {
  border: 0;
  border-radius: 5px;
  padding: 9px 13px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}


/* Основная синяя кнопка */
.primary {
  background: #294998;
  color: #fff;
}


/* Серая вторичная кнопка */
.ghost {
  background: #e8eaee;
  color: #333;
}


/* =========================================================
   16. АДМИНКА — ТАБЛИЦА
   ========================================================= */

/* Обертка таблицы.
   overflow:auto позволяет прокручивать таблицу,
   если она окажется шире контейнера */
.table-scroll {
  overflow: auto;
  background: #fff;
  border: 1px solid #d8dce3;
}


/* Сама таблица */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}


/* Ячейки заголовка и тела таблицы */
th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #e2e5e9;
}


/* Заголовки колонок */
th {
  background: #f1f3f6;
}


/* Колонка с кнопками действий */
.actions {
  white-space: nowrap;
}


/* Кнопки и ссылки в колонке действий */
.actions button,
.actions a {
  background: #eef1f7;
  color: #294998;
  margin-right: 5px;
}


/* Кнопка удаления */
.actions .danger {
  color: #a22;
  background: #f9eaea;
}


/* =========================================================
   17. АДМИНКА — ФОРМА РЕДАКТИРОВАНИЯ
   ========================================================= */

/* Основной блок редактора */
.editor {
  margin-top: 25px;
  background: #fff;
  border: 1px solid #d8dce3;
  padding: 24px;
  max-width: 650px;
}


/* Верхняя часть формы:
   заголовок + кнопка закрытия */
.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}


/* Заголовок формы */
.editor-head h2 {
  margin: 0;
  font-size: 20px;
}


/* Кнопка закрытия формы */
.editor-head button {
  font-size: 22px;
  padding: 2px 9px;
}


/* Подписи полей формы */
.editor label {
  display: block;
  font-size: 13px;
  margin: 13px 0;
  color: #555;
}


/* Поля ввода */
.editor input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid #cfd4dc;
  border-radius: 4px;
  font-size: 14px;
}


/* Контейнер кнопок "Сохранить" / "Отмена" */
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}


/* Универсальный класс скрытия элемента */
.hidden {
  display: none;
}


/* =========================================================
   18. СТРАНИЦА ОШИБКИ
   ========================================================= */

/* Фон страницы ошибки */
.error-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: #f4f5f7;
}


/* Белое окно ошибки */
.error-box {
  text-align: center;
  background: #fff;
  border: 1px solid #ddd;
  padding: 45px 70px;
}


/* Заголовок страницы ошибки */
.error-box h1 {
  font-family: Arial, sans-serif;
  font-size: 25px;
  margin-bottom: 10px;
}


/* Текст ошибки */
.error-box p {
  color: #777;
}


/* Ссылка на странице ошибки */
.error-box a {
  color: #294998;
}


/* =========================================================
   19. АДАПТИВНОСТЬ
   ========================================================= */

/* Эти правила начинают работать,
   когда ширина экрана становится меньше 760px */
@media(max-width:760px) {

  /* Контейнеры становятся шириной почти во весь экран */
  .topbar-inner,
  .content,
  .footer-inner {
    width: calc(100% - 30px);
  }

  /* Верхнее меню на маленьком экране скрывается */
  nav {
    display: none;
  }

  /* Таблица занимает всю доступную ширину */
  .record {
    width: 100%;
    margin-left: 0;
  }

  /* Колонки таблицы становятся 42% / 58% */
  .row {
    grid-template-columns: 42% 58%;
  }

  /* Footer на мобильном должен расти по содержимому,
     а не ограничивать список ссылок фиксированной высотой */
  .footer {
    height: auto;
    min-height: 0;
    padding: 24px 0 90px;
  }

  /* Колонки footer на мобильном */
  .footer-inner {
    width: calc(100% - 30px);
    height: auto;
    grid-template-columns: 1fr 1fr;
    align-content: start;
    padding: 0;
  }

}

/* =========================================================
   QR-КОД В АДМИНКЕ
   ========================================================= */

.qr-cell {
  min-width: 125px;
  vertical-align: middle;
}

.qr-preview {
  width: 90px;
  height: 90px;
  display: block;
  object-fit: contain;
  margin-bottom: 6px;
}

.qr-download {
  display: inline-block;
  color: #294998;
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}

.qr-download:hover {
  text-decoration: underline;
}

/* =========================================================
   20. АВТОРИЗАЦИЯ
   ========================================================= */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f5f6f8;
}

.login-box {
  width: min(420px, calc(100% - 30px));
  background: #fff;
  border: 1px solid #d8dce3;
  padding: 30px;
}

.login-box h1 {
  font-family: Arial, sans-serif;
  font-size: 25px;
  margin: 0 0 25px;
}

.login-box label {
  display: block;
  font-size: 13px;
  color: #555;
  margin: 15px 0;
}

.login-box input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px;
  border: 1px solid #cfd4dc;
  border-radius: 4px;
  font-size: 14px;
}

.login-box .primary {
  width: 100%;
  margin-top: 8px;
}

.login-error {
  margin: 12px 0;
  padding: 10px 12px;
  background: #f9eaea;
  color: #a22;
  border: 1px solid #eccaca;
  font-size: 13px;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-logout {
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 4px;
  padding: 7px 11px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

.header-logout:hover {
  background: rgba(255,255,255,.1);
}
