/* ==========================================================================
   1. BASE & VIEWPORT RESETS
   ========================================================================== */
html,
body {
	height: 100vh;
	overflow: hidden;
	margin: 0;
	padding: 0;
}

.app-viewport {
	display: flex;
	height: 100vh;
	width: 100%;
	position: relative;
}

.content-wrapper {
	flex: 1;
	height: 100%;
	overflow-y: auto;
	min-width: 0;
}

/* ==========================================================================
   2. APP SIDEBAR & HEADER
   ========================================================================== */
.app-sidebar {
	font-size: 0.9em;
	position: relative;
	width: 320px;
	height: 100%;
	background-color: #ffffff;
	border-right: 1px solid #dee2e6;
	z-index: 1030;
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .app-sidebar {
	margin-left: -320px;
}

.sidebar-header {
	width: 100%;
	border-bottom: 1px solid #dee2e6;
	background-color: #ffffff;
	flex-shrink: 0;
}

.header-user-row {
	height: 62px;
	width: 100%;
}

.header-user-toggle {
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	padding: 0 1.25rem;
	color: #333333;
	font-weight: 500;
	cursor: pointer;
	user-select: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

	.header-user-toggle:hover {
		background-color: rgba(0, 0, 0, 0.03);
		color: #0d6efd;
	}

	.header-user-toggle .user-info-container {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		overflow: hidden;
		margin-right: auto;
	}

		.header-user-toggle .user-info-container img {
			width: 42px;
			height: 42px;
			border-radius: 50%;
			outline: white solid 2px;
			outline-offset: 2px;
			flex-shrink: 0;
			object-fit: cover;
		}

	.header-user-toggle::after {
		content: "\f107";
		font-family: "Font Awesome 6 Free";
		font-weight: 900;
		font-size: 0.8rem;
		color: #6c757d;
		transition: transform 0.2s ease;
		margin-left: 0.45rem;
	}

	.header-user-toggle[aria-expanded="true"]::after {
		transform: rotate(-180deg);
		color: #0d6efd;
	}

.sidebar-header .collapse,
.sidebar-header .collapsing {
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	width: 100%;
}

/* ==========================================================================
   3. ANIMATED TOGGLE BUTTON (SIDEBAR)
   ========================================================================== */
.animated-toggle-btn {
	position: absolute;
	top: 50%;
	width: 16px;
	height: 64px;
	z-index: 40000;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid #dee2e6;
	background-color: #ffffff;
	box-shadow: 2px 0 6px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body:not(.sidebar-collapsed) .animated-toggle-btn {
	border-radius: 8px;
	border-left: 1px solid #dee2e6;
	transform: translate(-50%, -50%);
}

body.sidebar-collapsed .animated-toggle-btn {
	border-left: none;
	border-radius: 0 8px 8px 0;
	transform: translateY(-50%);
}

.animated-toggle-btn i {
	font-size: 0.75rem;
	color: #6c757d;
	transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

body:not(.sidebar-collapsed) .animated-toggle-btn i {
	transform: rotate(180deg);
}

body.sidebar-collapsed .animated-toggle-btn i {
	transform: rotate(0deg);
}

.animated-toggle-btn:hover {
	width: 24px;
	background-color: #48519e;
	border-color: #48519e;
}

	.animated-toggle-btn:hover i {
		color: #ffffff;
	}

/* ==========================================================================
   4. SIDEBAR NAVIGATION MENU
   ========================================================================== */
.sidebar-menu-scroll {
	flex: 1;
	overflow-y: auto;
	margin-right: 0.4em;
	align-items: start;
}

#gui nav ul {
	width: 100%;
	list-style: none;
	padding: 0;
	margin: 0;
}

.nested-collapse-menu {
	list-style: none;
	padding: 0 0 0 1rem !important;
	margin: 0;
	background-color: rgba(0, 0, 0, 0.02);
	width: 100%;
}

#gui nav ul li a,
#gui nav ul li .nested-toggle-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.65rem 1.25rem;
	white-space: normal;
	text-decoration: none;
	font-weight: 500;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.nested-toggle-btn::after {
	content: "\f107";
	font-family: "Font Awesome 6 Free";
	font-weight: 900;
	font-size: 0.8rem;
	color: #6c757d;
	transition: transform 0.2s ease;
}

.nested-toggle-btn[aria-expanded="true"]::after {
	transform: rotate(-180deg);
	color: #0d6efd;
}

#gui nav.navbar {
	background: none;
	box-shadow: none;
}

	#gui nav.navbar i.fa-solid {
		width: 1.5rem;
		font-size: 1.3rem;
		text-align: center;
		line-height: 1;
		display: inline-block;
		vertical-align: middle;
	}

/* ==========================================================================
   5. RESIZER HANDLE & RESIZING STATES
   ========================================================================== */
.resizer-handle {
	position: absolute;
	top: 0;
	right: -3px;
	width: 6px;
	height: 100%;
	cursor: col-resize;
	z-index: 10;
	transition: background-color 0.15s ease;
}

	.resizer-handle:hover,
	.resizer-handle.is-resizing {
		background-color: #48519e !important;
	}

body.sidebar-collapsed .resizer-handle {
	display: none;
}

body.is-resizing .app-sidebar,
body.is-resizing .animated-toggle-btn {
	transition: none !important;
}

body.is-resizing {
	user-select: none;
	cursor: col-resize !important;
}

	body.is-resizing * {
		pointer-events: none !important;
	}

	body.is-resizing #sidebarResizer {
		pointer-events: auto !important;
	}

