/* THREEDEL 3D Print Quote Calculator
   Colours resolve from the --td-* custom properties printed on the wrapper by
   PHP, which come from the Elementor Site Kit (or the manual hexes in
   Settings > 3D Quote Calculator). Restyling the brand needs no CSS edit.
   Selectors are scoped and slightly over-specified on purpose: WoodMart
   restyles bare button and select elements site-wide. */

.threedel-3dp {
	--td-r: 14px;
	--td-r-sm: 9px;
	--td-gap: 24px;
	font-family: inherit;
	color: var(--td-ink, #1f2937);
	background: var(--td-canvas, #f6f8f5);
	padding: 0 0 40px;
	line-height: 1.55;
}
.threedel-3dp *,
.threedel-3dp *::before,
.threedel-3dp *::after { box-sizing: border-box; }

.threedel-3dp button {
	font-family: inherit;
	text-transform: none;
	letter-spacing: 0;
	line-height: 1.3;
}
.threedel-3dp :focus-visible {
	outline: 2px solid var(--td-primary);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ------------------------------------------------------------------ header */

.td-header {
	background: var(--td-surface, #fff);
	border-bottom: 1px solid var(--td-line);
	box-shadow: inset 0 -3px 0 -1px var(--td-accent);
}
.td-head-inner {
	max-width: 1280px;
	margin: auto;
	padding: 20px 28px;
	display: flex;
	align-items: center;
	gap: 28px;
	flex-wrap: wrap;
}
.td-title { flex: 1 1 280px; }
.td-title h1 {
	font-size: 22px;
	line-height: 1.25;
	margin: 0 0 4px;
	color: var(--td-ink);
	font-weight: 700;
}
.td-title p { margin: 0; color: var(--td-muted); font-size: 13px; }

.td-steps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.td-steps > div { display: flex; gap: 9px; align-items: center; color: var(--td-faint); }
.td-steps > div.active,
.td-steps > div.done { color: var(--td-ink); }
.td-steps i { color: var(--td-line); font-style: normal; }
.td-steps b {
	display: grid; place-items: center;
	width: 32px; height: 32px; flex: none;
	border-radius: 50%;
	background: var(--td-line-soft);
	color: var(--td-muted);
	font-size: 13px; font-weight: 700;
	transition: background .2s, color .2s;
}
.td-steps .done b { background: var(--td-primary-soft); color: var(--td-primary); }
.td-steps .active b { background: var(--td-accent); color: var(--td-accent-contrast); }
.td-steps span { display: flex; flex-direction: column; font-size: 12px; line-height: 1.35; }
.td-steps strong { font-weight: 600; }
.td-steps small { font-size: 10.5px; color: var(--td-faint); }

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

.td-layout {
	max-width: 1280px;
	margin: var(--td-gap) auto 0;
	padding: 0 20px;
	display: grid;
	grid-template-columns: 1.05fr .95fr;
	gap: var(--td-gap);
	align-items: start;
}
.td-card {
	background: var(--td-surface, #fff);
	border: 1px solid var(--td-line);
	border-radius: var(--td-r);
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -16px rgba(16, 24, 40, .18);
	padding: 22px;
}

/* ------------------------------------------------------------- upload pane */

.td-drop {
	min-height: 360px;
	border: 2px dashed var(--td-primary-line);
	background: var(--td-primary-soft);
	border-radius: var(--td-r-sm);
	display: flex; flex-direction: column; justify-content: center; align-items: center;
	text-align: center; cursor: pointer; position: relative;
	padding: 24px;
	transition: border-color .18s, background .18s;
}
.td-drop:hover,
.td-drop.dragover { border-color: var(--td-primary); }
.td-drop.dragover { background: var(--td-surface); }
.td-upload-icon {
	width: 60px; height: 60px; border-radius: 50%;
	background: var(--td-surface); display: grid; place-items: center;
	color: var(--td-primary); font-size: 30px; font-weight: 700;
	box-shadow: 0 2px 12px rgba(16, 24, 40, .1); margin-bottom: 16px;
}
.td-drop-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--td-ink); }
.td-drop p:not(.td-drop-title) { margin: 6px 0 0; color: var(--td-muted); font-size: 14px; }
.td-drop small { color: var(--td-faint); font-size: 12px; margin-top: 4px; }
.threedel-3dp #td-choose {
	margin-top: 20px;
	background: var(--td-accent); color: var(--td-accent-contrast);
	border: 0; border-radius: var(--td-r-sm);
	padding: 13px 24px; font-weight: 700; font-size: 14.5px; cursor: pointer;
	transition: background .18s, transform .12s;
}
.threedel-3dp #td-choose:hover { background: var(--td-accent-hover); }
.threedel-3dp #td-choose:active { transform: translateY(1px); }
.td-drop em {
	font-style: normal; background: var(--td-surface);
	border: 1px solid var(--td-line); padding: 5px 12px;
	border-radius: 99px; font-size: 11px; color: var(--td-faint); margin-top: 12px;
}

/* ------------------------------------------------------------------ viewer */

.td-viewer-wrap {
	display: none; position: relative; height: 420px;
	background: var(--td-canvas); border-radius: var(--td-r-sm);
	overflow: hidden; border: 1px solid var(--td-line);
}
.td-viewer-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.td-viewer-wrap canvas.dragging { cursor: grabbing; }
#td-loading {
	display: none; position: absolute; inset: 0;
	align-items: center; justify-content: center; gap: 10px;
	color: var(--td-muted); font-size: 13px; background: var(--td-canvas);
}
.td-spin {
	width: 16px; height: 16px; border-radius: 50%;
	border: 2px solid var(--td-primary-line);
	border-top-color: var(--td-primary);
	animation: td-spin .7s linear infinite;
}
@keyframes td-spin { to { transform: rotate(360deg); } }
#td-viewer-help {
	display: none; position: absolute; left: 12px; bottom: 12px;
	background: rgba(255, 255, 255, .9); border: 1px solid var(--td-line);
	border-radius: 99px; padding: 5px 11px; font-size: 11px; color: var(--td-muted);
	pointer-events: none;
}

