header {
	position: relative;
	box-sizing: border-box;
	background-color: #fff;
	color: #000;
	margin-bottom: 0;
	width: 100%;
}
.header-title {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px 0;
}

/* Левый блок иконок */
.header-menu {
	box-sizing: border-box;
	width: 100%;
	height: calc(100% + 40px);
	position: absolute;
	left: 0;
	top: 0;
	background-color: rgba(81, 55, 37, 0.99);
	overflow: hidden;
	z-index: 3;
	transition: height 0.3s ease;
	padding: 3px 6px 0;
	display: flex;
	align-items: flex-end;
}
.header-menu.hidden {
	padding: 0;
	height: 0;
	transition: padding 0.3s ease, height 0.3s ease;
}
.header-menu-container {
	box-sizing: border-box;
	display: flex;
	justify-content: space-between;
	height: calc(100% - 40px);
	width: 100%;
}
.header-menu-btn {
	display: block;
	position: absolute;
	right: 20px;
	top: 15px;
	z-index: 4;
}
.header-menu-btn.hidden {
	display: none;
	cursor: pointer;
	z-index: 11;
}


.header-social {
	flex-wrap: wrap;
	max-width: 120px;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 10px;
	z-index: 10;
}

.header-social a {
	margin: 0;
}

.header-social img {
	width: 30px;
	transition: transform 0.12s linear;
}

.header-social img:hover {
	transform: scale(1.1);
}

/* Центральный блок — занимает доступное пространство и центрирует содержимое */
.main-title-container {
	max-width: 250px;
	text-align: center;
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
}

.logo-link {
	display: inline-block;
	text-decoration: none;
	color: inherit;
	transition: opacity 0.3s ease;
}

.logo-link:hover {
	opacity: 0.9;
}

.logo-link.active {
	cursor: default;
}

#inharta_log {
	cursor: pointer;
	width: 210px;
	margin-bottom: -18px;
	transition: transform 0.3s linear;
	transform: translateX(-30px);
	display: block;
}

#inharta_log:hover {
	transform: translateX(-30px) scale(1.03);
}

.logo-link.active #inharta_log {
	cursor: default;
}

.header-subtitle {
	display: block;
	color: #513725;
	font-size: 20px;
	font-weight: 600;
	margin: 0;
	margin-top: -10px;
}

/* Правый блок с пользователем */
.header-user-block {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-wrap: nowrap;
	gap: 8px;
	z-index: 10;
}

.header-user-links {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
}

.header-user-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	font-size: 16px;
	text-decoration: none;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	color: #fff;
	background-color: var(--COLOR-GREEN);
	font-weight: 600;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	cursor: pointer;
}
.header-user-link[href="/logout"] {
	background-color: #b60000;
}

.header-user-link:hover {
	transform: scale(1.06);
}
/* Навигация */
.header-container-nav {
	margin: 0;
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 0 16px;
	transition: padding .18s ease;
	z-index: 2;
}
.header-container-nav:hover {
	padding-top: 7px;
	padding-bottom: 7px;
}
.header-container-nav a {
	width: 100%;
	flex: 1;
	border-radius: 4px;
	padding: 6px 10px;
	position: relative;
	overflow: visible;
	transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
	cursor: pointer;
	text-decoration: none;
	color: #222;
	font-size: 20px;
	font-weight: 700;
	display: block;
	text-align: center;
}
.header-container-nav a:hover {
	transform: translateY(-1px) scale(1.03);
	box-shadow: 0 3px 12px rgba(135, 166, 123, .7);
}
.header-container-nav a.active { 
	background: var(--COLOR-GREEN);
	color: #fff;
}

/* Fixed state when nav is pinned to viewport */
.header-container-nav.fixed {
	position: fixed;
	top: 0;
	left: 0;
	right: 31px;
	border-radius: 0 0 10px 10px;
	padding: 0;
	padding-top: 10px;
	z-index: 499;
	background: #513725;
	box-shadow: 0 2px 12px rgba(0,0,0,0.7);
	transition: left .18s ease, right .18s ease, padding .18s ease, border-radius .18s ease;
}
.header-container-nav.fixed:hover {
	padding: 10px 0 7px;
	border-radius: 0;
}
.header-container-nav.fixed a {
	border-radius: 10px;
	color: #fff;
}
.header-container-nav.fixed a:hover {
	color: #000;
	background-color: #ffffff;
	box-shadow: 0 3px 12px rgba(135, 166, 123, .7);
	transform: none;
}
.nav-sentinel { height: 1px; }
/* /Навигация */

/* Fixed state for header menu and menu button to follow pinned nav */
.header-menu.fixed {
	height: 140px;
	max-height: 140px;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	border-radius: 0 0 10px 10px;
	z-index: 500;
	box-shadow: 0 2px 12px rgba(0,0,0,0.7);
	background-color: rgba(81, 55, 37, 0.99);
	transition: height 0.3s ease;
}
.header-menu.fixed.hidden {
	height: 0;
	padding: 0;
	transition: padding 0.3s ease, height 0.3s ease;
}
.header-menu-btn.fixed {
	display: block !important; /*Гарантировать видимость кнопки меню, если ей назначен .fixed */
	cursor: pointer;
	position: fixed;
	top: 0;
	right: 0;
	padding: 0;
	padding-top: 10px;
	padding-bottom: 1px;
	z-index: 501;
	background-color: rgba(81, 55, 37, 0.99);
	border-bottom-left-radius: 10px;
	transition: box-shadow 0.2s ease, background-color 0.2s ease, border-radius 0.2s ease;
}
.header-menu-btn.fixed:hover {
	background-color: #fff;
	box-shadow: 0 2px 8px rgba(0,0,0,0.5);
	border-radius: 2px;
}
.header-menu-btn.fixed svg line {
	stroke: #fff;
	transition: stroke 0.2s ease, stroke-width 0.2s ease;
}
.header-menu-btn.fixed:hover svg line {
	stroke: #000;
	stroke-width: 3;
}

/* Адаптивные стили для хедера */
@media (max-width: 650px) {
	/* Для очень узких экранов — иконки центрируем сверху, заголовок смещаем вниз */
	#inharta_log { width: 160px; transform: translateX(-23px);}
	#inharta_log:hover { transform: translateX(-23px) scale(1.03); }
	.header-subtitle { font-size: 16px; margin-top: -8px; }
	.header-container {
		flex-wrap: wrap;
		justify-content: center;
		padding-top: 8px;
	}
	.header-user-block {
		order: 2;
		justify-content: center;
	}

	/* Горизонтальный скролл навигации на маленьких экранах */
	.header-container-nav {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		overflow-y: visible;
		-webkit-overflow-scrolling: touch;
		gap: 8px;
		margin: 0;
		/* Подавляем видимый скролл в некоторых браузерах */
		scrollbar-width: none;
	}
	.header-container-nav:hover {
		padding-top: 10px;
	}
	.header-container-nav::-webkit-scrollbar { display: none; }
	.header-container-nav a {
		white-space: nowrap;
	}
}

@media (max-width: 530px) {
	.header-title {
		justify-content: center;
		padding: 3px 6px 0;
	}
	.main-title-container {
		position: static;
		transform: none;
	}
	#inharta_log {
		transform: none;
	}
	#inharta_log:hover {
		transform: scale(1.03);
	}
	.header-subtitle {
		transform: translateX(23px);
	}
}