/* =============== ПЕРЕМЕННЫЕ — ЕДИНЫЙ СТИЛЬ =============== */
/* =============== ПЕРЕМЕННЫЕ — ЕДИНЫЙ СТИЛЬ =============== */
:root {
  /* Основные цвета */
  --color-primary: #4080bf;      /* основной синий (академический, спокойный) */
  --color-accent: #f49a22;       /* вторичный оранжевый (акцент, кнопки, важное) */

  /* Семантические состояния */
  --color-success: #34c759;      /* успех (зелёный Apple-style) */
  --color-warning: #ffcc00;      /* ⚠️ добавлен: предупреждение (например, опоздание) */
  --color-danger: #ff3b30;       /* ошибка / критично (красный Apple-style) */

  /* Текст */
  --color-text: #1a1a1a;         /* почти чёрный, лучше для читаемости, чем #000 */
  --color-text-light: #666666;   /* серый текст (подписи, мелкий текст) */
  --color-text-muted: #888888;   /* ⚠️ добавлен: ещё более приглушённый текст (опционально) */

  /* Фон и поверхности */
  --color-bg: #f8f9fa;           /* фон страницы (светло-серый) */
  --color-card: #ffffff;         /* фон карточек, модалок, блоков */
  --color-overlay: rgba(0, 0, 0, 0.4); /* для затемнения фона под модалкой */

  /* Границы и разделители */
  --color-border: #eeeeee;       /* лёгкая граница (тоньше, чем текст) */
  --color-divider: #e0e0e0;      /* ⚠️ добавлен: для hr, разделителей в списках */

  /* Радиусы скругления */
  --border-radius: 16px;         /* крупные элементы: карточки, модалки */
  --border-radius-sm: 8px;       /* ⚠️ добавлен: кнопки, изображения, поля ввода */
  --border-radius-pill: 9999px;  /* ⚠️ добавлен: для "каплевидных" кнопок или аватаров */

  /* Высоты */
  --header-height: 56px;         /* высота шапки на мобильных */
  --nav-height: 64px;            /* высота нижней навигации */

  /* Шрифты */
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Значения по умолчанию на случай, если переменные не установлены */
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
}

/* =============== СБРОС И ГЛОБАЛЬНОЕ =============== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {

  padding-top: var(--safe-area-inset-top, 0px);
  padding-bottom: var(--safe-area-inset-bottom, 0px);
  padding-left: var(--safe-area-inset-left, 0px);
  padding-right: var(--safe-area-inset-right, 0px);
  margin: 0;
  min-height: 100vh;
  padding: 0; /* УБРАТЬ паддинги с body! */
  overflow: hidden; /* Запрещаем скролл на body */

  background: var(--color-bg);
  font-family: var(--font-main);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =============== HEADER (56px, компактный) =============== */
.app-header {

  position: fixed;
  left: 0;
  width: 100%;

  background: var(--color-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
  box-sizing: border-box;
  z-index: 100;
  padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
/*
  height: calc(var(--header-height)+var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));*/
}

.app-header__logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  transform: scale(1.2) translateX(5px) translateY(5px);
}

/* === HEADER: ИКОНКИ СПРАВА (единый размер 28×28 px) === */
.app-header__actions {
  display: flex;
  align-items: center;
  gap: 16px; /* ← единый интервал между иконками */
}

.app-header__icon,
.app-header__notifications {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  position: relative;
  color: #555;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
  border-radius: 50%;
}
.app-header__icon:hover,
.app-header__notifications:hover {
  color: var(--color-primary);
  background: rgba(64, 128, 191, 0.06);
}

/* === Аватар с инициалами (вписываем в тот же 28×28 квадрат) === */
.avatar-badge {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
}

.avatar-icon {
  font-size: 24px; /* чуть меньше, чтобы оставить место под инициалы */
  color: var(--color-primary);
  opacity: 0.3;
  transition: opacity 0.2s;
}

