/**
 * Refinance Modal widget styles.
 *
 * Source HTML scoped everything to .mms-rate; we re-scope to .mms-refi here
 * so this widget never collides with find-my-rate's .mms-rate selectors
 * when both are on the same page.
 *
 * Brand colors come from --mms-{token} with hex fallbacks. Neutrals stay
 * hardcoded.
 */

/* ── ISOLATION RESET ─────────────────────────────────────────────── */
.mms-refi, .mms-refi *, .mms-refi *::before, .mms-refi *::after {
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
}
.mms-refi .step-title,.mms-refi .success-title {
	font-family: 'DM Sans', sans-serif !important;
	font-weight: 700; line-height: 1.2;
	margin: 0; padding: 0; border: none; background: none;
	color: #1f2937; letter-spacing: -0.01em;
}
.mms-refi p,.mms-refi ul,.mms-refi ol,.mms-refi li {
	margin: 0; padding: 0; list-style: none;
	font-family: 'DM Sans', sans-serif !important;
}
.mms-refi a { text-decoration: none; color: inherit; }
.mms-refi input,.mms-refi select,.mms-refi button,.mms-refi textarea {
	font-family: 'DM Sans', sans-serif !important;
	-webkit-appearance: none; -moz-appearance: none; appearance: none; margin: 0;
}
.mms-refi input[type="number"]::-webkit-inner-spin-button,
.mms-refi input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── ROOT (full-screen overlay) ──────────────────────────────────── */
.mms-refi {
	font-family: 'DM Sans', sans-serif !important;
	font-size: 16px; line-height: 1.5; color: #1f2937;
	background: rgba(0, 0, 0, 0.6);
	position: fixed;
	top: 0; left: 0;
	width: 100%; height: 100%;
	z-index: 999999;
	display: flex; align-items: center; justify-content: center; padding: 16px;
	animation: mmsRefiFadeIn 0.2s ease;

	--p:    var(--mms-p,   #1e3295);
	--pdk:  var(--mms-pdk, #171e3b);
	--sec:  var(--mms-sec, #0ea5c9);
	--p50:  #eff6ff; --p100: #dbeafe;
	--n50:  #f9fafb; --n100: #f3f4f6; --n200: #e5e7eb;
	--n300: #d1d5db; --n400: #9ca3af; --n500: #6b7280;
	--n600: #4b5563; --n700: #374151; --n800: #1f2937;
}
@keyframes mmsRefiFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── MODAL ───────────────────────────────────────────────────────── */
.mms-refi .modal {
	background: white; border-radius: 15px; box-shadow: 0 25px 60px rgba(0,0,0,0.2);
	width: 100%; max-width: 560px; max-height: calc(100vh - 32px);
	display: flex; flex-direction: column;
	animation: mmsRefiSlideIn 0.3s ease; overflow: hidden; position: relative;
}
.mms-refi .modal-body   { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }
.mms-refi .modal-footer { flex: 0 0 auto; }

/* Inline success-screen close button — pinned to top-right. */
.mms-refi .success-screen { position: relative; }
.mms-refi .success-close-btn {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 36px;
	height: 36px;
	border-radius: 999px;
	border: none;
	background: rgba(23,30,59,0.05);
	color: #6b7280;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
	padding: 0;
	z-index: 2;
}
.mms-refi .success-close-btn:hover,
.mms-refi .success-close-btn:focus {
	background: rgba(23,30,59,0.12);
	color: #171E3B;
	outline: none;
}
@keyframes mmsRefiSlideIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.mms-refi .close-btn {
	position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
	border-radius: 50%; border: none; background: transparent; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	color: var(--n400); transition: background 0.15s; z-index: 10;
}
.mms-refi .close-btn:hover { background: var(--n100); color: var(--n700); }

.mms-refi .modal-body { padding: 32px 40px 24px; }
@media (max-width: 480px) { .mms-refi .modal-body { padding: 24px 20px 16px; } }

/* ── PROGRESS ────────────────────────────────────────────────────── */
.mms-refi .progress-wrap { margin-bottom: 28px; }
.mms-refi .progress-labels { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 8px; }
.mms-refi .progress-labels span:first-child { color: var(--n500); }
.mms-refi .progress-labels span:last-child { color: var(--n700); font-weight: 600; }
.mms-refi .progress-track { height: 8px; background: var(--n100); border-radius: 99px; overflow: hidden; }
.mms-refi .progress-bar { height: 100%; background: linear-gradient(to right, var(--p), var(--sec)); border-radius: 99px; transition: width 0.5s cubic-bezier(0.4,0,0.2,1); }

/* ── STEP HEADER ─────────────────────────────────────────────────── */
.mms-refi .step-header { text-align: center; margin-bottom: 28px; }
.mms-refi .step-icon { width: 64px; height: 64px; background: linear-gradient(135deg, var(--p100), #cffafe); border-radius: 15px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.mms-refi .step-icon svg { width: 30px; height: 30px; color: var(--p); }
.mms-refi .step-header .step-title { font-size: 1.7rem; font-weight: 700; color: var(--n800); margin-bottom: 6px; font-family: 'DM Sans', sans-serif !important; }
.mms-refi .step-header p { font-size: 0.95rem; color: var(--n500); line-height: 1.5; }

/* ── OPTIONS ─────────────────────────────────────────────────────── */
.mms-refi .options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.mms-refi .option-label { display: block; padding: 14px 16px; border: 2px solid var(--n200); border-radius: 15px; cursor: pointer; transition: all 0.15s; background: white; }
.mms-refi .option-label:hover { border-color: var(--n300); background: var(--n50); }
.mms-refi .option-label.selected { border-color: var(--p); background: var(--p50); }
.mms-refi .option-inner { display: flex; align-items: center; gap: 14px; }
.mms-refi .option-icon { width: 42px; height: 42px; border-radius: 15px; background: var(--n100); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.mms-refi .option-label.selected .option-icon { background: var(--p100); }
.mms-refi .option-icon svg { width: 20px; height: 20px; color: var(--n500); }
.mms-refi .option-label.selected .option-icon svg { color: var(--p); }
.mms-refi .option-text { flex: 1; }
.mms-refi .option-title { font-size: 0.95rem; font-weight: 600; color: var(--n800); }
.mms-refi .option-desc { font-size: 0.82rem; color: var(--n500); margin-top: 2px; }
.mms-refi .option-radio-dot { width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%; border: 2px solid #d1d5db; background: white; transition: all 0.15s; }
.mms-refi .option-radio-dot.checked { border-color: var(--p); background: var(--p); box-shadow: inset 0 0 0 3px white; }

/* ── INPUT FIELDS ────────────────────────────────────────────────── */
.mms-refi .input-group { margin-bottom: 16px; }
.mms-refi .input-group label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--n600); margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.04em; font-family: 'DM Sans', sans-serif !important; }
.mms-refi .input-wrap { position: relative; }
.mms-refi .input-prefix { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--n400); font-weight: 500; font-size: 0.95rem; pointer-events: none; }
.mms-refi .input-wrap input,
.mms-refi .input-group input,
.mms-refi .input-group select {
	width: 100%; padding: 12px 18px; border: 2px solid var(--n200); border-radius: 999px;
	font-family: 'DM Sans', sans-serif !important; font-size: 0.95rem; color: var(--n800);
	outline: none; transition: border-color 0.15s, box-shadow 0.15s; background: white; line-height: 1.4;
}
.mms-refi .input-wrap input { padding-left: 32px; }
.mms-refi .input-group input:focus,
.mms-refi .input-group select:focus,
.mms-refi .input-wrap input:focus { border-color: var(--p); box-shadow: 0 0 0 3px rgba(30, 50, 149, 0.1); }
.mms-refi .input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 400px) { .mms-refi .input-row { grid-template-columns: 1fr; } }

/* City / State / ZIP row on the property-address step — 3-column on
   desktop with proportions matching the live form (City widest, ZIP
   narrowest). Stacks on narrower screens. */
.mms-refi .input-row-address { grid-template-columns: 2fr 1.2fr 1fr; }
@media (max-width: 600px) { .mms-refi .input-row-address { grid-template-columns: 1fr; } }


/* ── SUCCESS ─────────────────────────────────────────────────────── */
.mms-refi .success-screen { text-align: center; padding: 16px 0 8px; }
.mms-refi .success-icon { width: 80px; height: 80px; background: linear-gradient(135deg, #d1fae5, #a7f3d0); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.mms-refi .success-icon svg { width: 36px; height: 36px; color: #059669; }
.mms-refi .success-screen .success-title { font-size: 1.8rem; font-weight: 700; color: var(--n800); margin-bottom: 10px; font-family: 'DM Sans', sans-serif !important; }
.mms-refi .success-screen p { font-size: 0.95rem; color: var(--n500); line-height: 1.6; max-width: 380px; margin: 0 auto 24px; }
.mms-refi .success-details { background: var(--n50); border: 1px solid var(--n200); border-radius: 15px; padding: 18px 20px; text-align: left; margin-bottom: 20px; }
.mms-refi .detail-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--n100); font-size: 0.85rem; }
.mms-refi .detail-row:last-child { border-bottom: none; }
.mms-refi .detail-row span { color: var(--n500); }
.mms-refi .detail-row strong { color: var(--n800); font-weight: 600; }

/* ── FOOTER NAV ──────────────────────────────────────────────────── */
.mms-refi .modal-footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 40px 28px; }
@media (max-width: 480px) { .mms-refi .modal-footer { padding: 12px 20px 20px; } }

.mms-refi .btn-back { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border: none; background: transparent; font-family: 'DM Sans', sans-serif !important; font-size: 0.95rem; font-weight: 600; color: var(--n600); cursor: pointer; border-radius: 999px; transition: all 0.15s; line-height: 1; }
.mms-refi .btn-back:hover:not(:disabled) { background: var(--n100); color: var(--n800); }
.mms-refi .btn-back:disabled { opacity: 0.4; cursor: not-allowed; }

.mms-refi .btn-next { display: flex; align-items: center; gap: 8px; padding: 12px 28px; border: none; background: linear-gradient(to right, var(--p), var(--pdk)); color: white; font-family: 'DM Sans', sans-serif !important; font-size: 0.95rem; font-weight: 700; border-radius: 999px; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 14px rgba(23, 30, 59, 0.2); line-height: 1; }
.mms-refi .btn-next:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(23, 30, 59, 0.3); }
.mms-refi .btn-next:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.mms-refi .step-content { animation: mmsRefiFadeSlide 0.25s ease; }
@keyframes mmsRefiFadeSlide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* ── MULTI-SELECT CHECKBOX OPTIONS ────────────────────────────────
   Used on the refinance-goal step. Reuses .option-label/.options grid
   from the single-select radio styles but swaps the right-edge dot for
   a square checkbox. */
.mms-refi .option-checkbox .option-check-box {
	width: 22px; height: 22px; flex-shrink: 0;
	border: 2px solid #d1d5db; border-radius: 6px; background: white;
	display: flex; align-items: center; justify-content: center;
	transition: all 0.15s; color: transparent;
}
.mms-refi .option-checkbox .option-check-box svg { width: 14px; height: 14px; }
.mms-refi .option-checkbox.selected .option-check-box,
.mms-refi .option-checkbox .option-check-box.checked {
	border-color: var(--p); background: var(--p); color: white;
}

/* ── INPUT SUFFIX (% on current-rate step) ────────────────────────── */
.mms-refi .input-wrap-suffix .input-suffix {
	position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
	color: var(--n400); font-weight: 500; font-size: 0.95rem; pointer-events: none;
}
.mms-refi .input-wrap-suffix input { padding-right: 40px; padding-left: 18px; }

/* Estimate disclaimer — small italic block below step content. */
.mms-refi .mms-refi-estimate-disclaimer {
	margin-top: 18px;
	padding: 12px 14px;
	background: var(--n50);
	border-radius: 10px;
	font-size: 0.72rem;
	font-style: italic;
	color: var(--n500);
	line-height: 1.5;
}
