/* ==========================================================================
   Printer picker (assets/script/printer-picker.js). Design tokens only; the
   picker and its dialog always render inside .print-manager-admin.
   Theme colour is --pm-brand for selected states, switches and the primary
   button. Status never greys or hides a printer: "Reported offline" is a
   quiet note only.
   ========================================================================== */

.zprint-pp,
.zprint-pp-modal {
	font-family: var(--pm-font);
	font-size: var(--pm-text-base);
	color: var(--pm-text);
}

.zprint-pp *,
.zprint-pp-modal * {
	box-sizing: border-box;
}

.zprint-pp {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--pm-bg-white);
}

.zprint-pp-icon {
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.zprint-pp__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- search and hint ---------- */

.zprint-pp__top {
	padding: var(--pm-space-3) var(--pm-space-5);
	border-bottom: 1px solid var(--pm-bg);
}

/* In the dialog the title sits right above the search box. */
.zprint-pp-modal .zprint-pp__top {
	padding-top: 0;
}

.zprint-pp__search {
	position: relative;
	display: flex;
	align-items: center;
	color: var(--pm-text-subtle);
}

.zprint-pp__search .zprint-pp-icon {
	position: absolute;
	left: 10px;
	pointer-events: none;
}

.zprint-pp .zprint-pp__search-input {
	width: 100%;
	min-height: 34px;
	margin: 0;
	padding: 6px 10px 6px 32px;
	border: 1px solid var(--pm-border);
	border-radius: var(--pm-radius-md);
	background: var(--pm-bg-white);
	color: var(--pm-text);
	font-size: var(--pm-text-base);
	line-height: 1.5;
	box-shadow: none;
}

.zprint-pp .zprint-pp__search-input::-webkit-search-cancel-button {
	filter: grayscale(1);
	cursor: pointer;
}

.zprint-pp .zprint-pp__search-input::placeholder {
	color: var(--pm-text-subtle);
}

.zprint-pp .zprint-pp__search-input:focus {
	border-color: var(--pm-brand);
	outline: none;
	box-shadow: 0 0 0 1px var(--pm-brand);
}

.zprint-pp__hint {
	margin: var(--pm-space-2) 0 0;
	color: var(--pm-text-subtle);
	font-size: var(--pm-text-sm);
}

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

.zprint-pp__list {
	/* Positioned, so option offsets are measured from the list (revealSelected). */
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: var(--pm-space-1) 0 var(--pm-space-2);
	overscroll-behavior: contain;
}

.zprint-pp__group {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.zprint-pp__group-head {
	display: flex;
	justify-content: space-between;
	gap: var(--pm-space-3);
	width: 100%;
	padding: 10px var(--pm-space-5) var(--pm-space-1);
	color: var(--pm-text-subtle);
	font-size: var(--pm-text-xs);
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.zprint-pp__group-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.zprint-pp__group-count {
	flex: 0 0 auto;
}

.zprint-pp__opt {
	display: flex;
	align-items: center;
	gap: var(--pm-space-3);
	min-height: 38px;
	padding: 9px var(--pm-space-5);
	cursor: pointer;
	line-height: 1.4;
}

.zprint-pp__opt:hover {
	background: var(--pm-bg);
}

.zprint-pp__opt.is-selected {
	background: var(--pm-brand-light);
}

.zprint-pp__name {
	min-width: 0;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.zprint-pp__note {
	flex: 0 0 auto;
	margin-left: auto;
	color: var(--pm-text-subtle);
	font-size: var(--pm-text-xs);
}

.zprint-pp__group.is-missing .zprint-pp__name {
	font-weight: 400;
	font-family: Menlo, Consolas, monospace;
	font-size: var(--pm-text-sm);
}

.zprint-pp__empty {
	margin: 0;
	padding: var(--pm-space-6) var(--pm-space-5);
	color: var(--pm-text-muted);
	text-align: center;
}

/* ---------- radios and checkboxes (black theme, not the admin blue) ---------- */

.zprint-pp input.zprint-pp__input,
.zprint-pp input.zprint-pp__check {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	top: 0;
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	min-width: 16px;
	margin: 0;
	padding: 0;
	border: 1.5px solid var(--pm-text-subtle);
	background: var(--pm-bg-white);
	box-shadow: none;
	cursor: pointer;
	vertical-align: middle;
}

.zprint-pp input.zprint-pp__input[type="radio"] {
	border-radius: 50%;
}

.zprint-pp input.zprint-pp__input[type="checkbox"],
.zprint-pp input.zprint-pp__check {
	border-radius: 3px;
}

.zprint-pp input.zprint-pp__input::before,
.zprint-pp input.zprint-pp__check::before,
.zprint-pp input.zprint-pp__input::after,
.zprint-pp input.zprint-pp__check::after {
	content: none;
}

.zprint-pp input.zprint-pp__input[type="radio"]:checked {
	border: 5px solid var(--pm-brand);
}

.zprint-pp input.zprint-pp__input[type="checkbox"]:checked,
.zprint-pp input.zprint-pp__check:checked {
	border-color: var(--pm-brand);
	background: var(--pm-brand);
}

/* The admin stylesheet blanks checkbox ::before with !important, so the tick is drawn with ::after. */
.zprint-pp input.zprint-pp__input[type="checkbox"]:checked::after,
.zprint-pp input.zprint-pp__check:checked::after {
	content: "";
	position: absolute;
	left: 4px;
	top: 0;
	width: 5px;
	height: 9px;
	margin: 0;
	border: solid var(--pm-bg-white);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
	background: none;
}

.zprint-pp input.zprint-pp__input:focus,
.zprint-pp input.zprint-pp__check:focus {
	outline: none;
	box-shadow: none;
}

.zprint-pp input.zprint-pp__input:focus-visible,
.zprint-pp input.zprint-pp__check:focus-visible {
	box-shadow: 0 0 0 2px var(--pm-bg-white), 0 0 0 4px var(--pm-brand);
}

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

.zprint-pp__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--pm-space-2);
	padding: var(--pm-space-3) var(--pm-space-5);
	border-top: 1px solid var(--pm-bg);
}

.zprint-pp__foot:empty {
	display: none;
}

.zprint-pp__multi {
	display: inline-flex;
	align-items: center;
	gap: var(--pm-space-2);
	color: var(--pm-text-muted);
	cursor: pointer;
}

.zprint-pp__spacer {
	flex: 1 1 auto;
}

.zprint-pp .button.zprint-pp-btn {
	min-height: 32px;
	padding: 0 var(--pm-space-3);
	border-color: var(--pm-border);
	border-radius: var(--pm-radius-md);
	background: var(--pm-bg-white);
	color: var(--pm-text);
	font-weight: 600;
	line-height: 30px;
}

.zprint-pp .button.zprint-pp-btn:hover {
	border-color: var(--pm-text-muted);
	background: var(--pm-bg);
	color: var(--pm-text);
}

.zprint-pp .button.zprint-pp-btn--primary,
.zprint-pp .button.zprint-pp-btn--primary:focus {
	border-color: var(--pm-brand);
	background: var(--pm-brand);
	color: var(--pm-bg-white);
	box-shadow: none;
}

.zprint-pp .button.zprint-pp-btn--primary:hover {
	border-color: var(--pm-brand-hover);
	background: var(--pm-brand-hover);
	color: var(--pm-bg-white);
}

.zprint-pp .button.zprint-pp-btn:focus-visible {
	outline: 2px solid var(--pm-brand);
	outline-offset: 1px;
}

.zprint-pp .button.zprint-pp-btn--primary:disabled,
.zprint-pp .button.zprint-pp-btn--primary[disabled] {
	border-color: var(--pm-brand) !important;
	background: var(--pm-brand) !important;
	color: var(--pm-bg-white) !important;
	opacity: 0.4;
	cursor: default;
}

/* ---------- dialog ---------- */

.zprint-pp-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--pm-space-6);
	background: rgba(var(--pm-brand-rgb), 0.55);
}