.avatar-initials {
  position: absolute;
  top: 35%;
  left: 35%;
  transform: translate(-35%, -35%);
  font-size: 12px;
  font-weight: 600;
  color: #000;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); /* лучше на светлом фоне */
  pointer-events: none;
  line-height: 1;
}

/* При наведении — иконка светлеет, инициалы чётче */
#avatarBtn:hover .avatar-icon {
  opacity: 0.6;
}
#avatarBtn:hover .avatar-initials {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}


/* =============== ГЛОБАЛЬНЫЙ ЭКРАН ЗАГРУЗКИ =============== */
/* Декоративная анимированная «гирлянда» сверху — как вы просили ранее */
.loading-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100%; /* ← КЛЮЧ: работает даже если родитель "схлопнулся" */
  padding: 24px 16px;
  text-align: center;
  gap: 20px;
  color: var(--color-text-light);
  font-size: 16px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;

}


.loading-screen .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(64, 128, 191, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

.loading-screen > div {
  opacity: 0.9;
  animation: pulseText 1.8s ease-in-out infinite 0.2s;
}

@keyframes pulseText {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}
/* === Бейдж уведомлений — поверх иконки === */
.app-header__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 0 2px var(--color-card);
  pointer-events: none;
}

/* =============== ОСНОВНОЙ КОНТЕНТ =============== */
.app-content {
  position: fixed;
  top: var(--header-height);
  bottom: var(--nav-height);
  left: 0;
  right: 0;

  /* Добавляем отступы для системных панелей */
  top: calc(var(--header-height) + var(--safe-area-inset-top, 0px));
  bottom: calc(var(--nav-height) + var(--safe-area-inset-bottom, 0px));
  left: var(--safe-area-inset-left, 0px);
  right: var(--safe-area-inset-right, 0px);

  overflow-y: auto;
  padding: 16px;
  background: var(--color-bg);
  box-sizing: border-box;
}

