/**
 * Acrylic Panel Configurator — front-end styles.
 *
 * All rules are namespaced under .apc-root so they don't leak into the theme.
 * Typography (font family, text colour, heading sizes/weights) is intentionally
 * NOT set — the plugin inherits whatever the active theme provides. Only
 * functional layout and a few brand accents (primary button colour, selected
 * state green, field grey) are enforced.
 */

.apc-root {
	--apc-border: #e2e2e2;
	--apc-border-strong: #cfcfcf;
	--apc-muted: #6b6b6b;
	--apc-primary: #cf5b19;
	--apc-primary-hover: #b34d13;
	--apc-field-bg: #e6e3df;
	--apc-field-bg-hover: #dcd8d3;
	--apc-selected: #1f8a4c;
	--apc-error: #b23a2e;
	--apc-error-bg: #fcedec;
	--apc-radius: 8px;

	box-sizing: border-box;
	width: 100%;
}

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

.apc-hr {
	border: none;
	border-top: 1px solid var(--apc-border);
	margin: 32px 0;
}

.apc-hidden {
	display: none !important;
}

/* --- Initial questions ------------------------------------------------- */

.apc-initial-questions .apc-fields {
	display: grid;
	gap: 12px;
}

.apc-initial-questions .apc-row-3 {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 12px;
}

.apc-initial-questions .apc-row-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

@media (max-width: 640px) {
	.apc-initial-questions .apc-row-3,
	.apc-initial-questions .apc-row-2 {
		grid-template-columns: 1fr;
	}
}

.apc-field label {
	display: block;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--apc-muted);
	margin-bottom: 6px;
}

.apc-field input {
	display: block;
	width: 100%;
	margin: 0;
	padding: 10px;
	border: 1px solid transparent;
	border-radius: 4px;
	background: var(--apc-field-bg);
	color: inherit;
	font: inherit;
	line-height: 1.3em;
	outline: none;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.apc-field input:focus {
	background: var(--apc-field-bg-hover);
}

.apc-field input:focus-visible {
	border-color: var(--apc-primary);
}

.apc-field input::placeholder {
	color: var(--apc-muted);
}

.apc-field input.apc-field-invalid {
	border-color: var(--apc-error);
	background: var(--apc-error-bg);
}

.apc-field-hint {
	min-height: 16px;
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--apc-error);
}

/* --- Decor / repeater sections ---------------------------------------- */

.apc-decor-section {
	margin-top: 8px;
}

.apc-decor-header {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.apc-decor-header h3 {
	flex: 0 0 auto;
}

.apc-product-select {
	appearance: none;
	-webkit-appearance: none;
	padding: 10px 36px 10px 10px;
	border: 0 none;
	border-radius: 0;
	background-color: var(--apc-field-bg);
	color: inherit;
	font: inherit;
	line-height: 1.3em;
	cursor: pointer;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
	background-repeat: no-repeat;
	background-position: right 12px center;
	transition: background-color 0.2s ease;
}

.apc-product-select:hover {
	background-color: var(--apc-field-bg-hover);
}

.apc-subtitle {
	margin: 12px 0 4px;
}

.apc-subtitle-note {
	color: var(--apc-muted);
	margin: 0 0 12px;
}

.apc-actions-inline {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	flex-wrap: wrap;
	margin-top: 8px;
}

/* --- Buttons ---------------------------------------------------------- */

.apc-btn {
	display: inline-block;
	padding: 10px 18px;
	border: 0 none;
	border-radius: 0;
	background: var(--apc-field-bg);
	color: inherit;
	font: inherit;
	line-height: 1.3em;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.2s ease;
}

.apc-btn:hover {
	background: var(--apc-field-bg-hover);
}

.apc-btn-primary {
	background: var(--apc-primary);
	color: #fff;
}

.apc-btn-primary:hover {
	background: var(--apc-primary-hover);
	color: #fff;
}

/* --- Configurations grid --------------------------------------------- */

.apc-config-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-top: 28px;
}

@media (max-width: 900px) {
	.apc-config-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 520px) {
	.apc-config-grid {
		grid-template-columns: 1fr;
	}
}

