/**
 * Grafikplay Product Customizer - front end.
 *
 * Scoped under .gpc-app so it never leaks into the theme.
 */

.gpc-app {
	--gpc-bg: #ffffff;
	--gpc-surface: #f7f8fa;
	--gpc-border: #e2e5ea;
	--gpc-text: #1c1f24;
	--gpc-muted: #656d78;
	--gpc-accent: #1f5eff;
	--gpc-accent-soft: #eaf0ff;
	--gpc-danger: #c0392b;
	--gpc-warning: #b26b00;
	--gpc-success: #1e7a3c;
	--gpc-radius: 10px;

	--gpc-scrollbar: 0px;

	color: var(--gpc-text);
	margin: 2.5rem 0;

	/* Break out of the theme container so the matrix has room, correcting for
	   the scrollbar width (set from JS) so this never causes a horizontal
	   scroll on the page. */
	width: calc(100vw - var(--gpc-scrollbar));
	max-width: calc(100vw - var(--gpc-scrollbar));
	margin-left: calc(50% - ((100vw - var(--gpc-scrollbar)) / 2));
	padding-inline: clamp(1rem, 3vw, 3rem);
}

/* Hide the standard variation form on products handled by the customizer.
   The hooks are removed in PHP; this covers themes that print the form
   directly from their own template instead of going through the hook. */
body.gpc-customizer-active div.product > form.cart,
body.gpc-customizer-active div.product .summary form.cart,
body.gpc-customizer-active div.product .entry-summary form.cart {
	display: none !important;
}

.gpc-summary-cta {
	margin: 1.25rem 0;
}

.gpc-summary-cta .gpc-cta-button {
	display: inline-block;
	font-weight: 700;
}

.gpc-summary-cta-help {
	margin: 0.6rem 0 0;
	font-size: 0.875rem;
	opacity: 0.75;
	max-width: 42ch;
}

/* The section itself needs it too: it is exactly viewport wide, so its own
   padding must fit inside that width instead of adding to it. */
.gpc-app,
.gpc-app *,
.gpc-app *::before,
.gpc-app *::after {
	box-sizing: border-box;
}

.gpc-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
	gap: 2rem;
	align-items: start;
	max-width: 1600px;
	margin-inline: auto;
}

@media (max-width: 900px) {
	.gpc-layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Visually hidden, but still read out. Our own class: `.screen-reader-text`
   is provided by the theme, not by WordPress, so relying on it would leave
   these labels visible on themes that do not define it. */
.gpc-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Tabs -------------------------------------------------------------- */

.gpc-tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	border-bottom: 2px solid var(--gpc-border);
	padding-bottom: 0.75rem;
	/* Room for the info badge that sits above the tab corner. */
	padding-top: 0.5rem;
	margin-bottom: 1.25rem;
}

.gpc-tabs-techniques {
	display: contents;
}

.gpc-tab {
	appearance: none;
	background: var(--gpc-surface);
	border: 1px solid var(--gpc-border);
	border-radius: var(--gpc-radius);
	color: var(--gpc-text);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	padding: 0.6rem 0.9rem;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.gpc-tab:hover {
	border-color: var(--gpc-accent);
}

.gpc-tab:focus-visible {
	outline: 3px solid var(--gpc-accent);
	outline-offset: 2px;
}

.gpc-tab.is-active {
	background: var(--gpc-accent);
	border-color: var(--gpc-accent);
	color: #fff;
}

.gpc-tab[disabled],
.gpc-tab.is-unavailable {
	opacity: 0.45;
	cursor: not-allowed;
	background: var(--gpc-surface);
	border-style: dashed;
}

.gpc-tab-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.gpc-tab-info {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 1px solid var(--gpc-border);
	background: var(--gpc-bg);
	color: var(--gpc-accent);
	font: 700 12px/1 serif;
	font-style: italic;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 2;
}

.gpc-tab-info:hover {
	background: var(--gpc-accent);
	border-color: var(--gpc-accent);
	color: #fff;
}

.gpc-tab-info:focus-visible {
	outline: 3px solid var(--gpc-accent);
	outline-offset: 2px;
}

.gpc-info-minimum {
	font-weight: 700;
	color: var(--gpc-danger);
}

.gpc-tab-note,
.gpc-tab-badge {
	font-size: 0.75em;
	font-weight: 600;
	padding: 0.1rem 0.4rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.08);
}

