/* =========================================================================
   IME Motors: "Products" mega menu ([ime_products_megamenu]).
   Category tabs on the left, the hovered category's models on the right.
   ====================================================================== */

.ime-mega {
	--ime-mega-red: var(--color-primary, #ec2329);
	--ime-mega-ink: #111827;
	--ime-mega-muted: #6b7280;
	--ime-mega-soft: #fdf3ef;
	--ime-mega-line: #eef0f3;
	--ime-mega-card: #f7f7f8;
	display: grid;
	grid-template-columns: 290px minmax(0, 1fr);
	gap: 40px;
	padding: 32px 36px 36px;
	min-height: 440px;
	background: #fff;
	color: var(--ime-mega-ink);
	text-align: left;
	font-family: inherit;
}

.ime-mega ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* ---- Tabs ---------------------------------------------------------- */
.ime-mega__tabs {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding-right: 24px !important;
	border-right: 1px solid var(--ime-mega-line);
}

.ime-mega__tab {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 13px 18px;
	border-radius: 999px;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--ime-mega-ink) !important;
	text-decoration: none !important;
	transition: background-color .15s ease, color .15s ease;
}
.ime-mega__tab .ime-mega__arrow {
	flex: none;
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity .15s ease, transform .15s ease;
}
.ime-mega__tab:hover,
.ime-mega__tab:focus-visible,
.ime-mega__tab.is-active {
	background: var(--ime-mega-soft);
	color: var(--ime-mega-red) !important;
}
.ime-mega__tab.is-active .ime-mega__arrow,
.ime-mega__tab:focus-visible .ime-mega__arrow {
	opacity: 1;
	transform: none;
}
.ime-mega__tab:focus-visible,
.ime-mega__more:focus-visible,
.ime-mega__card:focus-visible {
	outline: 2px solid var(--ime-mega-red);
	outline-offset: 2px;
}

/* ---- Panel --------------------------------------------------------- */
.ime-mega__panel[hidden] { display: none !important; }

.ime-mega__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 28px;
}
.ime-mega__title {
	margin: 0 !important;
	font-size: 30px;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.4px;
	color: var(--ime-mega-ink);
}
.ime-mega__more {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex: none;
	padding: 12px 26px;
	border-radius: 999px;
	background: var(--ime-mega-red);
	color: #fff !important;
	font-size: 16px;
	font-weight: 600;
	text-decoration: none !important;
	transition: background-color .15s ease, transform .15s ease;
}
.ime-mega__more:hover { background: #b01920; }
.ime-mega__more:hover .ime-mega__arrow { transform: translateX(3px); }
.ime-mega__more .ime-mega__arrow { transition: transform .15s ease; }

/* ---- Model cards --------------------------------------------------- */
.ime-mega__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 28px 24px;
}
.ime-mega__card {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: var(--ime-mega-ink) !important;
	text-decoration: none !important;
}
.ime-mega__img {
	display: block;
	aspect-ratio: 4 / 3;
	margin-bottom: 10px;
	overflow: hidden;
	border-radius: 12px;
	background: var(--ime-mega-card);
}
.ime-mega__img img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
	transition: transform .35s ease;
}
.ime-mega__name {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	transition: color .15s ease;
}
.ime-mega__desc {
	font-size: 13px;
	line-height: 1.4;
	color: var(--ime-mega-muted);
}
.ime-mega__card:hover .ime-mega__img img { transform: scale(1.05); }
.ime-mega__card:hover .ime-mega__name { color: var(--ime-mega-red); }

@media (prefers-reduced-motion: reduce) {
	.ime-mega__img img,
	.ime-mega__tab .ime-mega__arrow,
	.ime-mega__more .ime-mega__arrow { transition: none; }
}

/* ---- Smaller screens ----------------------------------------------- */
@media (max-width: 1399px) {
	.ime-mega { grid-template-columns: 270px minmax(0, 1fr); gap: 28px; padding: 28px; }
	.ime-mega__tab { font-size: 16px; padding: 11px 16px; }
	.ime-mega__title { font-size: 26px; }
}
@media (max-width: 1199px) {
	/* Only reached if the menu is ever shown in a narrow layout: stack it. */
	.ime-mega { grid-template-columns: 1fr; min-height: 0; padding: 16px; }
	.ime-mega__tabs { border-right: 0; padding-right: 0 !important; }
	.ime-mega__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Dark mode ------------------------------------------------------ */
html.uc-dark .ime-mega {
	--ime-mega-ink: #f3f4f6;
	--ime-mega-muted: #9ca3af;
	--ime-mega-soft: rgba(236, 35, 41, .14);
	--ime-mega-line: rgba(255, 255, 255, .08);
	--ime-mega-card: rgba(255, 255, 255, .05);
	background: #111827;
}
