/* /css/mr-calculators.css
   The calculators' shared look, matching the buyer, market, lender and company dashboards:
   Poppins, LoanGlass green, white cards with soft borders, pill buttons, dark tooltips.
   Every calculator view (desktop and mobile) wraps its markup in <div class="lgc"> and links this
   file; everything here is scoped to .lgc so the theme's own calculator CSS (StyleSheet-Green.css,
   compiled by uSkinned) still applies anywhere else. Chart colors and fonts come from
   /scripts/mr-calculators-theme.js. */

.lgc {
    --lgc-green: #2f9e44; --lgc-green-d: #166534; --lgc-green-l: #ebf8ee; --lgc-green-b: #cfe9d6;
    --lgc-ink: #14181f; --lgc-muted: #5b6472; --lgc-line: #e3e7ec; --lgc-bg: #f5f7f9;
    --lgc-blue: #1a56db; --lgc-blue-l: #eaf1ff; --lgc-purple: #7c3aed; --lgc-amber: #b45309;
    --lgc-radius: 22px; --lgc-sticky-top: 100px;
    font-family: Poppins, sans-serif; color: var(--lgc-ink);
}
.lgc *, .lgc *::before, .lgc *::after { box-sizing: border-box; }

/* ---------- layout ---------- */
.lgc .calc-container { gap: 28px; margin-top: 8px; align-items: flex-start; }
.lgc .calc-form,
.lgc .mobile-calc-form {
    background: #fff; border: 1px solid var(--lgc-line); border-radius: var(--lgc-radius);
    box-shadow: 0 1px 3px rgba(20,24,31,.05); gap: 4px;
}
.lgc .calc-form { flex: 0 0 280px; padding: 20px 20px 18px; top: var(--lgc-sticky-top); }
.lgc .mobile-calc-form { padding: 18px 16px 16px; }
.lgc .calc-charts, .lgc .mobile-calc-charts { min-width: 0; }
.lgc .mobile-calc-container { gap: 18px; }

/* Section titles inside the form ("Your New Loan", "Your Situation", "Loan A") */
.lgc .calc-form h6, .lgc .mobile-calc-form h6, .lgc .scenario-box h6 {
    font: 700 12px/1.3 Poppins, sans-serif !important; letter-spacing: .08em; text-transform: uppercase;
    color: var(--lgc-green-d) !important; margin: 0 0 4px; text-align: left !important;
}
.lgc .mobile-section-header { font-size: 12px !important; font-weight: 700 !important; letter-spacing: .08em; text-transform: uppercase; color: var(--lgc-green-d) !important; }
.lgc > h3, .lgc .mobile-calc-title { font-size: 22px; font-weight: 600; letter-spacing: -.3px; color: var(--lgc-ink); }

/* ---------- fields ---------- */
.lgc .field-label, .lgc .small-field-label {
    display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap;
    font-size: 13px; font-weight: 600; color: var(--lgc-ink); margin: 10px 0 5px; line-height: 1.35;
}
.lgc .field-label small, .lgc .small-field-label small { font-weight: 500; color: var(--lgc-muted); font-size: 12px; }
.lgc .field-label.has-tooltip, .lgc .small-field-label.has-tooltip { cursor: help; }
.lgc .field-label.has-tooltip::after, .lgc .small-field-label.has-tooltip::after {
    content: "?"; display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 15px; height: 15px; border-radius: 50%; background: var(--lgc-bg); color: var(--lgc-muted);
    font-size: 10px; font-weight: 700; line-height: 1;
}
.lgc .switch-label .field-label.has-tooltip::after { display: none; }
.lgc .field-label.has-tooltip .tooltip-text, .lgc .small-field-label.has-tooltip .tooltip-text {
    background: var(--lgc-ink); color: #fff; border-radius: 12px; padding: 10px 12px;
    font: 400 13px/1.5 Poppins, sans-serif; white-space: normal; width: max-content; max-width: 280px;
    box-shadow: 0 10px 28px rgba(20,24,31,.22); bottom: calc(100% + 8px); text-transform: none; letter-spacing: 0;
}

