/* ============================================================
   Шапка и футер сайта
   ============================================================ */

/* ── ШАПКА ──────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
  height: var(--header-height);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-6);
}

/* Брендинг: знак ИКИТ + двухстрочная подпись кафедры */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.brand__logo {
  width: 40px;
  height: 40px;
  display: block;
  flex-shrink: 0;
}
.brand__caption {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.brand__caption-top {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
  white-space: nowrap;
}
.brand__caption-mute {
  color: var(--color-text-muted);
  opacity: 0.6;
}
.brand__caption-main {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Навигация */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.site-nav__link {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-soft);
  transition: all var(--duration-fast) var(--ease);
  white-space: nowrap;
}
.site-nav__link:hover {
  color: var(--color-text);
  background: var(--color-surface-soft);
}
.site-nav__link--active {
  color: var(--color-primary);
  background: var(--color-surface-tint);
}

/* Действия */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px 6px 6px;
  background: var(--color-surface-soft);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease);
}
.user-pill:hover { background: var(--color-surface-tint); color: var(--color-text); }
.user-pill__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ikit-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.burger {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
}
.burger svg { width: 20px; height: 20px; }

/* ── ФУТЕР ──────────────────────────────────────────────── */
.site-footer {
  margin-top: var(--space-12);
  background: #0F1320;
  color: rgba(255, 255, 255, 0.86);
  padding: var(--space-10) 0 var(--space-6);
  position: relative;
  overflow: hidden;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ikit-gradient);
}
.site-footer__inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: var(--space-8);
}
.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 360px;
}
/* Логотип в футере: ограничиваем ширину, не растягиваем */
.site-footer__logo {
  height: 36px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  object-position: left center;
}
.site-footer__about {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  color: rgba(255, 255, 255, 0.7);
}
.site-footer__col-title {
  margin: 0 0 var(--space-4);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(255, 255, 255, 0.95);
}
.site-footer__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.site-footer__list a {
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--fs-sm);
  transition: color var(--duration-fast) var(--ease);
}
.site-footer__list a:hover { color: var(--color-secondary); }

.site-footer__contact-item {
  display: flex;
  flex-direction: column;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-3);
}
.site-footer__contact-item a { color: rgba(255, 255, 255, 0.85); }
.site-footer__contact-item a:hover { color: var(--color-secondary); }
.site-footer__contact-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: 2px;
}

.site-footer__bottom {
  margin-top: var(--space-9);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.5);
}
.site-footer__signature {
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.4);
}

/* ── АДАПТИВ ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .brand__caption { display: none; }
}

@media (max-width: 1024px) {
  .site-footer__inner { grid-template-columns: 1fr 1fr; gap: var(--space-7); }
  .site-footer__brand { grid-column: 1 / -1; max-width: 540px; }
}

@media (max-width: 768px) {
  .site-header__inner { grid-template-columns: auto auto; }
  .site-nav { display: none; }
  .site-nav--open {
    display: flex;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3);
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    box-shadow: var(--shadow-md);
  }
  .site-nav--open .site-nav__link { padding: 12px 16px; }
  .burger { display: inline-flex; }
  .site-header__actions .btn--ghost { display: none; }

  .site-footer__inner { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .brand__logo { width: 32px; height: 32px; }
  .user-pill__name { display: none; }
}



/* ═══════════════════════════════════════════════════════════
   SIDEBAR + TOPBAR — раскладка для авторизованных
   ═══════════════════════════════════════════════════════════ */

body.has-sidebar { background: var(--color-surface-tint); }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.22s var(--ease);
}

/* COLLAPSED-режим — sidebar 68px шириной */
body.sidebar-collapsed .app-shell {
  grid-template-columns: 68px 1fr;
}

.app-shell__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--color-surface-tint);
}

.app-shell__content { flex: 1; min-width: 0; }

/* ── SIDEBAR ──────────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow: hidden;
  z-index: 30;
  transition: width 0.22s var(--ease);
}

.sidebar__inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  padding: 16px 14px 14px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Шапка sidebar с кнопкой collapse */
.sidebar__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 16px 6px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
  position: relative;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
}