.gpc-tab.is-active .gpc-tab-badge {
	background: rgba(255, 255, 255, 0.25);
}

/* Panels ------------------------------------------------------------ */

.gpc-panel-title {
	margin: 0 0 0.35rem;
	font-size: 1.15rem;
}

.gpc-panel-help {
	margin: 0 0 1rem;
	color: var(--gpc-muted);
	font-size: 0.9rem;
}

.gpc-matrix-wrap {
	overflow-x: auto;
	border: 1px solid var(--gpc-border);
	border-radius: var(--gpc-radius);
}

/* Matrix ------------------------------------------------------------ */

.gpc-matrix {
	border-collapse: collapse;
	width: 100%;
	min-width: 520px;
	font-size: 0.9rem;
}

.gpc-matrix th,
.gpc-matrix td {
	border-bottom: 1px solid var(--gpc-border);
	padding: 0.5rem;
	text-align: center;
}

.gpc-matrix thead th {
	background: var(--gpc-surface);
	font-weight: 700;
	position: sticky;
	top: 0;
	z-index: 1;
}

.gpc-matrix tbody th.gpc-color-cell {
	text-align: left;
	white-space: nowrap;
	padding: 0.6rem 0.75rem;
	background: var(--gpc-bg);

	/* Keeps the colour visible while the matrix scrolls horizontally. */
	position: sticky;
	left: 0;
	z-index: 2;
	box-shadow: 1px 0 0 var(--gpc-border);
}

.gpc-matrix thead th:first-child {
	position: sticky;
	left: 0;
	z-index: 3;
	box-shadow: 1px 0 0 var(--gpc-border);
}

.gpc-color-cell-inner {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.gpc-color-text {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
}

.gpc-swatch {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.25);
	flex: 0 0 auto;
}

.gpc-color-name {
	font-weight: 600;
}

.gpc-color-group {
	color: var(--gpc-muted);
	font-size: 0.72rem;
	font-weight: 400;
}

@media print {
	.gpc-app {
		display: none;
	}
}

.gpc-cell input[type="number"] {
	width: 4.2rem;
	padding: 0.35rem;
	text-align: center;
	border: 1px solid var(--gpc-border);
	border-radius: 6px;
	font: inherit;
	background: var(--gpc-bg);
	color: var(--gpc-text);
}

.gpc-cell input[type="number"]:focus-visible {
	outline: 3px solid var(--gpc-accent);
	outline-offset: 1px;
}

.gpc-cell input.is-capped {
	border-color: var(--gpc-danger);
}

.gpc-cell-price {
	display: block;
	font-size: 0.72rem;
	color: var(--gpc-muted);
	margin-top: 0.2rem;
}

.gpc-cell.is-disabled,
.gpc-cell-empty {
	background: repeating-linear-gradient(
		45deg,
		#f2f3f5,
		#f2f3f5 6px,
		#eceef1 6px,
		#eceef1 12px
	);
	color: var(--gpc-muted);
}

.gpc-col-total {
	font-weight: 700;
	background: var(--gpc-surface);
}

.gpc-col-total.has-units {
	color: var(--gpc-accent);
}

.gpc-matrix-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin-top: 0.75rem;
}

.gpc-total-units {
	margin: 0;
	font-weight: 700;
}

.gpc-link-button {
	background: none;
	border: 0;
	color: var(--gpc-accent);
	cursor: pointer;
	font: inherit;
	padding: 0;
	text-decoration: underline;
}

/* Positions --------------------------------------------------------- */

.gpc-positions {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 0.75rem;
}

.gpc-position {
	border: 1px solid var(--gpc-border);
	border-radius: var(--gpc-radius);
	padding: 0.75rem;
	background: var(--gpc-bg);
	transition: border-color 0.15s ease, background 0.15s ease;
}

.gpc-position.is-selected {
	border-color: var(--gpc-accent);
	background: var(--gpc-accent-soft);
}

.gpc-position-figure {
	display: flex;
	justify-content: center;
	margin-bottom: 0.5rem;
}

.gpc-thumb {
	width: 74px;
	height: 74px;
	display: block;
	object-fit: contain;
}

.gpc-position-head {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: start;
	gap: 0.5rem;
	cursor: pointer;
}

.gpc-position-head input[type="checkbox"] {
	margin-top: 0.15rem;
}