/* Right padding is left to the wrappers ($ spinners, % and "Years" suffixes) that reserve room. */
/* Hidden tooltips still take up room: on phones keep them inside the screen, and open the
   right-hand column's to the left, or the page scrolls sideways. */
.lgc .has-tooltip:not(:hover) .tooltip-text { display: none; }
@media (max-width: 991.98px) { .lgc .has-tooltip .tooltip-text { max-width: min(280px, calc(100vw - 48px)) !important; } }
.lgc .mobile-calc-form .field-label.has-tooltip .tooltip-text { max-width: min(260px, calc(100vw - 48px)); }
.lgc .mobile-field-row > div:nth-child(2) .field-label.has-tooltip .tooltip-text { left: auto; right: 0; }

.lgc input[type="text"], .lgc input[type="number"], .lgc input[type="email"], .lgc select:not([multiple]) {
    min-height: 44px; border: 1px solid #d5dbe2; border-radius: 12px; background-color: #fbfcfd;
    padding-top: 9px; padding-bottom: 9px; padding-left: 12px; font: 500 15px Poppins, sans-serif; color: var(--lgc-ink); box-shadow: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.lgc select:not([multiple]) {
    -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.lgc input[type="text"]:focus, .lgc input[type="number"]:focus, .lgc select:focus {
    outline: none; border-color: var(--lgc-green); background-color: #fff; box-shadow: 0 0 0 4px rgba(47,158,68,.15);
}
.lgc input[readonly], .lgc input:disabled, .lgc .input-readonly { background-color: var(--lgc-bg) !important; color: var(--lgc-muted); }
.lgc .pct-wrapper::after, .lgc .points-spinner::after, .lgc .years-wrapper::after, .lgc .months-wrapper::after { color: var(--lgc-muted); font-size: 13px; font-weight: 500; }
.lgc .split-inputs { gap: 8px; }
.lgc .spinner-buttons { right: 6px; gap: 0; }
.lgc .spinner-buttons button {
    width: 22px; height: 16px; border-radius: 5px; color: var(--lgc-muted); font-size: 9px; line-height: 16px;
    transition: background .15s, color .15s;
}
.lgc .spinner-buttons button:hover { background: var(--lgc-green-l); color: var(--lgc-green-d); }

/* Range sliders (DTI etc.) */
.lgc input[type="range"] { width: 100%; accent-color: var(--lgc-green); min-height: 0; padding: 0; border: 0; background: none; }
.lgc .input-slider { font-size: 13px; color: var(--lgc-muted); }
.lgc .input-slider span { font-weight: 600; color: var(--lgc-ink); }

/* Toggle switches */
.lgc .switch-label { gap: 10px; font-weight: 600; margin-top: 8px; }
.lgc .switch-label .slider, .lgc .stacked-toggles .slider { flex: none; width: 36px; height: 20px; background-color: #d5dbe2; }
.lgc .switch-label .slider::before, .lgc .stacked-toggles .slider::before { width: 16px; height: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.lgc .switch-label input:checked + .slider, .lgc .stacked-toggles input:checked + .slider { background-color: var(--lgc-green); }
.lgc .switch-label .field-label, .lgc .input-switch { margin: 0; font-size: 13px !important; font-weight: 500; color: var(--lgc-ink); }
/* The theme's ".calc-form input { padding:10px }" gave the hidden checkbox a width and pushed every switch right. */
.lgc .switch-label input[type="checkbox"] { position: absolute; padding: 0; border: 0; margin: 0; }
.lgc .switch-label input:focus-visible + .slider { outline: 3px solid var(--lgc-blue); outline-offset: 2px; }

/* "Show other inputs" link and similar */
.lgc .calc-form > .toggle-btn, .lgc .mobile-calc-form > .toggle-btn, .lgc .toggle-link {
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin: 6px 0 0; padding: 7px 13px;
    border-radius: 999px; background: var(--lgc-green-l); color: var(--lgc-green-d); font: 600 13px Poppins, sans-serif;
    text-decoration: none; border: 0; transition: background .15s;
}
.lgc .calc-form > .toggle-btn:hover, .lgc .mobile-calc-form > .toggle-btn:hover, .lgc .toggle-link:hover { background: #dcf2e2; }

/* Two-way toggles (purchase/refinance) and the A/B button sliders */
.lgc .purchase-refinance-toggle .toggle-btn { height: 44px; line-height: 44px; border-color: #d5dbe2; font-family: Poppins, sans-serif; }
.lgc .purchase-refinance-toggle .toggle-btn:first-child { border-radius: 12px 0 0 12px; }
.lgc .purchase-refinance-toggle .toggle-btn:nth-child(2) { border-radius: 0 12px 12px 0; }
.lgc .purchase-refinance-toggle .toggle-btn.active { background: var(--lgc-green-l); color: var(--lgc-green-d); }
.lgc .button-slider-button { border-color: var(--lgc-green); border-radius: 12px; }
.lgc .button-slider-button.left.active, .lgc .button-slider-button.right.active { background: var(--lgc-green); }

/* ---------- saved scenarios ---------- */
.lgc .scenario { width: auto; margin-top: 16px; }
.lgc .scenario-box { background: var(--lgc-green-l); border: 1px solid var(--lgc-green-b); border-radius: 18px; padding: 14px 14px 12px; text-align: left; }
.lgc .scenario-button {
    border-radius: 999px; background-color: var(--lgc-green); padding: 10px 18px; font: 600 14px Poppins, sans-serif;
    box-shadow: 0 6px 16px rgba(47,158,68,.22); transition: background-color .15s, transform .15s;
}
.lgc .scenario-button:hover { background-color: var(--lgc-green-d); transform: translateY(-1px); }
.lgc .scenario-save { font-size: 13px; color: var(--lgc-muted); }
.lgc .scenario-entry, .lgc .scenario-save a { color: var(--lgc-blue); font-weight: 600; }

/* ---------- results ----------
   Results text runs larger than the form's (labels 15-16px, figures 20px and up), and the
   charts are tall (each calculator sets its own chart heights). */
.lgc .chart-box {
    margin-top: 22px; background: #fff; border: 1px solid var(--lgc-line); border-radius: var(--lgc-radius);
    padding: 14px 10px 6px; box-shadow: 0 1px 3px rgba(20,24,31,.04); max-width: 100%;
}
.lgc .chart-description {
    font-size: 17px; line-height: 1.6; color: var(--lgc-muted); margin: 10px 4px 0; max-width: 900px;
}
.lgc .calc-headline, .lgc .calc-headline1 { font-size: 16px !important; font-weight: 700 !important; letter-spacing: .08em; text-transform: uppercase; color: var(--lgc-muted) !important; margin-bottom: 4px; }
.lgc .calc-headline-big, .lgc .calc-headline-big2, .lgc #totalPaymentAmount, .lgc #mobile_totalPaymentAmount {
    color: var(--lgc-green-d) !important; font-weight: 700 !important; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.05;
}
.lgc .calc-headline-big { font-size: 64px; margin-bottom: 8px; }
.lgc .calc-headline-big2 { font-size: 48px; }
.lgc .calc-error { font-size: 28px; font-weight: 600; color: #c92a2a; margin-top: 30px; }

/* Summary figures next to charts */
.lgc .chart-details { font-size: 17px; color: var(--lgc-ink); gap: 12px; }
.lgc .chart-details-header { font-size: 22px; font-weight: 600; color: var(--lgc-ink); }
.lgc .chart-details-label { font-size: 16px; color: var(--lgc-muted); }
.lgc .chart-details-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- AI analysis button and modal (purple, as in the company page's AI section) ---------- */
.lgc .floating-ai-btn, .lgc .mobile-floating-ai-btn {
    background: radial-gradient(120px 60px at 0% 0%, rgba(124,58,237,.9), transparent 70%), linear-gradient(135deg, #3b2a8f 0%, #14181f 100%) !important;
    border-radius: 999px !important; font: 600 15px Poppins, sans-serif !important;
    box-shadow: 0 10px 28px rgba(76,29,149,.35) !important; border: 1px solid rgba(196,181,253,.35) !important;
}
.lgc .floating-ai-btn svg, .lgc .mobile-floating-ai-btn svg { color: #c4b5fd; }
.lgc .ai-modal, .lgc .mobile-ai-modal { background-color: rgba(20,24,31,.55); backdrop-filter: blur(3px); }
.lgc .ai-modal-content, .lgc .mobile-ai-modal-content { border-radius: 24px !important; overflow: hidden; font-family: Poppins, sans-serif; }
.lgc .ai-modal-header, .lgc .mobile-ai-modal-header {
    background: radial-gradient(500px 200px at 0% 0%, rgba(124,58,237,.45), transparent 60%), linear-gradient(135deg, #171a2e 0%, #14181f 80%) !important;
    border-radius: 0 !important;
}
.lgc .ai-modal-title, .lgc .mobile-ai-modal-title { font-size: 20px !important; font-weight: 600 !important; letter-spacing: -.2px; color: #fff !important; }
.lgc .ai-btn-primary, .lgc .mobile-ai-btn-primary {
    background: linear-gradient(135deg, var(--lgc-purple) 0%, var(--lgc-blue) 100%) !important; border-radius: 999px !important;
    font: 600 15px Poppins, sans-serif !important; padding: 11px 22px !important;
}
.lgc .ai-btn-secondary, .lgc .mobile-ai-btn-secondary { border-radius: 999px !important; font: 600 15px Poppins, sans-serif !important; padding: 11px 22px !important; background: var(--lgc-bg) !important; }
.lgc .ai-loading-spinner, .lgc .mobile-ai-loading-spinner { border-top-color: var(--lgc-purple) !important; }
.lgc .ai-highlight { border-left-color: var(--lgc-purple) !important; border-radius: 0 14px 14px 0 !important; }

/* The AI button sits bottom-right everywhere (the views centred it on the right edge, over the
   results). No transform or float animation: an animation would beat "transform: none". */
/* On the calculator pages it sits above uSkinned's back-to-top button (60px, bottom-right). */
.lgc .floating-ai-btn, .lgc .mobile-floating-ai-btn { top: auto !important; bottom: 92px !important; right: 20px !important; transform: none !important; animation: none !important; }
.lgc .floating-ai-btn:hover, .lgc .mobile-floating-ai-btn:hover { transform: translateY(-3px) !important; }
html.lg-embed .lgc .floating-ai-btn, html.lg-embed .lgc .mobile-floating-ai-btn { bottom: 24px !important; right: 24px !important; }
@media (max-width: 991.98px) {
    .lgc .floating-ai-btn, .lgc .mobile-floating-ai-btn { right: 16px !important; }
    html.lg-embed .lgc .floating-ai-btn, html.lg-embed .lgc .mobile-floating-ai-btn { bottom: 16px !important; right: 16px !important; }
}

/* ---------- inside the calculator dashboard (?lgembed=1): no site header, so nothing to clear ---------- */
html.lg-embed .lgc { --lgc-sticky-top: 16px; }

@media (max-width: 991.98px) {
    .lgc .calc-form { flex-basis: 100%; position: static; }
    .lgc .calc-headline-big { font-size: 50px; }
}
@media print {
    .lgc .chart-box { border: 0; box-shadow: none; padding: 0; }
    .lgc .floating-ai-btn, .lgc .mobile-floating-ai-btn { display: none !important; }
}
