/**
 * Fixed dark sidebar (full viewport height; no top app bar).
 * Desktop (md+): fixed column + main content offset.
 * Mobile: sidebar stacks above main content (relative, full width).
 */

:root {
	--app-sidebar-width: 260px;
	--app-navbar-height: 0px;
}

/* Mobile: stack layout — sidebar not fixed */
#sideMenuWrap.app-sidebar {
	position: relative;
	width: 100%;
	min-height: auto;
	z-index: 1020;
}

#sideMenuWrap ~ .container-fluid,
#sideMenuWrap ~ .container {
	margin-left: 0;
	max-width: 100%;
}

@media (min-width: 768px) {
	#sideMenuWrap.app-sidebar {
		position: fixed;
		top: var(--app-navbar-height);
		left: 0;
		width: var(--app-sidebar-width);
		height: calc(100vh - var(--app-navbar-height)); /* 100vh when --app-navbar-height is 0 */
		min-height: calc(100vh - var(--app-navbar-height));
		z-index: 1020;
	}

	#sideMenuWrap ~ .container-fluid,
	#sideMenuWrap ~ .container {
		margin-left: var(--app-sidebar-width);
		width: calc(100% - var(--app-sidebar-width));
		max-width: 100%;
		box-sizing: border-box;
	}
}

.app-sidebar-inner {
	min-height: 0;
}

.app-sidebar-header .sidebar-header-avatar:hover img,
.app-sidebar-header .sidebar-header-avatar:hover span {
	opacity: 0.92;
	filter: brightness(1.08);
}

.app-sidebar .nav-link {
	border: none;
	font-size: 0.95rem;
}

.app-sidebar .nav-link.text-white:hover,
.app-sidebar .nav-link.text-white:focus {
	background-color: rgba(255, 255, 255, 0.08);
	color: #fff;
}

.app-sidebar .nav-link.active {
	background-color: var(--bs-primary) !important;
	color: #fff !important;
}

.app-sidebar .nav-link i.bi {
	font-size: 1.1rem;
	opacity: 0.95;
}

.app-sidebar-footer .link-light:hover {
	color: #fff !important;
}

/* Floating AI chat (logged-in sidebar) */
.ai-float-chat-toggle:hover,
.ai-float-chat-toggle:focus {
	opacity: 0.92;
	filter: brightness(1.12);
	color: #fff !important;
}

.ai-float-chat-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1050;
	background: rgba(0, 0, 0, 0.28);
}

.ai-float-chat-panel {
	position: fixed;
	bottom: max(1rem, env(safe-area-inset-bottom));
	right: max(1rem, env(safe-area-inset-right));
	left: auto;
	z-index: 1055;
	width: min(100vw - 2rem, 420px);
	max-height: min(72vh, 560px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
}

@media (max-width: 767.98px) {
	.ai-float-chat-panel {
		left: 50%;
		right: auto;
		transform: translateX(-50%);
		width: calc(100vw - 1.5rem);
		max-width: 420px;
	}
}

.ai-float-chat-inner {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	background: #fff;
}

.ai-float-chat-box {
	flex: 1 1 auto;
	overflow-y: auto;
	min-height: 160px;
	max-height: min(38vh, 320px);
	padding: 0.75rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.ai-float-msg {
	padding: 0.5rem 0.75rem;
	border-radius: 0.65rem;
	max-width: 95%;
}
.ai-float-msg.user {
	align-self: flex-end;
	margin-left: auto;
	background: rgba(13, 110, 253, 0.12);
	border: 1px solid rgba(13, 110, 253, 0.2);
}
.ai-float-msg.assistant {
	align-self: flex-start;
	background: rgba(33, 37, 41, 0.05);
	border: 1px solid rgba(0, 0, 0, 0.08);
}
.ai-float-msg.assistant.streaming {
	border-style: dashed;
}
.ai-float-msgLabel {
	font-size: 0.72rem;
	font-weight: 600;
	opacity: 0.55;
	margin-bottom: 0.15rem;
}
.ai-float-msgBody {
	margin: 0;
	font-family: inherit;
	font-size: 0.95rem;
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-word;
}
.ai-float-msgError .ai-float-msgBody {
	color: var(--bs-danger);
}

.ai-float-chat-form textarea {
	resize: vertical;
	min-height: 2.5rem;
}
