/* Шапка сайта и меню (с 04.10.2026). Разметку собирает View::userMenu (core.php), открывает -/js/ui.js
   (data-toggle="dropdown" ставит .open на .site-account; щелчок мимо, по пункту, «Закрыть» и Esc закрывают).
   Компьютер: название, подписанные ссылки, кнопка с именем → выпадающее меню.
   Телефон (до 767px): название и кнопка «АИ Меню» → боковая панель с разделами и учётной записью. */

body { padding-top: 56px; }

.site-header { display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 max(16px, calc((100% - 1140px) / 2)); background: #fff; border-bottom: 1px solid #e2e6ea; font-weight: 400; }
.site-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: #1f2933; font-size: 19px; text-decoration: none; white-space: nowrap; }
.site-brand:hover, .site-brand:focus { color: #1f2933; text-decoration: none; }
.site-brand img { width: 32px; height: auto; }
.site-brand span { line-height: 1.15; }

.site-links { display: flex; align-items: center; gap: 2px; }
.site-link { display: flex; align-items: center; gap: 5px; height: 56px; padding: 0 12px; color: #3b4650; font-size: 15px; text-decoration: none; border-bottom: 2px solid transparent; }
.site-link:hover, .site-link:focus { color: #1f2933; text-decoration: none; }
.site-link.active { color: #35208a; border-bottom-color: #35208a; }
.site-ext { font-size: 14px; color: #8a9199; }

.site-login { display: flex; align-items: center; gap: 7px; height: 40px; margin-left: 10px; padding: 0 16px; border: 1px solid #cfd5dc; border-radius: 8px; color: #1f2933; font-size: 15px; text-decoration: none; white-space: nowrap; }
.site-login:hover, .site-login:focus { color: #1f2933; border-color: #9aa3ad; text-decoration: none; }
.site-login .ti { font-size: 19px; }

/* ---- Кнопка с именем ---- */
.site-account { position: relative; margin-left: 10px; }
.site-account-button { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px 0 5px; border: 1px solid #e2e6ea; border-radius: 22px; background: #fff; color: #1f2933; font: inherit; font-size: 15px; cursor: pointer; }
.site-account-button:hover { border-color: #cfd5dc; }
.site-account.open .site-account-button { border-color: #35208a; }
.site-account-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-account-menu, .site-account-burger { display: none; }
.site-account-chevron, .site-account-burger { font-size: 18px; color: #5f6b76; }
.site-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: #35208a; color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em; }

/* ---- Меню: на компьютере — выпадающее ---- */
.site-menu { display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 1040; width: 300px; max-height: calc(100vh - 80px); overflow-y: auto; padding: 6px 0 8px; background: #fff; border: 1px solid #e2e6ea; border-radius: 12px; box-shadow: 0 12px 40px rgba(20, 24, 60, .18); }
.site-account.open .site-menu { display: block; }
.site-menu-backdrop, .site-menu-head, .site-menu-main { display: none; }
.site-menu-profile { display: flex; align-items: center; gap: 12px; padding: 12px 18px 14px; border-bottom: 1px solid #eef0f2; margin-bottom: 4px; }
.site-menu-profile .site-avatar { width: 44px; height: 44px; font-size: 15px; }
.site-menu-profile b { display: block; font-weight: 500; font-size: 16px; color: #1f2933; line-height: 1.3; }
.site-menu-profile small { display: block; font-size: 13px; color: #5f6b76; }
.site-menu-caption { display: block; padding: 12px 18px 4px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6b737b; }
.site-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 18px; color: #1f2933; font-size: 15px; text-decoration: none; }
.site-item:hover, .site-item:focus { background: #f3f5f7; color: #1f2933; text-decoration: none; }
.site-item > .ti:first-child { font-size: 20px; color: #5f6b76; }
.site-item > span { flex: 1; }
.site-item.active { background: #f1effa; box-shadow: inset 3px 0 0 #35208a; }
.site-item.active > .ti:first-child { color: #35208a; }
.site-item-danger, .site-item-danger:hover, .site-item-danger:focus, .site-item-danger > .ti:first-child { color: #a94442 !important; }

/* ---- Телефон: боковая панель ---- */
@media (max-width: 767px) {
	.site-links, .site-account-name, .site-account-chevron { display: none; }
	/* название дисциплины на телефоне — мельче, в две строки */
	.site-brand { gap: 8px; min-width: 0; font-size: 15px; white-space: normal; }
	.site-brand span { max-width: 190px; }
	.site-account-menu, .site-account-burger { display: inline; }
	.site-account-button { padding: 0 12px 0 5px; }

	.site-menu-backdrop { position: fixed; inset: 0; z-index: 1039; background: rgba(14, 18, 40, .5); }
	.site-account.open .site-menu-backdrop { display: block; }
	.site-menu { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); max-height: none; border: 0; border-radius: 0; padding: 0 0 16px; box-shadow: -8px 0 32px rgba(0, 0, 0, .2); }
	.site-menu-head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding-left: 0; border-bottom: 1px solid #eef0f2; }
	.site-menu-head .site-menu-caption { padding-top: 0; padding-bottom: 0; }
	.site-menu-close { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px; border: 0; background: none; font: inherit; font-size: 15px; color: #3b4650; }
	.site-menu-close .ti { font-size: 22px; }
	.site-menu-profile { padding: 18px 20px; margin-bottom: 0; }
	.site-menu-main { display: block; padding: 6px 0; border-bottom: 1px solid #eef0f2; }
	.site-item { min-height: 50px; padding: 0 20px; font-size: 16px; }
	.site-menu-caption { padding: 14px 20px 4px; }
	body:has(.site-account.open) { overflow: hidden; }
}

/* ---- Планшет: длинное название дисциплины + ссылки — имя на кнопке прячем, остаются инициалы ---- */
@media (min-width: 768px) and (max-width: 1099px) {
	.site-brand { font-size: 17px; }
	.site-account-name { display: none; }
}
