/**
 * Стили: главное меню в шапке (верхнее).
 *
 * @package medexpress-by-fin-code
 */

.me-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	height: 0;
	pointer-events: none;
}

/* ============================================
   Верхняя строка (логотип + меню + сервисные)
   ============================================ */

.me-header__top {
	display: flex;
	align-items: center;
	height: var(--header-top-height);
	background: #fff;
	position: fixed;
	top: calc(-1 * var(--header-top-height));
	left: 0;
	right: 0;
	z-index: 1002;
	pointer-events: auto;
	transition: top 0.3s ease, visibility 0s linear 0.3s;
}

.me-header__logo {
	display: flex;
	align-items: center;
	text-decoration: none;
}

.me-header__logo--wide {
	align-self: stretch;
	flex-shrink: 0;
	width: var(--logo-wide-width);
	padding: 0 21px;
	background: var(--logo-bg);
}

.me-header__logo--wide img {
	height: 41px;
	width: auto;
}

/* Главное меню — в верхней строке, уезжает вместе с ней при скролле */
.me-header__primary {
	margin-left: 40px;
	height: var(--header-top-height);
	display: flex;
	align-items: center;
	min-width: 0;
}

.me-header__menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 32px;
	height: 100%;
}

.me-header__menu-item {
	display: flex;
	height: 100%;
}

.me-header__menu-link {
	display: flex;
	align-items: center;
	font-family: var(--font-family);
	font-size: 18px;
	line-height: 1;
	color: var(--font-color);
	background: none;
	border: none;
	border-bottom: 1px solid transparent;
	border-radius: 0;
	padding: 0;
	margin: 0;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
}

.me-header__menu-link:hover {
	text-decoration: none;
}

.me-header__menu-link:visited {
	color: var(--font-color);
}

/* Подсветка верхнего пункта — по текущей странице (раздел или его подстраница) */
.me-header__menu-item.is-active > .me-header__menu-link {
	color: var(--primary-color);
	border-bottom-color: var(--primary-color);
}

/* Сервисные ссылки */
.me-header__aux {
	display: flex;
	align-items: center;
}

.me-header__aux--desktop {
	margin-left: auto;
	gap: 24px;
	padding-right: var(--header-pad-x);
}

.me-header__aux--mobile {
	display: none;
}

.me-header__aux-icon,
.me-header__aux-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--font-color);
	text-decoration: none;
	font-size: 16px;
}

.me-header__aux-icon:visited,
.me-header__aux-link:visited {
	color: var(--font-color);
}

.me-header__aux-icon .me-icon,
.me-header__aux-link .me-icon,
.me-header__aux-icon svg,
.me-header__aux-link svg {
	flex-shrink: 0;
	display: block;
}

/* ============================================
   Нижняя строка (подменю активной секции)
   ============================================ */

.me-header__sub {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: var(--header-sub-height);
	background: var(--menu-background-color);
	border-top: 1px solid var(--gray-border-color);
	border-bottom: 1px solid var(--gray-border-color);
	z-index: 1001;
	pointer-events: auto;
	transition: top 0.3s ease;
}

.me-header__sub-inner {
	display: flex;
	align-items: center;
	height: var(--header-sub-height);
	width: 100%;
}

/* Квадратный логотип — «выезжает» при скролле */
.me-header__logo--square {
	flex-shrink: 0;
	justify-content: center;
	width: 50px;
	height: 50px;
	max-width: 0;
	margin-right: 0;
	background: var(--logo-bg);
	overflow: hidden;
	opacity: 0;
	transition: max-width 0.3s ease, margin-right 0.3s ease, opacity 0.25s ease;
}

.me-header__logo--square img {
	width: 38px;
	height: 38px;
	transform: translateX(-150%);
	transition: transform 0.3s ease;
}

.me-header__submenus {
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.me-header__submenus::-webkit-scrollbar {
	display: none;
}

.me-header__submenu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 20px;
}

.me-header__submenu[hidden] {
	display: none;
}

