/* Collapsed by default: one box with a title row; the fields sit in .tp-pz__body */
.tp-pz { margin: 0 0 18px; background: #fff; border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--tp-border); transition: box-shadow 0.15s; }
.tp-pz:hover { box-shadow: inset 0 0 0 1.5px var(--tp-muted); }
.tp-pz[open] { box-shadow: inset 0 0 0 1.5px var(--tp-border); }
.tp-pz__summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-size: 15px; font-weight: 600; color: var(--tp-ink); cursor: pointer; list-style: none; border-radius: 14px; }
.tp-pz__summary::-webkit-details-marker { display: none; }
.tp-pz__summary:focus-visible { outline: 2px solid var(--tp-primary); outline-offset: 2px; }
.tp-pz__title { flex: 1; }
.tp-pz__badge { padding: 2px 10px; font-size: 12px; font-weight: 600; color: var(--tp-primary-press); background: var(--tp-tint); border-radius: 9999px; }
.tp-pz__chev { display: grid; place-items: center; color: var(--tp-muted); transition: transform 0.2s; }
.tp-pz__chev .tp-icon { width: 16px; height: 16px; }
.tp-pz[open] > .tp-pz__summary .tp-pz__chev { transform: rotate(90deg); }
.tp-pz__body { display: grid; gap: 14px; padding: 2px 16px 16px; animation: tp-pz-open 0.25s ease-out; }
@keyframes tp-pz-open { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .tp-pz__body { animation: none; } .tp-pz__chev { transition: none; } }
.tp-pz__label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--tp-ink); }
.tp-pz__req { color: var(--tp-warm); }
.tp-pz__price { font-weight: 500; color: var(--tp-muted); }
.tp-pz__input { width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--tp-ink); background: #fff; border: 0; border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--tp-border); }
textarea.tp-pz__input { resize: vertical; }
.tp-pz__input:focus-visible { outline: 2px solid var(--tp-primary); outline-offset: 2px; }
.tp-pz__check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--tp-ink); cursor: pointer; }
.tp-pz__check input { width: 18px; height: 18px; margin: 0; accent-color: var(--tp-primary); }
.tp-pz__help { margin: 6px 0 0; font-size: 13px; color: var(--tp-muted); }

/*
 * Upload component (.tp-upload): a compact one-row drop zone above a list of file cards (progress, Replace,
 * Remove). The zone hides when the field's photo limit is reached (.is-full).
 * Layout language after Shopify's upload pattern (one pill action + "or drag here", a quiet hint, file cards),
 * in the storefront palette: TPTrue blue accent, white / gray surfaces, 12px cards, pill button.
 */
.tp-upload {
	position: relative;
}

.tp-upload__zone {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	cursor: pointer;
	background: var(--tp-surface);
	border: 1.5px dashed var(--tp-border);
	border-radius: 12px;
	transition: border-color 0.15s, background-color 0.15s;
}

.tp-upload__zone:hover,
.tp-upload[data-state="dragover"] .tp-upload__zone {
	background: var(--tp-tint);
	border-color: var(--tp-primary);
}

.tp-upload[data-state="dragover"] .tp-upload__zone {
	border-style: solid;
}

.tp-upload[data-state="error"] .tp-upload__zone {
	border-color: var(--tp-warm);
}

.tp-upload.is-full .tp-upload__zone {
	display: none;
}

.tp-upload__zone:focus-within {
	outline: 2px solid var(--tp-primary);
	outline-offset: 2px;
}

/* The real file input stays focusable for keyboards and screen readers, just not visible */
.tp-upload__input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
	clip: rect(0 0 0 0);
}

.tp-upload__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	font-size: 18px;
	color: var(--tp-primary);
	background: #fff;
	border-radius: 9999px;
	box-shadow: inset 0 0 0 1px var(--tp-hairline);
}

.tp-upload__text {
	display: grid;
	gap: 2px;
	min-width: 0;
}

.tp-upload__cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.tp-upload__btn {
	display: inline-flex;
	align-items: center;
	min-height: 30px;
	padding: 0 14px;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--tp-primary);
	background: #fff;
	border-radius: 9999px;
	box-shadow: inset 0 0 0 1.5px var(--tp-primary);
}

.tp-upload__zone:hover .tp-upload__btn {
	color: #fff;
	background: var(--tp-primary);
}

.tp-upload__or {
	font-size: 13.5px;
	color: var(--tp-muted);
}

.tp-upload__hint {
	font-size: 12.5px;
	color: var(--tp-muted);
}

/* File cards */
.tp-upload__list {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tp-upload__list:not(:empty) {
	margin-bottom: 8px;
}

.tp-upload.is-full .tp-upload__list {
	margin-bottom: 0;
}

.tp-upload__file {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 8px;
	background: #fff;
	border-radius: 12px;
	box-shadow: inset 0 0 0 1.5px var(--tp-border);
}

.tp-upload__thumb {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	overflow: hidden;
	font-size: 20px;
	color: var(--tp-primary);
	background: var(--tp-surface);
	border-radius: 8px;
}

.tp-upload__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tp-upload__thumb img:not([src]),
.tp-upload__thumb .tp-icon {
	display: none;
}

/* No preview (HEIC, or the page was shown again): a check mark stands in for the picture */
.tp-upload__thumb img:not([src]) + .tp-icon {
	display: block;
}

.tp-upload__file[data-state="uploading"] .tp-upload__thumb img {
	opacity: 0.55;
}

.tp-upload__meta {
	display: grid;
	gap: 3px;
	min-width: 0;
}

.tp-upload__name {
	overflow: hidden;
	font-size: 14px;
	font-weight: 600;
	color: var(--tp-ink);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.tp-upload__sub {
	font-size: 12.5px;
	color: var(--tp-muted);
}

.tp-upload__file[data-state="done"] .tp-upload__sub {
	color: #1a7f45;
}

.tp-upload__bar {
	display: none;
	height: 4px;
	overflow: hidden;
	background: var(--tp-hairline);
	border-radius: 9999px;
}

.tp-upload__file[data-state="uploading"] .tp-upload__bar {
	display: block;
}

.tp-upload__bar span {
	display: block;
	width: 0;
	height: 100%;
	background: var(--tp-primary);
	border-radius: inherit;
	transition: width 0.2s ease-out;
}

.tp-upload__actions {
	display: flex;
	align-items: center;
	gap: 2px;
}

.tp-upload__replace {
	min-height: 30px;
	padding: 0 10px;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var(--tp-primary);
	background: none;
	border: 0;
	border-radius: 9999px;
	cursor: pointer;
}

.tp-upload__replace:hover {
	background: var(--tp-tint);
}

.tp-upload__file[data-state="uploading"] .tp-upload__replace {
	display: none;
}

.tp-upload__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	font-size: 15px;
	color: var(--tp-muted);
	background: none;
	border: 0;
	border-radius: 9999px;
	cursor: pointer;
}

.tp-upload__remove:hover {
	color: var(--tp-warm-ink);
	background: var(--tp-warm-tint);
}

.tp-upload__replace:focus-visible,
.tp-upload__remove:focus-visible {
	outline: 2px solid var(--tp-primary);
	outline-offset: 1px;
}

.tp-upload__error {
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--tp-warm-ink);
}

/* Touch screens cannot drag files in: keep only the button */
@media (hover: none) {
	.tp-upload__or {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tp-upload__zone,
	.tp-upload__bar span {
		transition: none;
	}
}
