/**
 * Motorized Carts & Tuggers panel — adapted from Sample D mockup.
 * Layered on top of mega-menu.css (which provides .hdm-mm-panel positioning,
 * trigger CSS, mobile suppression, etc.). Only carts-specific styles here.
 */

/* Carts panel only — desktop layout (993+) */
@media (min-width: 993px) {

	/* Carts panel uses hdm-mm-panel base for hover/show behavior;
	 * inner gets its own grid since structure is different. */
	.hdm-mm-carts-panel {
		--mmc-green: #16a34a;
		--mmc-green-dark: #15803d;
		--mmc-hi: #ecfdf5;
		--mmc-hi-2: #d1fae5;
		--mmc-ink: #0f172a;
		--mmc-ink-2: #334155;
		--mmc-muted: #64748b;
		--mmc-line: #e2e8f0;
		--mmc-bg-soft: #f8fafc;
	}

	/* Override the base .hdm-mm-panel-inner grid (which is sized for the
	 * mobility-scooter panel: sidebar + content + trust-strip). The carts
	 * panel manages its own internal layout via .hdm-mm-carts-grid + the
	 * demo banner as a stacked sibling. */
	.hdm-mm-panel-inner.hdm-mm-carts-inner {
		display: block;
		padding: 18px 22px 0;
		grid-template-columns: none;
		grid-template-rows: none;
	}

	.hdm-mm-carts-grid {
		display: grid;
		grid-template-columns: 240px 1fr;
		gap: 20px;
	}

	.hdm-mm-carts-col-head {
		font-size: 10px;
		letter-spacing: 0.14em;
		text-transform: uppercase;
		color: var(--mmc-muted);
		margin: 0 0 8px;
		font-weight: 700;
	}

	/* ─── Industries sidebar ─────────────────────────────────── */
	.hdm-mm-carts-ind {
		display: flex;
		flex-direction: column;
		gap: 1px;
	}

	.hdm-mm-carts-ind-item {
		display: flex;
		align-items: center;
		gap: 9px;
		padding: 7px 9px;
		border-radius: 7px;
		text-decoration: none;
		color: var(--mmc-ink);
		font-size: 13px;
		font-weight: 600;
		transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
		border: 1px solid transparent;
		line-height: 1.15;
	}

	.hdm-mm-carts-ind-item:hover,
	.hdm-mm-carts-ind-item.is-active {
		background: var(--mmc-hi);
		border-color: var(--mmc-hi-2);
	}

	.hdm-mm-carts-ind-item.is-active {
		box-shadow: 0 0 0 1px var(--mmc-green) inset;
	}

	.hdm-mm-carts-ind-ico {
		width: 28px;
		height: 28px;
		display: grid;
		place-items: center;
		background: #ffffff;
		border: 1px solid var(--mmc-line);
		border-radius: 6px;
		color: var(--mmc-green-dark);
		flex-shrink: 0;
	}

	.hdm-mm-carts-ind-ico svg {
		width: 14px;
		height: 14px;
	}

	.hdm-mm-carts-ind-item.is-active .hdm-mm-carts-ind-ico {
		background: var(--mmc-green);
		color: #ffffff;
		border-color: var(--mmc-green);
	}

	.hdm-mm-carts-ind-lbl {
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
	}

	.hdm-mm-carts-ind-ct {
		font-size: 10px;
		color: var(--mmc-muted);
		font-weight: 600;
		background: #f1f5f9;
		padding: 1px 6px;
		border-radius: 999px;
	}

	.hdm-mm-carts-ind-item.is-active .hdm-mm-carts-ind-ct {
		background: var(--mmc-hi-2);
		color: var(--mmc-green-dark);
	}

	/* ─── Product family cards ────────────────────────────────── */
	.hdm-mm-carts-fams {
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		gap: 10px;
	}

	.hdm-mm-carts-fam {
		display: flex;
		flex-direction: column;
		padding: 8px;
		background: #ffffff;
		border: 1px solid var(--mmc-line);
		border-radius: 10px;
		text-decoration: none;
		color: inherit;
		transition: border-color 0.14s, transform 0.14s, box-shadow 0.14s;
		min-width: 0;
	}

	.hdm-mm-carts-fam:hover {
		border-color: var(--mmc-green);
		transform: translateY(-2px);
		box-shadow: 0 4px 12px rgba(34, 197, 94, 0.14);
	}

	.hdm-mm-carts-fam-pic {
		width: 100%;
		height: 88px;
		background: var(--mmc-bg-soft);
		border-radius: 6px;
		display: grid;
		place-items: center;
		overflow: hidden;
		margin-bottom: 8px;
	}

	.hdm-mm-carts-fam-img {
		/* Theme/WC has `img { height: auto !important }` and `% height` was
		 * still resolving to natural-size in this grid context. Pixel height
		 * matches the .hdm-mm-carts-fam-pic height exactly, with !important
		 * to beat the theme rule. object-fit:contain then clamps. */
		width: 100% !important;
		height: 88px !important;
		max-width: 100% !important;
		object-fit: contain;
		display: block;
	}

	.hdm-mm-carts-fam-body h5 {
		margin: 0 0 2px;
		font-size: 12px;
		font-weight: 700;
		color: var(--mmc-ink);
		line-height: 1.2;
		letter-spacing: -0.005em;
	}

	.hdm-mm-carts-fam-meta {
		font-size: 10px;
		color: var(--mmc-muted);
		margin: 0 0 4px;
		line-height: 1.3;
	}

	.hdm-mm-carts-fam-pr {
		font-size: 11px;
		color: var(--mmc-green-dark);
		font-weight: 800;
		margin: 0;
	}

	/* ─── Brand chip ──────────────────────────────────────────── */
	.hdm-mm-carts-brand {
		display: flex;
		align-items: center;
		gap: 12px;
		margin-top: 12px;
		padding: 10px 14px;
		background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
		border: 1px solid var(--mmc-line);
		border-radius: 10px;
	}

	.hdm-mm-carts-brand-logo {
		width: 34px;
		height: 34px;
		background: #0f172a;
		color: #86efac;
		border-radius: 7px;
		display: grid;
		place-items: center;
		font-weight: 800;
		font-size: 11px;
		letter-spacing: 0.04em;
		flex-shrink: 0;
	}

	.hdm-mm-carts-brand-name {
		display: flex;
		flex-direction: column;
		line-height: 1.2;
		flex-shrink: 0;
	}

	.hdm-mm-carts-brand-name b {
		font-size: 12px;
		color: var(--mmc-ink);
		letter-spacing: -0.005em;
	}

	.hdm-mm-carts-brand-name span {
		font-size: 9px;
		color: var(--mmc-muted);
		font-weight: 700;
		letter-spacing: 0.06em;
		text-transform: uppercase;
		margin-top: 1px;
	}

	.hdm-mm-carts-brand-badges {
		display: flex;
		gap: 6px;
		flex: 1;
		justify-content: center;
		flex-wrap: wrap;
	}

	.hdm-mm-carts-brand-badge {
		display: inline-flex;
		align-items: center;
		gap: 5px;
		background: #ffffff;
		border: 1px solid var(--mmc-line);
		padding: 3px 9px;
		border-radius: 999px;
		font-size: 11px;
		font-weight: 700;
		color: var(--mmc-ink-2);
		white-space: nowrap;
	}

	.hdm-mm-carts-brand-badge svg {
		width: 11px;
		height: 11px;
		color: var(--mmc-green-dark);
	}

	.hdm-mm-carts-brand-badge.is-usa {
		background: #fef2f2;
		border-color: #fecaca;
		color: #991b1b;
	}

	.hdm-mm-carts-brand-badge.is-usa svg {
		color: #dc2626;
	}

	.hdm-mm-carts-brand-about {
		font-size: 11px;
		color: var(--mmc-green-dark);
		text-decoration: none;
		font-weight: 700;
		white-space: nowrap;
		flex-shrink: 0;
	}

	.hdm-mm-carts-brand-about:hover {
		color: var(--mmc-ink);
	}

	.hdm-mm-carts-brand-shop {
		background: #0f172a;
		color: #ffffff;
		font-size: 12px;
		font-weight: 800;
		padding: 7px 14px;
		border-radius: 7px;
		text-decoration: none;
		white-space: nowrap;
		flex-shrink: 0;
		display: inline-flex;
		align-items: center;
		gap: 5px;
		transition: background 0.14s;
	}

	.hdm-mm-carts-brand-shop:hover {
		background: #1e293b;
		color: #ffffff;
	}

	/* ─── Demo banner (full-width amber strip) ───────────────── */
	.hdm-mm-carts-demo {
		display: flex;
		align-items: center;
		gap: 16px;
		margin: 14px -22px 0;
		padding: 11px 22px;
		background: linear-gradient(95deg, #fef3c7 0%, #fde68a 60%, #fcd34d 100%);
		color: #78350f;
		border-top: 2px solid #f59e0b;
		position: relative;
		overflow: hidden;
	}

	.hdm-mm-carts-demo::before {
		content: "";
		position: absolute;
		left: -30px;
		top: -20px;
		width: 120px;
		height: 120px;
		background: radial-gradient(circle, rgba(245, 158, 11, 0.25), transparent 70%);
		pointer-events: none;
	}

	.hdm-mm-carts-demo-icon {
		width: 42px;
		height: 42px;
		background: #78350f;
		color: #fef3c7;
		border-radius: 10px;
		display: grid;
		place-items: center;
		flex-shrink: 0;
		box-shadow: 0 2px 8px rgba(120, 53, 15, 0.2);
		position: relative;
		z-index: 1;
	}

	.hdm-mm-carts-demo-icon svg {
		width: 22px;
		height: 22px;
	}

	.hdm-mm-carts-demo-text {
		flex: 1;
		min-width: 0;
		position: relative;
		z-index: 1;
		line-height: 1.25;
	}

	.hdm-mm-carts-demo-head {
		font-size: 14px;
		font-weight: 900;
		letter-spacing: 0.04em;
		text-transform: uppercase;
		margin: 0;
		color: #7c2d12;
		display: flex;
		align-items: center;
		gap: 8px;
	}

	.hdm-mm-carts-pulse {
		display: inline-block;
		width: 7px;
		height: 7px;
		background: #dc2626;
		border-radius: 50%;
		box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
		animation: hdm-mm-carts-pulse 1.8s infinite;
	}

	@keyframes hdm-mm-carts-pulse {
		0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
		70%  { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
		100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
	}

	.hdm-mm-carts-demo-sub {
		font-size: 12px;
		font-weight: 600;
		color: #92400e;
		margin: 1px 0 0;
	}

	.hdm-mm-carts-demo-sub b {
		color: #7c2d12;
	}

	.hdm-mm-carts-demo-cta {
		background: #7c2d12;
		color: #ffffff;
		font-weight: 800;
		padding: 10px 18px;
		border-radius: 8px;
		text-decoration: none;
		font-size: 13px;
		letter-spacing: 0.02em;
		display: inline-flex;
		align-items: center;
		gap: 6px;
		flex-shrink: 0;
		position: relative;
		z-index: 1;
		transition: background 0.14s, transform 0.14s, box-shadow 0.14s;
		box-shadow: 0 2px 8px rgba(120, 53, 15, 0.25);
		border: 0;
		cursor: pointer;
		font-family: inherit;
	}

	.hdm-mm-carts-demo-cta:hover {
		background: #92400e;
		transform: translateY(-1px);
		box-shadow: 0 4px 12px rgba(120, 53, 15, 0.35);
		color: #ffffff;
	}

	.hdm-mm-carts-demo-cta svg {
		width: 14px;
		height: 14px;
	}
}

/* ─── Inquiry modal (any viewport) ─────────────────────────── */
.hdm-mm-carts-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.hdm-mm-carts-modal[hidden] {
	display: none;
}

.hdm-mm-carts-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	cursor: pointer;
}

.hdm-mm-carts-modal-card {
	position: relative;
	background: #ffffff;
	border-radius: 14px;
	max-width: 560px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.05);
	padding: 28px 32px;
	animation: hdm-mm-carts-modal-in 0.18s ease-out;
}

