/* OutputMath calculator components. Global color variables may be supplied by the theme. */

.om-calculator {
	max-width: 760px;
	margin: 32px auto;
	color: var(--om-text, #111827);
	font-family: var(--om-font, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.om-calculator__title {
	margin: 0 0 12px;
	font-size: clamp(1.5rem, 4vw, 2rem);
	line-height: 1.25;
}

.om-calculator__description {
	margin: 0 0 24px;
	color: var(--om-text-secondary, #475569);
}

.om-calculator__form {
	margin-top: 28px;
}

.om-input-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
}

.om-field {
	min-width: 0;
}

.om-fieldset {
	margin: 0;
	padding: 0;
	border: 0;
}

.om-duration-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.om-input-grid--spaced {
	margin-top: 24px;
}

.om-label {
	display: block;
	margin-bottom: 8px;
	color: var(--om-text, #111827);
	font-size: 0.875rem;
	font-weight: 700;
}

.om-label--secondary {
	color: var(--om-text-secondary, #475569);
	font-weight: 600;
}

.om-input {
	width: 100%;
	min-height: 48px;
	padding: 11px 14px;
	color: var(--om-text, #111827);
	background: var(--om-surface, #ffffff);
	border: 1px solid var(--om-border-strong, #b8c4d4);
	border-radius: var(--om-radius-md, 10px);
	box-shadow: none;
}

.om-input:focus {
	border-color: var(--om-primary, #2563eb);
	box-shadow: var(--om-focus-ring, 0 0 0 3px rgba(37, 99, 235, 0.24));
	outline: 0;
}

.om-helper-text,
.om-result-note {
	color: var(--om-text-secondary, #475569);
	font-size: 0.875rem;
}

.om-helper-text {
	margin: 14px 0 0;
}

.om-result-note {
	margin: 0 0 18px;
}

.om-input-with-unit {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	overflow: hidden;
	background: var(--om-surface, #ffffff);
	border: 1px solid var(--om-border-strong, #b8c4d4);
	border-radius: var(--om-radius-md, 10px);
}

.om-input-with-unit:focus-within {
	border-color: var(--om-primary, #2563eb);
	box-shadow: var(--om-focus-ring, 0 0 0 3px rgba(37, 99, 235, 0.24));
}

.om-input-with-unit input {
	width: 100%;
	min-width: 0;
	min-height: 48px;
	padding: 11px 14px;
	color: var(--om-text, #111827);
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.om-input-with-unit input:focus {
	outline: 0;
	box-shadow: none;
}

.om-input-with-unit span {
	padding: 0 14px;
	color: var(--om-text-muted, #64748b);
	font-size: 0.875rem;
	font-weight: 600;
}

.om-field-error {
	margin: 16px 0 0;
	padding: 12px 14px;
	color: var(--om-error, #dc2626);
	background: var(--om-error-soft, #fef2f2);
	border-radius: var(--om-radius-sm, 6px);
	font-weight: 600;
}

.om-button-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 24px;
}

.om-calculator__message {
	margin-top: 20px;
}

.om-card {
	padding: 32px;
	background: var(--om-surface, #ffffff);
	border: 1px solid var(--om-border, #dbe3ee);
	border-radius: var(--om-radius-lg, 16px);
	box-shadow: var(--om-shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.06));
}

.om-button-primary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 22px;
	color: #ffffff;
	background: var(--om-primary, #2563eb);
	border: 0;
	border-radius: var(--om-radius-md, 10px);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
}

.om-button-primary:hover {
	color: #ffffff;
	background: var(--om-primary-hover, #1d4ed8);
}

.om-button-primary:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.28);
	outline-offset: 2px;
}

.om-button-secondary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 22px;
	color: var(--om-text, #111827);
	background: var(--om-surface, #ffffff);
	border: 1px solid var(--om-border-strong, #b8c4d4);
	border-radius: var(--om-radius-md, 10px);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
}

.om-button-secondary:hover {
	color: var(--om-primary-hover, #1d4ed8);
	background: var(--om-primary-soft, #eff6ff);
	border-color: var(--om-primary, #2563eb);
}

.om-result {
	margin-top: 28px;
	padding: 24px;
	background: var(--om-primary-soft, #eff6ff);
	border: 1px solid #bfdbfe;
	border-radius: var(--om-radius-lg, 16px);
}

.om-result__eyebrow {
	margin: 0 0 4px;
	color: var(--om-text-secondary, #475569);
	font-size: 0.875rem;
	font-weight: 700;
}

.om-result-value {
	margin: 0;
	color: var(--om-primary-hover, #1d4ed8);
	font-size: clamp(2.25rem, 7vw, 3.5rem);
	font-weight: 800;
	letter-spacing: -0.05em;
	line-height: 1.1;
}

.om-result-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin: 24px 0;
}

.om-result-grid div {
	padding: 14px;
	background: var(--om-surface, #ffffff);
	border: 1px solid var(--om-border, #dbe3ee);
	border-radius: var(--om-radius-md, 10px);
}

.om-result-grid dt {
	color: var(--om-text-muted, #64748b);
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
}

.om-result-grid dd {
	margin: 4px 0 0;
	color: var(--om-text, #111827);
	font-size: 1.0625rem;
	font-weight: 700;
}

.om-matching-dimensions {
	margin-top: 28px;
	padding-top: 28px;
	border-top: 1px solid var(--om-border, #dbe3ee);
}

.om-matching-dimensions h3 {
	margin: 0 0 8px;
	font-size: 1.25rem;
}

.om-matching-dimensions > p {
	margin: 0 0 20px;
	color: var(--om-text-secondary, #475569);
}

.om-notice-success,
.om-notice-error {
	padding: 16px;
	border-radius: var(--om-radius-sm, 6px);
}

.om-notice-success {
	background: var(--om-success-soft, #ecfdf5);
	border-left: 4px solid var(--om-success, #0f9f8f);
}

.om-notice-error {
	background: var(--om-error-soft, #fef2f2);
	border-left: 4px solid var(--om-error, #dc2626);
}

@media (max-width: 768px) {
	.om-calculator {
		margin: 20px 0;
	}

	.om-card {
		padding: 20px 16px;
	}

	.om-input-grid,
	.om-duration-grid,
	.om-result-grid {
		grid-template-columns: 1fr;
	}

	.om-button-primary,
	.om-button-secondary {
		width: 100%;
	}
}
