/**
 * Find My Rate widget styles.
 *
 * Tokenized: brand colors come from --mms-{token}, with hex fallbacks
 * inline so the modal still renders correctly even if the plugin's
 * :root style block hasn't loaded yet (e.g. in Elementor's editor preview
 * before the wp_head hook fires).
 *
 * Neutral grays (n50–n800) are kept hardcoded — they're not brand-locked
 * and exposing them in plugin settings would clutter the UI for a
 * customization nobody's likely to want.
 */

/* ── ISOLATION RESET ─────────────────────────────────────────────── */
.mms-rate, .mms-rate *, .mms-rate *::before, .mms-rate *::after {
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
}
.mms-rate .step-title,.mms-rate .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-rate p,.mms-rate ul,.mms-rate ol,.mms-rate li {
	margin: 0; padding: 0; list-style: none;
	font-family: 'DM Sans', sans-serif !important;
}
.mms-rate a { text-decoration: none; color: inherit; }
.mms-rate input,.mms-rate select,.mms-rate button,.mms-rate textarea {
	font-family: 'DM Sans', sans-serif !important;
	-webkit-appearance: none; -moz-appearance: none; appearance: none; margin: 0;
}
.mms-rate input[type="number"]::-webkit-inner-spin-button,
.mms-rate input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── ROOT (overlay) ──────────────────────────────────────────────── */
.mms-rate {
	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;

	/* Local fallbacks — match the design-system defaults so the modal
	   renders correctly even before the plugin :root vars resolve. */
	--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;

	animation: mmsFadeIn 0.2s ease;
}
@keyframes mmsFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── MODAL ───────────────────────────────────────────────────────── */
/* Flex column layout so close-btn stays pinned at top, body scrolls,
   footer stays at bottom. max-height: 100vh - 32px keeps the modal
   inside the viewport so the body's overflow can actually scroll. */
.mms-rate .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: mmsSlideIn 0.3s ease;
	overflow: hidden;
	position: relative;
}
.mms-rate .modal-body  { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }
.mms-rate .modal-footer { flex: 0 0 auto; }

/* Inline success-screen close button — pinned to top-right. */
.mms-rate .success-screen { position: relative; }
.mms-rate .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-rate .success-close-btn:hover,
.mms-rate .success-close-btn:focus {
	background: rgba(23,30,59,0.12);
	color: #171E3B;
	outline: none;
}
@keyframes mmsSlideIn { from { opacity:0; transform: translateY(20px) scale(0.98); } to { opacity:1; transform: translateY(0) scale(1); } }

.mms-rate .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-rate .close-btn:hover { background: var(--n100); color: var(--n700); }

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

/* ── PROGRESS ────────────────────────────────────────────────────── */
.mms-rate .progress-wrap { margin-bottom: 28px; }
.mms-rate .progress-labels { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 8px; }
.mms-rate .progress-labels span:first-child { color: var(--n500); }
.mms-rate .progress-labels span:last-child { color: var(--n700); font-weight: 600; }
.mms-rate .progress-track { height: 8px; background: var(--n100); border-radius: 99px; overflow: hidden; }
.mms-rate .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-rate .step-header { text-align: center; margin-bottom: 28px; }
.mms-rate .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-rate .step-icon svg { width: 30px; height: 30px; color: var(--p); }
.mms-rate .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-rate .step-header p { font-size: 0.95rem; color: var(--n500); line-height: 1.5; }

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

/* ── INPUT FIELDS ────────────────────────────────────────────────── */
.mms-rate .input-group { margin-bottom: 16px; }
.mms-rate .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-rate .input-wrap { position: relative; }
.mms-rate .input-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--n400); font-weight: 500; font-size: 0.95rem; pointer-events: none; }
.mms-rate .input-wrap input,
.mms-rate .input-group input,
.mms-rate .input-group select {
	width: 100%; padding: 12px 14px; border: 2px solid var(--n200); border-radius: 15px;
	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-rate .input-wrap input { padding-left: 30px; }
.mms-rate .input-group input:focus,
.mms-rate .input-group select:focus,
.mms-rate .input-wrap input:focus { border-color: var(--p); box-shadow: 0 0 0 3px rgba(30, 50, 149, 0.1); }
.mms-rate .input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 400px) { .mms-rate .input-row { grid-template-columns: 1fr; } }