.apc-config-card {
	cursor: pointer;
	border: 1px solid transparent;
	border-radius: var(--apc-radius);
	overflow: hidden;
	background: #fafafa;
	transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
	position: relative;
}

.apc-config-card:hover {
	border-color: var(--apc-border-strong);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.apc-config-card .apc-config-index {
	position: absolute;
	top: 8px;
	left: 10px;
	background: rgba(255, 255, 255, 0.85);
	padding: 2px 8px;
	border-radius: var(--apc-radius);
}

.apc-config-card img {
	display: block;
	width: 100%;
	height: auto;
	/* aspect-ratio: 3 / 2; */
	object-fit: cover;
}
.apc-config-card.apc-config-card-custom img {
		aspect-ratio: 3 / 2;
}


/* --- Panel selector --------------------------------------------------- */

.apc-panel-selector {
	margin-top: 20px;
}

.apc-panel-row {
	display: flex;
	flex-direction: column;
	background: #fff;
	margin-top: 24px;
}

.apc-panel-canvas {
	position: relative;
	display: flex;
	align-items: stretch;
	justify-content: flex-start;
	width: 100%;
}

.apc-panel {
	position: relative;
	cursor: pointer;
	overflow: hidden;
	transition: opacity 0.2s, filter 0.2s;
	display: flex;
	flex-direction: column;
}

.apc-panel img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: fill;
	pointer-events: none;
}

.apc-panel-bleed {
	position: relative;
	pointer-events: none;
	overflow: hidden;
	background-color: #f2efeb;
	background-image: repeating-linear-gradient(
		135deg,
		rgba(0, 0, 0, 0.06) 0 8px,
		rgba(0, 0, 0, 0) 8px 16px
	);
}

.apc-panel-bleed-custom {
	background-color: #111;
	box-shadow: inset 2px 0 0 0 rgba(255, 255, 255, 0.7);
	border-left: 2px dashed rgba(0, 0, 0, 0.35);
}

.apc-panel-size {
	position: absolute;
	top: 8px;
	left: 8px;
	background: rgba(255, 255, 255, 0.92);
	color: #1d2327;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 16px;
	line-height: 1.2;
	font-weight: 600;
	letter-spacing: 0.2px;
	pointer-events: none;
	z-index: 2;
}

.apc-panel-tick {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 24px;
	height: 24px;
	background: var(--apc-selected);
	color: #fff;
	border-radius: 50%;
	display: none;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	line-height: 1;
	font-weight: 700;
	pointer-events: none;
	z-index: 2;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);    font-family: system-ui;
}

.apc-panel.apc-selected {
	opacity: 1;
	box-shadow: inset 0 0 0 4px var(--apc-selected) !important;
}

.apc-panel.apc-selected .apc-panel-tick {
	display: flex;
}

.apc-panel.apc-disabled {
	opacity: 0.18;
	cursor: not-allowed;
	filter: grayscale(0.3);
}

.apc-panel.apc-disabled:hover {
	opacity: 0.18;
}

.apc-panel:not(.apc-disabled):hover::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.04);
}

/* --- Order footer / summary ------------------------------------------ */

.apc-order-footer {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--apc-border);
}

.apc-summary-message {
	padding: 8px 0 16px;
	text-align: left;
}

.apc-summary-actions {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 8px;
	flex-wrap: wrap;
}

.apc-divider-repeat {
	margin: 40px 0 20px;
	border-top: 1px solid var(--apc-border);
}

/* --- Disclaimer -------------------------------------------------------- */

.apc-disclaimer {
	margin: 24px 0 0;
	padding-top: 20px;
	border-top: 1px solid var(--apc-border);
	color: var(--apc-muted);
	font-size: 12px;
	line-height: 1.5;
}

/* --- Form message banner (inline errors) ------------------------------ */

.apc-form-message {
	display: none;
	margin-top: 16px;
	padding: 14px 16px;
	border-radius: var(--apc-radius);
	border: 1px solid var(--apc-error);
	background: var(--apc-error-bg);
	color: var(--apc-error);
	font-size: 14px;
	line-height: 1.5;
}

.apc-form-message.apc-show {
	display: block;
}

/* --- Success screen ---------------------------------------------------- */

