/* FBA Calculator — Frontend styles
   Brand: Deep Navy #0F172A / Emerald Green #10B981 / White #FFFFFF
   Mobile-first, minimal, no horizontal scrolling. */

.fbac-calculator {
	--fbac-primary: #10B981;
	--fbac-secondary: #0F172A;
	--fbac-bg: #FFFFFF;
	--fbac-border: #E2E8F0;
	--fbac-text: #0F172A;
	--fbac-muted: #64748B;
	--fbac-danger: #DC2626;
	--fbac-radius: 10px;
	--fbac-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	box-sizing: border-box;
	max-width: 640px;
	width: 100%;
	margin: 24px auto;
	background: var(--fbac-bg);
	border: 1px solid var(--fbac-border);
	border-radius: var(--fbac-radius);
	padding: 20px;
	font-family: var(--fbac-font);
	color: var(--fbac-text);
	overflow-x: hidden;
}
.fbac-calculator *, .fbac-calculator *::before, .fbac-calculator *::after { box-sizing: border-box; }

.fbac-error-box {
	max-width: 640px;
	margin: 16px auto;
	padding: 14px 16px;
	border-radius: 8px;
	background: #FEF2F2;
	color: #991B1B;
	border: 1px solid #FCA5A5;
	font-family: var(--fbac-font);
}

.fbac-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.fbac-header-centered { justify-content: center; text-align: center; margin-bottom: 20px; }
.fbac-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.fbac-logo-large { width: auto; height: 44px; max-width: 220px; object-fit: contain; border-radius: 0; }
.fbac-title { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--fbac-secondary); }
.fbac-tagline { margin: 2px 0 0; font-size: 0.82rem; color: var(--fbac-muted); }

.fbac-form { display: flex; flex-direction: column; gap: 14px; }

.fbac-field { width: 100%; }
.fbac-field label {
	display: flex; align-items: center; gap: 6px;
	font-size: 0.88rem; font-weight: 600; color: var(--fbac-secondary); margin-bottom: 4px;
}
.fbac-required { color: var(--fbac-danger); }
.fbac-tooltip {
	display: inline-flex; align-items: center; justify-content: center;
	width: 16px; height: 16px; border-radius: 50%;
	background: var(--fbac-border); color: var(--fbac-muted);
	font-size: 11px; cursor: help; line-height: 1;
}
.fbac-field-desc { margin: 0 0 6px; font-size: 0.78rem; color: var(--fbac-muted); }