/* ==========================================================================
   6. DIALOGS & MODAL OVERLAYS
   ========================================================================== */
#dialogs {
	background-image: url('/images/logo.png');
	background-repeat: no-repeat;
	background-position: center center;
	background-attachment: scroll;
	background-size: 55% auto;
}

	#dialogs .modal:not(.topMost) .modal-content::after {
		display: block;
		content: "";
		position: absolute;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		background: white;
		z-index: 2;
		border-radius: 8px;
		opacity: 0.4;
		pointer-events: none;
	}

.modal.morph-active {
	display: flex !important;
	align-items: center;
	justify-content: center;
	background: transparent !important;
}

	.modal.morph-active .modal-dialog {
		margin: auto;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.modal.morph-active .modal-content {
		overflow: hidden;
		contain: content;
		will-change: width, height;
	}

.modal-offscreen {
	visibility: hidden !important;
	pointer-events: none !important;
}

/* ==========================================================================
   7. INTERACTION SHIELD & LOCKOUT GATEWAY
   ========================================================================== */
.dialog-interaction-locked,
.dialog-interaction-locked .modal-content {
	pointer-events: none !important;
}

	.dialog-interaction-locked [data-popups="allow"],
	[data-tippy-root] {
		pointer-events: auto !important;
	}

/* ==========================================================================
   8. CUSTOM TIPPY THEME (RED OUTLINE & SAFETY)
   ========================================================================== */
.tippy-box[data-theme~='red-outline'] {
	background-color: #ffffff;
	color: #333333;
	border: 1px solid #ff0000 !important;
	box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15) !important;
	border-radius: 0.5rem;
	z-index: 10000 !important;
	transition-duration: 0ms !important;
}

	.tippy-box[data-theme~='red-outline'][data-placement^='top'] > .tippy-arrow::before {
		border-top-color: #ffffff !important;
	}

	.tippy-box[data-theme~='red-outline'][data-placement^='bottom'] > .tippy-arrow::before {
		border-bottom-color: #e7f5ff !important;
	}

	.tippy-box[data-theme~='red-outline'][data-placement^='left'] > .tippy-arrow::before {
		border-left-color: #ffffff !important;
	}

	.tippy-box[data-theme~='red-outline'][data-placement^='right'] > .tippy-arrow::before {
		border-right-color: #ffffff !important;
	}

	.tippy-box[data-theme~='red-outline'][data-placement^='top'] > .tippy-arrow {
		filter: drop-shadow(0px 1px 0px #ff0000);
	}

	.tippy-box[data-theme~='red-outline'][data-placement^='bottom'] > .tippy-arrow {
		filter: drop-shadow(0px -1px 0px #ff0000);
	}

	.tippy-box[data-theme~='red-outline'][data-placement^='left'] > .tippy-arrow {
		filter: drop-shadow(1px 0px 0px #ff0000);
	}

	.tippy-box[data-theme~='red-outline'][data-placement^='right'] > .tippy-arrow {
		filter: drop-shadow(-1px 0px 0px #ff0000);
	}

	.tippy-box[data-theme~='red-outline'] .tippy-arrow,
	.tippy-box[data-theme~='red-outline'] .tippy-arrow::before {
		transition-duration: 0ms !important;
	}

	.tippy-box[data-theme~='red-outline'] .tippy-content {
		padding: 0px 1px;
	}

	.tippy-box[data-theme~='red-outline'] .btn-close {
		opacity: 1;
		background: none;
		padding-top: 0;
	}

/* Viewport Safety Mask for Unpositioned Tippy Panels */
[data-tippy-root][style*="transform: translate(0px, 0px)"],
[data-tippy-root][style*="transform: translate3d(0px, 0px)"] {
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
}
