/**
 * ImageToolkit Pro Converter - styles.
 * Everything is scoped under .itpv so it cannot clash with your theme.
 */

.itpv {
	--itpv-accent: #6366f1;
	--itpv-accent-soft: #eef2ff;
	--itpv-accent-edge: #c7d2fe;
	--itpv-accent-focus: #a5b4fc;
	--itpv-text: #111827;
	--itpv-muted: #6b7280;
	--itpv-line: #e5e7eb;
	--itpv-bg: #f9fafb;
	--itpv-green: #15803d;
	--itpv-green-dark: #166534;
	--itpv-radius: 14px;

	max-width: 1120px;
	margin: 24px auto;
	padding: 0 12px;
	color: var(--itpv-text);
	font-size: 16px;
	line-height: 1.5;
	box-sizing: border-box;
}

/* Newer browsers: tints are made from the main color you pick in the settings. */
@supports (color: color-mix(in srgb, red 10%, white)) {
	.itpv {
		--itpv-accent-soft: color-mix(in srgb, var(--itpv-accent) 12%, #fff);
		--itpv-accent-edge: color-mix(in srgb, var(--itpv-accent) 45%, #fff);
		--itpv-accent-focus: color-mix(in srgb, var(--itpv-accent) 55%, #fff);
	}
}

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

.itpv [hidden] {
	display: none !important;
}

.itpv-icon {
	flex: none;
	width: 1.15em;
	height: 1.15em;
}

/* ---------- heading and messages ---------- */

.itpv-head {
	margin-bottom: 20px;
	text-align: center;
}

.itpv-title {
	margin: 0 0 6px;
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	line-height: 1.2;
	color: var(--itpv-text);
}

.itpv-subtitle {
	margin: 0;
	color: var(--itpv-muted);
	font-size: 1.05rem;
}

.itpv-notice {
	margin: 0 0 16px;
	padding: 12px 16px;
	white-space: pre-line;
	border-radius: 12px;
	border: 1px solid #bfdbfe;
	background: #eff6ff;
	color: #1e3a8a;
}

.itpv-notice.is-error {
	border-color: #fecaca;
	background: #fef2f2;
	color: #991b1b;
}

.itpv-notice.is-success {
	border-color: #bbf7d0;
	background: #f0fdf4;
	color: #166534;
}

/* ---------- buttons ---------- */

.itpv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 18px;
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	color: #fff;
	background: var(--itpv-accent);
	border: 2px solid transparent;
	border-radius: 12px;
	cursor: pointer;
	transition: filter 0.15s, transform 0.15s;
}

.itpv-btn:hover {
	filter: brightness(0.93);
}

.itpv-btn:active {
	transform: translateY(1px);
}

.itpv-btn-lg {
	padding: 14px 28px;
	font-size: 1.05rem;
}

.itpv-btn-success {
	background: var(--itpv-green);
}

.itpv-btn-ghost {
	color: var(--itpv-text);
	background: #fff;
	border-color: var(--itpv-line);
}

.itpv-btn-ghost:hover {
	background: #f3f4f6;
	filter: none;
}

.itpv-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	filter: none;
}

.itpv-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	font: inherit;
	color: var(--itpv-text);
	background: #fff;
	border: 1px solid var(--itpv-line);
	border-radius: 10px;
	cursor: pointer;
	text-decoration: none;
}

.itpv-iconbtn:hover {
	background: #f3f4f6;
}

.itpv-iconbtn.is-primary {
	color: #fff;
	background: var(--itpv-green);
	border-color: var(--itpv-green);
}

.itpv-iconbtn.is-primary:hover {
	background: var(--itpv-green-dark);
}

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

.itpv-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 330px;
	gap: 20px;
	align-items: start;
}

.itpv-main {
	min-width: 0;
}

/* ---------- drop area ---------- */

