/**
 * Header cart widget frontend styles.
 *
 * Location: /assets/css/frontend/cart/cart-widget.css
 *
 * @package SunTechPortal
 */

.stp-header-cart-widget {
	--stp-header-cart-icon-color: var(--stp-cart-icon-color, #000000);
	--stp-header-cart-badge-bg: #16a34a;
	--stp-header-cart-badge-text: #ffffff;
	--stp-header-cart-text: #111827;
	--stp-header-cart-muted: #64748b;
	--stp-header-cart-danger: #dc2626;
	--stp-header-cart-danger-hover: #b91c1c;
	--stp-header-cart-border: #d1d5db;
	--stp-header-cart-border-soft: #e5e7eb;
	--stp-header-cart-bg: #ffffff;
	--stp-header-cart-soft-bg: #f8fafc;
	--stp-header-cart-item-bg: #f9fafb;
	--stp-header-cart-item-hover-bg: #fff7ed;
	--stp-header-cart-primary: #f97316;
	--stp-header-cart-primary-hover: #ea580c;
	--stp-mini-cart-items-max-height: 320px;

	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
}

.stp-header-cart-widget *,
.stp-header-cart-widget *::before,
.stp-header-cart-widget *::after {
	box-sizing: border-box;
}

.stp-header-cart-widget a,
.stp-header-cart-widget span,
.stp-header-cart-widget strong,
.stp-header-cart-widget p,
.stp-header-cart-widget button {
	font-family: inherit;
}

.stp-header-cart-widget::after {
	content: "";
	position: absolute;
	top: 100%;
	right: 0;
	left: 0;
	z-index: 10019;
	display: none;
	height: 16px;
}

.stp-header-cart-widget--dropdown-enabled:not(.is-click-closed):hover::after,
.stp-header-cart-widget--dropdown-enabled.is-open::after {
	display: block;
}

.stp-header-cart-widget__toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-width: 42px;
	height: 42px;
	padding: 0 11px;
	border: 1px solid var(--stp-header-cart-border-soft);
	border-radius: 12px;
	background: #ffffff;
	color: var(--stp-header-cart-icon-color);
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color 0.16s ease,
		border-color 0.16s ease,
		box-shadow 0.16s ease,
		color 0.16s ease;
}

.stp-header-cart-widget__toggle:hover,
.stp-header-cart-widget__toggle:focus {
	border-color: #cbd5e1;
	background: #ffffff;
	color: var(--stp-header-cart-icon-color);
	text-decoration: none;
	outline: none;
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.stp-header-cart-widget__toggle:focus-visible {
	outline: 2px solid #111827;
	outline-offset: 2px;
}

.stp-header-cart-widget__icon-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	flex: 0 0 24px;
}

.stp-header-cart-widget__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	color: var(--stp-header-cart-icon-color);
	line-height: 1;
}

.stp-header-cart-widget__icon-mask {
	display: block;
	width: 22px;
	height: 22px;
	background-color: var(--stp-header-cart-icon-color);
	-webkit-mask-image: var(--stp-cart-icon-mask);
	mask-image: var(--stp-cart-icon-mask);
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.stp-header-cart-widget__badge {
	position: absolute;
	top: -14px;
	right: -9px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border: 2px solid #ffffff;
	border-radius: 999px;
	background: var(--stp-header-cart-badge-bg);
	color: var(--stp-header-cart-badge-text);
	font-size: 10px;
	font-weight: 800;
	line-height: 1;
	text-align: center;
	white-space: nowrap;
}

.stp-header-cart-widget__badge.is-empty {
	display: inline-flex;
	opacity: 1;
}

.stp-header-cart-widget__amount {
	display: inline-flex;
	align-items: center;
	max-width: 92px;
	overflow: hidden;
	color: var(--stp-header-cart-text);
	font-size: 12px;
	font-style: normal;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.stp-header-cart-widget--hover-glow .stp-header-cart-widget__toggle:hover {
	background: #f8fafc;
}

.stp-header-cart-widget__dropdown {
	position: absolute;
	top: calc(100% + 12px);
	right: 0;
	z-index: 10020;
	width: 350px;
	max-width: calc(100vw - 24px);
	padding: 0;
	border: 1px solid var(--stp-header-cart-border);
	border-radius: 16px;
	background: var(--stp-header-cart-bg);
	color: var(--stp-header-cart-text);
	box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition:
		opacity 0.18s ease,
		transform 0.18s ease,
		visibility 0.18s ease;
	pointer-events: none;
}

.stp-header-cart-widget__dropdown::before {
	content: "";
	position: absolute;
	top: -7px;
	right: 18px;
	width: 12px;
	height: 12px;
	border-top: 1px solid var(--stp-header-cart-border);
	border-left: 1px solid var(--stp-header-cart-border);
	background: var(--stp-header-cart-bg);
	transform: rotate(45deg);
}

.stp-header-cart-widget:not(.is-click-closed):hover .stp-header-cart-widget__dropdown,
.stp-header-cart-widget.is-open .stp-header-cart-widget__dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

.stp-mini-cart {
	width: 100%;
	max-height: min(680px, calc(100vh - 120px));
	overflow: hidden;
	border-radius: 16px;
	background: var(--stp-header-cart-bg);
	color: var(--stp-header-cart-text);
	font-family: inherit;
}

.stp-mini-cart__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--stp-header-cart-border-soft);
}

