/*
 * Mobile-only home page layout (FactoryPlans): header, badge row, MOPAR / FORD
 * buttons, footer and sticky bar.
 * Loaded by resources/views/index.blade.php, AFTER frontend/css/mobile-blocks.css,
 * which holds the shared quote block styles. Based on the Ford/Chrysler file; the
 * FactoryPlans-only differences are marked "FactoryPlans".
 * EVERY rule lives inside the max-width query below, so tablet (>=768px)
 * and desktop rendering are unchanged.
 *
 * Reordering: on mobile the nested sidebar/content wrappers (.m-contents)
 * become display:contents, which flattens every box into one flex column
 * (.m-flow) that is then ordered with the .m-o-* classes (see mobile-blocks.css).
 * No markup is duplicated or removed, so all content stays crawlable.
 */
@media (max-width: 767.98px) {

	/* home page: hide anything marked .m-hide (header, footer, slider, promo bits) */
	.m-hide { display: none !important; }

	body { padding-bottom: 76px; } /* room for the sticky CTA bar */

	/* ---------- header ---------- */
	html #header .notice-top-bar .row { padding-top: 4px !important; padding-bottom: 4px !important; }
	html #header .notice-top-bar .col-9 { flex: 0 0 85%; max-width: 85%; }
	html #header .notice-top-bar span,
	html #header .notice-top-bar span * {
		font-size: 13px !important;
		line-height: 1.3 !important;
	}
	html #header .header-top,
	html #header .header-top.bg-color-light {
		background-color: #0099e6 !important;
		min-height: 0 !important;
	}
	#header .header-top .container {
		padding-left: 12px;
		padding-right: 12px;
		background-color: transparent !important;
	}
	#header .header-nav-top .nav-item > span > span img { width: 18px !important; }
	#header .header-top .header-row { min-height: 0 !important; }
	#header .header-nav-top { width: 100% !important; }
	#header .header-nav-top .nav {
		display: flex !important;
		width: 100%;
		padding-right: 0 !important;
	}
	#header .header-nav-top .nav-item {
		width: 100%;
		justify-content: space-between;
		padding-top: 6px !important;
		padding-bottom: 6px !important;
	}
	#header .custom-header-top-nav-background::before,
	#header .custom-header-top-nav-background::after { display: none !important; }
	#header .header-nav-top a { font-size: 13px !important; }
	#header .m-show-email {
		display: flex !important;
		margin-left: auto !important;
	}
	#header .m-show-email img { display: none !important; }
	#header .m-show-email a { font-weight: 500 !important; }

	/* ---------- badge row (Guarantee + BBB) ---------- */
	.m-badges {
		display: flex !important;
		justify-content: center;
		flex-wrap: wrap;
		gap: 8px;
		padding: 10px 12px;
		background: #fffbea;
		border-bottom: 1px solid #efe6c4;
	}
	.m-badge-pill {
		display: inline-block;
		padding: 4px 12px;
		border: 1px solid #d9cfa6;
		border-radius: 999px;
		background: #fff;
		color: #333 !important;
		font-size: 12px;
		font-weight: 600;
		line-height: 1.4;
		text-decoration: none !important;
	}

	/* ---------- flatten + reorder ---------- */
	.m-home-wrap {
		margin-top: 0 !important;
		padding: 12px 12px 0 !important;
	}
	.m-flow-section {
		padding: 0 !important;
		margin: 0 !important;
		background: transparent !important;
	}
	.m-flow-section .container1 { padding: 0 !important; }

	/* FactoryPlans: after Available by Phone, the two plan text boxes (cards like the
	   desktop ones: coloured top border, centred text), then the article as plain text. */
	.m-flow .m-o-plan { order: 21; }
	.m-flow .m-o-article { order: 22; }
	html body .m-flow .m-o-plan.featured-box {
		margin: 0 0 14px !important;
		border: 1px solid #e6e6e6 !important;
		border-radius: 4px !important;
		background: #f7f7f7 !important;
		box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
		text-align: center !important;
	}
	html body .m-flow .m-o-plan.featured-box > .box-content {
		border-top: 4px solid #0099e6 !important;
		border-radius: 4px 4px 0 0;
		padding: 16px !important;
		text-align: center !important;
	}
	html body .m-flow .m-o-plan.featured-box-secondary > .box-content { border-top-color: #e36159 !important; }
	html .m-flow .m-article {
		margin: 6px 0 14px !important;
		padding: 0 2px !important;
		border: 0 !important;
		border-radius: 0 !important;
		background: transparent !important;
	}

	/* FactoryPlans: the notice bar sits outside #header on this page */
	html .notice-top-bar .row { padding-top: 4px !important; padding-bottom: 4px !important; }
	html .notice-top-bar .col-9 { flex: 0 0 85%; max-width: 85%; }
	html .notice-top-bar span,
	html .notice-top-bar span * {
		font-size: 13px !important;
		line-height: 1.3 !important;
	}

	/* FactoryPlans: bigger MOPAR / FORD buttons, full width, stacked */
	/* FactoryPlans: this theme floats its col-* columns; unfloat them so the blocks
	   stack full width (a float above would squeeze the .m-flow column beside it) */
	.m-flow-section [class*="col-"] {
		float: none !important;
		width: 100% !important;
	}
	.m-flow { clear: both; }

	/* the row has an inline "margin-top: -40px !important" (desktop overlap with the logo
	   strip), which no stylesheet can override; the wrapper's extra 40px absorbs it */
	html .m-home-wrap { padding-top: 40px !important; }
	/* its inner div also has an inline "margin-bottom: 30px !important"; the negative
	   bottom margin here brings the gap to the next card down to the usual 14px */
	.m-brand-buttons {
		margin-left: 0 !important;
		margin-right: 0 !important;
		margin-bottom: -28px !important;
		padding: 14px 0 0;
	}
	.m-brand-buttons > [class*="col-"] { padding: 0 !important; }
	/* font-size/line-height 0 drop the &nbsp; spacers between the links */
	.m-brand-buttons .text-center { font-size: 0; line-height: 0; }
	.m-brand-buttons .btn {
		display: flex !important;
		align-items: center;
		justify-content: center;
		gap: 10px;
		width: 100%;
		min-height: 60px;
		margin: 0 0 12px !important;
		padding: 12px 16px !important;
		border-radius: 8px !important;
		font-size: 18px !important;
		line-height: 1.25;
		white-space: normal;
	}
	.m-brand-buttons .btn span { position: static !important; margin: 0 !important; transform: none !important; }

	/* Hide Google's floating reCAPTCHA badge. visibility (not display:none) keeps
	   reCAPTCHA v3 working; Google requires the text notice shown instead
	   (.m-recaptcha-note under the Contact Form). */
	.grecaptcha-badge { visibility: hidden !important; }
	.m-recaptcha-note {
		display: block !important;
		margin: 8px 0 0;
		font-size: 11.5px;
		line-height: 1.45;
		color: #777;
	}
	.m-recaptcha-note a { color: #0088cc !important; }

	/* (quote/contact block styles live in mobile-blocks.css) */

	/* ---------- FAQ ---------- */
	.m-faq .mRight > .toggle { margin: 0 !important; }
	.m-faq .toggle > section.toggle > label {
		font-size: 14px !important;
		line-height: 1.35;
	}
	.m-faq .m-faq-extra { display: none !important; }
	.m-faq.m-faq-all .m-faq-extra { display: block !important; }
	.m-faq-more {
		display: block;
		width: 100%;
		min-height: 44px;
		margin-top: 6px;
		border: 0;
		border-top: 1px solid #e1e5ea;
		background: none;
		color: #0088cc;
		font-size: 14px;
		font-weight: 600;
		text-align: left;
	}

	/* ---------- Learn More (collapsed long content) ---------- */
	.m-learn-title {
		display: block !important;
		margin: 0 !important;
		padding: 14px 14px 6px;
		border: 1px solid #e1e5ea;
		border-bottom: 0;
		border-radius: 6px 6px 0 0;
		background: #f5f6f7;
		color: #0088cc;
		font-size: 17px;
		font-weight: 600;
	}
	/* Learn More: Plans + footer link groups, each a tap-to-open row */
	.m-learn-links {
		display: block !important;
		margin: 0 0 14px !important;
		padding: 0 14px 6px;
		border: 1px solid #e1e5ea;
		border-top: 0;
		border-radius: 0 0 6px 6px;
		background: #f5f6f7;
	}
	.m-learn-links .m-cwrap.m-open > .m-ctoggle { border-bottom-color: transparent; }
	.m-learn-links .m-cbody { padding-top: 0; padding-bottom: 4px; }
	.m-learn-links .m-cwrap.m-open > .m-cbody { border-bottom: 1px solid #e1e5ea; }
	.m-learn-intro { margin: 0 0 6px !important; font-size: 13px; color: #666; }
	.m-learn-links ul { list-style: none; margin: 0; padding: 0; }
	.m-learn-links li {
		padding: 10px 0;
		border-top: 1px solid #e1e5ea;
		font-size: 13px;
		line-height: 1.45;
		color: #555;
	}
	.m-learn-links li a {
		display: block;
		color: #0088cc !important;
		font-size: 15px;
		font-weight: 600;
		text-decoration: none !important;
	}
	.m-learn-links li a::after { content: " \203A"; }

	.m-flow .m-o-plan.featured-box {
		margin: 0 !important;
		min-height: 0 !important;
		border: 1px solid #e1e5ea !important;
		border-top: 0 !important;
		border-bottom: 0 !important;
		border-radius: 0 !important;
		background: #f5f6f7 !important;
		box-shadow: none !important;
		text-align: left !important;
	}
	.m-flow .m-o-plan.featured-box > .box-content {
		border-top: 0 !important;
		padding: 0 14px !important;
		min-height: 0 !important;
		text-align: left !important;
	}
	.m-flow .m-article {
		margin-bottom: 14px !important;
		padding: 0 14px 6px !important;
		border: 1px solid #e1e5ea;
		border-top: 0;
		border-radius: 0 0 6px 6px;
		background: #f5f6f7;
	}
	.m-flow .m-article .col-md-12,
	.m-flow .m-article .row { padding: 0 !important; margin: 0 !important; }

	.m-ctoggle {
		position: relative;
		display: block;
		margin: 0 !important;
		padding: 12px 28px 12px 0 !important;
		border-bottom: 1px solid #e1e5ea;
		cursor: pointer;
		color: #333 !important;
		font-size: 15px !important;
		font-weight: 500 !important;
		line-height: 1.35 !important;
		letter-spacing: 0 !important;
		text-transform: none !important;
		text-align: left !important;
	}
	.m-ctoggle::after {
		content: "+";
		position: absolute;
		right: 2px;
		top: 50%;
		transform: translateY(-50%);
		color: #0099e6;
		font-size: 20px;
		font-weight: 700;
	}
	.m-cwrap.m-open > .m-ctoggle::after { content: "\2212"; }
	.m-cbody { display: none; padding: 8px 0 12px; font-size: 14px; }
	.m-cwrap.m-open > .m-cbody { display: block; }
	.m-cbody img { max-width: 100%; height: auto; }

	/* ---------- footer ---------- */
	#footer .m-footer-summary {
		display: block !important;
		padding: 14px 16px;
		background: #212529;
		color: #c9ced3;
		font-size: 13px;
		line-height: 1.6;
	}
	#footer .m-footer-summary a { color: #fff !important; text-decoration: underline; }
	.m-footer-toggle {
		margin-top: 4px;
		padding: 8px 0;
		border: 0;
		background: none;
		color: #8fd3ff;
		font-size: 13px;
	}
	.m-footer-toggle::after { content: " +"; font-weight: 700; }
	#footer.m-links-open .m-footer-toggle::after { content: " \2212"; }
	.m-footer-phones { display: none; padding-top: 4px; }
	#footer.m-links-open .m-footer-phones { display: block; }
	#footer .m-footer-nav { display: none; }
	#footer.m-links-open .m-footer-nav { display: block; }

	/* ---------- sticky Get Quote / Call bar ---------- */
	.m-sticky-cta {
		display: flex !important;
		gap: 8px;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 1040;
		padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
		background: #fff;
		box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
	}
	.m-cta-btn {
		flex: 1 1 0;
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 48px;
		border: 2px solid #0099e6;
		border-radius: 4px;
		font-size: 16px;
		font-weight: 700;
		text-decoration: none !important;
	}
	.m-cta-quote { background: #0099e6; color: #fff !important; }
	.m-cta-call { background: #fff; color: #0088cc !important; }
}
