/* MakerEst — scoped so theme CSS cannot blow out the work area */

.maker-estimator-container,
.maker-estimator-container * {
	box-sizing: border-box;
}

.maker-estimator-container {
	--maker-est-primary: #007cba;
	--maker-est-primary-hover: #005a87;
	--maker-est-bg: #ffffff;
	--maker-est-border: #d0d5dd;
	--maker-est-text: #1d2327;
	--maker-est-muted: #646970;
	--maker-est-surface: #f6f7f7;
	--maker-est-success-bg: #f0f9eb;
	--maker-est-success-border: #c3e6cb;
	--maker-est-success-text: #155724;
	--maker-est-radius: 10px;

	width: 100%;
	max-width: min(1100px, 100%);
	margin: 1.5rem auto;
	padding: clamp(16px, 3vw, 28px);
	border-radius: var(--maker-est-radius);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	background: var(--maker-est-bg);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
	border: 1px solid #e2e4e7;
	color: var(--maker-est-text);
	line-height: 1.45;
	overflow: hidden;
}

.maker-estimator-container h2 {
	text-align: left;
	margin: 0 0 0.35em;
	color: #1d2327;
	font-size: clamp(1.25rem, 2.4vw, 1.6rem);
	line-height: 1.25;
}

.maker-est-lede {
	margin: 0 0 1.1rem;
	color: var(--maker-est-muted);
	font-size: 0.95rem;
}

.maker-est-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.85fr);
	gap: clamp(12px, 2.4vw, 24px);
	align-items: stretch;
}

.maker-est-workspace {
	position: relative;
	width: 100%;
	min-width: 0;
	aspect-ratio: 16 / 11;
	min-height: 220px;
	max-height: min(62vh, 560px);
	background: #111418;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #222;
}

.maker-est-workspace canvas {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: 100%;
}

.maker-est-workspace-empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #9aa0a6;
	font-size: 0.92rem;
	padding: 1rem;
	text-align: center;
	pointer-events: none;
}

.maker-est-workspace.has-preview .maker-est-workspace-empty {
	display: none;
}

.maker-est-panel {
	min-width: 0;
}

.maker-est-field {
	margin-bottom: 1rem;
}

.maker-est-label-text {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: 0.92rem;
}

.maker-est-file-group {
	position: relative;
	width: 100%;
}

.maker-est-input-file {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 10;
}

.maker-est-file-label {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: clamp(18px, 4vw, 32px) 16px;
	border: 2px dashed #b0b0b0;
	border-radius: 6px;
	background: var(--maker-est-surface);
	transition: border-color 0.2s ease, background-color 0.2s ease;
	text-align: center;
	cursor: pointer;
	word-break: break-word;
}

.maker-est-input-file:hover + .maker-est-file-label,
.maker-est-input-file:focus + .maker-est-file-label {
	border-color: var(--maker-est-primary);
	background: #f0f6fa;
}

.maker-est-file-label.has-file {
	border-color: #46b450;
	background: #f0f9eb;
}
.maker-est-file-group.is-drag .maker-est-file-label {
	border-color: var(--maker-est-primary);
	background: #e8f4fb;
}

.maker-est-icon-upload {
	font-size: 1.75rem;
	margin-bottom: 8px;
}

.maker-est-file-text {
	font-size: 0.95rem;
	color: var(--maker-est-muted);
}

.maker-est-select-wrapper select,
.maker-est-qty-row input {
	width: 100%;
	max-width: 100%;
	padding: 11px 12px;
	border: 1px solid var(--maker-est-border);
	border-radius: 4px;
	background: #fff;
	font-size: 16px; /* stops iOS zoom */
	color: var(--maker-est-text);
}

.maker-est-select-wrapper select:focus,
.maker-est-qty-row input:focus {
	border-color: var(--maker-est-primary);
	outline: none;
	box-shadow: 0 0 0 1px var(--maker-est-primary);
}

.maker-est-results {
	margin-top: 0.5rem;
	padding: 16px;
	background: var(--maker-est-success-bg);
	border: 1px solid var(--maker-est-success-border);
	border-radius: 6px;
}

.maker-est-hidden {
	display: none !important;
}

.maker-est-results h3 {
	margin: 0 0 12px;
	font-size: 1.05rem;
	color: var(--maker-est-success-text);
	border-bottom: 1px solid var(--maker-est-success-border);
	padding-bottom: 8px;
}

.maker-est-result-item {
	margin-bottom: 10px;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	font-size: 0.92rem;
}

.maker-est-result-item span:last-child {
	text-align: right;
	word-break: break-word;
}

.maker-est-label {
	font-weight: 600;
	color: #444;
	flex-shrink: 0;
}

.maker-est-breakdown {
	font-size: 0.82rem;
	color: #3d5a40;
	margin: 8px 0 12px;
	padding-top: 8px;
	border-top: 1px dashed var(--maker-est-success-border);
}

.maker-est-breakdown div {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 4px;
}

.maker-est-total {
	font-size: 1.05rem;
	padding-top: 8px;
	border-top: 1px solid var(--maker-est-success-border);
}

.maker-est-total #maker-est-cost {
	font-weight: 700;
}

.maker-est-cta {
	width: 100%;
	margin-top: 14px;
	padding: 13px;
	background: var(--maker-est-primary);
	color: #fff !important;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.3px;
	text-align: center;
}

.maker-est-cta:hover {
	background: var(--maker-est-primary-hover);
}

/* Tablet / phone: stack preview above controls, keep preview inside the viewport */
@media (max-width: 782px) {
	.maker-est-layout {
		grid-template-columns: 1fr;
	}

	.maker-est-workspace {
		aspect-ratio: 4 / 3;
		min-height: 180px;
		max-height: min(46vh, 360px);
	}

	.maker-estimator-container {
		margin: 0.75rem 0;
		padding: 14px;
		border-radius: 0;
		box-shadow: none;
	}
}

@media (max-width: 480px) {
	.maker-est-workspace {
		aspect-ratio: 1 / 1;
		max-height: 42vh;
	}

	.maker-est-result-item {
		flex-direction: column;
		gap: 2px;
	}

	.maker-est-result-item span:last-child {
		text-align: left;
	}
}