.stp-mini-cart__header strong {
	color: var(--stp-header-cart-text);
	font-size: 15px;
	font-weight: 800;
	line-height: 1.25;
}

.stp-mini-cart__header span {
	color: var(--stp-header-cart-muted);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
}

.stp-mini-cart__empty {
	padding: 24px 16px;
	text-align: center;
}

.stp-mini-cart__empty p {
	margin: 0;
	color: var(--stp-header-cart-muted);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.6;
}

.stp-mini-cart__items {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: min(var(--stp-mini-cart-items-max-height, 320px), calc(100vh - 290px));
	overflow-y: auto;
	padding: 10px;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
}

.stp-mini-cart__items::-webkit-scrollbar {
	width: 7px;
}

.stp-mini-cart__items::-webkit-scrollbar-track {
	background: transparent;
}

.stp-mini-cart__items::-webkit-scrollbar-thumb {
	border-radius: 999px;
	background: #cbd5e1;
}

.stp-mini-cart-item {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr);
	gap: 10px;
	align-items: center;
	padding: 8px;
	border: 1px solid var(--stp-header-cart-border-soft);
	border-radius: 13px;
	background: var(--stp-header-cart-item-bg);
	transition:
		background-color 0.16s ease,
		border-color 0.16s ease,
		opacity 0.16s ease;
}

.stp-mini-cart-item:hover {
	border-color: #fed7aa;
	background: var(--stp-header-cart-item-hover-bg);
}

.stp-mini-cart-item.is-removing {
	opacity: 0.55;
	pointer-events: none;
}

.stp-mini-cart-item__image {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	overflow: hidden;
	border: 1px solid var(--stp-header-cart-border-soft);
	border-radius: 11px;
	background: #ffffff;
	text-decoration: none;
}

.stp-mini-cart-item__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.stp-mini-cart-item__image span {
	display: block;
	width: 22px;
	height: 22px;
	border-radius: 8px;
	background: #e5e7eb;
}

.stp-mini-cart-item__content {
	min-width: 0;
}

.stp-mini-cart-item__top {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 24px;
	gap: 8px;
	align-items: start;
}

.stp-mini-cart-item__title {
	display: -webkit-box;
	overflow: hidden;
	color: var(--stp-header-cart-text);
	font-size: 13px;
	font-weight: 800;
	line-height: 1.35;
	text-decoration: none;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.stp-mini-cart-item__title:hover,
.stp-mini-cart-item__title:focus {
	color: var(--stp-header-cart-primary);
	text-decoration: none;
	outline: none;
}

.stp-mini-cart-item__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin: -3px -2px 0 0;
	padding: 0;
	border: 1px solid #fecaca;
	border-radius: 999px;
	background: #fff1f2;
	color: var(--stp-header-cart-danger);
	font-size: 17px;
	font-weight: 800;
	line-height: 1;
	text-align: center;
	cursor: pointer;
	transition:
		background-color 0.16s ease,
		border-color 0.16s ease,
		color 0.16s ease,
		transform 0.16s ease;
}

.stp-mini-cart-item__remove span {
	display: block;
	line-height: 1;
	transform: translateY(-1px);
}

