/* FinanceCalcwise calculator widget styles.
   Uses CSS custom properties so any theme (including a non-matching one)
   can restyle it just by redefining these variables. */

.fcw-calculator {
	--fcw-primary: #2563eb;
	--fcw-primary-contrast: #ffffff;
	--fcw-border: #e2e8f0;
	--fcw-bg: #ffffff;
	--fcw-bg-muted: #f8fafc;
	--fcw-text: #0f172a;
	--fcw-text-muted: #64748b;
	--fcw-danger: #dc2626;
	--fcw-radius: 10px;

	max-width: 480px;
	background: var(--fcw-bg);
	border: 1px solid var(--fcw-border);
	border-radius: var(--fcw-radius);
	padding: 24px;
	font-family: inherit;
	color: var(--fcw-text);
	box-sizing: border-box;
}
.fcw-calculator * { box-sizing: border-box; }

/* When the FinanceCalcwise theme is active, match its brand color instead of
   the plugin's own default blue (see functions.php, which prints this). */
body.fcw-theme-active .fcw-calculator {
	--fcw-primary: var(--fcw-theme-primary-color, #2563eb);
}

/* Dark mode: if the page has html.dark (the convention used by the
   FinanceCalcwise theme's toggle, and common elsewhere), switch the
   widget's own palette too — otherwise a light calculator card would look
   out of place dropped onto a dark page. */
html.dark .fcw-calculator {
	--fcw-border: #2a3441;
	--fcw-bg: #16211c;
	--fcw-bg-muted: #1c2a23;
	--fcw-text: #ecf3ee;
	--fcw-text-muted: #9fb0a8;
	--fcw-danger: #f87171;
}

.fcw-field { margin-bottom: 16px; }
.fcw-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.fcw-field-row .fcw-field { margin-bottom: 0; }
.fcw-field-narrow { max-width: 140px; }

.fcw-calculator label {
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--fcw-text);
}

.fcw-calculator input[type="number"],
.fcw-calculator input[type="text"],
.fcw-calculator select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--fcw-border);
	border-radius: 8px;
	font-size: 1rem;
	background: var(--fcw-bg);
	color: var(--fcw-text);
}
.fcw-calculator input:focus,
.fcw-calculator select:focus {
	outline: none;
	border-color: var(--fcw-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--fcw-primary) 20%, transparent);
}

.fcw-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.fcw-tab {
	flex: 1;
	padding: 10px;
	border: 1px solid var(--fcw-border);
	background: var(--fcw-bg-muted);
	color: var(--fcw-text-muted);
	border-radius: 8px;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s, color .15s;
}
.fcw-tab.active { background: var(--fcw-primary); color: var(--fcw-primary-contrast); border-color: var(--fcw-primary); }

.fcw-subhead { margin: 20px 0 10px; font-size: 0.95rem; }

.fcw-result { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--fcw-border); }
.fcw-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; font-size: 0.95rem; }
.fcw-row span:first-child { color: var(--fcw-text-muted); }
.fcw-row span:last-child { font-weight: 600; }
.fcw-row-total { border-top: 1px solid var(--fcw-border); margin-top: 6px; padding-top: 12px; font-size: 1.1rem; }
.fcw-row-total span:last-child { color: var(--fcw-primary); font-weight: 700; }
.fcw-row-neg span:last-child { color: var(--fcw-danger); }

.fcw-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fcw-compare-col h4 { margin: 0 0 10px; }

.fcw-note { font-size: 0.85rem; color: var(--fcw-text-muted); margin-top: 12px; line-height: 1.5; }
.fcw-note.fcw-warning { color: var(--fcw-danger); }

.fcw-sparkline { width: 100%; height: 80px; margin-top: 16px; color: var(--fcw-primary); }

.fcw-calc-loading { color: var(--fcw-text-muted); font-size: 0.9rem; }

@media (max-width: 480px) {
	.fcw-field-row,
	.fcw-compare { grid-template-columns: 1fr; }
}
