/* === drawer.css ===
   Mobile drawers, tab bar, animations */

:root {
	--tab-bar-height: 3.571rem;
	--drawer-width: 20rem;
	--drawer-max-width: 25rem;
	--drawer-shadow: 0 0 var(--size-4-10) var(--shadow-color);
	--drawer-content-padding: var(--size-4-5);
	--drawer-header-spacing: 0;
	/* Будем использовать padding на контейнерах */
}

/* === Mobile Tab Bar === */
.mobile-tab-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: var(--tab-bar-height);
	background-color: var(--background-primary);
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 var(--size-4-6);
	border-bottom: var(--divider-width) solid var(--divider-color);
	z-index: calc(var(--z-header) + 5);
	padding-top: env(safe-area-inset-top);
	backdrop-filter: blur(10px);
}

@media (min-width: 73.143rem) {
	.mobile-tab-bar {
		display: none;
	}
}


.tab-center-brand {
	display: none;
	/* Больше не используется, заменено на .tab-center-chat-info для унификации */
}

.tab-center-chat-info {
	display: flex;
	align-items: center;
	gap: var(--size-4-4);
	flex: 1;
	min-width: 0;
	padding: 0 var(--size-4-6);
}

.tab-center-chat-info .chat-header-avatar {
	width: var(--size-4-8);
	height: var(--size-4-8);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: var(--font-ui-small);
	flex-shrink: 0;
	color: var(--text-on-accent);
}

.tab-center-chat-info .chat-header-avatar.brand-avatar {
	background: transparent;
	overflow: hidden;
}

.tab-center-chat-info .chat-header-avatar.brand-avatar img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.tab-center-chat-info .chat-header-info {
	min-width: 0;
}

.tab-center-chat-info .chat-header-title {
	font-weight: 600;
	font-size: var(--font-ui-medium);
	color: var(--text-normal);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tab-center-chat-info .chat-header-subtitle {
	font-size: var(--font-ui-smaller);
	color: var(--text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tab-item {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--size-4-1);
	width: var(--size-4-10);
	height: var(--size-4-10);
	color: var(--text-muted);
	border: none;
	background: transparent;
	border-radius: var(--radius-m);
}

.tab-item:hover,
.tab-item.active {
	color: var(--interactive-accent);
	background: transparent;
	transform: none;
	box-shadow: none;
}

/* === Mobile Drawer (Burger Menu) === */
.mobile-drawer-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--background-modifier-overlay);
	backdrop-filter: blur(var(--size-2-1));
	z-index: var(--z-drawer);
}

.mobile-drawer {
	position: fixed;
	top: 0;
	bottom: 0;
	width: var(--drawer-width);
	background-color: var(--background-secondary);
	z-index: calc(var(--z-drawer) + 1);
	display: flex;
	flex-direction: column;
	/* Profile (top), MainBody (Rail + Panel) */
	padding: 0;
	overflow: hidden;
	opacity: 1;
}

.mobile-drawer:not(.is-right) {
	left: 0;
	box-shadow: var(--drawer-shadow);
}

.mobile-drawer.is-right {
	right: 0;
	box-shadow: calc(-1 * var(--size-4-1)) 0 var(--size-4-5) var(--shadow-color-soft), var(--shadow-m);
}

.mobile-drawer.rail-integrated {
	width: 85%;
	/* Широкая шторка */
	max-width: var(--drawer-max-width);
}

.mobile-drawer-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	height: 100%;
	background-color: var(--background-secondary);
}

.drawer-main-body {
	flex: 1;
	display: flex;
	flex-direction: row;
	overflow: hidden;
}

.mobile-drawer .side-rail {
	height: 100%;
	background-color: var(--background-secondary);
	padding-top: var(--size-4-2);
	/* Выровнено с заголовком после профиля */
	flex-shrink: 0;
	z-index: calc(var(--z-base) + 2);
}

.mobile-drawer .sidebar-panel {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 0;
	padding-top: 0;
	background-color: var(--background-secondary);
	overflow-y: auto;
	z-index: calc(var(--z-base) + 1);
	position: relative;
}

.rail-folders-scroll {
	display: flex;
	flex-direction: column;
	gap: var(--size-4-1);
	overflow-y: auto;
	padding-bottom: var(--size-4-8);
}

/* GUARD: RIGHT DRAWER CLASSES - REMOVED DUPLICATION, USING INHERITANCE ABOVE */
/* Rail borders for different sides */
.mobile-drawer:not(.is-right) .side-rail {
	border-right: var(--divider-width) solid var(--divider-color);
}

.mobile-drawer.is-right .side-rail {
	border-left: var(--divider-width) solid var(--divider-color);
}

/* END GUARD */

.drawer-profile {
	display: flex;
	align-items: center;
	gap: var(--size-4-3);
	padding: calc(env(safe-area-inset-top, 0px) + var(--size-4-4)) var(--drawer-content-padding) var(--size-4-4) 0.65rem;
	/* Выравнивание аватара по иконкам рейла */
	background: var(--background-secondary);
	border-bottom: var(--divider-width) solid var(--divider-color);
}

.drawer-profile .profile-avatar {
	width: var(--size-4-11);
	height: var(--size-4-11);
	font-size: 1.25rem;
	/* Для буквы в фоллбеке */
}

.drawer-profile .profile-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.drawer-profile .profile-name {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--text-normal);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.drawer-profile .profile-role {
	font-size: var(--font-ui-smaller);
	color: var(--text-muted);
}


:root #mobile-nav-content {
	flex: 1;
	overflow-y: auto;
	gap: 0;
	/* Гарантия отсутствия наложения на Rail */
	margin: 0;
	align-content: start;
}

/* === Drawer Tabs (Навигация / Мессенджер) === */
.drawer-tabs {
	display: flex;
	gap: var(--size-4-1);
}

.drawer-tab {
	padding: var(--size-4-1) var(--size-4-2);
	border: none;
	background: transparent;
	color: var(--text-muted);
	font-size: var(--font-ui-medium);
	font-weight: 600;
	cursor: pointer;
	border-bottom: var(--size-2-1) solid transparent;
	transition: color var(--anim-fast), border-color var(--anim-fast);
}

.drawer-tab:hover {
	color: var(--text-normal);
}

.drawer-tab.active {
	color: var(--interactive-accent);
	border-bottom-color: var(--interactive-accent);
}

.mobile-chat-list {
	flex: 1;
	overflow-y: auto;
}

/* Alpine Transitions */
@keyframes fadeIn {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes fadeOut {
	from {
		opacity: 1;
	}

	to {
		opacity: 0;
	}
}

@keyframes slideInLeft {
	from {
		transform: translateX(-100%);
	}

	to {
		transform: translateX(0);
	}
}

@keyframes slideOutLeft {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(-100%);
	}
}

@keyframes slideInRight {
	from {
		transform: translateX(100%);
	}

	to {
		transform: translateX(0);
	}
}

@keyframes slideOutRight {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(100%);
	}
}