/* ============================================================
   Classic GPMU — Приёмная комиссия СПбГПМУ
   Палитра gpmu.org:
     Тёмно-зелёный (шапка/футер/thead): #041b1b
     Бирюзовый (акцент, фильтры, кнопки): #05969c
     Оранжевый (CTA, активный nav): #ff5c00
     Светло-бирюзовый (карточки, hover): #edfffc / #e0f5f5
     Фон страницы: #f4f6f6
     Белый: #ffffff
   Шрифт: Open Sans
   ============================================================ */

/* Open Sans — Latin */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/opensans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Open Sans — Cyrillic */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/opensans-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-dark:        #041b1b;
  --color-dark-hover:  #0a2e2e;
  --color-teal:        #05969c;
  --color-teal-dark:   #047a80;
  --color-teal-light:  #edfffc;
  --color-teal-mid:    #e0f5f5;
  --color-orange:      #ff5c00;
  --color-orange-dark: #d94e00;
  --color-bg:          #f4f6f6;
  --color-surface:     #ffffff;
  --color-border:      #cdd8d8;
  --color-text:        #041b1b;
  --color-text-muted:  #4a6060;
  --color-row-even:    #f0f7f7;
  --color-row-hover:   #e0f5f5;
  --shadow-sm:         0 1px 4px rgba(4,27,27,.08);
  --shadow-md:         0 4px 18px rgba(4,27,27,.12);
  --radius:            6px;
  --font:              'Open Sans', Arial, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
}

/* ============================================================
   Верхняя информационная полоса
   ============================================================ */
.topbar {
  background: var(--color-dark);
  color: rgba(255,255,255,.6);
  font-size: .73rem;
  padding: 0 28px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: .1px;
}

.topbar a {
  color: rgba(255,255,255,.6);
  text-decoration: none;
  transition: color .2s;
}
.topbar a:hover { color: #fff; }

/* ============================================================
   Основная шапка — без логотипа, название текстом
   ============================================================ */
.site-header {
  background: var(--color-dark);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.3);
}

/* Название университета вместо логотипа */
.site-header .logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  gap: 10px;
}

.site-header .logo img {
  display: none; /* логотип скрыт */
}

.site-header .logo-text {
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .2px;
  line-height: 1.2;
}

.site-header .logo-text small {
  display: block;
  font-size: .68rem;
  font-weight: 400;
  color: rgba(255,255,255,.55);
  letter-spacing: .1px;
}

/* Альтернативная структура логотипа через div */
.site-header .logo-sub {
  display: block;
  font-size: .68rem;
  font-weight: 400;
  color: rgba(255,255,255,.55);
  letter-spacing: .1px;
  line-height: 1.3;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-header nav a {
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius);
  transition: background .2s, color .2s;
  white-space: nowrap;
}

.site-header nav a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.site-header nav a.active {
  background: var(--color-teal);
  color: #fff;
}

/* ============================================================
   Хлебные крошки
   ============================================================ */
.breadcrumb {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 9px 28px;
  font-size: .77rem;
  color: var(--color-text-muted);
}

.breadcrumb a {
  color: var(--color-teal);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 6px; }

/* ============================================================
   Главная страница — hero
   ============================================================ */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 90px);
  padding: 48px 24px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: var(--color-teal);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 22px;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 12px;
  line-height: 1.25;
  max-width: 640px;
}

.hero p {
  font-size: .95rem;
  color: var(--color-text-muted);
  margin-bottom: 48px;
  max-width: 520px;
}

.hero-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  align-items: stretch;
}

/* Карточки-кнопки на главной */
.btn-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  min-height: 0;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-teal);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .15s, border-color .2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-hero:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-top-color: var(--color-orange);
  background: var(--color-teal-light);
}

.btn-hero .btn-icon {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.btn-hero .btn-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--color-dark);
  line-height: 1.3;
  margin-bottom: 10px;
}

