/* =========================================================
   Streamworks — Shell shimmer & page loading
   ========================================================= */

@keyframes stream-shimmer-sweep {
	0% {
		transform: translateX(-120%);
	}

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

/* Shimmer palette — subtle, theme-aware */
:root {
	--stream-shimmer-base: var(--stream-color-surface);
	--stream-shimmer-wave: var(--stream-color-surface-strong);
	--stream-shimmer-sweep: rgba(148, 163, 175, 0.07);
	--stream-shimmer-sweep-core: rgba(148, 163, 175, 0.13);
	--stream-shimmer-border: var(--stream-color-border);
}

.stream-shimmer-block {
	position: relative;
	overflow: hidden;
	background: var(--stream-shimmer-base);
	border: 1px solid var(--stream-shimmer-border);
	isolation: isolate;
}

.stream-shimmer-block::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(
		90deg,
		var(--stream-shimmer-base) 0%,
		var(--stream-shimmer-base) 26%,
		var(--stream-shimmer-wave) 50%,
		var(--stream-shimmer-base) 74%,
		var(--stream-shimmer-base) 100%
	);
	background-size: 200% 100%;
	animation: stream-shimmer-wave 2s ease-in-out infinite;
}

.stream-shimmer-block::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 2;
	background: linear-gradient(
		105deg,
		transparent 0%,
		transparent 30%,
		var(--stream-shimmer-sweep) 44%,
		var(--stream-shimmer-sweep-core) 50%,
		var(--stream-shimmer-sweep) 56%,
		transparent 70%,
		transparent 100%
	);
	transform: translateX(-120%);
	animation: stream-shimmer-sweep 2s ease-in-out infinite;
}

@keyframes stream-shimmer-wave {
	0% {
		background-position: 120% 0;
	}

	100% {
		background-position: -120% 0;
	}
}

.stream-shimmer-menu-item:nth-child(2)::before,
.stream-shimmer-menu-item:nth-child(2)::after {
	animation-delay: 0.15s;
}

.stream-shimmer-menu-item:nth-child(3)::before,
.stream-shimmer-menu-item:nth-child(3)::after {
	animation-delay: 0.3s;
}

.stream-shimmer-menu-item:nth-child(4)::before,
.stream-shimmer-menu-item:nth-child(4)::after {
	animation-delay: 0.45s;
}

.stream-shimmer-menu-item:nth-child(5)::before,
.stream-shimmer-menu-item:nth-child(5)::after {
	animation-delay: 0.6s;
}

.stream-shimmer-branch::before,
.stream-shimmer-branch::after {
	animation-delay: 0.2s;
}

.stream-shimmer-toolbar::before,
.stream-shimmer-toolbar::after {
	animation-delay: 0.25s;
}

.stream-shimmer-table-row:nth-child(3)::before,
.stream-shimmer-table-row:nth-child(3)::after {
	animation-delay: 0.35s;
}

.stream-shimmer-table-row:nth-child(4)::before,
.stream-shimmer-table-row:nth-child(4)::after {
	animation-delay: 0.5s;
}

/* ---------- Full page refresh shell shimmer ---------- */
.stream-shell-shimmer {
	position: fixed;
	inset: 0;
	z-index: 500;
	display: flex;
	align-items: stretch;
	padding: var(--stream-space-sm);
	padding-left: calc(var(--stream-space-sm) + 74px + var(--stream-space-sm));
	gap: var(--stream-space-sm);
	pointer-events: none;
}

.stream-shimmer-sidebar {
	position: fixed;
	top: var(--stream-space-sm);
	left: var(--stream-space-sm);
	bottom: var(--stream-space-sm);
	width: 74px;
	border-radius: var(--stream-radius-lg);
	padding: 18px 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-between;
}

.stream-shimmer-sidebar-top,
.stream-shimmer-sidebar-bottom {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: 100%;
}

.stream-shimmer-logo {
	width: 42px;
	height: 42px;
	border-radius: 16px;
	margin-bottom: 18px;
}

.stream-shimmer-menu-item {
	width: 48px;
	height: 48px;
	border-radius: 16px;
}

.stream-shimmer-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--stream-space-sm);
}

.stream-shimmer-header {
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 4px;
}

.stream-shimmer-header-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.stream-shimmer-business {
	width: 180px;
	height: 34px;
	border-radius: 8px;
}

.stream-shimmer-branch {
	width: 160px;
	height: 34px;
	border-radius: 8px;
}

.stream-shimmer-header-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.stream-shimmer-circle {
	width: 34px;
	height: 34px;
	border-radius: 50%;
}

.stream-shimmer-content {
	flex: 1;
	min-height: 0;
	border-radius: var(--stream-radius-lg);
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: var(--stream-color-surface);
	border: 1px solid var(--stream-color-border);
}

.stream-shimmer-tabs {
	height: 42px;
	width: min(520px, 70%);
	border-radius: var(--stream-radius-md);
}

.stream-shimmer-toolbar {
	height: 40px;
	width: 100%;
	border-radius: var(--stream-radius-md);
}

.stream-shimmer-table-row {
	height: 44px;
	width: 100%;
	border-radius: var(--stream-radius-sm);
}

.stream-shimmer-table-row.short {
	width: 72%;
}

/* ---------- In-route page loading (main content only) ---------- */
.stream-page-content {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	position: relative;
}

.stream-page-content.is-page-loading > app-table-client-side,
.stream-page-content.is-page-loading > app-table-server-side {
	visibility: hidden;
	pointer-events: none;
}

.stream-page-loading {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--stream-color-primary);
	font-size: 28px;
}