/* ── SUCCESS ─────────────────────────────────────────────────────── */
.mms-rate .success-screen { text-align: center; padding: 16px 0 8px; }
.mms-rate .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-rate .success-icon svg { width: 36px; height: 36px; color: #059669; }
.mms-rate .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-rate .success-screen p { font-size: 0.95rem; color: var(--n500); line-height: 1.6; max-width: 380px; margin: 0 auto 24px; }
.mms-rate .success-details { background: var(--n50); border: 1px solid var(--n200); border-radius: 15px; padding: 18px 20px; text-align: left; margin-bottom: 20px; }
.mms-rate .detail-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--n100); font-size: 0.85rem; }
.mms-rate .detail-row:last-child { border-bottom: none; }
.mms-rate .detail-row span { color: var(--n500); }
.mms-rate .detail-row strong { color: var(--n800); font-weight: 600; }

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

.mms-rate .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: 15px; transition: all 0.15s; line-height: 1; }
.mms-rate .btn-back:hover:not(:disabled) { background: var(--n100); color: var(--n800); }
.mms-rate .btn-back:disabled { opacity: 0.4; cursor: not-allowed; }

.mms-rate .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: 15px; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 14px rgba(23, 30, 59, 0.2); line-height: 1; }
.mms-rate .btn-next:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(23, 30, 59, 0.3); }
.mms-rate .btn-next:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

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

/* ── MULTI-SELECT CHECKBOX OPTIONS (refinance goal step) ─────────── */
.mms-rate .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-rate .option-checkbox .option-check-box svg { width: 14px; height: 14px; }
.mms-rate .option-checkbox.selected .option-check-box,
.mms-rate .option-checkbox .option-check-box.checked {
	border-color: var(--p); background: var(--p); color: white;
}

/* ── INPUT SUFFIX (% on rate / down-payment percentage) ───────────── */
.mms-rate .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-rate .input-wrap-suffix input { padding-right: 40px; padding-left: 18px; }

/* ── PROPERTY ADDRESS ROW (city / state / ZIP three-up) ───────────── */
.mms-rate .input-row-address { grid-template-columns: 2fr 1.2fr 1fr; }
@media (max-width: 600px) { .mms-rate .input-row-address { grid-template-columns: 1fr; } }

/* ── DISCLOSURE (credit score "won't affect your credit" notice) ──── */
.mms-rate .mms-disclosure {
	display: flex; align-items: center; gap: 10px;
	margin-top: 12px;
	padding: 12px 14px;
	background: var(--p50);
	border-radius: 12px;
	font-size: 0.85rem; color: var(--p);
	font-weight: 500;
}
.mms-rate .mms-disclosure svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Estimate disclaimer — small italic block below step content. Always
   visible regardless of step so users see the "not an offer to lend"
   language at every interaction with the calculator. */
.mms-rate .mms-rate-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;
}

/* Inline field error message — shown when an input fails validation
   (e.g. ZIP code length, email format). Pairs with .has-error on the
   input to give visual feedback the field is the source of the error. */
.mms-rate .field-error {
	display: block;
	margin-top: 6px;
	font-size: 0.75rem;
	color: #dc2626;
	line-height: 1.4;
}
.mms-rate .field-error[hidden] { display: none; }
.mms-rate input.has-error,
.mms-rate select.has-error { border-color: #dc2626 !important; }
.mms-rate input.has-error:focus,
.mms-rate select.has-error:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important; }