.td-model-bar {
	display: none; align-items: center; gap: 12px;
	margin-top: 12px; padding: 11px 14px;
	background: var(--td-line-soft); border-radius: var(--td-r-sm);
}
.td-model-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#td-model-name {
	font-size: 13.5px; color: var(--td-ink); font-weight: 600;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#td-note { font-size: 12px; color: var(--td-muted); }
.threedel-3dp #td-reset {
	flex: none; border: 1px solid var(--td-line); background: var(--td-surface);
	color: var(--td-ink); padding: 9px 14px; border-radius: 7px;
	cursor: pointer; font-size: 13px; font-weight: 600;
}
.threedel-3dp #td-reset:hover { border-color: var(--td-primary); color: var(--td-primary); }

.threedel-3dp #td-file { display: none; }

.td-progress {
	display: none; margin-top: 12px;
	background: var(--td-primary-soft); padding: 12px 14px;
	border-radius: var(--td-r-sm); color: var(--td-primary); font-size: 13px; font-weight: 600;
}
.td-progress > div {
	height: 6px; background: var(--td-primary-line);
	border-radius: 99px; margin-top: 9px; overflow: hidden;
}
.td-progress span { display: block; width: 0; height: 100%; background: var(--td-primary); transition: width .15s; }

/* --------------------------------------------------------------- messaging */

#td-error {
	display: none; margin-top: 12px; padding: 14px 16px;
	background: #fff5f5; border: 1px solid #fecdd3;
	border-left: 3px solid #e11d48;
	border-radius: var(--td-r-sm); color: #9f1239; font-size: 13.5px;
}
#td-error p { margin: 0; font-weight: 600; line-height: 1.55; }
.threedel-3dp #td-error-more {
	margin-top: 8px; background: none; border: 0; padding: 0;
	color: #9f1239; font-size: 12px; font-weight: 600;
	text-decoration: underline; cursor: pointer;
}
#td-error-detail {
	margin: 10px 0 0; padding: 11px; max-height: 220px; overflow: auto;
	background: rgba(159, 18, 57, .06); border-radius: 6px;
	font-size: 11px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.td-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.td-features > div { display: flex; gap: 10px; align-items: flex-start; }
.td-features b {
	width: 32px; height: 32px; flex: none; border-radius: 50%;
	background: var(--td-accent-soft); display: grid; place-items: center; font-size: 15px;
}
.td-features span { display: flex; flex-direction: column; }
.td-features strong { font-size: 12.5px; color: var(--td-ink); font-weight: 600; }
.td-features small { font-size: 11px; color: var(--td-faint); margin-top: 2px; line-height: 1.4; }

.td-trust {
	margin-top: 16px; background: var(--td-primary-soft);
	border: 1px solid var(--td-primary-line); color: var(--td-primary);
	padding: 10px 14px; border-radius: var(--td-r-sm); font-size: 12px;
}

/* ------------------------------------------------------------ settings pane */

