/* ==========================================================================
   Gift Product Customizer – front end
   Uses Gifty theme tokens when present, with safe fallbacks.
   ========================================================================== */

.gpc {
	--gpc-primary: var(--g-purple, #7A00C8);
	--gpc-primary-dark: var(--g-purple-dark, #5A0096);
	--gpc-primary-soft: var(--g-purple-50, #F6EEFD);
	--gpc-accent: var(--g-yellow, #FFD900);
	--gpc-cream: var(--g-cream-light, #FFFBEA);
	--gpc-ink: var(--g-ink, #1C1C1C);
	--gpc-muted: var(--g-muted, #5F5A66);
	--gpc-line: var(--g-line, #ECE6F2);
	--gpc-error: #C62828;
	--gpc-warn: #9A6700;
	--gpc-radius: 16px;
	margin: 0 0 24px;
	color: var(--gpc-ink);
	font-size: 15px;
	line-height: 1.5;
}

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

/* ---------- Header ---------- */
.gpc__head { margin-bottom: 16px; }
.gpc__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--gpc-accent);
	color: var(--gpc-ink);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
}
.gpc__eyebrow::before { content: "✦"; font-size: 10px; }
.gpc__title {
	margin: 10px 0 4px;
	font-size: 22px;
	line-height: 1.25;
	color: var(--gpc-ink);
}
.gpc__sub { margin: 0; color: var(--gpc-muted); font-size: 14px; }

/* ---------- Steps ---------- */
.gpc__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.gpc-step {
	position: relative;
	margin: 0;
	border: 1.5px solid var(--gpc-line);
	border-radius: var(--gpc-radius);
	background: #fff;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.gpc-step:focus-within { border-color: var(--gpc-primary); box-shadow: 0 0 0 4px rgba(122, 0, 200, .08); }
.gpc-step.is-complete { border-color: rgba(122, 0, 200, .35); }
.gpc-step.has-error { border-color: var(--gpc-error); box-shadow: 0 0 0 4px rgba(198, 40, 40, .08); }

.gpc-step__head {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 14px 16px 6px;
	cursor: default;
	-webkit-tap-highlight-color: transparent;
}
.gpc-step__num {
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--gpc-primary-soft);
	color: var(--gpc-primary);
	font-weight: 700;
	font-size: 14px;
	transition: background .2s ease, color .2s ease;
}
.gpc-step.is-complete .gpc-step__num { background: var(--gpc-primary); color: #fff; font-size: 0; }
.gpc-step.is-complete .gpc-step__num::after { content: "✓"; font-size: 15px; }
.gpc-step.has-error .gpc-step__num { background: #FDECEC; color: var(--gpc-error); }

.gpc-step__titles { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.gpc-step__kicker { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gpc-muted); }
.gpc-step__label { font-weight: 700; font-size: 15.5px; color: var(--gpc-ink); }
.gpc-req { color: var(--gpc-error); margin-left: 2px; }
.gpc-step__value { display: none; }
.gpc-step__chev { display: none; }

.gpc-step__body { padding: 8px 16px 16px 60px; }
.gpc-step__help { margin: 8px 0 0; font-size: 13px; color: var(--gpc-muted); }
.gpc-step__cost { margin: 6px 0 0; font-size: 13px; color: var(--gpc-primary); font-weight: 600; }
.gpc-step__error { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--gpc-error); }
.gpc-step__error::before { content: "! "; }
.gpc-step__next { display: none; }

/* ---------- Inputs ---------- */
.gpc-input-wrap { position: relative; }
.gpc .gpc-input {
	width: 100%;
	min-height: 48px;
	padding: 12px 14px;
	border: 1.5px solid var(--gpc-line);
	border-radius: 12px;
	background: #FCFBFE;
	color: var(--gpc-ink);
	font: inherit;
	font-size: 16px; /* avoids iOS zoom */
	transition: border-color .2s ease, background .2s ease;
	-webkit-appearance: none;
	appearance: none;
}
.gpc .gpc-input:focus { outline: none; border-color: var(--gpc-primary); background: #fff; }
.gpc .gpc-input::placeholder { color: #A39DAB; }
.gpc .gpc-textarea { min-height: 96px; resize: vertical; padding-bottom: 26px; }
.gpc-count { position: absolute; right: 12px; bottom: 8px; font-size: 11px; color: var(--gpc-muted); pointer-events: none; }
.gpc-input-wrap:has(input) .gpc-count { top: 50%; bottom: auto; transform: translateY(-50%); }
.gpc-input-wrap:has(input) .gpc-input { padding-right: 64px; }

.gpc-select-wrap { position: relative; }
.gpc-select-wrap::after {
	content: "";
	position: absolute;
	right: 16px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--gpc-primary);
	border-bottom: 2px solid var(--gpc-primary);
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
}
.gpc .gpc-select { padding-right: 40px; cursor: pointer; }

/* ---------- Pills (radio buttons) ---------- */
.gpc-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.gpc-pill { position: relative; margin: 0; cursor: pointer; }
.gpc-pill input,
.gpc-swatch input,
.gpc-addon input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.gpc-pill__text {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 56px;
	min-height: 46px;
	padding: 8px 16px;
	border: 1.5px solid var(--gpc-line);
	border-radius: 12px;
	background: #fff;
	font-weight: 600;
	font-size: 14px;
	line-height: 1.2;
	transition: all .18s ease;
}
.gpc-pill__text small { font-weight: 500; font-size: 11px; color: var(--gpc-muted); margin-top: 2px; }
.gpc-pill:hover .gpc-pill__text { border-color: var(--gpc-primary); }
.gpc-pill input:checked + .gpc-pill__text { border-color: var(--gpc-primary); background: var(--gpc-primary); color: #fff; }
.gpc-pill input:checked + .gpc-pill__text small { color: rgba(255, 255, 255, .85); }
.gpc-pill input:focus-visible + .gpc-pill__text { outline: 3px solid var(--gpc-accent); outline-offset: 2px; }

/* ---------- Colour swatches ---------- */
.gpc-swatches { display: flex; flex-wrap: wrap; gap: 12px 10px; }
.gpc-swatch { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; margin: 0; cursor: pointer; }
.gpc-swatch__dot {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--gpc-swatch);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
	outline: 2px solid transparent;
	outline-offset: 3px;
	transition: outline-color .18s ease, transform .18s ease;
}
.gpc-swatch:hover .gpc-swatch__dot { transform: scale(1.06); }
.gpc-swatch input:checked + .gpc-swatch__dot { outline-color: var(--gpc-primary); }
.gpc-swatch input:focus-visible + .gpc-swatch__dot { outline-color: var(--gpc-accent); }
.gpc-swatch__name { font-size: 11.5px; text-align: center; line-height: 1.2; color: var(--gpc-muted); }
.gpc-swatch input:checked ~ .gpc-swatch__name { color: var(--gpc-ink); font-weight: 700; }

/* ---------- Add-ons (checkbox cards) ---------- */
.gpc-addons { display: grid; gap: 8px; }
.gpc-addon {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	margin: 0;
	padding: 10px 14px;
	border: 1.5px solid var(--gpc-line);
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
	transition: border-color .18s ease, background .18s ease;
}
.gpc-addon:hover { border-color: var(--gpc-primary); }
.gpc-addon__box {
	flex: 0 0 22px;
	width: 22px;
	height: 22px;
	border: 2px solid #C9C1D3;
	border-radius: 6px;
	display: grid;
	place-items: center;
	transition: all .18s ease;
}
.gpc-addon input:checked ~ .gpc-addon__box { background: var(--gpc-primary); border-color: var(--gpc-primary); }
.gpc-addon input:checked ~ .gpc-addon__box::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 700; }
.gpc-addon input:focus-visible ~ .gpc-addon__box { outline: 3px solid var(--gpc-accent); outline-offset: 2px; }
.gpc-addon:has(input:checked) { border-color: var(--gpc-primary); background: var(--gpc-primary-soft); }
.gpc-addon__label { flex: 1; font-weight: 600; font-size: 14.5px; }
.gpc-addon__price { font-weight: 700; font-size: 14px; color: var(--gpc-primary); white-space: nowrap; }

/* ---------- Upload ---------- */
.gpc-drop {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	margin: 0;
	padding: 22px 16px;
	border: 2px dashed #CDB4E8;
	border-radius: 14px;
	background: linear-gradient(180deg, #FCF8FF 0%, #fff 100%);
	cursor: pointer;
	transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.gpc-drop:hover,
.gpc-drop.is-drag { border-color: var(--gpc-primary); background: var(--gpc-primary-soft); }
.gpc-drop.is-drag { transform: scale(1.01); }
.gpc-drop__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.gpc-drop__input:focus-visible + .gpc-drop__icon { outline: 3px solid var(--gpc-accent); outline-offset: 3px; }
.gpc-drop__icon {
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--gpc-primary);
	color: #fff;
	box-shadow: 0 8px 20px rgba(122, 0, 200, .25);
}
.gpc-drop__title { font-weight: 700; font-size: 15px; color: var(--gpc-ink); }
.gpc-drop__or { display: block; font-weight: 500; font-size: 13px; color: var(--gpc-muted); }
.gpc-drop__meta { font-size: 12px; color: var(--gpc-muted); }
.gpc-drop__price { font-size: 12px; font-weight: 600; color: var(--gpc-primary); }

.gpc-files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.gpc-files:empty { display: none; }
.gpc-file {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px;
	margin: 0;
	border: 1px solid var(--gpc-line);
	border-radius: 12px;
	background: #fff;
}
.gpc-file__img { flex: 0 0 56px; width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #F3EEF8; }
.gpc-file__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gpc-file__name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gpc-file__status { font-size: 12px; color: var(--gpc-muted); }
.gpc-file__bar { display: block; height: 4px; border-radius: 4px; background: #EFE7F7; overflow: hidden; }
.gpc-file__bar span { display: block; height: 100%; width: 0; background: var(--gpc-primary); transition: width .2s ease; }
.gpc-file.is-done .gpc-file__bar,
.gpc-file.is-error .gpc-file__bar { display: none; }
.gpc-file.is-done .gpc-file__status::before { content: "✓ "; color: #1B8A4B; font-weight: 700; }
.gpc-file.is-lowres .gpc-file__status { color: var(--gpc-warn); }
.gpc-file.is-lowres .gpc-file__status::before { content: "⚠ "; color: var(--gpc-warn); }
.gpc-file.is-error { border-color: #F3C4C4; background: #FFF7F7; }
.gpc-file.is-error .gpc-file__status { color: var(--gpc-error); }
.gpc-file__remove {
	flex: 0 0 36px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: #F4F0F8;
	color: var(--gpc-ink);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	transition: background .18s ease, color .18s ease;
}
.gpc-file__remove:hover { background: var(--gpc-error); color: #fff; }

/* ---------- Summary ---------- */
.gpc-summary {
	margin-top: 16px;
	padding: 16px 18px;
	border-radius: var(--gpc-radius);
	background: var(--gpc-cream);
	border: 1px solid #F6E7A6;
}
.gpc-summary__title { font-weight: 800; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--gpc-primary); margin-bottom: 8px; }
.gpc-summary__list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.gpc-summary__list li { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 14px; }
.gpc-summary__key { color: var(--gpc-muted); flex-shrink: 0; }
.gpc-summary__val { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.gpc-summary__val em { font-style: normal; color: var(--gpc-primary); font-weight: 700; }
.gpc-summary__empty { color: var(--gpc-muted); font-style: italic; }
.gpc-summary__rows { border-top: 1px dashed #E8D98E; padding-top: 10px; display: grid; gap: 4px; }
.gpc-summary__row { display: flex; justify-content: space-between; font-size: 14px; }
.gpc-summary__row--total { margin-top: 4px; font-size: 16px; font-weight: 700; }
.gpc-summary__row--total strong { font-size: 20px; color: var(--gpc-primary); }
.gpc-summary__row small { font-weight: 500; color: var(--gpc-muted); }

.gpc-form-error { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: #FDECEC; color: var(--gpc-error); font-weight: 600; font-size: 14px; }

/* ---------- Buy Now next to Add to Cart ---------- */
form.cart .gpc-buy-now {
	background: var(--g-yellow, #FFD900) !important;
	color: var(--g-ink, #1C1C1C) !important;
	border-color: var(--g-yellow, #FFD900) !important;
}
form.cart .gpc-buy-now:hover { background: #F5C800 !important; }

/* ---------- Cart / order display ---------- */
.gpc-cart-thumbs { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.gpc-cart-thumbs img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid #ECE6F2; }
.gpc-cart-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 6px; vertical-align: -2px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.gpc-cart-price { color: var(--g-purple, #7A00C8); font-weight: 600; font-size: .92em; }
.gpc-order-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gpc-order-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }

/* ---------- Mobile sticky bar ---------- */
.gpc-sticky { display: none; }

@media (max-width: 767px) {
	.gpc__title { font-size: 20px; }

	/* Accordion steps */
	.gpc-step__head { cursor: pointer; padding: 14px 14px; min-height: 64px; }
	.gpc-step__chev {
		display: block;
		flex: 0 0 10px;
		width: 10px;
		height: 10px;
		border-right: 2px solid var(--gpc-muted);
		border-bottom: 2px solid var(--gpc-muted);
		transform: rotate(45deg);
		margin: -4px 4px 0 0;
		transition: transform .2s ease;
	}
	.gpc-step.is-open .gpc-step__chev { transform: rotate(-135deg); margin-top: 4px; }
	.gpc-step__value {
		display: block;
		font-size: 13px;
		color: var(--gpc-primary);
		font-weight: 600;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.gpc-step.is-open .gpc-step__value { display: none; }
	.gpc-step__body { display: none; padding: 0 14px 16px; }
	.gpc-step.is-open .gpc-step__body { display: block; animation: gpcIn .2s ease; }
	.gpc-step__next {
		display: block;
		width: 100%;
		min-height: 46px;
		margin-top: 14px;
		border: 1.5px solid var(--gpc-primary);
		border-radius: 999px;
		background: #fff;
		color: var(--gpc-primary);
		font: inherit;
		font-weight: 700;
		cursor: pointer;
	}
	.gpc-drop { padding: 20px 12px; }

	/* Sticky bar */
	.gpc-sticky {
		display: flex;
		align-items: center;
		gap: 10px;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 990;
		padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
		background: rgba(255, 255, 255, .97);
		border-top: 1px solid var(--g-line, #ECE6F2);
		box-shadow: 0 -8px 24px rgba(28, 28, 28, .08);
		transform: translateY(110%);
		transition: transform .25s ease;
	}
	.gpc-sticky.is-visible { transform: translateY(0); }
	.gpc-sticky__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
	.gpc-sticky__name { font-size: 12px; color: var(--g-muted, #5F5A66); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.gpc-sticky__price { font-weight: 800; font-size: 17px; color: var(--g-purple, #7A00C8); white-space: nowrap; }
	.gpc-sticky__price del { display: none; }
	.gpc-sticky__price ins { text-decoration: none; }
	.gpc-sticky__actions { display: flex; gap: 8px; }
	.gpc-sticky__btn {
		min-height: 46px;
		padding: 0 16px;
		border: 0;
		border-radius: 999px;
		font: inherit;
		font-weight: 700;
		font-size: 14px;
		cursor: pointer;
		white-space: nowrap;
	}
	.gpc-sticky__btn--cart { background: var(--g-purple, #7A00C8); color: #fff; }
	.gpc-sticky__btn--buy { background: var(--g-yellow, #FFD900); color: var(--g-ink, #1C1C1C); }
	body.gpc-sticky-visible { padding-bottom: 76px; }
}

@media (max-width: 360px) {
	.gpc-sticky__btn { padding: 0 12px; font-size: 13px; }
}

@keyframes gpcIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
	.gpc *, .gpc-sticky { transition: none !important; animation: none !important; }
}
