/*
 * labete.dev logs (on top of tools.css)
 * The log list fills the screen. Everything above it is one tight stack of bars
 * with no gaps, and the list's header sits flush against them. Rows have one
 * fixed height (--row), which the script reads, so the virtual scroll maths and
 * the CSS can never disagree.
 */

.source-switch {
	display: flex;
	padding: 2px;
	border: 1px solid var(--rule);
	border-radius: 8px;
}

.source-switch button {
	height: 26px;
	padding: 0 14px;
	border: 0;
	border-radius: 6px;
	background: none;
	color: var(--soft);
	cursor: pointer;
}

.source-switch [aria-selected='true'] {
	background: var(--ink);
	color: var(--paper);
	font-weight: 600;
}

/* Live: status, platform, command, copy. Every control in the bar is 30px tall,
   so it keeps its height whichever of them are showing. */
.bar-source .status {
	min-height: 30px;
}

.bar-source .button-strong {
	height: 30px;
}

.platform {
	flex-shrink: 0;
	height: 30px;
	padding: 0 8px;
	border: 1px solid var(--rule);
	border-radius: 6px;
	background: var(--paper-raised);
	color: var(--ink);
	font: inherit;
}

.command {
	flex: 1;
	min-width: 0;
	padding: 5px 10px;
	border-radius: 6px;
	background: var(--wash);
	font-family: var(--mono);
	font-size: 12.5px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.source-note {
	flex: 1;
	min-width: 0;
	color: var(--soft);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.file-name {
	flex: 1;
	min-width: 0;
	font-family: var(--mono);
	font-size: 13px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Filter: search, level chips (also the counts), shown count */
.search {
	flex: 0 1 340px;
	min-width: 140px;
}

.search input {
	width: 100%;
	height: 30px;
	padding: 0 10px;
	border: 1px solid var(--rule);
	border-radius: 6px;
	background: var(--paper-raised);
	color: var(--ink);
	font-family: var(--mono);
	font-size: 13px;
}

.levels {
	display: flex;
	gap: 6px;
}

.level-chip {
	display: flex;
	align-items: baseline;
	gap: 6px;
	height: 30px;
	padding: 5px 10px 0;
	border: 1px solid var(--rule);
	border-radius: 6px;
	background: none;
	font-family: var(--mono);
	font-size: 12.5px;
	cursor: pointer;
}

.level-chip b {
	color: var(--soft);
	font-weight: 500;
}

.level-chip[data-level='error'] {
	color: var(--error);
}

.level-chip[data-level='warn'] {
	color: var(--warn);
}

.level-chip[data-level='debug'] {
	color: var(--soft);
}

/* A level that is filtered out reads as switched off */
.level-chip[aria-pressed='false'] {
	opacity: 0.4;
	text-decoration: line-through;
	border-style: dashed;
}

.shown {
	margin-left: auto;
	color: var(--soft);
	font-size: 13px;
	white-space: nowrap;
}

/* ───────────── the list ───────────── */

.list-wrap {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

/* Columns shared by the header and every row */
.list-head,
.row {
	display: grid;
	grid-template-columns: 112px 52px 0 minmax(0, 1fr);
	column-gap: 14px;
	padding: 0 calc(var(--pad) + 14px) 0 var(--pad);
}

.has-service .list-head,
.has-service .row {
	grid-template-columns: 112px 52px minmax(0, 160px) minmax(0, 1fr);
}

.col-service {
	overflow: hidden;
}

.list-head {
	height: 30px;
	align-items: center;
	border-bottom: 1px solid var(--rule);
	color: var(--soft);
	font-size: 12.5px;
	font-weight: 600;
}

.list {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-anchor: none;
	outline: none;
}

.list-spacer {
	width: 1px;
}

.list-rows {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	will-change: transform;
}

.row {
	height: var(--row);
	align-items: center;
	font-family: var(--mono);
	font-size: 12.5px;
	cursor: pointer;
	/* An edge in the level's colour; transparent for info and debug */
	box-shadow: inset 2px 0 0 transparent;
}

.row:hover {
	background: var(--wash);
}

.row.selected {
	background: var(--select);
}

.row > span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.row .col-time,
.row .col-service {
	color: var(--soft);
}

.row.error {
	box-shadow: inset 2px 0 0 var(--error);
}

.row.warn {
	box-shadow: inset 2px 0 0 var(--warn);
}

.row.error .col-level {
	color: var(--error);
	font-weight: 600;
}

.row.warn .col-level {
	color: var(--warn);
	font-weight: 600;
}

.row.debug .col-level,
.row.debug .col-message {
	color: var(--soft);
}

mark {
	background: var(--mark);
	color: inherit;
	border-radius: 2px;
}

/* The error map: where errors and warnings sit in the whole log */
.error-map {
	position: absolute;
	top: 31px;
	right: 0;
	bottom: 0;
	width: 12px;
	border-left: 1px solid var(--rule);
	cursor: pointer;
}

/* "N new lines" while scrolled up in a live stream */
.new-lines {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	height: 32px;
	padding: 0 14px;
	border: 0;
	border-radius: 16px;
	background: var(--ink);
	color: var(--paper);
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

/* Empty: waiting for a stream, or a file to open */
.empty {
	position: absolute;
	inset: 31px 0 0 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	text-align: center;
}

.empty-command {
	max-width: min(560px, 100%);
	padding: 12px 16px;
	border: 1px solid var(--rule);
	border-radius: 8px;
	background: var(--paper-raised);
	font-family: var(--mono);
	font-size: 12.5px;
	line-height: 1.65;
	text-align: left;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.empty-command:empty {
	display: none;
}

.drop-hint {
	position: absolute;
	inset: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px dashed var(--live);
	border-radius: 10px;
	background: var(--paper);
	color: var(--live);
	font-size: 18px;
	font-weight: 700;
	pointer-events: none;
}

/* ───────────── narrow screens ───────────── */

@media (max-width: 760px) {
	:root {
		--pad: 12px;
	}

	.bar {
		flex-wrap: wrap;
	}

	.bar-top {
		gap: 12px;
	}

	.bar-actions {
		width: 100%;
		margin-left: 0;
	}

	/* The status with the note or the platform picker on one row, the buttons on
	   the next, so the bar is the same two rows with or without the command. The
	   command is too long to read here; Copy command copies it. */
	.bar-source > * {
		order: 3;
	}

	.bar-source .status {
		order: 0;
	}

	.bar-source .platform {
		order: 1;
		margin-left: auto;
	}

	.bar-source .source-note {
		order: 1;
		white-space: normal;
	}

	.bar-source .command {
		display: none;
	}

	.search {
		flex: 1 1 100%;
	}

	.shown {
		margin-left: 0;
	}

	/* Time and message only; the level shows as the row's edge */
	.list-head,
	.row,
	.has-service .list-head,
	.has-service .row {
		grid-template-columns: 84px 0 0 minmax(0, 1fr);
		column-gap: 10px;
	}

	.col-level,
	.col-service {
		visibility: hidden;
	}
}