/* The admin stylesheet gives every child of the page wrapper side margins; the overlay covers the whole window. */
.print-manager-admin > .zprint-pp-modal {
	margin: 0;
}

.zprint-pp-modal__box {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 620px;
	max-height: calc(100vh - 2 * var(--pm-space-6));
	overflow: hidden;
	border-radius: 10px;
	background: var(--pm-bg-white);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.zprint-pp-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--pm-space-3);
	padding: 18px var(--pm-space-5) 10px;
}

.zprint-pp-modal__head h2 {
	margin: 0;
	padding: 0;
	color: var(--pm-text);
	font-size: var(--pm-text-lg);
	font-weight: 600;
	line-height: 1.3;
}

.zprint-pp-modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	margin: -4px -6px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--pm-text-muted);
	cursor: pointer;
}

.zprint-pp-modal__close:hover,
.zprint-pp-modal__close:focus-visible {
	background: var(--pm-bg);
	color: var(--pm-text);
	outline: none;
}

.zprint-pp-modal__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
}

.zprint-pp-modal__body > .zprint-pp {
	flex: 1 1 auto;
}

@media screen and (max-width: 600px) {
	.zprint-pp-modal {
		align-items: flex-end;
		padding: 0;
	}

	.zprint-pp-modal__box {
		max-height: calc(100vh - var(--pm-space-8));
		border-radius: 10px 10px 0 0;
	}

	.zprint-pp__multi {
		flex: 1 0 100%;
	}
}