.me-header__submenu-link {
	display: inline-flex;
	align-items: center;
	font-family: var(--font-family);
	font-size: 18px;
	line-height: 1;
	color: var(--font-color);
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.me-header__submenu-link:visited {
	color: var(--font-color);
}

.me-header__submenu-link.is-active,
.me-header__submenu-link.is-full-open,
.me-header__submenu-link.current-menu-item,
.me-header__submenu-link.current-menu-ancestor,
.me-header__submenu-link--active,
.me-header__submenu-link.is-active:visited,
.me-header__submenu-link.current-menu-item:visited,
.me-header__submenu-link.current-menu-ancestor:visited,
.me-header__submenu-link--active:visited {
	color: var(--primary-color);
}

.me-header__submenu-chevron {
	display: none;
}

.me-header__sub-aux {
	flex-shrink: 0;
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 20px;
	padding-left: 20px;
}

.me-header__claim {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--primary-color);
	font-weight: 500;
	font-size: 18px;
	text-decoration: none;
	white-space: nowrap;
}

.me-header__contact {
	position: relative;
}

.me-header__contact-btn {
	height: 49px;
	padding: 0 24px;
	gap: 8px;
	white-space: nowrap;
}

.me-header__contact-btn svg {
	flex-shrink: 0;
	transition: transform 0.25s ease;
}

.me-header__contact-btn.is-open svg {
	transform: rotate(180deg);
}

/* Выпадающее окно «Связаться с нами» (десктоп) */
.me-header__contact-popup {
	position: absolute;
	top: calc(100% + 14px);
	right: 0;
	z-index: 10;
	width: 520px;
	max-width: min(520px, calc(100vw - 2 * var(--content-side-padding)));
	padding: 24px;
	background: #fff;
	box-shadow: 0 28px 27px 10px rgba(var(--primary-color-rgb), 0.06);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
	pointer-events: none;
}

.me-header__contact-popup.is-open,
.me-header__contact-popup.is-closing {
	visibility: visible;
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}

.me-header__contact-popup.is-open {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.me-header__contact-popup-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: 21px;
}

