/* Cart extra upsell: category triggers + modal */

.chef-cart-extra-upsell {
	margin-top: 1.5rem;
}

.chef-cart-extra-upsell__title {
	margin: 0 0 0.75rem;
	font-size: 1.125rem;
}

.chef-cart-extra-upsell__triggers {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.chef-cart-extra-upsell__trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	border: 1px solid rgba(0, 0, 0, 0.15);
	background: #fff;
	padding: 0.5rem 1rem;
	border-radius: 4px;
	font: inherit;
	line-height: 1.3;
	text-align: left;
	transition:
		border-color 0.15s ease,
		background 0.15s ease;
}

.chef-cart-extra-upsell__term-thumb {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.04);
}

.chef-cart-extra-upsell__term-thumb--trigger
	.chef-cart-extra-upsell__term-thumb-img {
	display: block;
	width: 2.25rem;
	height: 2.25rem;
	object-fit: cover;
}

.chef-cart-extra-upsell__term-label {
	min-width: 0;
}

.chef-cart-extra-upsell__trigger:hover,
.chef-cart-extra-upsell__trigger:focus-visible {
	border-color: rgba(0, 0, 0, 0.35);
	outline: none;
}

.chef-cart-extra-upsell__trigger.is-active {
	border-color: currentColor;
	font-weight: 600;
}

/* Native dialog */
.chef-cart-extra-upsell-dialog {
	max-width: min(52rem, calc(100vw - 2rem));
	width: 100%;
	max-height: calc(100dvh - 2rem);
	padding: 0;
	border: none;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	overflow: hidden;
	background: #f0f0f0;
}

.chef-cart-extra-upsell-dialog::backdrop {
	background: rgba(0, 0, 0, 0.45);
}

.chef-cart-extra-upsell-dialog__inner {
	display: flex;
	flex-direction: column;
	max-height: calc(100dvh - 2rem);
	padding: 1rem 1.25rem 1.25rem;
	overflow: hidden;
}

.chef-cart-extra-upsell-dialog__header {
	display: flex;
	flex: 0 0 auto;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
}

.chef-cart-extra-upsell-dialog__title {
	font-size: 1.45rem;
	line-height: 1.2;
	flex: 1;
	margin: 10px 0 10px 0;
}

.chef-cart-extra-upsell-dialog__close {
	flex: 0 0 auto;
	cursor: pointer;
	border: none;
	background: transparent;
	font-size: 1.75rem;
	padding: 0.15rem 0.35rem;
	border-radius: 40px;
	color: inherit;
	background: #fab400;
	width: 44px;
	height: 44px;
	position: relative;

	display: flex;
	flex-flow: row wrap;
	align-items: center;
	justify-content: center;
}

.chef-cart-extra-upsell-dialog__close span {
	line-height: 1;
	display: block;
}

.chef-cart-extra-upsell-dialog__close:hover,
.chef-cart-extra-upsell-dialog__close:focus-visible {
	background: #ffffff;
	outline: none;
}

.chef-cart-extra-upsell-dialog__category {
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	gap: 0.35rem;
	margin-bottom: 1rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.chef-cart-extra-upsell-dialog__category-label {
	font-size: 0.875rem;
	font-weight: 600;
}

.chef-cart-extra-upsell-dialog__category-select {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 0.5rem 2rem 0.5rem 0.65rem;
	font: inherit;
	font-size: 0.9375rem;
	line-height: 1.35;
	color: inherit;
	background-color: #fff;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 6px;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.65rem center;
	background-size: 12px 12px;
}

.chef-cart-extra-upsell-dialog__category-select:hover {
	border-color: rgba(0, 0, 0, 0.32);
}

.chef-cart-extra-upsell-dialog__category-select:focus {
	outline: none;
	border-color: currentColor;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.chef-cart-extra-upsell-dialog__loading {
	flex: 0 0 auto;
	margin: 0.5rem 0;
	font-size: 0.9375rem;
	color: #555;
}

.chef-cart-extra-upsell-dialog__list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.chef-cart-extra-upsell-dialog__empty {
	margin: 0.75rem 0 0;
	color: #555;
}

.chef-cart-extra-upsell__products {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.65rem;
}

.chef-cart-extra-upsell__product-link {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	text-decoration: none;
	color: inherit;
	padding: 0.35rem 0;
	border-radius: 4px;
}

.chef-cart-extra-upsell__product-link:hover .chef-cart-extra-upsell__name,
.chef-cart-extra-upsell__product-link:focus-visible
	.chef-cart-extra-upsell__name {
	text-decoration: underline;
}

.chef-cart-extra-upsell__thumb {
	flex: 0 0 56px;
	width: 56px;
}

.chef-cart-extra-upsell__thumb img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}

.chef-cart-extra-upsell__meta {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
}

.chef-cart-extra-upsell__name {
	font-weight: 500;
}

.chef-cart-extra-upsell__products--theme {
	display: flex;
	flex-flow: row wrap;
	gap: 1rem;
}

.part.product-extra {
	flex: 0 1 calc(50% - 0.5rem);
}

.chef-cart-extra-upsell__price {
	font-size: 0.9rem;
	opacity: 0.9;
}

/* Fallback when <dialog> showModal is missing */
.chef-cart-extra-upsell-dialog[open]:not(:modal) {
	display: block;
	position: fixed;
	inset: 50% auto auto 50%;
	transform: translate(-50%, -50%);
	z-index: 100000;
}

html.chef-cart-extra-upsell-dialog-open,
body.chef-cart-extra-upsell-dialog-open {
	overflow: hidden;
}

/* Fallback overlay when <dialog> showModal is unavailable (no ::backdrop) */
body.chef-cart-extra-upsell-dialog-open:not(
		:has(.chef-cart-extra-upsell-dialog:modal)
	)::before {
	content: "";
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 99999;
}