.td-settings h2 { font-size: 18px; margin: 0 0 18px; color: var(--td-ink); font-weight: 700; }
.td-settings label {
	display: block; font-size: 12px; font-weight: 600;
	color: var(--td-muted); margin: 16px 0 6px;
	letter-spacing: .01em;
}
.threedel-3dp select,
.threedel-3dp input[type="number"],
.threedel-3dp input[type="text"],
.threedel-3dp input[type="tel"] {
	width: 100%; height: 44px;
	border: 1px solid var(--td-line); border-radius: var(--td-r-sm);
	padding: 0 13px; background: var(--td-surface);
	color: var(--td-ink); font-size: 14.5px; font-family: inherit;
	box-shadow: none;
}
.threedel-3dp select {
	appearance: none; -webkit-appearance: none;
	padding-right: 38px;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 19px) 20px, calc(100% - 14px) 20px;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
}
.threedel-3dp select:disabled { color: var(--td-faint); background-color: var(--td-line-soft); cursor: not-allowed; }
.threedel-3dp select:focus,
.threedel-3dp input:focus {
	outline: none;
	border-color: var(--td-primary);
	box-shadow: 0 0 0 3px var(--td-primary-soft);
}

#td-material-info {
	margin-top: 8px; background: var(--td-accent-soft);
	border: 1px solid var(--td-accent-line); padding: 11px 13px;
	border-radius: var(--td-r-sm); font-size: 12px; line-height: 1.6; color: var(--td-ink);
}

#td-colors { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.threedel-3dp .td-swatch {
	width: 30px; height: 30px; min-width: 0; flex: 0 0 30px;
	padding: 0; border-radius: 50%;
	background: var(--sw, #ccc);
	border: 2px solid var(--td-surface);
	box-shadow: 0 0 0 1px var(--td-line);
	cursor: pointer;
	transition: box-shadow .15s, transform .12s;
}
.threedel-3dp .td-swatch:hover { transform: scale(1.08); }
.threedel-3dp .td-swatch.selected { box-shadow: 0 0 0 2px var(--td-primary); }

.threedel-3dp #td-color-note {
	background: var(--td-line-soft); border: 1px solid var(--td-line);
	border-radius: var(--td-r-sm); padding: 10px 13px; margin-top: 12px;
	font-size: 11.5px; line-height: 1.5; color: var(--td-muted);
}

.threedel-3dp #td-advanced-toggle,
.threedel-3dp #td-breakdown-toggle {
	display: flex; justify-content: space-between; align-items: center;
	width: 100%; background: none; border: 0;
	border-top: 1px solid var(--td-line);
	margin-top: 18px; padding: 16px 0 10px;
	font-weight: 600; font-size: 13.5px; color: var(--td-ink);
	cursor: pointer;
}
.threedel-3dp #td-advanced-toggle span:last-child { transition: transform .18s; }
.threedel-3dp #td-advanced-toggle[aria-expanded="true"] span:last-child { transform: rotate(180deg); }
.threedel-3dp #td-advanced { display: none; }
.td-default-note { font-size: 11.5px; color: var(--td-faint); margin: 10px 0 0; }

.threedel-3dp #td-cost {
	width: 100%; height: 50px; border: 0;
	border-radius: var(--td-r-sm); background: var(--td-line);
	color: var(--td-muted); font-weight: 700; font-size: 15px;
	margin-top: 18px; cursor: not-allowed;
	transition: background .18s, color .18s;
}
.threedel-3dp #td-cost.ready { background: var(--td-accent); color: var(--td-accent-contrast); cursor: pointer; }
.threedel-3dp #td-cost.ready:hover { background: var(--td-accent-hover); }

.td-quote-loading { display: none; text-align: center; color: var(--td-primary); font-size: 13px; padding: 12px; }

/* ------------------------------------------------------------------ result */

#td-result { display: none; margin-top: 20px; border-top: 1px solid var(--td-line); padding-top: 18px; }
.td-price-row { display: flex; align-items: baseline; gap: 8px; }
.td-price { font-size: 36px; font-weight: 800; color: var(--td-accent); line-height: 1.05; letter-spacing: -.02em; }
.td-price-row span { color: var(--td-faint); font-size: 12.5px; }

#td-summary { margin-top: 16px; display: grid; gap: 9px; }
#td-summary > div,
#td-breakdown > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--td-muted); }
#td-summary > div span:last-child { color: var(--td-ink); font-weight: 500; text-align: right; }
.td-total {
	display: flex; justify-content: space-between; align-items: baseline;
	border-top: 1px solid var(--td-line); margin-top: 4px; padding-top: 11px;
	font-size: 14px; color: var(--td-muted);
}
.td-total strong { font-size: 18px; color: var(--td-ink); font-weight: 700; }

#td-breakdown { display: none; padding-bottom: 4px; gap: 9px; }
#td-breakdown > div { margin-bottom: 8px; }
#td-breakdown p { font-size: 11.5px; color: var(--td-faint); margin: 4px 0 0; }

.td-shipping {
	margin-top: 16px; background: var(--td-primary-soft);
	border: 1px solid var(--td-primary-line); color: var(--td-primary);
	padding: 10px 14px; border-radius: var(--td-r-sm); font-size: 12.5px;
}
#td-size-warning {
	display: none; margin-top: 10px; background: var(--td-accent-soft);
	border: 1px solid var(--td-accent-line); color: var(--td-ink);
	padding: 10px 14px; border-radius: var(--td-r-sm); font-size: 12.5px;
}

