/* The background-upload dock — the one thing on screen that outlives the page.
 *
 * Written as plain CSS, not Tailwind utilities, for the same reason
 * order_tracks.css is: this component is injected by JavaScript on every route
 * of the app, so it cannot depend on utility classes surviving a template it
 * was never written into. It also has to be legible over whatever page happens
 * to be underneath it, which means owning its own stacking and elevation.
 *
 * Palette follows the app: primary maroon (#7a1526 / #6b1521) for the active
 * bar, emerald for a finished file, amber for one that needs the user, and
 * neutral greys everywhere else. Logical properties (inset-inline-end, padding
 * -inline) throughout, so the dock lands bottom-LEFT in Arabic without a single
 * [dir="rtl"] override.
 */

.lsu-dock {
	position: fixed;
	inset-block-end: 1rem;
	inset-inline-end: 1rem;
	z-index: 9000;
	width: min(22rem, calc(100vw - 2rem));
	font-family: inherit;
	color: #171717;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 1rem;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
	overflow: hidden;
	transform: translateY(0);
	transition: transform .25s ease, opacity .25s ease;
}

.lsu-dock[hidden] { display: none; }

/* Mobile: full width above the bottom nav rather than a floating card that
 * covers a third of a phone screen. */
@media (max-width: 640px) {
	.lsu-dock {
		inset-inline: 0.5rem;
		inset-block-end: calc(0.5rem + env(safe-area-inset-bottom, 0px));
		width: auto;
	}
}

/* ---- header ------------------------------------------------------------ */

.lsu-head {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	width: 100%;
	padding: 0.75rem 0.875rem;
	background: linear-gradient(135deg, #7a1726, #5c121c);
	color: #fff;
	border: 0;
	text-align: start;
	cursor: pointer;
	font: inherit;
}

.lsu-head:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -3px;
}

.lsu-head-icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 0.5rem;
	background: rgba(255, 255, 255, .16);
	font-size: 0.8125rem;
}

.lsu-head-text { flex: 1 1 auto; min-width: 0; }

