/* =========================================================
   Streamworks — Global layout styles
   Theme color tokens live in theme.css
   ========================================================= */

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	height: 100%;
	overflow: hidden;
}

body {
	font-family: var(--stream-font-family);
	overflow: hidden;
	height: 100%;
	background:
		radial-gradient(
			circle at top left,
			var(--stream-color-bg-start) 0%,
			var(--stream-color-bg-mid) 45%,
			var(--stream-color-bg-end) 100%
		);
	color: var(--stream-color-text);
}

/*
  Soft waves — fixed + no filter blur.
  Blurred oversized layers (even position:fixed) inflate document
  scrollHeight in Chromium and create unselectable blank scroll space.
*/
body::before,
body::after {
	content: "";
	position: fixed;
	inset: 0;
	width: auto;
	height: auto;
	pointer-events: none;
	z-index: 0;
	border-radius: 0;
	opacity: var(--stream-wave-opacity, 0.45);
}

body::before {
	background: radial-gradient(
		ellipse 95% 60% at 0% 100%,
		var(--stream-color-wave-a) 0%,
		var(--stream-color-wave-b) 38%,
		transparent 72%
	);
}

body::after {
	background: radial-gradient(
		ellipse 85% 55% at 100% 22%,
		var(--stream-color-wave-c) 0%,
		var(--stream-color-wave-a) 40%,
		transparent 72%
	);
}

/* ---------- Layout ---------- */
.stream-app {
	display: flex;
	align-items: stretch;
	height: 100vh;
	height: 100dvh;
	padding: var(--stream-space-sm);
	/* Reserve column width for the fixed sidebar (74px) + gap */
	padding-left: calc(var(--stream-space-sm) + 74px + var(--stream-space-sm));
	gap: var(--stream-space-sm);
	position: relative;
	z-index: 2;
	/* Keep visible so fixed sidebar tooltips are not clipped */
	overflow: visible;
}

.stream-main {
	flex: 1;
	min-width: 0;
	min-height: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	gap: var(--stream-space-sm);
	overflow: hidden;
	position: relative;
	z-index: 1;
}

.stream-main > app-header {
	flex-shrink: 0;
}

.stream-main > app-footer {
	flex-shrink: 0;
}

.stream-select-box {
	height: 46px;
	padding: 0 16px;
	border-radius: var(--stream-radius-md);
	background: var(--stream-color-surface);
	display: flex;
	align-items: center;
	gap: 10px;
	border: 1px solid var(--stream-color-border);
	color: var(--stream-color-text);
	font-size: 14px;
	font-weight: 500;
}

.stream-content {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 0;
	background: transparent;
	border: none;
	padding: 0;
}

/* Routed views are siblings of router-outlet inside .stream-content */
.stream-content > *:not(router-outlet) {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.stream-page {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	gap: 0;
}

.stream-page-body {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.stream-page-body > *:not(router-outlet) {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Staff remote hosts / table custom elements */
app-staffs-list,
app-staff-creation,
app-designations,
app-access-groups,
app-staffs-hierarchy {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* ---------- Page forms (same control language as modals) ---------- */
.stream-form-page {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 2px 2px 8px 8px;
	background: var(--stream-color-surface);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid var(--stream-color-border);
	box-shadow:
		0 10px 40px var(--stream-color-shadow),
		inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stream-form-page-header,
.stream-form-page-footer {
	flex-shrink: 0;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.stream-form-page-header {
	border-bottom: 1px solid var(--stream-color-border);
}

.stream-form-page-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--stream-color-primary);
}

.stream-form-page-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 20px 22px 8px;
}

.stream-form-page-footer {
	border-top: 1px solid var(--stream-color-border);
	justify-content: flex-end;
}

.stream-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px 22px;
}

.stream-form-section {
	min-width: 0;
}

.stream-form-section-title {
	margin: 0 0 12px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--stream-color-heading);
}

.stream-form-section-body {
	border: 1px solid var(--stream-color-border);
	border-radius: var(--stream-radius-md);
	padding: 20px 16px 4px;
}

.stream-form-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 16px;
}

.stream-form-span-2 {
	grid-column: span 2;
}

.stream-isd-mobile {
	display: grid;
	grid-template-columns: 92px minmax(0, 1fr);
	gap: 10px;
	min-width: 0;
}

.stream-isd-field .stream-form-control {
	padding-left: 8px;
	padding-right: 22px;
}

@media (max-width: 1100px) {
	.stream-form-grid,
	.stream-form-fields {
		grid-template-columns: 1fr;
	}

	.stream-form-span-2 {
		grid-column: span 1;
	}
}
