/* ============================================================
   Приёмная кампания — TV-табло
   Дизайн под Full HD (1920×1080), чтение с ~2-3 м
   ВАЖНО: макет рассчитан так, чтобы контент помещался в 1080px
   без зума на 1920×1080, и не «упирался» в низ при scale < 100%
   ============================================================ */

:root {
  /* База шрифта привязана к ширине viewport. На 1920px = ~17.5px */
  font-size: clamp(13px, 0.92vw, 18px);

  /* Палитра */
  --bg-0: #050816;
  --bg-1: #0a0e27;
  --bg-2: #111634;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #f5f7fb;
  --text-dim: #c8d0e0;
  --text-muted: #7a8499;

  --accent: #6366f1;       /* индиго */
  --accent-2: #22d3ee;     /* циан */
  --accent-success: #34d399; /* изумрудный */
  --accent-warn: #fbbf24;
  --accent-danger: #f87171;

  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-0);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center; /* контент центрируется при любом zoom */
  background:
    radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.15), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(34, 211, 238, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

/* Декоративные «орбы» на фоне */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.bg-orb--1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4), transparent 70%);
  top: -200px; left: -150px;
}
.bg-orb--2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.3), transparent 70%);
  bottom: -200px; right: -100px;
}

/* Контейнер: без min-height: 100vh, чтобы не тянуть пустое место.
   Сам не переполняем — если контент выше вьюпорта, появится скролл,
   но при 1920×1080 он не понадобится. */
.container {
  position: relative;
  z-index: 1;
  max-width: 1920px;
  margin: 0 auto;
  padding: 1.5rem 3.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ============================================================
   Шапка
   ============================================================ */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  animation: fadeIn 0.6s ease-out backwards;
  flex-shrink: 0;
}

.header-left { flex: 1; min-width: 0; }

.institution {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 0%, #c8d0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.campaign {
  margin-top: 0.3rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-shrink: 0;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-success);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-success);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
  }
}

.datetime {
  text-align: right;
  min-width: 0;
}

.time {
  font-size: 1.95rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #818cf8 0%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.date {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

/* ============================================================
   Карточки статистики
   ============================================================ */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  flex-shrink: 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.85rem 1.15rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.04) 100%);
  pointer-events: none;
}

.stat-card--accent {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
  border-color: rgba(99, 102, 241, 0.25);
}

.stat-card--cyan {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.10), rgba(34, 211, 238, 0.03));
  border-color: rgba(34, 211, 238, 0.22);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-card--accent .stat-value {
  color: #a5b4fc;
}

.stat-card--cyan .stat-value {
  color: #67e8f9;
}

.stat-foot {
  margin-top: 0.3rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stat-bar {
  margin-top: 0.55rem;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 999px;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   Таблица — занимает всё оставшееся место по высоте
   ============================================================ */

.table-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.85rem 1.15rem 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.7s 0.1s ease-out backwards;
}

.table-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 30%);
  pointer-events: none;
}

.data-table {
  width: 100%;
  height: 100%;
  border-collapse: separate;
  border-spacing: 0;
  position: relative;
  z-index: 1;
  table-layout: fixed;
}

.col-specialty { width: 30%; }
.col-num { width: 17.5%; }

.data-table th {
  text-align: center;
  font-weight: 600;
  padding: 0.6rem 0.6rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.data-table th.th-specialty {
  text-align: left;
  padding-left: 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.data-table th.th-class {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-transform: none;
  letter-spacing: 0.01em;
  padding: 0.7rem 0.6rem;
}

.data-table th.th-type {
  font-size: 0.72rem;
  font-weight: 600;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.th-type--budget {
  color: #a5b4fc;
}
.th-type--nonbudget {
  color: #67e8f9;
}

/* Тело таблицы — компактные ряды */
.data-table tbody td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: center;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.2s ease;
}

.specialty-cell {
  text-align: left;
  padding-left: 0.4rem !important;
}

.specialty-code {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  padding: 0.1rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-bottom: 0.3rem;
  letter-spacing: 0.03em;
}

.specialty-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.15;
}

/* Числовые ячейки — крупно, но в сжатых пропорциях */
.num-cell {
  position: relative;
}

.num-applied {
  font-size: 2.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
  display: inline-block;
}

.num-sep {
  font-size: 1.4rem;
  color: var(--text-muted);
  margin: 0 0.2rem;
  font-weight: 300;
}

.num-plan {
  font-size: 1rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.num-cell--budget .num-applied { color: #c7d2fe; }
.num-cell--nonbudget .num-applied { color: #a5f3fc; }

/* Прочерк */
.num-empty {
  display: inline-block;
  font-size: 2.2rem;
  font-weight: 300;
  color: var(--text-muted);
  opacity: 0.4;
}

/* Прогресс-полоска под числом (тонкая) */
.num-bar {
  position: relative;
  margin: 0.45rem auto 0;
  width: 65%;
  max-width: 120px;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}

.num-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.num-bar-fill--full {
  background: linear-gradient(90deg, var(--accent-warn) 0%, var(--accent-danger) 100%);
}

/* Состояние «заявок больше мест» */
.num-cell--over .num-applied { color: var(--accent-danger); }
.num-cell--over .num-bar-fill { background: var(--accent-danger); }

/* Ошибка */
.table-error {
  margin-top: 0.85rem;
  padding: 0.85rem 1.1rem;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 0.7rem;
  color: #fecaca;
  font-size: 0.9rem;
  text-align: center;
}

.table-error code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ============================================================
   Подвал
   ============================================================ */

.page-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
  padding-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.footer-dot { opacity: 0.5; }

/* ============================================================
   Анимации
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.data-table tbody tr {
  animation: rowIn 0.4s ease-out backwards;
}

.data-table tbody tr:nth-child(1) { animation-delay: 0.15s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.20s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.25s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.30s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.35s; }

.stats .stat-card {
  animation: fadeIn 0.5s ease-out backwards;
}
.stats .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats .stat-card:nth-child(2) { animation-delay: 0.10s; }
.stats .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats .stat-card:nth-child(4) { animation-delay: 0.20s; }

.flash-update {
  animation: flash 0.6s ease-out;
}
@keyframes flash {
  0% { background: rgba(99, 102, 241, 0.18); }
  100% { background: transparent; }
}

/* ============================================================
   Адаптив — на небольших экранах переключаемся на «свободный» рост
   и нормальную пиксельную типографику
   ============================================================ */

@media (max-width: 1280px) {
  .container { padding: 1.5rem 2rem 1rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .institution { font-size: 1.4rem; }
  .time { font-size: 1.7rem; }
  .num-applied { font-size: 2.1rem; }
  .specialty-name { font-size: 1.15rem; }
  .table-wrapper { padding: 0.85rem 1rem; }
}

@media (max-width: 720px) {
  .container { padding: 1rem; gap: 0.85rem; }
  .stats { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .header-right { width: 100%; justify-content: space-between; }
  .col-specialty { width: 45%; }
  .col-num { width: 13.75%; }
  .num-applied { font-size: 1.5rem; }
  .specialty-name { font-size: 0.95rem; }
}
