/* PDF Merge Tool — "paper stack" theme
   Palette: kraft paper, ink, clip-red accent
   --pmt-paper:   #FAF7F0  (off-white paper)
   --pmt-kraft:   #C98A4B  (kraft paper accent)
   --pmt-kraft-d: #A66B32  (kraft, darker, hover)
   --pmt-ink:     #2B2620  (near-black ink)
   --pmt-ink-60:  #6B6459  (muted ink for secondary text)
   --pmt-line:    #E4DCC8  (hairline separators)
   --pmt-clip:    #B0402E  (paperclip red — the merge action)
*/

.pmt-widget {
	--pmt-paper: #faf7f0;
	--pmt-kraft: #c98a4b;
	--pmt-kraft-d: #a66b32;
	--pmt-ink: #2b2620;
	--pmt-ink-60: #6b6459;
	--pmt-line: #e4dcc8;
	--pmt-clip: #b0402e;
	--pmt-clip-d: #8f3122;

	max-width: 640px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--pmt-ink);
	box-sizing: border-box;
}

.pmt-widget *,
.pmt-widget *::before,
.pmt-widget *::after {
	box-sizing: inherit;
}

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

.pmt-dropzone {
	position: relative;
	border: 2px dashed var(--pmt-line);
	border-radius: 10px;
	background: var(--pmt-paper);
	padding: 36px 24px;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pmt-dropzone:hover,
.pmt-dropzone:focus-visible {
	border-color: var(--pmt-kraft);
	background: #fff;
}

.pmt-dropzone:focus-visible {
	outline: 2px solid var(--pmt-kraft-d);
	outline-offset: 3px;
}

.pmt-dropzone.pmt-drag-over {
	border-color: var(--pmt-clip);
	background: #fff8f4;
}

.pmt-drop-icon {
	width: 34px;
	height: 34px;
	margin: 0 auto 10px;
	fill: none;
	stroke: var(--pmt-kraft-d);
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.pmt-drop-text {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.pmt-drop-sub {
	margin: 4px 0 0;
	font-size: 12.5px;
	color: var(--pmt-ink-60);
}

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

.pmt-file-list {
	list-style: none;
	margin: 14px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.pmt-file-row {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	border: 1px solid var(--pmt-line);
	border-left: 4px solid var(--pmt-kraft);
	border-radius: 6px;
	padding: 9px 10px;
	font-size: 13.5px;
	cursor: grab;
	transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.pmt-file-row:active {
	cursor: grabbing;
}

.pmt-file-row.pmt-dragging {
	opacity: 0.4;
}

.pmt-file-row.pmt-drop-target {
	box-shadow: 0 -2px 0 var(--pmt-clip);
}

.pmt-file-handle {
	color: var(--pmt-ink-60);
	font-size: 14px;
	line-height: 1;
	user-select: none;
	flex: 0 0 auto;
}

.pmt-file-index {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--pmt-paper);
	border: 1px solid var(--pmt-line);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	color: var(--pmt-ink-60);
}

.pmt-file-name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 500;
}

.pmt-file-meta {
	flex: 0 0 auto;
	font-size: 11.5px;
	color: var(--pmt-ink-60);
	font-variant-numeric: tabular-nums;
}

.pmt-file-controls {
	flex: 0 0 auto;
	display: flex;
	gap: 2px;
}

.pmt-icon-btn {
	border: none;
	background: transparent;
	color: var(--pmt-ink-60);
	width: 24px;
	height: 24px;
	border-radius: 4px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	line-height: 1;
}

.pmt-icon-btn:hover {
	background: var(--pmt-paper);
	color: var(--pmt-ink);
}

.pmt-icon-btn:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.pmt-icon-btn.pmt-remove:hover {
	color: var(--pmt-clip);
}

/* ---- Actions ---- */

.pmt-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 16px;
}

.pmt-status {
	font-size: 12.5px;
	color: var(--pmt-ink-60);
	min-height: 1.2em;
}

.pmt-status.pmt-status-error {
	color: var(--pmt-clip);
}

.pmt-status.pmt-status-success {
	color: #3f7d3a;
}

.pmt-merge-btn {
	appearance: none;
	border: none;
	background: var(--pmt-clip);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	padding: 10px 20px;
	border-radius: 7px;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.15s ease, transform 0.05s ease;
}

.pmt-merge-btn:hover:not(:disabled) {
	background: var(--pmt-clip-d);
}

.pmt-merge-btn:active:not(:disabled) {
	transform: translateY(1px);
}

.pmt-merge-btn:disabled {
	background: var(--pmt-line);
	color: var(--pmt-ink-60);
	cursor: not-allowed;
}

/* ---- Ad gate ---- */

.pmt-ad-gate {
	margin-top: 18px;
	padding: 16px;
	border: 1px solid var(--pmt-line);
	border-radius: 10px;
	background: var(--pmt-paper);
	text-align: center;
}

.pmt-ad-gate[hidden] {
	display: none;
}

.pmt-ad-gate-label {
	margin: 0 0 12px;
	font-size: 13px;
	font-weight: 600;
	color: var(--pmt-ink);
}

.pmt-ad-slot {
	min-height: 90px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	margin-bottom: 14px;
}

.pmt-unlock-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.pmt-unlock-progress {
	flex: 1 1 auto;
	height: 6px;
	border-radius: 999px;
	background: var(--pmt-line);
	overflow: hidden;
}

.pmt-unlock-bar {
	height: 100%;
	width: 0%;
	background: var(--pmt-kraft);
	border-radius: 999px;
	transition: width 0.2s linear;
}

.pmt-unlock-bar.pmt-unlock-complete {
	background: #3f7d3a;
}

.pmt-unlock-text {
	flex: 0 0 auto;
	font-size: 12px;
	color: var(--pmt-ink-60);
	font-variant-numeric: tabular-nums;
	min-width: 3.5em;
	text-align: right;
}

.pmt-download-btn {
	appearance: none;
	border: none;
	width: 100%;
	background: #3f7d3a;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	padding: 11px 20px;
	border-radius: 7px;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}

.pmt-download-btn:hover:not(:disabled) {
	background: #336a2f;
}

.pmt-download-btn:active:not(:disabled) {
	transform: translateY(1px);
}

.pmt-download-btn:disabled {
	background: var(--pmt-line);
	color: var(--pmt-ink-60);
	cursor: not-allowed;
}

@media (max-width: 480px) {
	.pmt-dropzone {
		padding: 26px 16px;
	}

	.pmt-file-meta {
		display: none;
	}

	.pmt-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.pmt-merge-btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pmt-widget * {
		transition: none !important;
	}
}