@keyframes hdm-mm-carts-modal-in {
	from { opacity: 0; transform: translateY(8px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.hdm-mm-carts-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border: 0;
	background: #f1f5f9;
	border-radius: 8px;
	color: #475569;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background 0.14s, color 0.14s;
}

.hdm-mm-carts-modal-close:hover {
	background: #e2e8f0;
	color: #0f172a;
}

.hdm-mm-carts-modal-close svg {
	width: 18px;
	height: 18px;
}

.hdm-mm-carts-modal-head h2 {
	margin: 0 0 6px;
	font-size: 22px;
	font-weight: 800;
	color: #0f172a;
	letter-spacing: -0.015em;
}

.hdm-mm-carts-modal-head p {
	margin: 0 0 18px;
	font-size: 13px;
	color: #64748b;
}

.hdm-mm-carts-modal-form label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: #334155;
	letter-spacing: 0.01em;
	margin-bottom: 12px;
}

.hdm-mm-carts-modal-form input[type="text"],
.hdm-mm-carts-modal-form input[type="email"],
.hdm-mm-carts-modal-form input[type="tel"],
.hdm-mm-carts-modal-form select,
.hdm-mm-carts-modal-form textarea {
	display: block;
	width: 100%;
	margin-top: 4px;
	padding: 10px 12px;
	font-size: 14px;
	font-weight: 500;
	color: #0f172a;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background: #ffffff;
	font-family: inherit;
	box-sizing: border-box;
	transition: border-color 0.12s, box-shadow 0.12s;
}

.hdm-mm-carts-modal-form input:focus,
.hdm-mm-carts-modal-form select:focus,
.hdm-mm-carts-modal-form textarea:focus {
	outline: none;
	border-color: #16a34a;
	box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.hdm-mm-carts-modal-form textarea {
	resize: vertical;
	min-height: 80px;
}

.hdm-mm-carts-modal-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.hdm-mm-carts-modal-row > label {
	margin-bottom: 12px;
}

.hdm-mm-carts-modal-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

.hdm-mm-carts-modal-actions {
	margin-top: 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.hdm-mm-carts-modal-submit {
	background: #16a34a;
	color: #ffffff;
	font-weight: 800;
	font-size: 14px;
	padding: 12px 24px;
	border-radius: 8px;
	border: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: background 0.14s, transform 0.14s;
	font-family: inherit;
}

.hdm-mm-carts-modal-submit:hover:not([disabled]) {
	background: #15803d;
	transform: translateY(-1px);
}

.hdm-mm-carts-modal-submit[disabled] {
	opacity: 0.6;
	cursor: wait;
}

.hdm-mm-carts-modal-submit-spinner {
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: hdm-mm-carts-spin 0.8s linear infinite;
	display: none;
}

.hdm-mm-carts-modal-submit.is-loading .hdm-mm-carts-modal-submit-spinner {
	display: inline-block;
}

@keyframes hdm-mm-carts-spin {
	to { transform: rotate(360deg); }
}

.hdm-mm-carts-modal-disclaimer {
	font-size: 11px;
	color: #94a3b8;
	margin: 0;
	text-align: center;
}

.hdm-mm-carts-modal-error {
	margin: 12px 0 0;
	padding: 10px 14px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	display: none;
}

.hdm-mm-carts-modal-error.is-visible {
	display: block;
}

.hdm-mm-carts-modal-success {
	text-align: center;
	padding: 20px 8px;
}

.hdm-mm-carts-modal-success svg {
	width: 56px;
	height: 56px;
	color: #16a34a;
	margin-bottom: 12px;
}

.hdm-mm-carts-modal-success p {
	color: #334155;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.5;
	margin: 0 0 18px;
}

.hdm-mm-carts-modal-success-close {
	background: #0f172a;
	color: #ffffff;
	font-weight: 700;
	padding: 10px 24px;
	border-radius: 8px;
	border: 0;
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
}

.hdm-mm-carts-modal-success-close:hover {
	background: #1e293b;
}

@media (max-width: 600px) {
	.hdm-mm-carts-modal-card {
		padding: 22px 18px;
	}
	.hdm-mm-carts-modal-row {
		grid-template-columns: 1fr;
		gap: 0;
	}
}


/* ─── Mobile dropdown enhancements ─────────────────────────────
 * The mobile menu uses standard wp_nav_menu rendering of the
 * trigger's children. Below 993px, inject section headings via
 * pseudo-elements and turn the demo CTA into a prominent box.
 * Selectors are scoped by hdm-carts-* classes on the <li> so
 * desktop is unaffected (where children aren't rendered anyway).
 */
@media (max-width: 992px) {

	/* "Shop by industry" heading — first industry item */
	li.hdm-carts-industry:first-child::before {
		content: "Shop by industry";
		display: block;
		font-size: 11px;
		font-weight: 800;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: #16a34a;
		padding: 14px 0 6px;
		margin: 6px 0 4px;
		border-bottom: 1px solid #e2e8f0;
	}

	/* "Browse by product" heading — first family item (after last industry) */
	li.hdm-carts-industry + li.hdm-carts-family::before {
		content: "Browse by product";
		display: block;
		font-size: 11px;
		font-weight: 800;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: #16a34a;
		padding: 14px 0 6px;
		margin: 14px 0 4px;
		border-bottom: 1px solid #e2e8f0;
	}

	/* Demo CTA — prominent amber box with megaphone icon */
	li.hdm-carts-demo-cta {
		margin: 16px 0 8px !important;
		padding: 0 !important;
		background: linear-gradient(135deg, #fef3c7 0%, #fde68a 60%, #fcd34d 100%);
		border: 2px solid #f59e0b;
		border-radius: 12px;
		list-style: none;
		box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15);
		position: relative;
		overflow: hidden;
	}

	li.hdm-carts-demo-cta::before {
		/* subtle radial accent in top-left corner */
		content: "";
		position: absolute;
		left: -20px;
		top: -20px;
		width: 100px;
		height: 100px;
		background: radial-gradient(circle, rgba(245, 158, 11, 0.25), transparent 70%);
		pointer-events: none;
	}

	/* Override theme's default <a> styling inside this li.
	 * Grid layout: icon column + text column, with subtitle on row 2
	 * spanning the text column only. */
	li.hdm-carts-demo-cta > a {
		display: grid !important;
		grid-template-columns: 36px 1fr;
		grid-template-rows: auto auto;
		column-gap: 12px;
		row-gap: 2px;
		align-items: center;
		padding: 14px 16px !important;
		color: #7c2d12 !important;
		font-weight: 800 !important;
		text-decoration: none !important;
		font-size: 14px !important;
		line-height: 1.3 !important;
		border: 0 !important;
		background: transparent !important;
		text-transform: none !important;
		letter-spacing: 0.01em;
		position: relative;
		z-index: 1;
	}

	/* Megaphone icon — grid column 1, spans both rows so it centers vertically */
	li.hdm-carts-demo-cta > a::before {
		content: "";
		grid-column: 1;
		grid-row: 1 / 3;
		align-self: center;
		width: 36px;
		height: 36px;
		background-color: #7c2d12;
		border-radius: 9px;
		background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fef3c7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10v4l5 1 4 6V3L8 9 3 10z'/%3E%3Cpath d='M16 7s2 1.5 2 5-2 5-2 5'/%3E%3C/svg%3E");
		background-size: 20px 20px;
		background-repeat: no-repeat;
		background-position: center;
		box-shadow: 0 2px 6px rgba(120, 53, 15, 0.25);
	}

	/* Subtitle — grid column 2 row 2 */
	li.hdm-carts-demo-cta > a::after {
		content: "21-day trial · Refundable $250 deposit · You pay freight only";
		grid-column: 2;
		grid-row: 2;
		font-size: 11px;
		font-weight: 600;
		color: #92400e;
		letter-spacing: 0.01em;
		text-transform: none;
		line-height: 1.35;
	}
}