.btn-hero .btn-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--color-teal);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Кнопка поиска по коду */
.btn-hero--search {
  border-top-color: #e65100;
  background: linear-gradient(135deg, #fff8f5 0%, #fff 100%);
}
.btn-hero--search:hover {
  border-top-color: #e65100;
  background: linear-gradient(135deg, #fff0e8 0%, #fff 100%);
}
.btn-hero--search .btn-arrow {
  color: #e65100;
}

/* Заблокированные карточки */
.btn-hero--disabled {
  opacity: .65;
  cursor: default;
  border-top-color: var(--color-border);
}
.btn-hero--disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-top-color: var(--color-border);
  background: var(--color-surface);
}

.btn-notice {
  font-size: .75rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ============================================================
   Страница с таблицей
   ============================================================ */
.page-container {
  max-width: 100%;
  padding: 22px 28px 40px;
}

.page-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--color-border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-dark);
  line-height: 1.2;
}

.page-title span {
  display: block;
  width: 40px;
  height: 3px;
  background: var(--color-teal);
  margin-top: 8px;
  border-radius: 2px;
}

.update-info {
  font-size: .77rem;
  color: var(--color-text-muted);
  background: var(--color-teal-light);
  border: 1px solid #b2e0e0;
  border-radius: 20px;
  padding: 4px 14px;
  white-space: nowrap;
}

/* ============================================================
   Панель фильтров
   ============================================================ */
.filters-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-teal);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 200px;
  flex: 1;
}

.filter-group label {
  font-size: .69rem;
  font-weight: 700;
  color: var(--color-teal-dark);
  text-transform: uppercase;
  letter-spacing: .7px;
}

.filter-group input,
.filter-group select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .88rem;
  font-family: var(--font);
  color: var(--color-text);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(5,150,156,.14);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* ============================================================
   Кнопки
   ============================================================ */
.btn {
  height: 38px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius);
  font-size: .85rem;
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s;
  letter-spacing: .2px;
}

.btn:active { transform: scale(.97); }

/* Основная кнопка — бирюзовая */
.btn-primary {
  background: var(--color-teal);
  color: #fff;
}
.btn-primary:hover { background: var(--color-teal-dark); }

/* Вторичная кнопка */
.btn-secondary {
  background: var(--color-row-even);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-teal-mid); border-color: var(--color-teal); }

/* CTA-кнопка (оранжевая) */
.btn-cta {
  background: var(--color-orange);
  color: #fff;
}
.btn-cta:hover { background: var(--color-orange-dark); }

/* ============================================================
   Счётчик результатов
   ============================================================ */
.results-count {
  font-size: .79rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  padding-left: 2px;
}

/* ============================================================
   Таблица
   ============================================================ */
.table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  white-space: normal;
  table-layout: fixed;
}

.data-table thead th {
  background: var(--color-dark);
  color: rgba(255,255,255,.92);
  padding: 10px 10px;
  text-align: left;
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .1px;
  border-right: 1px solid rgba(255,255,255,.1);
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: auto;
  -webkit-hyphens: auto;
  lang: ru;
  line-height: 1.35;
  vertical-align: bottom;
  width: 100px;
  position: sticky;
  top: 0;
  z-index: 5;
}

/* Первый столбец (номер) — бирюзовый акцент */
.data-table thead th:first-child {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  background: var(--color-teal);
  overflow: hidden;
}

/* Ширины по типам столбцов */
.data-table thead th.th-code  { width: 85px;  }
.data-table thead th.th-name  { width: 230px; }
.data-table thead th.th-uid   { width: 95px;  }
.data-table thead th.th-score { width: 80px;  text-align: center; }
.data-table thead th.th-flag  { width: 75px;  text-align: center; }
.data-table thead th.th-subj  { width: 110px; }

.data-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background .12s;
}

.data-table tbody tr:nth-child(even) {
  background: var(--color-row-even);
}

.data-table tbody tr:hover {
  background: var(--color-row-hover);
}

.data-table tbody td {
  padding: 8px 10px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-right: 1px solid var(--color-border);
  color: var(--color-text);
}

.data-table tbody td:first-child {
  text-align: center;
  font-weight: 700;
  color: var(--color-text-muted);
  font-size: .75rem;
  background: #f5fafa;
  border-right: 2px solid var(--color-border);
}

/* Конкурсная группа — бирюзовый код */
.data-table td.col-code {
  font-weight: 700;
  color: var(--color-teal-dark);
  white-space: nowrap;
}

