/* =========================================================
   Theme4 Desktop Category Mega Menu
   Desktop only. Mobile menu is intentionally untouched.
   ========================================================= */

@media (min-width: 992px) {
	.t4-cats-dropdown {
		position: relative;
		z-index: 1250;
	}

	/*
	 * Bootstrap normally keeps .dropdown-menu display:none.
	 * We keep it mounted and control visibility with pure CSS,
	 * so no click/JS is required on desktop.
	 */
	.t4-cats-dropdown > .t4-mega-menu {
		display: block !important;
		position: absolute !important;
		top: 100% !important;
		left: 0 !important;
		right: auto !important;
		transform: none !important;

		width: 285px;
		min-width: 285px;
		max-width: 285px;
		max-height: none;
		overflow: visible !important;

		margin-top: 5px !important;
		padding: 8px;

		border: 0px solid #e2e6eb;
		border-radius: 10px 0 0 10px;
		background: #fff;
		box-shadow: 0 18px 48px rgba(15, 23, 42, .15);

		opacity: 0;
		visibility: hidden;
		/*
		 * Desktop hover-intent:
		 * Mouse ayrıldıktan sonra menü 500ms daha açık/etkileşimli kalır.
		 * visibility:hidden geciktirildiği için kullanıcı bu sürede
		 * menüye geri dönerse kapanma iptal olur.
		 */
		pointer-events: auto;
		transition:
			opacity .14s ease .25s,
			visibility 0s linear .64s;
		z-index: 1255 !important;
	}

	/* Hover or keyboard focus opens the categories menu automatically. */
	.t4-cats-dropdown:hover > .t4-mega-menu,
	.t4-cats-dropdown:focus-within > .t4-mega-menu {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transition-delay: 0s;
	}

	/* Tiny invisible bridge prevents flicker between button and menu. */
	.t4-cats-dropdown::after {
		content: "";
		position: absolute;
		left: 0;
		top: 100%;
		width: 100%;
		height: 8px;
		pointer-events: none;
	}

	.t4-cats-dropdown:hover::after,
	.t4-cats-dropdown:focus-within::after {
		pointer-events: auto;
	}

	.t4-cats-btn {
		font-size: 16px;
		font-weight: 500;
	}

	/*
	 * Root items are static so every child flyout is anchored to
	 * the same top edge of the main menu, like marketplace mega menus.
	 */
	.t4-mega-menu__item {
		position: static !important;
	}

	.t4-mega-menu__link {
		min-height: 40px;
		padding: 9px 11px;
		border-radius: 7px;
		color: #252525;
		font-size: 13px;
		font-weight: 400;
		line-height: 1.3;
		transition:
			background-color .14s ease,
			color .14s ease;
	}

	.t4-mega-menu__item.has-children > .t4-mega-menu__link {
		font-weight: 500;
	}

	.t4-mega-menu__link:hover,
	.t4-mega-menu__link.is-active,
	.t4-mega-menu__item.has-children:hover > .t4-mega-menu__link {
		background: #f3f5f7;
		color: #252525;
	}

	/* Category image + label */
	.t4-mega-menu__link-main {
		display: flex;
		align-items: center;
		min-width: 0;
		flex: 1 1 auto;
	}

	.t4-mega-menu__category-image,
	.t4-mega-menu__subcategory-image {
		flex: 0 0 48px;
		width: 48px;
		height: 48px;
		margin-right: 8px;
		border: 0px solid #edf0f3;
		border-radius: 7px;
		background: #fff;
		object-fit: cover;
		object-position: center;
	}

	.t4-mega-menu__category-name,
	.t4-mega-menu__subcategory-name {
		min-width: 0;
		overflow-wrap: anywhere;
	}

	/* An image row needs enough height for the full 48px thumbnail. */
	.t4-mega-menu__link:has(.t4-mega-menu__category-image) {
		min-height: 60px;
		padding-top: 6px;
		padding-bottom: 6px;
	}

	.t4-mega-menu__arrow {
		font-size: 14px;
		font-weight: 400;
		color: #98a1ad;
		transform: none !important;
		transition: color .14s ease, translate .14s ease;
	}

	.t4-mega-menu__item.has-children:hover > .t4-mega-menu__link .t4-mega-menu__arrow {
		color: var(--primary);
		translate: 2px 0;
		transform: none !important;
	}

	/*
	 * Right-side child panel.
	 * It stays mounted to allow a smooth hover hand-off from left to right.
	 */
	.t4-mega-menu__children {
		display: block !important;
		position: absolute;
		top: -1px;
		left: calc(100% - 1px);

		width: 500px;
		min-height: calc(100% + 2px);
		max-height: 470px;
		overflow-y: auto;

		margin: 0 !important;
		padding: 18px 20px 20px;

		border: 0px solid #e2e6eb;
		border-left-color: #edf0f3;
		border-radius: 0 12px 12px 0;
		background: #fff;
		box-shadow: 22px 18px 48px rgba(15, 23, 42, .13);

		opacity: 0;
		visibility: hidden;
		/*
		 * Alt kategori paneli de mouse ayrıldıktan sonra 500ms bekler.
		 * Böylece ana listeden sağdaki panele geçerken veya mouse kısa
		 * süre dışarı taşınca panel aniden kapanmaz.
		 */
		pointer-events: auto;
		transform: translateX(-5px);
		transition:
			opacity .13s ease .25s,
			transform .13s ease .25s,
			visibility 0s linear .63s;

		z-index: 1260;
	}

	.t4-mega-menu__item.has-children:hover > .t4-mega-menu__children,
	.t4-mega-menu__item.has-children:focus-within > .t4-mega-menu__children {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: translateX(0);
		transition-delay: 0s;
	}

	.t4-mega-menu__children-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 18px;
		padding: 2px 2px 13px;
		margin-bottom: 10px;
		border-bottom: 1px solid #edf0f3;
	}

	.t4-mega-menu__children-title {
		min-width: 0;
		color: #252525;
		font-size: 14px;
		font-weight: 500;
		line-height: 1.3;
	}

	.t4-mega-menu__all-link {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		flex: 0 0 auto;
		color: var(--primary);
		font-size: 12px;
		font-weight: 500;
		text-decoration: none;
		white-space: nowrap;
	}

	.t4-mega-menu__all-link:hover {
		color: var(--primary-hover);
		text-decoration: none;
	}

	.t4-mega-menu__children-grid {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 3px 12px;
	}

	.t4-mega-menu__child-link {
		position: relative;
		display: flex;
		align-items: center;
		min-height: 38px;
		padding: 8px 10px 8px 19px;
		border-radius: 7px;
		color: #505866;
		font-size: 13px;
		font-weight: 400;
		line-height: 1.35;
		text-decoration: none;
		transition:
			background-color .14s ease,
			color .14s ease,
			padding-left .14s ease;
	}

	.t4-mega-menu__child-link::before {
		content: "";
		position: absolute;
		left: 8px;
		top: 50%;
		width: 4px;
		height: 4px;
		margin-top: -2px;
		border-radius: 50%;
		background: #c5cbd3;
	}

	.t4-mega-menu__child-link:hover,
	.t4-mega-menu__child-link.is-active {
		padding-left: 22px;
		background: #f5f7f9;
		color: var(--primary);
	}

	.t4-mega-menu__child-link:hover::before,
	.t4-mega-menu__child-link.is-active::before {
		background: var(--primary);
	}


	.t4-mega-menu__child-link.has-image {
		min-height: 60px;
		padding: 6px 10px !important;
	}

	.t4-mega-menu__child-link.has-image::before {
		display: none;
	}

	.t4-mega-menu__child-link.has-image:hover,
	.t4-mega-menu__child-link.has-image.is-active {
		padding-left: 10px !important;
	}

	.t4-mega-menu__child-link.has-image .t4-mega-menu__subcategory-image {
		margin-right: 8px;
	}

	/* Scrollbar only when a category has an unusually large child list. */
	.t4-mega-menu__children {
		scrollbar-width: thin;
		scrollbar-color: #cbd2da transparent;
	}

	.t4-mega-menu__children::-webkit-scrollbar {
		width: 6px;
	}

	.t4-mega-menu__children::-webkit-scrollbar-thumb {
		border-radius: 999px;
		background: #cbd2da;
	}

	/*
	 * Narrow desktop/laptop screens:
	 * keep the flyout usable without touching the mobile layout.
	 */
	@media (max-width: 1199.98px) {
		.t4-cats-dropdown > .t4-mega-menu {
			width: 255px;
			min-width: 255px;
			max-width: 255px;
		}

		.t4-mega-menu__children {
			width: min(440px, calc(100vw - 300px));
		}
	}
}