.td-qty { display: flex; gap: 12px; margin-top: 18px; align-items: stretch; }
.td-qty > div { position: relative; width: 112px; flex: none; }
.threedel-3dp .td-qty input { height: 50px; padding-right: 36px; font-weight: 600; }
.threedel-3dp .td-qty > div button {
	position: absolute; right: 5px; width: 26px; height: 19px;
	border: 1px solid var(--td-line); background: var(--td-surface);
	color: var(--td-muted); border-radius: 5px; cursor: pointer;
	font-size: 8px; padding: 0;
}
.threedel-3dp .td-qty > div button:hover { color: var(--td-primary); border-color: var(--td-primary); }
#td-up { top: 4px; }
#td-down { bottom: 4px; }
.threedel-3dp #td-request {
	flex: 1; border: 0; border-radius: var(--td-r-sm);
	background: var(--td-primary); color: var(--td-primary-contrast);
	font-weight: 700; font-size: 15px; cursor: pointer; min-height: 50px;
	transition: background .18s;
}
.threedel-3dp #td-request:hover { background: var(--td-primary-hover); }

/* ------------------------------------------------------------------- modal */

.td-modal {
	display: none; position: fixed; inset: 0; z-index: 99999;
	background: rgba(15, 23, 20, .6);
	align-items: center; justify-content: center; padding: 20px;
}
.td-modal > div {
	background: var(--td-surface); border-radius: var(--td-r);
	padding: 28px; width: 100%; max-width: 430px; position: relative;
	box-shadow: 0 24px 60px -12px rgba(16, 24, 40, .35);
}
.td-modal h3 { margin: 0 0 6px; font-size: 20px; color: var(--td-ink); font-weight: 700; }
.td-modal p { margin: 0; color: var(--td-muted); font-size: 13.5px; }
.td-modal label { display: block; font-size: 12px; font-weight: 600; color: var(--td-muted); margin: 16px 0 6px; }
#td-hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
#td-contact-error { color: #9f1239; font-size: 12.5px; min-height: 18px; margin: 10px 0 0; }
.threedel-3dp #td-modal-x {
	position: absolute; top: 14px; right: 14px;
	background: none; border: 0; font-size: 24px; padding: 0;
	color: var(--td-faint); cursor: pointer; line-height: 1;
}
.td-modal > div > div:last-child { display: flex; gap: 10px; margin-top: 18px; }
.threedel-3dp #td-cancel {
	flex: 1; height: 46px; border: 1px solid var(--td-line);
	background: var(--td-surface); color: var(--td-ink);
	border-radius: var(--td-r-sm); cursor: pointer; font-weight: 600;
}
.threedel-3dp #td-submit {
	flex: 2; height: 46px; border: 0; background: var(--td-accent);
	color: var(--td-accent-contrast); border-radius: var(--td-r-sm);
	font-weight: 700; cursor: pointer;
}
.threedel-3dp #td-submit:hover { background: var(--td-accent-hover); }
.threedel-3dp #td-submit:disabled { background: var(--td-line); color: var(--td-muted); cursor: default; }

.td-success { text-align: center; }
.td-success > div {
	width: 58px; height: 58px; margin: 0 auto 16px;
	border-radius: 50%; background: var(--td-primary-soft);
	color: var(--td-primary); display: grid; place-items: center; font-size: 28px;
}
.td-success strong {
	display: block; margin: 14px 0 20px;
	font-size: 19px; letter-spacing: .08em; color: var(--td-accent); font-weight: 700;
}
.threedel-3dp .td-success button {
	width: 100%; height: 46px; border: 0; border-radius: var(--td-r-sm);
	background: var(--td-primary); color: var(--td-primary-contrast);
	font-weight: 700; cursor: pointer;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 1024px) {
	.td-layout { grid-template-columns: 1fr; }
	.td-steps { width: 100%; }
	.td-viewer-wrap { height: 380px; }
}
@media (max-width: 640px) {
	.threedel-3dp { --td-gap: 16px; }
	.td-head-inner { padding: 16px; gap: 14px; }
	.td-title h1 { font-size: 19px; }
	.td-layout { padding: 0 12px; }
	.td-card { padding: 16px; }
	.td-drop { min-height: 250px; }
	.td-drop-title { font-size: 17px; }
	.td-viewer-wrap { height: 300px; }
	.td-features { grid-template-columns: 1fr; gap: 12px; }
	.td-steps { gap: 6px; }
	.td-steps > div span { display: none; }
	.td-price { font-size: 30px; }
	.td-qty { flex-direction: column; }
	.td-qty > div { width: 100%; }
	.td-model-bar { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
	.threedel-3dp *,
	.threedel-3dp *::before { transition: none !important; animation: none !important; }
}