.itpv-drop {
	padding: 44px 20px 34px;
	text-align: center;
	background: linear-gradient(180deg, var(--itpv-accent-soft), #fff);
	border: 2px dashed var(--itpv-accent-edge);
	border-radius: 22px;
	transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}

.itpv.is-dragover .itpv-drop {
	border-color: var(--itpv-accent);
	background: var(--itpv-accent-soft);
	transform: scale(1.01);
}

.itpv-drop-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	margin-bottom: 10px;
	color: var(--itpv-accent);
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.itpv-drop-icon .itpv-icon {
	width: 32px;
	height: 32px;
}

.itpv-drop-title {
	margin: 0;
	font-size: 1.5rem;
	line-height: 1.3;
	color: var(--itpv-text);
}

.itpv-drop-sub {
	margin: 4px 0 18px;
	color: var(--itpv-muted);
}

.itpv-hint {
	margin: 14px 0 0;
	font-size: 0.875rem;
	color: var(--itpv-muted);
}

/* once pictures are added, the drop area becomes a slim bar */
.itpv.has-files .itpv-drop {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px;
	text-align: left;
	border-radius: var(--itpv-radius);
}

.itpv.has-files .itpv-drop-icon,
.itpv.has-files .itpv-drop-sub,
.itpv.has-files .itpv-hint {
	display: none;
}

.itpv.has-files .itpv-drop-title {
	font-size: 1.05rem;
}

.itpv.has-files .itpv-btn-lg {
	padding: 10px 18px;
	font-size: 1rem;
}

.itpv.has-files .itpv-points {
	display: none;
}

.itpv-points {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin: 18px 0 0;
	padding: 0;
	list-style: none;
}

.itpv-points li {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px;
	font-weight: 600;
	font-size: 0.95rem;
	background: var(--itpv-bg);
	border: 1px solid var(--itpv-line);
	border-radius: 12px;
}

.itpv-points .itpv-icon {
	color: var(--itpv-accent);
}

.itpv-privacy {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 16px 0 0;
	font-size: 0.9rem;
	color: var(--itpv-green);
}

/* ---------- summary ---------- */

.itpv-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	margin-top: 14px;
	padding: 14px 16px;
	background: #fff;
	border: 1px solid var(--itpv-line);
	border-radius: var(--itpv-radius);
}

.itpv-summary-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.itpv-summary-sub {
	font-size: 0.85rem;
	color: var(--itpv-muted);
}

.itpv-summary-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.itpv-bar {
	flex: 1 1 100%;
	height: 6px;
	overflow: hidden;
	background: var(--itpv-line);
	border-radius: 99px;
}

.itpv-bar-fill {
	display: block;
	width: 0;
	height: 100%;
	background: var(--itpv-accent);
	border-radius: 99px;
	transition: width 0.2s;
}

/* ---------- the list of pictures ---------- */

.itpv-list {
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.itpv-item {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 12px;
	margin-bottom: 10px;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid var(--itpv-line);
	border-radius: var(--itpv-radius);
}

.itpv-thumb {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 10px;
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
		linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
		linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
	background-size: 12px 12px;
	background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

.itpv-info {
	min-width: 0;
}

.itpv-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
}

.itpv-meta {
	font-size: 0.875rem;
	color: var(--itpv-muted);
}

.itpv-meta strong {
	color: var(--itpv-text);
}

.itpv-itemnote {
	margin-top: 2px;
	font-size: 0.8rem;
	color: var(--itpv-muted);
}

.itpv-itemnote.is-warn {
	color: #b45309;
}

.itpv-itemnote.is-error {
	color: #b91c1c;
}

.itpv-badge {
	display: inline-block;
	min-width: 64px;
	padding: 4px 10px;
	text-align: center;
	font-size: 0.9rem;
	font-weight: 700;
	color: #166534;
	background: #dcfce7;
	border-radius: 99px;
}

.itpv-badge.is-zero {
	color: #92400e;
	background: #fef3c7;
}

.itpv-badge.is-bad {
	color: #991b1b;
	background: #fee2e2;
}

.itpv-badge.is-wait {
	color: var(--itpv-muted);
	background: #f3f4f6;
	font-weight: 600;
}

.itpv-spin {
	display: inline-block;
	width: 22px;
	height: 22px;
	vertical-align: middle;
	border: 3px solid var(--itpv-accent-soft);
	border-top-color: var(--itpv-accent);
	border-radius: 50%;
	animation: itpv-spin 0.8s linear infinite;
}

@keyframes itpv-spin {
	to {
		transform: rotate(360deg);
	}
}

.itpv-actions {
	display: flex;
	gap: 6px;
}

/* ---------- settings panel ---------- */

.itpv-panel {
	position: sticky;
	top: 16px;
}

.itpv-settings-summary {
	display: none; /* only shown on small screens */
}

.itpv-settings-body {
	display: grid;
	gap: 14px;
}

.itpv-box {
	padding: 16px;
	background: #fff;
	border: 1px solid var(--itpv-line);
	border-radius: var(--itpv-radius);
}

.itpv-box-title {
	margin: 0 0 12px;
	font-size: 1rem;
	line-height: 1.3;
	color: var(--itpv-text);
}

.itpv-label {
	display: block;
	margin-bottom: 4px;
	font-size: 0.875rem;
	font-weight: 600;
}

.itpv-slider,
.itpv-field {
	display: block;
	margin-top: 12px;
}

.itpv-slider:first-of-type {
	margin-top: 0;
}

.itpv input[type="range"] {
	display: block;
	width: 100%;
	margin: 6px 0 0;
	accent-color: var(--itpv-accent);
}

.itpv select,
.itpv input[type="number"] {
	display: block;
	width: 100%;
	min-height: 44px;
	padding: 0 12px;
	font: inherit;
	color: var(--itpv-text);
	background: #fff;
	border: 2px solid var(--itpv-line);
	border-radius: 10px;
}

.itpv-small {
	margin: 10px 0 0;
	font-size: 0.8rem;
	color: var(--itpv-muted);
}

.itpv-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 0.925rem;
	cursor: pointer;
}