.gpc-position-meta {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

.gpc-position-name {
	font-weight: 600;
	font-size: 0.9rem;
}

.gpc-position-area,
.gpc-position-price {
	font-size: 0.75rem;
	color: var(--gpc-muted);
}

.gpc-position-price {
	font-weight: 600;
	color: var(--gpc-accent);
}

.gpc-position-options {
	margin-top: 0.6rem;
	border-top: 1px dashed var(--gpc-border);
	padding-top: 0.6rem;
}

.gpc-position-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	font-size: 0.85rem;
}

.gpc-position-option select {
	font: inherit;
	width: 100%;
	padding: 0.35rem 0.4rem;
	border: 1px solid var(--gpc-border);
	border-radius: 6px;
	background: var(--gpc-bg);
	color: var(--gpc-text);
}

/* Modal ------------------------------------------------------------- */

.gpc-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.gpc-modal[hidden] {
	display: none;
}

.gpc-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(12, 15, 20, 0.6);
}

.gpc-modal-dialog {
	position: relative;
	background: #fff;
	color: #1c1f24;
	border-radius: 12px;
	max-width: 720px;
	width: 100%;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.gpc-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid #e2e5ea;
}

.gpc-modal-title {
	margin: 0;
	font-size: 1.1rem;
}

.gpc-modal-title:focus-visible {
	outline: none;
}

.gpc-modal-close {
	background: none;
	border: 0;
	cursor: pointer;
	font-size: 1.75rem;
	line-height: 1;
	padding: 0 0.25rem;
	color: #656d78;
}

.gpc-modal-body {
	padding: 1.25rem;
	overflow-y: auto;
	line-height: 1.6;
}

.gpc-modal-body :first-child {
	margin-top: 0;
}

body.gpc-modal-open {
	overflow: hidden;
}

/* Extras, comments, copyright --------------------------------------- */

.gpc-extras,
.gpc-comments,
.gpc-copyright {
	margin-top: 1.5rem;
}

.gpc-extras-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 0.6rem;
}

.gpc-extra {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 0.5rem;
	border: 1px solid var(--gpc-border);
	border-radius: var(--gpc-radius);
	padding: 0.6rem 0.75rem;
	cursor: pointer;
}

.gpc-extra-price {
	font-weight: 600;
	color: var(--gpc-muted);
	font-size: 0.85rem;
}

.gpc-comments label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.35rem;
}

.gpc-comments textarea {
	width: 100%;
	border: 1px solid var(--gpc-border);
	border-radius: var(--gpc-radius);
	padding: 0.6rem;
	font: inherit;
	background: var(--gpc-bg);
	color: var(--gpc-text);
}

.gpc-copyright label {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	font-size: 0.9rem;
}

/* Quote panel ------------------------------------------------------- */

.gpc-side {
	position: sticky;
	top: 1.5rem;
}

.gpc-quote {
	border: 1px solid var(--gpc-border);
	border-radius: var(--gpc-radius);
	background: var(--gpc-surface);
	padding: 1rem;
}

.gpc-quote-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.5rem;
	border-bottom: 1px solid var(--gpc-border);
	padding-bottom: 0.6rem;
	margin-bottom: 0.75rem;
}

.gpc-quote-label {
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--gpc-muted);
}

.gpc-quote-number {
	font-size: 0.9rem;
	letter-spacing: 0.04em;
}

.gpc-quote-section {
	margin-bottom: 0.9rem;
}

.gpc-quote-section h4 {
	margin: 0 0 0.4rem;
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--gpc-muted);
}

.gpc-quote-section ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gpc-quote-line {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.3rem 0;
	border-bottom: 1px dotted var(--gpc-border);
	font-size: 0.87rem;
}

.gpc-quote-line-label small {
	display: block;
	color: var(--gpc-muted);
	font-size: 0.78em;
}

.gpc-quote-line-value {
	font-weight: 600;
	white-space: nowrap;
}

.gpc-quote-summary dl {
	margin: 0;
}

.gpc-quote-summary dl > div {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.25rem 0;
	font-size: 0.9rem;
}

.gpc-quote-summary dt,
.gpc-quote-summary dd {
	margin: 0;
}

.gpc-quote-total {
	border-top: 2px solid var(--gpc-border);
	margin-top: 0.4rem;
	padding-top: 0.5rem !important;
	font-size: 1.15rem !important;
	font-weight: 700;
}

.gpc-quote-note {
	font-size: 0.75rem;
	color: var(--gpc-muted);
	margin: 0.5rem 0 0;
}