.stp-mini-cart-item__remove:hover,
.stp-mini-cart-item__remove:focus {
	border-color: var(--stp-header-cart-danger);
	background: var(--stp-header-cart-danger);
	color: #ffffff;
	outline: none;
	transform: translateY(-1px);
}

.stp-mini-cart-item__remove:focus-visible {
	outline: 2px solid #111827;
	outline-offset: 2px;
}

.stp-mini-cart-item__remove.is-loading,
.stp-mini-cart__button.is-loading {
	opacity: 0.65;
	cursor: wait;
	pointer-events: none;
}

.stp-mini-cart-item__meta {
	display: grid;
	grid-template-columns: minmax(0, auto) minmax(0, 1fr);
	align-items: center;
	gap: 8px;
	width: 100%;
	margin-top: 5px;
	color: var(--stp-header-cart-muted);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.35;
}

.stp-mini-cart-item__meta > span:first-child,
.stp-mini-cart-item__meta > :first-child {
	justify-self: start;
	min-width: 0;
	color: var(--stp-header-cart-muted);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.35;
	white-space: nowrap;
}

.stp-mini-cart-item__meta > span:last-child,
.stp-mini-cart-item__meta > :last-child {
	justify-self: end;
	min-width: 0;
	color: var(--stp-header-cart-muted);
	font-size: 12px;
	font-weight: 800;
	line-height: 1.35;
	text-align: right;
	white-space: nowrap;
}

.stp-mini-cart__total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 13px 16px;
	border-top: 1px solid var(--stp-header-cart-border-soft);
	color: var(--stp-header-cart-text);
}

.stp-mini-cart__total span {
	color: var(--stp-header-cart-muted);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
}

.stp-mini-cart__total strong {
	color: var(--stp-header-cart-text);
	font-family: inherit;
	font-size: 15px;
	font-style: normal;
	font-weight: 800;
	letter-spacing: 0;
	line-height: 1.3;
	text-align: right;
	white-space: nowrap;
}

.stp-mini-cart__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	padding: 14px 16px 16px;
	border-top: 1px solid var(--stp-header-cart-border-soft);
	background: var(--stp-header-cart-bg);
}

.stp-mini-cart__actions--has-clear {
	grid-template-columns: 1fr 1fr;
}

.stp-mini-cart__actions--has-clear .stp-mini-cart__button--clear {
	grid-column: 1 / -1;
}

.stp-header-cart-widget .stp-mini-cart__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 10px 12px;
	border: 1px solid transparent;
	border-radius: 999px;
	font-family: inherit;
	font-size: 13px;
	font-style: normal;
	font-weight: 800;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color 0.16s ease,
		border-color 0.16s ease,
		color 0.16s ease,
		opacity 0.16s ease;
}

.stp-header-cart-widget .stp-mini-cart__button:hover,
.stp-header-cart-widget .stp-mini-cart__button:focus {
	text-decoration: none;
	outline: none;
}

.stp-header-cart-widget .stp-mini-cart__button:focus-visible {
	outline: 2px solid #111827;
	outline-offset: 2px;
}

.stp-header-cart-widget .stp-mini-cart__button--secondary {
	border-color: var(--stp-header-cart-border);
	background: #ffffff;
	color: var(--stp-header-cart-text);
}

.stp-header-cart-widget .stp-mini-cart__button--secondary:hover,
.stp-header-cart-widget .stp-mini-cart__button--secondary:focus {
	border-color: var(--stp-header-cart-primary);
	background: #fff7ed;
	color: var(--stp-header-cart-primary-hover);
}

.stp-header-cart-widget .stp-mini-cart__button--primary {
	border-color: var(--stp-header-cart-primary);
	background: var(--stp-header-cart-primary);
	color: #ffffff;
}

.stp-header-cart-widget .stp-mini-cart__button--primary:hover,
.stp-header-cart-widget .stp-mini-cart__button--primary:focus {
	border-color: var(--stp-header-cart-primary-hover);
	background: var(--stp-header-cart-primary-hover);
	color: #ffffff;
}

.stp-header-cart-widget .stp-mini-cart__button--clear {
	border-color: #fecaca;
	background: #fff1f2;
	color: var(--stp-header-cart-danger);
}