.itpv-check input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 3px 0 0;
	accent-color: var(--itpv-accent);
}

.itpv-limit {
	display: grid;
	grid-template-columns: 1fr 90px;
	gap: 8px;
	margin-top: 10px;
}

.itpv-note {
	margin: 0;
	font-size: 0.8rem;
	color: var(--itpv-muted);
}

/* ---------- preview ---------- */

.itpv-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(17, 24, 39, 0.72);
}

.itpv-modal-card {
	width: min(100%, 900px);
	max-height: 100%;
	overflow: auto;
	padding: 14px;
	background: #fff;
	border-radius: 18px;
}

.itpv-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.itpv-modal-title {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.itpv-preview-wrap {
	text-align: center;
	line-height: 0;
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
		linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
		linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
	background-size: 20px 20px;
	background-position: 0 0, 0 10px, 10px -10px, -10px 0;
	border-radius: 10px;
}

.itpv-preview-img {
	display: inline-block;
	max-width: 100%;
	max-height: 70vh;
	height: auto;
	image-rendering: auto;
}

/* keyboard focus is always visible */
.itpv button:focus-visible,
.itpv label:focus-within > input[type="color"],
.itpv input:focus-visible,
.itpv select:focus-visible,
.itpv summary:focus-visible,
.itpv a:focus-visible {
	outline: 3px solid var(--itpv-accent-focus);
	outline-offset: 2px;
}

/* ---------- small screens ---------- */

@media (max-width: 900px) {
	/* order on phones: drop box, settings, results */
	.itpv-layout {
		display: flex;
		flex-direction: column;
		align-items: stretch; /* every block uses the full width */
		gap: 14px;
	}

	.itpv-main {
		display: contents;
	}

	.itpv-formats { order: 1; margin-bottom: 0; }
	.itpv-drop { order: 2; }
	.itpv-panel { order: 3; position: static; }
	.itpv-summary { order: 4; margin-top: 0; }
	.itpv-list { order: 5; margin-top: 0; }
	.itpv-points { order: 6; margin-top: 0; }
	.itpv-privacy { order: 7; margin-top: 0; }

	.itpv-settings-summary {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 14px 16px;
		font-weight: 700;
		list-style: none;
		cursor: pointer;
		background: #fff;
		border: 1px solid var(--itpv-line);
		border-radius: var(--itpv-radius);
	}

	.itpv-settings-summary::-webkit-details-marker {
		display: none;
	}

	.itpv-settings-summary::after {
		content: "";
		flex: none;
		width: 8px;
		height: 8px;
		margin-left: 4px;
		border-right: 2px solid var(--itpv-muted);
		border-bottom: 2px solid var(--itpv-muted);
		transform: rotate(45deg);
		transition: transform 0.15s;
	}

	.itpv-settings[open] > .itpv-settings-summary::after {
		transform: rotate(-135deg);
	}

	.itpv-settings-icon {
		display: inline-flex;
		color: var(--itpv-accent);
	}

	.itpv-settings-now {
		margin-left: auto;
		font-size: 0.8rem;
		font-weight: 600;
		color: var(--itpv-muted);
	}

	.itpv-settings-body {
		margin-top: 10px;
	}
}

@media (max-width: 600px) {
	.itpv-points {
		grid-template-columns: 1fr;
	}

	.itpv-drop {
		padding: 32px 14px 24px;
	}

	.itpv.has-files .itpv-drop {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
	}

	.itpv-item {
		grid-template-columns: 52px minmax(0, 1fr) auto;
		gap: 8px 10px;
		padding: 10px;
	}

	.itpv-thumb {
		width: 52px;
		height: 52px;
	}

	.itpv-actions {
		grid-column: 1 / -1;
		justify-content: flex-end;
	}

	.itpv-iconbtn {
		width: 44px;
		height: 44px;
	}

	.itpv-summary-actions {
		width: 100%;
	}

	.itpv-summary-actions .itpv-btn {
		flex: 1;
	}

	.itpv-settings-now {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.itpv-spin {
		animation-duration: 2.5s;
	}

	.itpv-btn,
	.itpv-drop,
	.itpv-bar-fill {
		transition: none;
	}
}

/* ---------- format tiles ---------- */

.itpv-formats {
	margin-bottom: 14px;
	padding: 14px;
	background: #fff;
	border: 1px solid var(--itpv-line);
	border-radius: var(--itpv-radius);
}

.itpv-formats-title {
	margin: 0 0 10px;
	font-size: 1rem;
	line-height: 1.3;
	color: var(--itpv-text);
}

.itpv-tiles {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 8px;
}

.itpv-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 68px;
	padding: 8px 6px;
	font: inherit;
	text-align: center;
	color: var(--itpv-text);
	background: #fff;
	border: 2px solid var(--itpv-line);
	border-radius: 12px;
	cursor: pointer;
	transition: border-color 0.15s, background-color 0.15s;
}

.itpv-tile:hover {
	background: #f3f4f6;
}

.itpv-tile.is-active {
	color: #fff;
	background: var(--itpv-accent);
	border-color: var(--itpv-accent);
}

.itpv-tile-name {
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1.2;
}

.itpv-tile-sub {
	font-size: 0.72rem;
	line-height: 1.25;
	opacity: 0.8;
}

/* ---------- options ---------- */

.itpv-small-top {
	margin-top: 0;
}

.itpv-swatches {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
}

.itpv-swatch {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--itpv-line);
	cursor: pointer;
}