.page {
  display: none;
  animation: fade-in 0.3s ease;
}
.page--active {
  display: block;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============== БАЗОВАЯ КАРТОЧКА =============== */
.card {
  background: var(--color-card);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: relative;
  transition: box-shadow 0.2s;
}
.card:active {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* =============== БЕЙДЖИ =============== */
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge--yellow { background: var(--color-accent); }
.badge--red    { background: var(--color-danger); }
.badge--green  { background: var(--color-success); }
.badge--blue   { background: var(--color-primary); }
.badge--success {
    background-color: #28a745;
}
.badge--danger {
    background-color: #dc3545;
}
.badge--secondary {
    background-color: #6c757d;
}

/* =============== Аттестация — стили =============== */
.alert {
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    font-size: 14px;
}
.alert--success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert--warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
.alert--info    { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert--secondary { background-color: #f8f9fa; color: #6c757d; border: 1px solid #e9ecef; }

/* =============== КНОПКИ =============== */
.btn {
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  border: none;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.btn--primary {
  width: 100%;
  background: var(--color-accent);
  color: white;
}
.btn--primary:hover {
  background: #e08a1a;
}
.btn--outline {
  width: 100%;
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}
.btn--outline:hover {
  background: var(--color-primary);
  color: white;
}
.btn--retry {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.btn--retry:hover {
  background: #356ca0;
}

/* =============== НИЖНЕЕ МЕНЮ =============== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;

  background: var(--color-card);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--color-border);
  padding: 8px 0;
  box-sizing: border-box;
  z-index: 100;

  /* Комбинированный подход: и env(), и var() */
  padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

.nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  color: #888;
  font-size: 12px;
  width: 20%;
  padding: 4px 0;
  transition: color 0.2s;
  border-bottom: none;
}
.nav__item i {
  font-size: 20px;
  margin-bottom: 4px;
}
.nav__item--active {
  color: var(--color-accent);
}

/* =============== ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ =============== */

/* Цвета текста */
.text-muted { color: var(--color-text-light) !important; }
.text-primary { color: var(--color-primary, #4080bf) !important; }
.text-secondary { color: var(--color-secondary, #f49a22) !important; }
.text-dark { color: var(--color-text, #333333) !important; }
.text-white { color: #ffffff !important; }

/* Отступы по вертикали (margin-bottom) */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.mb-5 { margin-bottom: 24px !important; }

/* Отступы по вертикали (margin-top) */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; }
.mt-5 { margin-top: 24px !important; }

/* Вертикальные отступы (margin-top + margin-bottom) */
.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-1 { margin-top: 4px !important; margin-bottom: 4px !important; }
.my-2 { margin-top: 8px !important; margin-bottom: 8px !important; }
.my-3 { margin-top: 12px !important; margin-bottom: 12px !important; }
.my-4 { margin-top: 16px !important; margin-bottom: 16px !important; }
.my-5 { margin-top: 24px !important; margin-bottom: 24px !important; }

/* Горизонтальные отступы (margin-left/right) */
.ml-0 { margin-left: 0 !important; }
.ml-1 { margin-left: 4px !important; }
.ml-2 { margin-left: 8px !important; }
.ml-3 { margin-left: 12px !important; }
.ml-4 { margin-left: 16px !important; }
.ml-5 { margin-left: 24px !important; }

.mr-0 { margin-right: 0 !important; }
.mr-1 { margin-right: 4px !important; }
.mr-2 { margin-right: 8px !important; }
.mr-3 { margin-right: 12px !important; }
.mr-4 { margin-right: 16px !important; }
.mr-5 { margin-right: 24px !important; }

.mx-0 { margin-left: 0 !important; margin-right: 0 !important; }
.mx-1 { margin-left: 4px !important; margin-right: 4px !important; }
.mx-2 { margin-left: 8px !important; margin-right: 8px !important; }
.mx-3 { margin-left: 12px !important; margin-right: 12px !important; }
.mx-4 { margin-left: 16px !important; margin-right: 16px !important; }
.mx-5 { margin-left: 24px !important; margin-right: 24px !important; }

/* Padding аналогично (если понадобится) */
.p-0 { padding: 0 !important; }
.p-1 { padding: 4px !important; }
.p-2 { padding: 8px !important; }
.p-3 { padding: 12px !important; }
.p-4 { padding: 16px !important; }
.p-5 { padding: 24px !important; }

.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-1 { padding-top: 4px !important; padding-bottom: 4px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-3 { padding-top: 12px !important; padding-bottom: 12px !important; }
.py-4 { padding-top: 16px !important; padding-bottom: 16px !important; }
.py-5 { padding-top: 24px !important; padding-bottom: 24px !important; }

.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-1 { padding-left: 4px !important; padding-right: 4px !important; }
.px-2 { padding-left: 8px !important; padding-right: 8px !important; }
.px-3 { padding-left: 12px !important; padding-right: 12px !important; }
.px-4 { padding-left: 16px !important; padding-right: 16px !important; }
.px-5 { padding-left: 24px !important; padding-right: 24px !important; }

/* Позиционирование и отображение */
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.hidden { display: none !important; }

/* Flex */
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-around { justify-content: space-around !important; }
.align-center { align-items: center !important; }
.align-start { align-items: flex-start !important; }
.align-end { align-items: flex-end !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 24px !important; }

/* Текст */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-justify { text-align: justify !important; }
.text-decoration-none { text-decoration: none !important; }
.fw-bold { font-weight: bold !important; }
.fw-normal { font-weight: normal !important; }

/* Размеры */
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }
.h-100 { height: 100% !important; }

/* Прочее */
.indent { text-indent: 32px !important; }
.rounded { border-radius: 4px !important; }
.border { border: 1px solid var(--color-border, #e0e0e0) !important; }
.shadow-sm {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

/* Skeleton */
.skeleton-line {
  background: #f0f0f0;
  border-radius: 4px;
  margin-bottom: 8px;
}

a {
  color: #4080bf;
  text-decoration: none;
  font-weight: 500;
}
a:hover {
  color: #f49a22;
  text-decoration: none;
}