.gpc-quote-empty {
	color: var(--gpc-muted);
	font-size: 0.9rem;
	margin: 0;
}

.gpc-side .gpc-copyright {
	margin: 1rem 0 0;
	padding-top: 0.85rem;
	border-top: 1px solid var(--gpc-border);
	font-size: 0.82rem;
}

.gpc-side .gpc-copyright label {
	align-items: flex-start;
	gap: 0.45rem;
}

.gpc-policy-link {
	display: inline-block;
	margin: 0.2rem 0 0 1.35rem;
	font-size: 0.8rem;
}

.gpc-upload-notice {
	margin-top: 0.6rem;
	font-size: 0.72rem;
	line-height: 1.45;
	color: var(--gpc-muted);
}

.gpc-upload-notice p {
	margin: 0 0 0.35rem;
}

.gpc-upload-notice p:first-child {
	font-weight: 600;
	color: var(--gpc-text);
}

.gpc-upload-notice p:last-child {
	margin-bottom: 0;
}

/* Uploads ------------------------------------------------------------ */

.gpc-uploads {
	margin-top: 0.85rem;
}

.gpc-uploads[hidden] {
	display: none;
}

.gpc-dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.2rem;
	border: 2px dashed var(--gpc-border);
	border-radius: var(--gpc-radius);
	background: var(--gpc-bg);
	padding: 1rem 0.75rem;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.gpc-dropzone:hover,
.gpc-dropzone.is-over {
	border-color: var(--gpc-accent);
	background: var(--gpc-accent-soft);
}

.gpc-dropzone:focus-visible {
	outline: 3px solid var(--gpc-accent);
	outline-offset: 2px;
}

.gpc-dropzone-icon {
	font-size: 1.6rem;
	line-height: 1;
	color: var(--gpc-accent);
}

.gpc-dropzone-label {
	font-weight: 700;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.gpc-dropzone-hint {
	font-size: 0.72rem;
	color: var(--gpc-muted);
}

.gpc-file-list {
	list-style: none;
	margin: 0.6rem 0 0;
	padding: 0;
	display: grid;
	gap: 0.35rem;
}

.gpc-file {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: center;
	gap: 0.5rem;
	background: var(--gpc-bg);
	border: 1px solid var(--gpc-border);
	border-radius: 6px;
	padding: 0.35rem 0.5rem;
	font-size: 0.8rem;
}

.gpc-file-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gpc-file-meta {
	color: var(--gpc-muted);
	font-size: 0.72rem;
	white-space: nowrap;
}

.gpc-file-remove {
	background: none;
	border: 0;
	color: var(--gpc-danger);
	cursor: pointer;
	font-size: 1.1rem;
	line-height: 1;
	padding: 0 0.2rem;
}

.gpc-quote-actions {
	display: grid;
	gap: 0.5rem;
	margin-top: 1rem;
}

.gpc-quote-actions .button[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Messages ---------------------------------------------------------- */

.gpc-message,
.gpc-notice {
	border-radius: 8px;
	font-size: 0.85rem;
	margin: 0.4rem 0 0;
	padding: 0.5rem 0.7rem;
}

.gpc-message-error {
	background: #fdecea;
	color: var(--gpc-danger);
}

.gpc-message-warning,
.gpc-notice-warning {
	background: #fff5e0;
	color: var(--gpc-warning);
}

.gpc-message-success {
	background: #e8f6ec;
	color: var(--gpc-success);
}

.gpc-notice {
	background: var(--gpc-surface);
	color: var(--gpc-muted);
}

.gpc-summary-pointer a {
	font-weight: 600;
}

/* Mobile sticky bar -------------------------------------------------- */

.gpc-mobile-bar {
	display: none;
}

@media (max-width: 900px) {
	.gpc-side {
		position: static;
	}

	.gpc-app .gpc-side {
		display: none;
	}

	.gpc-app.gpc-summary-open .gpc-side {
		display: block;
	}

	.gpc-mobile-bar {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: 1rem;
		position: sticky;
		bottom: 0;
		width: 100%;
		background: var(--gpc-accent);
		color: #fff;
		border: 0;
		border-radius: var(--gpc-radius);
		font: inherit;
		font-weight: 700;
		padding: 0.85rem 1rem;
		margin-top: 1rem;
		cursor: pointer;
		z-index: 20;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gpc-app * {
		transition: none !important;
	}
}