.me-header__contact-popup-col {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.me-header__contact-popup-label {
	margin: 0 0 16px;
	font-size: 16px;
	line-height: 1.1;
	color: var(--font-color);
	opacity: 0.6;
}

.me-header__contact-popup-col:last-child .me-header__contact-popup-label {
	margin-top: 18px;
	margin-bottom: 14px;
}

.me-header__contact-popup-phones {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.me-header__contact-popup-phones a {
	font-size: 24px;
	line-height: 0.92;
	color: var(--font-color);
	text-decoration: none;
}

.me-header__contact-popup-actions {
	display: flex;
	gap: 16px;
	margin-top: 40px;
}

.me-header__contact-popup-actions .me-btn {
	flex: 1 1 0;
	height: 52px;
	padding: 16px 24px;
	white-space: nowrap;
}

/* Мобильные блоки скрыты на десктопе */
.me-header__mobile-extras {
	display: none;
}

/* Второй уровень шапки на главной (только мобилка) */
.me-header__home-sub {
	display: none;
}

.me-header__home-sub-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: flex-end;
	gap: 32px;
	height: 100%;
}

.me-header__home-sub-link {
	display: inline-flex;
	align-items: center;
	padding-bottom: 18px;
	font-family: var(--font-family);
	font-size: 18px;
	line-height: 0.92;
	color: var(--font-color);
	text-decoration: none;
	white-space: nowrap;
	border-bottom: 1px solid transparent;
}

.me-header__home-sub-link:visited {
	color: var(--font-color);
}

.me-header__home-sub-link.is-active,
.me-header__home-sub-link.current-menu-item,
.me-header__home-sub-link.current-menu-ancestor {
	color: var(--primary-color);
	border-bottom-color: var(--primary-color);
}

.me-header__home-sub-link.is-active:visited,
.me-header__home-sub-link.current-menu-item:visited,
.me-header__home-sub-link.current-menu-ancestor:visited {
	color: var(--primary-color);
}

/* ============================================
   Полное меню (level 3): карточки-продукты
   ============================================ */

.me-header__full {
	pointer-events: auto;
}

.me-header__full[hidden] {
	display: none;
}

/* Размытый фон под панелью (десктоп) */
.me-header__full-backdrop {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	top: var(--header-full-height);
	background: rgba(var(--primary-color-rgb), 0.08);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	z-index: 999;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.me-header__full.is-open .me-header__full-backdrop {
	opacity: 1;
}

/* Белая панель с карточками — выезжает под нижней строкой шапки */
.me-header__full-panel {
	position: fixed;
	left: 0;
	right: 0;
	top: var(--header-full-height);
	max-height: calc(100vh - var(--header-full-height));
	overflow-y: auto;
	background: #fff;
	z-index: 1000;
	box-shadow: 0 28px 27px 10px rgba(var(--primary-color-rgb), 0.06);
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.me-header__full-panel[hidden] {
	display: none;
}

.me-header__full.is-open .me-header__full-panel {
	opacity: 1;
	transform: translateY(0);
}

.me-header.is-scrolled .me-header__full-backdrop,
.me-header.is-scrolled .me-header__full-panel {
	top: var(--header-sub-height);
}

.me-header.is-scrolled .me-header__full-panel {
	max-height: calc(100vh - var(--header-sub-height));
}

.me-header__full-inner {
	padding-top: 32px;
	padding-bottom: 56px;
}

.me-header__full-head {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	margin-bottom: 24px;
}

.me-header__full-title {
	display: none;
}

.me-header__full-back {
	display: none;
}

.me-header__full-close {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: none;
	border: 0;
	padding: 0;
	font-family: var(--font-family);
	font-size: 16px;
	color: var(--font-color-muted);
	cursor: pointer;
}

.me-header__full-close svg {
	flex-shrink: 0;
	display: block;
}

/* Карточки полного меню — сетка как на главной (по 2 в ряд) */
.me-header__full-cards {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 24px;
}

.me-header__full-cards .me-card {
	min-height: 206px;
}

/* ============================================
   Состояние при скролле (десктоп)
   ============================================ */

@media (min-width: 769px) {
	.me-header__primary {
		flex: 1;
	}

	/* Фейд при переключении подменю секций */
	.me-header__submenus {
		position: relative;
		align-self: stretch;
	}

	.me-header__submenu[hidden] {
		display: flex;
	}

	.me-header__submenu {
		position: absolute;
		left: 0;
		top: 0;
		bottom: 0;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.25s ease;
	}

	.me-header__submenu.is-active {
		opacity: 1;
		pointer-events: auto;
	}

	/* Развёрнуто: обе строки стопкой. Свёрнуто: верхняя за экраном, подменю у верха. */
	.me-header:not(.is-scrolled) .me-header__top {
		top: 0;
		visibility: visible;
		transition: top 0.3s ease, visibility 0s;
	}

	.me-header:not(.is-scrolled) .me-header__sub {
		top: var(--header-top-height);
	}

	.me-header.is-scrolled .me-header__top {
		top: calc(-1 * var(--header-top-height));
		visibility: hidden;
		pointer-events: none;
	}

	.me-header.is-scrolled .me-header__sub {
		top: 0;
	}

	.me-header.is-scrolled .me-header__logo--square {
		max-width: 50px;
		margin-right: 24px;
		opacity: 1;
	}

	.me-header.is-scrolled .me-header__logo--square img {
		transform: translateX(0);
	}

	/* Ховеры */
	.me-header__menu-item:not(.is-active) > .me-header__menu-link:hover,
	.me-header__submenu-link:not(.is-active):not(.me-header__submenu-link--active):hover {
		color: var(--primary-color);
		text-decoration: none;
	}

	.me-header__aux-icon:hover,
	.me-header__aux-link:hover,
	.me-header__claim:hover {
		color: var(--primary-color);
	}

	.me-header__contact-popup-phones a:hover {
		color: var(--primary-color);
		text-decoration: none;
	}

	.me-header__full-close:hover {
		color: var(--primary-color);
	}
}

/* ============================================
   Средние разрешения (узкий десктоп / планшет)
   ============================================ */

@media (min-width: 769px) and (max-width: 1240px) {
	.me-header__menu {
		gap: 24px;
	}

	.me-header__primary {
		margin-left: 24px;
	}

	.me-header__aux--desktop {
		gap: 16px;
		padding-right: 24px;
	}
}

/* ============================================
   Мобильная версия
   ============================================ */

@media (max-width: 768px) {
	.me-header {
		position: fixed;
		height: var(--mobile-header-height);
		background: #fff;
		pointer-events: auto;
	}

	.me-header--home-mobile-sub {
		height: calc(var(--mobile-header-height) + var(--mobile-home-sub-height));
		transition: height 0.3s ease;
	}

	.me-header--home-mobile-sub.is-scrolled {
		height: var(--mobile-header-height);
	}

	.me-header--home-mobile-sub ~ .me-content {
		padding-top: calc(var(--mobile-header-height) + var(--mobile-home-sub-height));
		transition: padding-top 0.3s ease;
	}

	.me-header--home-mobile-sub.is-scrolled ~ .me-content {
		padding-top: var(--mobile-header-height);
	}

	.me-header--home-mobile-sub .me-header__home-sub {
		display: block;
		position: fixed;
		top: var(--mobile-header-height);
		left: 0;
		right: 0;
		height: var(--mobile-home-sub-height);
		background: var(--menu-background-color);
		box-shadow: inset 0 -1px 0 var(--gray-border-color);
		z-index: 1001;
		pointer-events: auto;
		padding: 0 0 0 16px;
		box-sizing: border-box;
		visibility: visible;
		transition: top 0.3s ease, visibility 0s;
	}

	.me-header--home-mobile-sub.is-scrolled .me-header__home-sub {
		top: calc(var(--mobile-header-height) - var(--mobile-home-sub-height));
		visibility: hidden;
		pointer-events: none;
		transition: top 0.3s ease, visibility 0s linear 0.3s;
	}

	.me-header--home-mobile-sub.is-open .me-header__home-sub,
	.me-header--home-mobile-sub.me-header--full-open .me-header__home-sub {
		display: none;
	}

	.me-header__top {
		position: relative;
		top: auto;
		height: var(--mobile-header-height);
		visibility: visible;
		pointer-events: auto;
		box-shadow: inset 0 -1px 0 var(--gray-border-color);
	}

	.me-header__sub {
		top: var(--mobile-header-height);
	}

	.me-header__logo--wide {
		width: auto;
		padding: 0 16px;
	}

	.me-header__logo--wide img {
		height: 34px;
	}

	.me-header__aux--desktop {
		display: none;
	}

	.me-header__aux--mobile {
		display: flex;
		margin-left: auto;
		align-items: center;
		gap: 16px;
		padding-right: 16px;
	}

	.me-header__aux--mobile .me-header__aux-icon {
		width: 32px;
		height: 32px;
		padding: 0;
		justify-content: center;
	}

	.me-header__aux-divider {
		flex-shrink: 0;
		width: 1px;
		height: 32px;
		background: var(--gray-border-color);
	}

	.me-header__aux--mobile .me-header__aux-icon svg,
	.me-header__burger svg {
		width: 32px;
		height: 32px;
	}

	.me-header__burger {
		line-height: 0;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 32px;
		height: 32px;
		padding: 0;
		background: none;
		border: none;
		color: var(--font-color);
	}

	.me-header__burger-close {
		display: none;
	}

	.me-header.is-open .me-header__burger-open {
		display: none;
	}

	.me-header.is-open .me-header__burger-close {
		display: inline-flex;
	}

	/* Нижняя строка превращается в полноэкранное меню */
	.me-header__sub {
		display: none;
		position: fixed;
		top: var(--mobile-header-height);
		left: 0;
		right: 0;
		bottom: 0;
		height: auto;
		background: #fff;
		border: none;
		border-top: 1px solid var(--gray-border-color);
		overflow-y: auto;
		z-index: 1001;
	}

	.me-header.is-open .me-header__sub {
		display: block;
	}

	.me-header__sub-inner {
		flex-direction: column;
		align-items: stretch;
		height: auto;
		max-width: none;
		padding: 0 16px 32px;
	}

	.me-header__logo--square {
		display: none;
	}

	/* Главное меню в мобильном drawer (в верхней строке, фиксируется под баром) */
	.me-header__primary {
		display: none;
		margin-left: 0;
		height: auto;
	}

	.me-header.is-open .me-header__primary {
		display: flex;
		position: fixed;
		top: var(--mobile-header-height);
		left: 0;
		right: 0;
		z-index: 1002;
		margin: 0;
		padding: 16px;
		background: #fff;
		border-bottom: 1px solid var(--gray-border-color);
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.me-header.is-open .me-header__sub-inner {
		padding-top: 57px;
	}

	.me-header__menu {
		flex-wrap: nowrap;
	}

	.me-header__menu-item {
		flex-shrink: 0;
	}

	.me-header__menu-link {
		padding-bottom: 6px;
	}

	/* Подменю — вертикальный список с шевронами */
	.me-header__submenus {
		order: 2;
		display: block;
		padding-top: 12px;
	}

	.me-header__submenu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.me-header__submenu-item {
		border-bottom: 1px solid var(--gray-border-color);
	}

	.me-header__submenu-link {
		justify-content: space-between;
		width: 100%;
		padding: 12px 0;
	}

	.me-header__submenu-chevron {
		display: inline-flex;
		color: var(--font-color-muted);
	}

	/* «Страховой случай» */
	.me-header__sub-aux {
		order: 3;
		margin: 0;
		padding: 20px 0 0;
		flex-direction: column;
		align-items: flex-start;
		gap: 0;
	}

	.me-header__contact-btn {
		display: none;
	}

	.me-header__contact-popup {
		display: none;
	}

	/* Контакты / кнопки / Офисы */
	.me-header__mobile-extras {
		order: 4;
		display: flex;
		flex-direction: column;
		gap: 28px;
		padding-top: 55px;
	}

	.me-header__contacts {
		display: flex;
		flex-direction: column;
		gap: 20px;
	}

	.me-header__contacts-title {
		margin: 0;
		font-size: 24px;
		font-weight: 500;
		line-height: 1;
	}

	.me-header__contacts-group {
		display: flex;
		flex-direction: column;
		gap: 10px;
	}

	.me-header__contacts-label {
		font-size: 14px;
		color: var(--font-color-muted);
		line-height: 1.1;
	}

	.me-header__contacts-phones {
		display: flex;
		gap: 5px 20px;
		font-size: 20px;
		flex-wrap: wrap;
	}

	.me-header__contacts-phones a {
		color: var(--font-color);
		text-decoration: none;
	}

	.me-header__cta {
		display: flex;
		flex-direction: column;
		gap: 12px;
	}

	.me-header__offices {
		padding: 0;
	}

	/* Полное меню (level 3) — выезжает слайдом поверх дровера */
	.me-header__full {
		position: fixed;
		top: var(--mobile-header-height);
		left: 0;
		right: 0;
		bottom: 0;
		background: #fff;
		z-index: 1005;
		overflow-y: auto;
		transform: translateX(100%);
		transition: transform 0.3s ease;
	}

	.me-header__full.is-open {
		transform: translateX(0);
	}

	/* Подложка (основное меню) при открытом full-меню: плавно сдвигается
	   в ту же сторону, куда уезжает full-меню (влево). */
	.me-header.is-open .me-header__primary,
	.me-header.is-open .me-header__sub {
		transition: transform 0.3s ease;
	}

	.me-header--full-open .me-header__primary,
	.me-header--full-open .me-header__sub {
		transform: translateX(-25%);
	}

	.me-header__full-backdrop {
		display: none;
	}

	.me-header__full-panel {
		position: static;
		max-height: none;
		overflow: visible;
		box-shadow: none;
		opacity: 1;
		transform: none;
		transition: none;
	}

	.me-header__full-inner {
		padding: 16px 16px 32px;
	}

	.me-header__full-head {
		flex-direction: column;
		align-items: flex-start;
		justify-content: flex-start;
		margin-bottom: 8px;
	}

	.me-header__full-close {
		display: none;
	}

	.me-header__full-back {
		display: inline-flex;
		align-items: center;
		gap: 4px;
		background: none;
		border: 0;
		padding: 8px 0;
		font-family: var(--font-family);
		font-size: 16px;
		color: var(--font-color-muted);
		cursor: pointer;
	}

	.me-header__full-back svg {
		flex-shrink: 0;
		display: block;
	}

	.me-header__full-title {
		display: block;
		margin: 15px 0 10px;
		font-size: 28px;
		font-weight: 500;
		line-height: 1.05;
	}

	.me-header__full-cards {
		display: flex;
		flex-direction: column;
		gap: 12px;
	}
}