.sidebar__brand-logo { flex-shrink: 0; }

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s var(--ease);
}

.sidebar__brand-mute {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 500;
}

.sidebar__brand-main {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-text);
}

.sidebar__collapse {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease), transform 0.22s var(--ease);
}

.sidebar__collapse:hover {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

.sidebar__collapse svg { width: 16px; height: 16px; }

body.sidebar-collapsed .sidebar__collapse svg {
  transform: rotate(180deg);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar__group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 600;
  padding: 14px 12px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar__group-title:first-of-type { padding-top: 0; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar__link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar__link:hover {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

.sidebar__link--active {
  background: rgba(28, 154, 214, 0.1);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar__link--active svg { color: var(--color-primary); }

.sidebar__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  margin-top: 16px;
  border-top: 1px solid var(--color-border);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--ease);
  overflow: hidden;
}

.sidebar__user:hover { background: var(--color-surface-soft); }

.sidebar__user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ikit-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.sidebar__user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sidebar__user-avatar.has-photo .sidebar__user-initials {
  display: none;
}

.sidebar__user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.sidebar__user-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__user-role {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: lowercase;
}

.sidebar__logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.sidebar__logout:hover {
  background: rgba(229, 72, 77, 0.1);
  color: var(--color-danger);
}

.sidebar__logout svg { width: 18px; height: 18px; }

/* ── COLLAPSED-режим — только иконки ──────────────────────── */

body.sidebar-collapsed .sidebar__brand-text,
body.sidebar-collapsed .sidebar__group-title,
body.sidebar-collapsed .sidebar__link span,
body.sidebar-collapsed .sidebar__user-info,
body.sidebar-collapsed .sidebar__logout {
  display: none;
}

body.sidebar-collapsed .sidebar__inner {
  padding: 16px 8px 14px;
}

body.sidebar-collapsed .sidebar__head {
  flex-direction: column;
  gap: 8px;
  padding-left: 0;
  padding-right: 0;
}

body.sidebar-collapsed .sidebar__link {
  justify-content: center;
  padding: 10px;
}

body.sidebar-collapsed .sidebar__group-title { padding: 8px 0 4px; }

body.sidebar-collapsed .sidebar__footer {
  justify-content: center;
  padding: 10px 0;
}

body.sidebar-collapsed .sidebar__user {
  padding: 4px;
  justify-content: center;
}

/* ── TOPBAR ───────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 0 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.topbar__burger {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.topbar__burger:hover { background: var(--color-surface-soft); }
.topbar__burger svg { width: 22px; height: 22px; }

.topbar__title {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
  flex: 1;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--color-text);
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  transition: background var(--duration-fast) var(--ease);
}

.topbar__user:hover { background: var(--color-surface-soft); }

.topbar__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ikit-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.topbar__user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar__user-avatar.has-photo .topbar__user-initials { display: none; }

.topbar__user-name { font-size: 13px; font-weight: 500; }

/* ── Overlay для мобильной версии ─────────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 19, 32, 0.4);
  z-index: 25;
  border: none;
  cursor: pointer;
}

.sidebar-overlay.is-active { display: block; }

/* ── Адаптив ─────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .app-shell,
  body.sidebar-collapsed .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: 0 20px 50px rgba(15, 19, 32, 0.15);
  }

  body.sidebar-collapsed .sidebar { width: 280px; }
  body.sidebar-collapsed .sidebar__brand-text,
  body.sidebar-collapsed .sidebar__group-title,
  body.sidebar-collapsed .sidebar__link span,
  body.sidebar-collapsed .sidebar__user-info,
  body.sidebar-collapsed .sidebar__logout { display: flex; }
  body.sidebar-collapsed .sidebar__link { justify-content: flex-start; }
  body.sidebar-collapsed .sidebar__head { flex-direction: row; }

  .sidebar.is-open { transform: translateX(0); }
  .topbar__burger { display: inline-flex; }

  .sidebar__collapse { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  .topbar__user-name { display: none; }
}