.apc-success-screen {
	text-align: center;
	max-width: 480px;
	margin: 48px auto;
	padding: 8px 16px;
}

.apc-success-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 20px;
	color: var(--apc-selected);
}

.apc-success-icon svg {
	width: 100%;
	height: 100%;
}

.apc-success-title {
	margin: 0 0 12px;
}

.apc-success-message {
	color: var(--apc-muted);
	margin: 0 0 28px;
	line-height: 1.5;
}

/* --- Custom-image config grid placeholders ---------------------------- */

.apc-config-card-diagram {
	display: flex;
	align-items: stretch;
	width: 100%;
	aspect-ratio: 3 / 2;
	background: #efece7;
	gap: 2px;
	padding: 2px;
}

.apc-config-card-swatch {
	position: relative;
	display: flex;
	align-items: flex-start;
	justify-content: center;
/* 	background-color: #111; */
	overflow: hidden;
}

.apc-config-card-swatch.apc-panel-seam {
/* 	box-shadow: inset 2px 0 0 0 rgba(255, 255, 255, 0.7); */
/* 	border-left: 2px dashed rgba(0, 0, 0, 0.35); */
}

.apc-config-card-swatch-label {
	margin-top: 4px;
	padding: 2px 6px;
	background: rgba(255, 255, 255, 0.92);
	color: #1d2327;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.3;
}

.apc-config-card-swatch-bleed {
	background-color: #f2efeb;
	background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.06) 0 8px, rgba(0, 0, 0, 0) 8px 16px);
}

.apc-config-card-caption {
	display: block;
	padding: 8px 10px;
	font-size: 12.5px;
	color: var(--apc-muted);
	text-align: center;
}

/* --- Custom image upload dropzone -------------------------------------- */

.apc-upload-dropzone {
	position: relative;
	margin-top: 24px;
	border: 2px dashed var(--apc-border-strong);
	border-radius: var(--apc-radius);
	padding: 32px 20px;
	text-align: center;
	cursor: pointer;
	background: #fafafa;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.apc-upload-dropzone:hover,
.apc-upload-dropzone.apc-dropzone-active {
	background: var(--apc-field-bg-hover);
	border-color: var(--apc-primary);
}

.apc-upload-dropzone .apc-upload-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.apc-upload-dropzone-body {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	pointer-events: none;
}

.apc-upload-icon {
	font-size: 22px;
	color: var(--apc-primary);
}

.apc-upload-dropzone-note {
	font-size: 12px;
	color: var(--apc-muted);
}

/* --- Crop UI ------------------------------------------------------------ */

.apc-crop-wrap {
	margin-top: 20px;
	max-width: 640px;
}

.apc-crop-instructions {
	color: var(--apc-muted);
	margin: 0 0 12px;
}

.apc-crop-canvas {
	display: block;
	width: 100%;
	height: auto;
	touch-action: none;
	cursor: grab;
	border-radius: var(--apc-radius);
	background: #111;
}

.apc-crop-canvas:active {
	cursor: grabbing;
}

.apc-crop-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 14px;
}

.apc-crop-zoom-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--apc-muted);
	flex: 1 1 220px;
}

.apc-crop-zoom-label input[type="range"] {
	flex: 1 1 auto;
}

.apc-crop-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

/* --- Custom panel canvas (post-crop) ------------------------------------ */

.apc-panel-custom {
	background-color: #111;
	background-repeat: no-repeat;
}

.apc-panel-custom.apc-panel-seam {
	box-shadow: inset 2px 0 0 0 rgba(255, 255, 255, 0.7);
	border-left: 2px dashed rgba(0, 0, 0, 0.35);
}

/* --- Per-section validation hint --------------------------------------- */

.apc-decor-hint {
	min-height: 16px;
	margin: 8px 0 0;
	font-size: 12px;
	color: var(--apc-error);
}

/* --- Focus states ---------------------------------------------------- */

.apc-root button:focus-visible,
.apc-root .apc-config-card:focus-visible,
.apc-root .apc-panel:focus-visible,
.apc-root select:focus-visible,
.apc-root input:focus-visible {
	outline: 2px solid var(--apc-primary);
	outline-offset: 2px;
}
