@import "../../main/variables";

$cart-width: 360px;

//Cart icon in menu
.cart-icon-wrapper {
	display: flex;
	align-items: center;

	&:hover {
		color: var(--hovercolor, var(--color));
	}

	.nv-cart {
		display: flex;

		svg {
			width: var(--iconsize);
			height: var(--iconsize);
		}
	}

	.cart-icon-label {
		margin-right: $spacing-xxs;
		font-size: var(--labelsize);
	}

	.cart-count {
		background: var(--nv-light-bg);
		color: var(--nv-text-color);
		position: absolute;
		font-size: 0.6em;
		padding: 3px;
		bottom: -7px;
		right: -13px;
		font-weight: 800;
		line-height: 1;
		border-radius: 3px;
	}
}

// Hide minicart on mobile
.nv-nav-cart {
	display: none;
	opacity: 0;
	visibility: hidden;
	background: var(--nv-site-bg);
	color: var(--nv-text-color);
	transition: all 0.3s;
	box-shadow: $soft-box-shadow;
	position: absolute;
	z-index: 100;
	width: $cart-width;
	text-align: left;
	--primarybtnpadding: 13px 15px;
	--secondarybtnpadding: 13px 15px;

	.widget {
		// Overflow needed to hide scrollbar.
		overflow: hidden;
	}

	.woocommerce-mini-cart {
		// Margin needed to hide scrollbar.
		margin-right: -40px !important;
		overflow-y: auto;
		overflow-x: hidden;
		max-height: 300px;
	}

	li {
		// Padding needed to hide scrollbar.
		padding: $spacing-md 40px + $spacing-sm $spacing-md $spacing-sm !important;

		border-bottom: $base-border;
		font-size: $text-sm;

		&:last-child {
			border: 0;
		}

		img {
			position: absolute;
			left: 35px;
			width: 60px !important;
			top: 50%;
			transform: translateY(-50%);
			margin-left: $spacing-xs !important;
		}

		.remove {
			top: 50% !important;
			left: $spacing-sm !important;
			transform: translateY(-50%);
		}

		.quantity {
			opacity: 0.5;
		}

		> *:not(.remove) {
			margin-left: 100px !important;
			font-weight: inherit !important;
		}

		dl {
			padding: 0 !important;
			border: 0 !important;

			> dd {
				margin: 0 !important;
			}
		}

		> a {
			color: var(--nv-text-color);
		}
	}

	.widget_shopping_cart_content {

		.total {
			border: 0;
			margin: 0;
			box-shadow: 0 -3px 9px -9px;
			padding: $spacing-sm $spacing-md;
		}

		strong {
			font-weight: inherit;
			margin-right: $spacing-xs;
		}

		.buttons {
			padding: 0 $spacing-md;
			margin-bottom: $spacing-md;

			&::before {
				content: none !important;
			}

			.button {
				--btnfs: var(--bodyfontsize);
				margin: 0;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}
}

.woocommerce-mini-cart__buttons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-column-gap: $spacing-md;
}

//Menu mini cart positioning
.menu-item-nav-cart {
	position: relative;

	.nv-nav-cart {
		right: 0;
	}
}

@mixin nav-cart--laptop() {

	.nv-nav-cart {
		display: block;
	}

	.menu-item-nav-cart {

		&:hover,
		&:focus-within {

			.nv-nav-cart {
				opacity: 1;
				visibility: visible;
			}
		}
	}
}