.lsu-title {
	display: block;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lsu-sub {
	display: block;
	margin-block-start: 0.125rem;
	font-size: 0.6875rem;
	font-weight: 500;
	line-height: 1.2;
	color: rgba(255, 255, 255, .78);
	font-variant-numeric: tabular-nums;
}

.lsu-caret {
	flex: none;
	font-size: 0.75rem;
	opacity: .85;
	transition: transform .25s ease;
}

.lsu-dock.is-collapsed .lsu-caret { transform: rotate(180deg); }

/* Thin overall bar welded to the bottom of the header, so a collapsed dock
 * still answers "how far along is this?" without being opened. */
.lsu-head-bar {
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	height: 3px;
	background: rgba(255, 255, 255, .2);
}

.lsu-head-bar > i {
	display: block;
	height: 100%;
	width: 0;
	background: #fff;
	transition: width .3s ease;
}

.lsu-head-wrap { position: relative; }

/* ---- list -------------------------------------------------------------- */

.lsu-body {
	max-height: 17rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.lsu-dock.is-collapsed .lsu-body,
.lsu-dock.is-collapsed .lsu-foot { display: none; }

.lsu-item {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	padding: 0.625rem 0.875rem;
	border-block-end: 1px solid #f5f5f5;
}

.lsu-item:last-child { border-block-end: 0; }

.lsu-icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 1.875rem;
	height: 1.875rem;
	margin-block-start: 0.125rem;
	border-radius: 0.5rem;
	background: #f5f5f5;
	color: #525252;
	font-size: 0.75rem;
}

.lsu-item.is-uploading .lsu-icon { background: #fdf2f4; color: #7a1726; }
.lsu-item.is-done     .lsu-icon { background: #ecfdf5; color: #047857; }
.lsu-item.is-error    .lsu-icon { background: #fffbeb; color: #b45309; }

.lsu-main { flex: 1 1 auto; min-width: 0; }

.lsu-name {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.3;
	color: #171717;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lsu-meta {
	display: block;
	margin-block-start: 0.125rem;
	font-size: 0.6875rem;
	font-weight: 500;
	color: #737373;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lsu-item.is-error .lsu-meta { color: #b45309; white-space: normal; }

.lsu-bar {
	height: 4px;
	margin-block-start: 0.375rem;
	border-radius: 999px;
	background: #f0f0f0;
	overflow: hidden;
}

.lsu-bar > i {
	display: block;
	height: 100%;
	width: 0;
	border-radius: inherit;
	background: linear-gradient(90deg, #8b1e2f, #7a1726);
	transition: width .3s ease;
}

.lsu-item.is-done  .lsu-bar > i { background: #059669; }
.lsu-item.is-error .lsu-bar > i { background: #d97706; }

/* The indeterminate shimmer only runs while bytes are actually moving, and
 * never for a user who has asked for less motion. */
.lsu-item.is-uploading .lsu-bar > i::after {
	content: '';
	display: block;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
	animation: lsu-shimmer 1.4s linear infinite;
}

@keyframes lsu-shimmer {
	from { transform: translateX(-100%); }
	to   { transform: translateX(100%); }
}

[dir="rtl"] .lsu-item.is-uploading .lsu-bar > i::after {
	animation-direction: reverse;
}

.lsu-actions {
	flex: none;
	display: flex;
	align-items: center;
	gap: 0.25rem;
	margin-block-start: 0.125rem;
}

.lsu-btn {
	display: grid;
	place-items: center;
	width: 1.625rem;
	height: 1.625rem;
	padding: 0;
	border: 0;
	border-radius: 0.4375rem;
	background: transparent;
	color: #737373;
	font-size: 0.6875rem;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}

.lsu-btn:hover  { background: #f5f5f5; color: #171717; }
.lsu-btn:focus-visible { outline: 2px solid #7a1726; outline-offset: 1px; }
.lsu-btn.is-danger:hover { background: #fef2f2; color: #b91c1c; }

/* ---- footer ------------------------------------------------------------ */

.lsu-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.5rem 0.875rem;
	background: #fafafa;
	border-block-start: 1px solid #f0f0f0;
}

.lsu-hint {
	font-size: 0.6875rem;
	font-weight: 500;
	color: #737373;
	line-height: 1.35;
}

.lsu-foot-btn {
	flex: none;
	padding: 0.3125rem 0.625rem;
	border: 1px solid #e5e5e5;
	border-radius: 0.5rem;
	background: #fff;
	color: #7a1726;
	font-size: 0.6875rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}

.lsu-foot-btn:hover { background: #fdf2f4; border-color: #f3d3d8; }
.lsu-foot-btn:focus-visible { outline: 2px solid #7a1726; outline-offset: 1px; }

/* ---- pending-files panel on the order page ----------------------------- */

/* Shown to whoever opens a case whose files are still on someone else's
 * device. Without it the order simply looks empty, which reads as broken. */
.lsu-pending {
	display: flex;
	flex-direction: column;
	gap: 0.625rem;
	padding: 0.875rem 1rem;
	margin-block-end: 1rem;
	border: 1px solid #fde68a;
	border-radius: 0.875rem;
	background: #fffbeb;
}

.lsu-pending-head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 700;
	color: #92400e;
}

.lsu-pending-row {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	font-size: 0.75rem;
	color: #78350f;
}

.lsu-pending-row .lsu-name { color: #78350f; }

.lsu-pending-row .lsu-bar {
	flex: 1 1 6rem;
	margin: 0;
	background: rgba(180, 83, 9, .15);
}

.lsu-pending-row .lsu-bar > i { background: #d97706; }

.lsu-pending-pct {
	flex: none;
	font-size: 0.6875rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: #92400e;
}

@media (prefers-reduced-motion: reduce) {
	.lsu-dock,
	.lsu-caret,
	.lsu-bar > i,
	.lsu-head-bar > i,
	.lsu-btn,
	.lsu-foot-btn { transition: none; }

	.lsu-item.is-uploading .lsu-bar > i::after { animation: none; }
}