.stp-header-cart-widget .stp-mini-cart__button--clear:hover,
.stp-header-cart-widget .stp-mini-cart__button--clear:focus {
	border-color: var(--stp-header-cart-danger);
	background: var(--stp-header-cart-danger);
	color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
	.stp-header-cart-widget__dropdown,
	.stp-mini-cart-item,
	.stp-mini-cart-item__remove,
	.stp-header-cart-widget .stp-mini-cart__button,
	.stp-header-cart-widget__toggle {
		transition: none;
	}
}

@media (max-width: 1180px) {
	.stp-header-cart-widget__amount {
		display: none;
	}

	.stp-header-cart-widget__toggle {
		width: 42px;
		padding: 0;
	}
}

@media (max-width: 1024px) {
	.stp-header-cart-widget__dropdown {
		position: fixed;
		top: 44px;
		left: 50%;
		right: auto;
		width: min(380px, calc(100vw - 40px));
		max-width: calc(100vw - 40px);
		max-height: calc(100vh - 58px);
		transform: translate(-50%, 8px);
	}

	.stp-header-cart-widget:not(.is-click-closed):hover .stp-header-cart-widget__dropdown,
	.stp-header-cart-widget.is-open .stp-header-cart-widget__dropdown {
		transform: translate(-50%, 0);
	}

	.stp-header-cart-widget__dropdown::before {
		top: -7px;
		right: 28px;
		margin-right: 0;
	}

	.stp-mini-cart {
		max-height: calc(100vh - 58px);
	}

	.stp-mini-cart__items {
		max-height: min(var(--stp-mini-cart-items-max-height, 320px), calc(100vh - 254px));
	}
}

@media (max-width: 767px) {
	.stp-header-cart-widget {
		position: relative;
	}

	.stp-header-cart-widget__toggle {
		width: 40px;
		height: 40px;
		padding: 0;
		border-radius: 12px;
	}

	.stp-header-cart-widget__icon-wrap {
		width: 23px;
		height: 23px;
		flex-basis: 23px;
	}

	.stp-header-cart-widget__icon,
	.stp-header-cart-widget__icon-mask {
		width: 23px;
		height: 23px;
	}

	.stp-header-cart-widget__badge {
		top: -13px;
		right: -9px;
		min-width: 17px;
		height: 17px;
		font-size: 10px;
	}

	.stp-header-cart-widget__dropdown {
		position: fixed;
		top: 52px;
		left: 50%;
		right: auto;
		width: min(350px, calc(100vw - 40px));
		max-width: calc(100vw - 40px);
		max-height: calc(100vh - 64px);
		transform: translate(-50%, 8px);
	}

	.stp-header-cart-widget:not(.is-click-closed):hover .stp-header-cart-widget__dropdown,
	.stp-header-cart-widget.is-open .stp-header-cart-widget__dropdown {
		transform: translate(-50%, 0);
	}

	.stp-header-cart-widget__dropdown::before {
		right: 28px;
		margin-right: 0;
	}

	.stp-mini-cart {
		max-height: calc(100vh - 64px);
	}

	.stp-mini-cart__items {
		max-height: min(var(--stp-mini-cart-items-max-height, 280px), calc(100vh - 276px));
	}
}

@media (max-width: 480px) {
	.stp-header-cart-widget__dropdown {
		top: 52px;
		width: min(342px, calc(100vw - 40px));
		max-width: calc(100vw - 40px);
		max-height: calc(100vh - 64px);
	}

	.stp-mini-cart {
		max-height: calc(100vh - 64px);
	}

	.stp-mini-cart__items {
		max-height: min(var(--stp-mini-cart-items-max-height, 260px), calc(100vh - 274px));
	}
}

@media (max-width: 380px) {
	.stp-header-cart-widget__dropdown {
		top: 50px;
		width: min(332px, calc(100vw - 32px));
		max-width: calc(100vw - 32px);
		max-height: calc(100vh - 60px);
	}

	.stp-mini-cart {
		max-height: calc(100vh - 60px);
	}

	.stp-mini-cart__header,
	.stp-mini-cart__total {
		padding-right: 13px;
		padding-left: 13px;
	}

	.stp-mini-cart__items {
		max-height: min(var(--stp-mini-cart-items-max-height, 248px), calc(100vh - 266px));
		padding-right: 8px;
		padding-left: 8px;
	}

	.stp-mini-cart__actions {
		padding-right: 13px;
		padding-left: 13px;
	}
}