.fbac-input-wrap { display: flex; align-items: stretch; width: 100%; }
.fbac-input-wrap input,
.fbac-field select {
	width: 100%;
	font-size: 1rem;
	padding: 10px 12px;
	border: 1px solid var(--fbac-border);
	border-radius: 8px;
	background: #fff;
	color: var(--fbac-text);
	font-family: var(--fbac-font);
}
.fbac-input-wrap input:focus,
.fbac-field select:focus {
	outline: none;
	border-color: var(--fbac-primary);
	box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.fbac-input-prefix, .fbac-input-suffix {
	display: flex; align-items: center; padding: 0 10px;
	background: #F8FAFC; border: 1px solid var(--fbac-border);
	color: var(--fbac-muted); font-size: 0.9rem; font-weight: 600;
}
.fbac-input-prefix { border-right: none; border-radius: 8px 0 0 8px; }
.fbac-input-suffix { border-left: none; border-radius: 0 8px 8px 0; }
.fbac-input-wrap .fbac-input-prefix + input { border-radius: 0; }
.fbac-input-wrap input:has(+ .fbac-input-suffix) { border-radius: 8px 0 0 8px; }

.fbac-radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.fbac-radio-option, .fbac-checkbox-option {
	display: flex; align-items: center; gap: 6px;
	font-size: 0.9rem; font-weight: 500; color: var(--fbac-text);
}

.fbac-field-error {
	display: block; margin-top: 4px; font-size: 0.78rem; color: var(--fbac-danger); min-height: 0;
}

.fbac-error-summary {
	background: #FEF2F2; border: 1px solid #FCA5A5; color: #991B1B;
	border-radius: 8px; padding: 10px 12px; font-size: 0.85rem;
}
.fbac-error-summary ul { margin: 4px 0 0; padding-left: 18px; }

.fbac-actions { display: flex; gap: 10px; margin-top: 4px; }
.fbac-btn {
	flex: 1; padding: 12px 16px; border-radius: 8px; font-size: 0.95rem; font-weight: 700;
	border: none; cursor: pointer; font-family: var(--fbac-font); transition: opacity .15s ease;
}
.fbac-btn:active { opacity: 0.85; }
.fbac-btn-primary { background: var(--fbac-primary); color: #fff; flex: 2; }
.fbac-btn-secondary { background: #F1F5F9; color: var(--fbac-secondary); flex: 1; }
.fbac-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.fbac-results { margin-top: 22px; border-top: 1px solid var(--fbac-border); padding-top: 18px; }
.fbac-results-grid { display: flex; flex-direction: column; gap: 8px; }
.fbac-result-row {
	display: flex; justify-content: space-between; align-items: center;
	font-size: 0.9rem; padding: 4px 0;
}
.fbac-result-row span { color: var(--fbac-muted); }
.fbac-result-row strong { color: var(--fbac-secondary); font-weight: 700; }
.fbac-result-total { border-top: 1px dashed var(--fbac-border); padding-top: 10px; margin-top: 2px; }
.fbac-result-profit {
	background: rgba(16,185,129,0.08); border-radius: 8px; padding: 10px 12px; margin-top: 4px;
}
.fbac-result-profit span { color: var(--fbac-secondary); font-weight: 600; }
.fbac-result-profit strong { color: var(--fbac-primary); font-size: 1.1rem; }
.fbac-result-profit.fbac-negative strong { color: var(--fbac-danger); }

.fbac-fee-breakdown { margin-top: 14px; font-size: 0.82rem; color: var(--fbac-muted); }
.fbac-fee-breakdown-row { display: flex; justify-content: space-between; padding: 2px 0; }

.fbac-chart { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.fbac-chart-row { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; }
.fbac-chart-label { width: 110px; flex-shrink: 0; color: var(--fbac-muted); }
.fbac-chart-track { flex: 1; height: 10px; background: #F1F5F9; border-radius: 6px; overflow: hidden; }
.fbac-chart-fill { height: 100%; border-radius: 6px; background: var(--fbac-secondary); }
.fbac-chart-fill.is-profit { background: var(--fbac-primary); }
.fbac-chart-value { width: 70px; flex-shrink: 0; text-align: right; color: var(--fbac-secondary); font-weight: 600; }

.fbac-fee-note { margin-top: 14px; font-size: 0.75rem; color: var(--fbac-muted); font-style: italic; }

.fbac-faqs { margin-top: 22px; border-top: 1px solid var(--fbac-border); padding-top: 16px; }
.fbac-faqs h4 { margin: 0 0 10px; color: var(--fbac-secondary); font-size: 1rem; }
.fbac-faq-item { border-bottom: 1px solid var(--fbac-border); padding: 10px 0; }
.fbac-faq-item summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; color: var(--fbac-secondary); }
.fbac-faq-item div { margin-top: 8px; font-size: 0.88rem; color: var(--fbac-text); line-height: 1.5; }

.fbac-powered-by { margin-top: 16px; text-align: center; font-size: 0.72rem; color: var(--fbac-muted); }
.fbac-powered-by a { color: var(--fbac-primary); text-decoration: none; font-weight: 600; }

@media (min-width: 480px) {
	.fbac-calculator { padding: 28px; }
}

/* Dark-mode aware only if the theme explicitly signals it via prefers-color-scheme;
   kept subtle since calculators are typically embedded in light content pages. */
@media (prefers-color-scheme: dark) {
	.fbac-calculator {
		--fbac-bg: #0F172A;
		--fbac-text: #E2E8F0;
		--fbac-border: #1E293B;
		--fbac-muted: #94A3B8;
	}
	.fbac-input-wrap input, .fbac-field select { background: #111827; color: #E2E8F0; }
	.fbac-input-prefix, .fbac-input-suffix, .fbac-btn-secondary { background: #111827; }
}