.itpv-swatch.is-active {
	box-shadow: 0 0 0 3px var(--itpv-accent);
}

.itpv-swatch[data-color="#ffffff"] { background: #ffffff; }
.itpv-swatch[data-color="#000000"] { background: #000000; }
.itpv-swatch[data-color="#e5e7eb"] { background: #e5e7eb; }

.itpv-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 0 12px;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--itpv-text);
	background: #fff;
	border: 1px solid var(--itpv-line);
	border-radius: 99px;
	cursor: pointer;
}

.itpv-chip.is-active {
	color: var(--itpv-accent);
	background: var(--itpv-accent-soft);
	border-color: var(--itpv-accent);
}

.itpv-chip input[type="color"] {
	width: 22px;
	height: 22px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.itpv-sizes {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.itpv-size {
	min-width: 56px;
	min-height: 40px;
	padding: 0 12px;
	font: inherit;
	font-weight: 700;
	color: var(--itpv-text);
	background: #fff;
	border: 2px solid var(--itpv-line);
	border-radius: 10px;
	cursor: pointer;
}

.itpv-size.is-active {
	color: #fff;
	background: var(--itpv-accent);
	border-color: var(--itpv-accent);
}

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

.itpv-badge.is-format {
	color: var(--itpv-accent);
	background: var(--itpv-accent-soft);
}

.itpv-meta .itpv-arrow {
	margin: 0 2px;
}

.itpv-actions .itpv-iconbtn[hidden] {
	display: none;
}

/* ---------- small screens: this block comes last so it wins over the rules above ---------- */

@media (max-width: 600px) {
	.itpv-tiles {
		grid-template-columns: repeat(2, 1fr);
	}

	.itpv-tile {
		min-height: 60px;
	}
}

/* the PDF "one file" checkbox sits below the dropdowns, so give it some air */
.itpv-box .itpv-field + .itpv-check {
	margin-top: 14px;
}

@media (max-width: 900px) {
	.itpv-formats {
		margin-bottom: 0;
	}
}
