/**
 * MergeImagez Tools — PDF image-workflow styles (images to PDF and
 * PDF to JPG/PNG).
 *
 * Self-contained: PDF pages enqueue ONLY this stylesheet (not
 * miz-tools.css), so the shared base styles (buttons, dropzone, status,
 * panels, fields, preview) are included here with the same values.
 * Class prefix: miz-. Brand palette via CSS variables (with fallbacks so
 * the tool still looks right if the theme does not define them).
 */

.miz-tool {
	--miz-primary: #2563EB;
	--miz-primary-dark: #1D4ED8;
	--miz-ink: #0F172A;
	--miz-body: #334155;
	--miz-bg: #F8FAFC;
	--miz-border: #E2E8F0;
	--miz-accent: #0891B2;
	--miz-error-bg: #FEF2F2;
	--miz-error-border: #FECACA;
	--miz-error-text: #991B1B;
	--miz-radius: 10px;

	color: var(--miz-body, #334155);
	font-size: 1rem;
	line-height: 1.5;
	margin: 2rem 0;
}

.miz-tool *,
.miz-tool *::before,
.miz-tool *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.miz-btn {
	appearance: none;
	border: 1px solid transparent;
	border-radius: 8px;
	cursor: pointer;
	display: inline-block;
	font: inherit;
	font-weight: 600;
	line-height: 1.4;
	padding: 0.6rem 1.1rem;
	text-align: center;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.miz-btn:focus-visible {
	outline: 3px solid var(--miz-accent, #0891B2);
	outline-offset: 2px;
}

.miz-btn:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.miz-btn-primary {
	background: var(--miz-primary, #2563EB);
	color: #fff;
}

.miz-btn-primary:hover:not(:disabled) {
	background: var(--miz-primary-dark, #1D4ED8);
}

.miz-btn-secondary {
	background: #fff;
	border-color: var(--miz-border, #E2E8F0);
	color: var(--miz-ink, #0F172A);
}

.miz-btn-secondary:hover:not(:disabled) {
	border-color: var(--miz-primary, #2563EB);
	color: var(--miz-primary, #2563EB);
}

.miz-btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

/* ------------------------------------------------------------------ */
/* Dropzone                                                            */
/* ------------------------------------------------------------------ */

.miz-dropzone {
	background: var(--miz-bg, #F8FAFC);
	border: 2px dashed var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	cursor: pointer;
	padding: 2.5rem 1.5rem;
	text-align: center;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.miz-dropzone:hover,
.miz-dropzone:focus-visible,
.miz-dropzone.is-dragover {
	border-color: var(--miz-primary, #2563EB);
	background: #EFF6FF;
}

.miz-dropzone:focus-visible {
	outline: 3px solid var(--miz-accent, #0891B2);
	outline-offset: 2px;
}

.miz-file-input {
	/* Visually hidden but still focusable / clickable via label-less JS. */
	height: 1px;
	left: -9999px;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.miz-dropzone-title {
	color: var(--miz-ink, #0F172A);
	font-size: 1.15rem;
	font-weight: 700;
	margin: 0 0 0.4rem;
}

.miz-dropzone-hint {
	margin: 0 0 1.1rem;
}

/* ------------------------------------------------------------------ */
/* Status / errors                                                     */
/* ------------------------------------------------------------------ */

.miz-status {
	color: var(--miz-body, #334155);
	margin: 0.9rem 0 0;
	min-height: 1.5em;
}

.miz-error {
	background: var(--miz-error-bg, #FEF2F2);
	border: 1px solid var(--miz-error-border, #FECACA);
	border-radius: 8px;
	color: var(--miz-error-text, #991B1B);
	margin: 0.9rem 0 0;
	padding: 0.7rem 1rem;
}

/* ------------------------------------------------------------------ */
/* Header Row & Breadcrumbs & Privacy Badge                           */
/* ------------------------------------------------------------------ */

.miz-tool-header-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 14px;
}

.miz-tool-breadcrumbs {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 0.875rem;
}

.miz-tool-breadcrumbs a {
	color: #64748B;
	text-decoration: none;
	transition: color 0.15s ease;
}

.miz-tool-breadcrumbs a:hover {
	color: var(--miz-primary, #2563EB);
}

.miz-bc-sep {
	color: #CBD5E1;
	user-select: none;
}

.miz-bc-current {
	color: var(--miz-ink, #0F172A);
	font-weight: 600;
}

.miz-privacy-reassurance {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #059669;
	background: #ECFDF5;
	border: 1px solid #A7F3D0;
	padding: 4px 10px;
	border-radius: 9999px;
}

/* ------------------------------------------------------------------ */
/* Workspace layout                                                    */
/* ------------------------------------------------------------------ */

.miz-workspace {
	margin-top: 1.5rem;
}

.miz-grid-2col {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
	gap: 24px;
	align-items: start;
	margin-top: 1.5rem;
}

.miz-col-preview,
.miz-col-controls {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.miz-panels {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-top: 0;
}

@media (max-width: 900px) {
	.miz-grid-2col {
		grid-template-columns: 1fr;
		gap: 16px;
	}
}

.miz-panel {
	background: #fff;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	margin: 0;
	padding: 1rem 1.1rem 1.1rem;
}

.miz-panel legend {
	color: var(--miz-ink, #0F172A);
	font-weight: 700;
	padding: 0 0.35rem;
}

/* ------------------------------------------------------------------ */
/* Fields                                                              */
/* ------------------------------------------------------------------ */

.miz-field {
	margin-bottom: 0.9rem;
}

.miz-field:last-child {
	margin-bottom: 0;
}

.miz-field label {
	color: var(--miz-ink, #0F172A);
	display: block;
	font-weight: 600;
	margin-bottom: 0.3rem;
}

.miz-field select,
.miz-field input[type="number"] {
	background: #fff;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: 6px;
	color: var(--miz-ink, #0F172A);
	font: inherit;
	padding: 0.45rem 0.6rem;
	width: 100%;
}

.miz-field input[type="range"] {
	width: 100%;
}

.miz-field-inline {
	align-items: center;
	display: flex;
	gap: 0.75rem;
}

.miz-field-inline label {
	margin-bottom: 0;
}

.miz-field-check {
	align-items: flex-start;
	display: flex;
	gap: 0.5rem;
}

.miz-field-check input[type="checkbox"] {
	margin-top: 0.25rem;
}

.miz-field-check label {
	font-weight: 500;
}

.miz-field-note {
	font-size: 0.9rem;
	margin: 0.4rem 0 0;
}

.miz-value {
	color: var(--miz-accent, #0891B2);
	font-weight: 700;
}

.miz-output-size {
	color: var(--miz-ink, #0F172A);
	font-weight: 700;
	margin: 0 0 0.8rem;
}

/* Two inputs side by side (width / height). */
.miz-field-pair {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: 1fr 1fr;
}

/* Input-mode picker (images to PDF): sits outside the workspace so it
 * can be chosen before the first upload. */
.miz-input-mode {
	margin-top: 1.25rem;
}

.miz-input-mode .miz-mode-tabs {
	margin-bottom: 0.4rem;
}

/* ------------------------------------------------------------------ */
/* Mode tabs (radio pills)                                             */
/* ------------------------------------------------------------------ */

.miz-mode-tabs {
	border: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0 0 1rem;
	padding: 0;
}

.miz-mode-tabs legend {
	color: var(--miz-ink, #0F172A);
	font-weight: 700;
	margin-bottom: 0.4rem;
	padding: 0;
}

.miz-mode-tab {
	cursor: pointer;
	display: inline-block;
}

.miz-mode-tab input {
	height: 1px;
	left: -9999px;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.miz-mode-tab span {
	background: #fff;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: 999px;
	color: var(--miz-ink, #0F172A);
	display: inline-block;
	font-weight: 600;
	padding: 0.35rem 0.9rem;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.miz-mode-tab input:checked + span {
	background: var(--miz-primary, #2563EB);
	border-color: var(--miz-primary, #2563EB);
	color: #fff;
}

.miz-mode-tab input:focus-visible + span {
	outline: 3px solid var(--miz-accent, #0891B2);
	outline-offset: 2px;
}

.miz-mode-tab:hover span {
	border-color: var(--miz-primary, #2563EB);
}

/* ------------------------------------------------------------------ */
/* Result panel (generated PDF summary)                                */
/* ------------------------------------------------------------------ */

.miz-result {
	background: #EFF6FF;
	border: 1px solid #BFDBFE;
	border-radius: 8px;
	margin-top: 1rem;
	padding: 0.9rem 1rem;
}

.miz-result-text {
	color: var(--miz-ink, #0F172A);
	margin: 0 0 0.8rem;
}

/* ------------------------------------------------------------------ */
/* Page list — images to PDF (list order = PDF page order)             */
/* ------------------------------------------------------------------ */

.miz-files-head {
	align-items: baseline;
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
}

.miz-files-title {
	color: var(--miz-ink, #0F172A);
	font-size: 1.1rem;
	margin: 0;
}

.miz-files-hint {
	font-size: 0.9rem;
}

.miz-pdf-page-list {
	list-style: none;
	margin: 0.8rem 0 1rem;
	padding: 0;
}

.miz-pdf-page {
	align-items: center;
	background: #fff;
	border: 2px solid var(--miz-border, #E2E8F0);
	border-radius: 8px;
	cursor: grab;
	display: flex;
	gap: 0.75rem;
	margin-bottom: 0.6rem;
	padding: 0.5rem 0.6rem;
}

.miz-pdf-page:active {
	cursor: grabbing;
}

.miz-pdf-page.is-dragging {
	opacity: 0.5;
}

.miz-pdf-page.is-drop-target {
	border-color: var(--miz-accent, #0891B2);
	border-style: solid;
}

.miz-pdf-page-num {
	background: var(--miz-primary, #2563EB);
	border-radius: 50%;
	color: #fff;
	flex: 0 0 auto;
	font-size: 0.85rem;
	font-weight: 700;
	height: 1.7rem;
	line-height: 1.7rem;
	text-align: center;
	width: 1.7rem;
}

.miz-pdf-page-thumb {
	flex: 0 0 auto;
	height: 48px;
	object-fit: contain;
	width: 64px;
}

.miz-pdf-page-meta {
	flex: 1 1 auto;
	font-size: 0.9rem;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.miz-pdf-page-actions {
	display: flex;
	flex: 0 0 auto;
	gap: 0.4rem;
}

.miz-pdf-move {
	padding: 0.4rem 0.65rem;
}

.miz-pdf-page-remove {
	background: var(--miz-ink, #0F172A);
	border: none;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	flex: 0 0 auto;
	font-size: 1rem;
	height: 1.6rem;
	line-height: 1;
	padding: 0;
	width: 1.6rem;
}

.miz-pdf-page-remove:hover {
	background: #B91C1C;
}

/* ------------------------------------------------------------------ */
/* Page list — PDF to JPG/PNG (checkbox selection)                     */
/* ------------------------------------------------------------------ */

.miz-pj-page-list {
	list-style: none;
	margin: 0.8rem 0 1rem;
	padding: 0;
}

.miz-pj-page {
	align-items: center;
	background: #fff;
	border: 2px solid var(--miz-border, #E2E8F0);
	border-radius: 8px;
	display: flex;
	gap: 0.75rem;
	margin-bottom: 0.6rem;
	padding: 0.5rem 0.6rem;
}

.miz-pj-page.is-selected {
	border-color: var(--miz-primary, #2563EB);
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.miz-pj-page-check {
	flex: 0 0 auto;
	height: 1.2rem;
	width: 1.2rem;
}

.miz-pj-page-label {
	background: none;
	border: none;
	color: var(--miz-ink, #0F172A);
	cursor: pointer;
	flex: 1 1 auto;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	min-width: 0;
	overflow: hidden;
	padding: 0;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.miz-pj-page-label:hover {
	color: var(--miz-primary, #2563EB);
}

.miz-pj-page-download {
	flex: 0 0 auto;
	padding: 0.4rem 0.8rem;
}

/* ------------------------------------------------------------------ */
/* Preview                                                             */
/* ------------------------------------------------------------------ */

.miz-preview-wrap {
	margin-top: 1.5rem;
}

.miz-preview-title {
	color: var(--miz-ink, #0F172A);
	font-size: 1.1rem;
	margin: 0 0 0.6rem;
}

.miz-canvas-scroll {
	background:
		linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%),
		linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%);
	background-color: #f9fafb;
	background-position: 0 0, 12px 12px;
	background-size: 24px 24px;
	border: 1px solid var(--miz-border, #E2E8F0);
	border-radius: var(--miz-radius);
	overflow: auto;
	padding: 1rem;
	text-align: center;
}

.miz-canvas-scroll canvas {
	display: inline-block;
	max-width: 100%;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 640px) {
	.miz-dropzone {
		padding: 1.8rem 1rem;
	}

	.miz-panels {
		grid-template-columns: 1fr;
	}

	.miz-field-pair {
		grid-template-columns: 1fr;
	}

	.miz-pdf-page {
		flex-wrap: wrap;
	}

	.miz-pdf-page-meta {
		flex: 1 1 100%;
		order: 3;
		white-space: normal;
	}

	.miz-pj-page {
		flex-wrap: wrap;
	}

	.miz-pj-page-label {
		flex: 1 1 100%;
		order: 3;
		white-space: normal;
	}

	.miz-btn-row .miz-btn {
		flex: 1 1 100%;
	}

	.miz-btn {
		padding: 0.7rem 1rem;
	}
}