/* Наименование — перенос строк */
.data-table td.col-name {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  min-width: 160px;
  max-width: 280px;
  line-height: 1.4;
}

/* Числовые столбцы */
.data-table td.col-score,
.data-table td.col-flag {
  text-align: center;
  white-space: nowrap;
}

/* ============================================================
   Sticky-заголовок таблицы (клон thead вне overflow)
   ============================================================ */
#sticky-header-outer {
  position: sticky;
  top: 0;
  z-index: 25;
  overflow: hidden;
  background: var(--color-dark);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* ============================================================
   Пагинация
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.pagination button {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: .82rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.pagination button:hover:not(:disabled) {
  background: var(--color-teal);
  border-color: var(--color-teal);
  color: #fff;
}

.pagination button.active {
  background: var(--color-teal);
  color: #fff;
  border-color: var(--color-teal);
  font-weight: 700;
}

.pagination button:disabled {
  opacity: .35;
  cursor: default;
}

.pagination .page-info {
  font-size: .8rem;
  color: var(--color-text-muted);
  padding: 0 6px;
}

/* ============================================================
   Состояние загрузки / ошибки
   ============================================================ */
.state-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
  font-size: .92rem;
}

.state-message .spinner {
  display: inline-block;
  width: 34px;
  height: 34px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-teal);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin-bottom: 14px;
}

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

/* ============================================================
   Футер
   ============================================================ */
.site-footer {
  background: var(--color-dark);
  color: rgba(255,255,255,.5);
  padding: 20px 28px;
  font-size: .77rem;
  text-align: center;
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.site-footer a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
}
.site-footer a:hover { color: var(--color-teal); }

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 768px) {
  .topbar { display: none; }
  .site-header { padding: 0 14px; height: 54px; }
  .site-header nav a { padding: 5px 10px; font-size: .78rem; }
  .hero h1 { font-size: 1.5rem; }
  .btn-hero { width: 100%; flex-direction: row; min-height: 80px; gap: 14px; padding: 16px; }
  .btn-hero .btn-icon { font-size: 1.4rem; margin-bottom: 0; }
  .page-container { padding: 16px 14px 32px; }
  .filters-panel { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Сводная ведомость — таблица
   ============================================================ */

/* Внешний контейнер */
.sved-table-outer {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: visible;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
}

/* Внутренний wrapper с горизонтальной и вертикальной прокруткой */
.sved-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
}

/* Сама таблица */
.sved-table {
  border-collapse: collapse;
  font-size: .78rem;
  white-space: nowrap;
  min-width: 100%;
}

/* Заголовки */
.sved-table thead th {
  background: var(--color-dark);
  color: rgba(255,255,255,.92);
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
  font-size: .72rem;
  border: 1px solid rgba(255,255,255,.12);
  white-space: normal;
  word-break: normal;
  line-height: 1.3;
  vertical-align: middle;
}

/* Ячейки данных */
.sved-table tbody td {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  vertical-align: middle;
  color: var(--color-text);
  white-space: nowrap;
  text-align: right;
}

/* Первый столбец (название) */
.sved-table tbody td:first-child {
  text-align: left;
  white-space: normal;
  min-width: 260px;
  max-width: 380px;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.4;
}

/* Строки-разделы */
.sved-row-section td {
  background: #041b1b !important;
  color: #fff !important;
  font-weight: 700;
  font-size: .8rem;
}

/* Итоговые строки */
.sved-row-total td {
  background: #e0f5f5 !important;
  font-weight: 700;
  border-top: 2px solid var(--color-teal);
}

/* Строки форм обучения */
.sved-row-form td {
  background: #c8e8e8 !important;
  font-weight: 600;
  color: #041b1b;
}

/* Строки уровней образования */
.sved-row-level td {
  background: #e8f5f5 !important;
  font-weight: 600;
  font-style: italic;
}

/* Строки направлений */
.sved-row-direction td {
  background: var(--color-surface);
}
.sved-row-direction:nth-child(even) td {
  background: var(--color-row-even);
}
.sved-row-direction:hover td {
  background: var(--color-row-hover) !important;
}

/* Прочие строки */
.sved-row-other td {
  background: var(--color-surface);
}
.sved-row-other:nth-child(even) td {
  background: var(--color-row-even);
}
