/* Custom Cart Sidebar */
.cart-sidebar-container {
	width: 100%;
	max-width: none;
}

.custom-cart-sidebar {
	background: var(--color-white);
	border: 1px solid var(--color-border);
	border-radius: 10px;
	padding: 24px 20px;
	box-shadow: 0 5px 18px rgba(15, 23, 42, 0.12);
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 100%;
	max-height: calc(100vh - 112px);
	min-height: 360px;
}

@media (min-width: 1024px) {
	.restaurant-menu-page > .container > .restaurant-layout {
		display: grid !important;
		grid-template-columns: minmax(190px, 215px) minmax(0, 1fr) minmax(340px, 380px) !important;
		grid-template-areas: "categories main cart" !important;
		align-items: flex-start !important;
		gap: 24px !important;
	}

	.restaurant-menu-page > .container > .restaurant-layout > .category-sidebar-container.desktop-only-section {
		display: block !important;
		grid-area: categories !important;
		grid-column: 1 !important;
		grid-row: 1 !important;
		width: 100% !important;
		min-width: 0 !important;
	}

	.restaurant-menu-page > .container > .restaurant-layout > .restaurant-main-column {
		grid-area: main !important;
		grid-column: 2 !important;
		grid-row: 1 !important;
		width: auto !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	.restaurant-menu-page > .container > .restaurant-layout > .cart-sidebar-container.desktop-only-section {
		display: block !important;
		grid-area: cart !important;
		grid-column: 3 !important;
		grid-row: 1 !important;
		width: 100% !important;
		max-width: 380px !important;
		min-width: 0 !important;
		justify-self: stretch !important;
		align-self: flex-start !important;
		position: sticky !important;
		top: 92px !important;
		z-index: 2 !important;
		margin-top: 0 !important;
		clear: none !important;
		float: none !important;
	}
}

.cart-title {
	font-size: 1.42rem;
	font-weight: 850;
	margin-bottom: 4px;
	padding-bottom: 0;
	border-bottom: none;
	color: var(--color-text);
}

.cart-product-count {
	font-size: 0.9rem;
	color: var(--color-text-secondary);
	margin-bottom: 18px;
	display: block;
}

/* Empty State */
.cart-empty-state {
	text-align: center;
	padding: 0 0 8px;
}

.cart-empty-icon {
	color: #6b7280;
	margin: 0 auto 20px;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 104px;
	height: 104px;
	border-radius: 0;
	background: transparent;
	border: none;
}

.cart-empty-icon svg {
	width: 90px;
	height: 90px;
}

.cart-empty-heading {
	font-size: 1.72rem;
	font-weight: 850;
	color: var(--color-text);
	margin: 0 0 6px;
}

.cart-empty-text {
	color: var(--color-text);
	font-size: 1rem;
	line-height: 1.32;
	max-width: 340px;
	margin: 0 auto;
}

.cart-empty-footer {
	margin-top: 34px;
	padding-top: 18px;
	border-top: 4px solid #f0f0f0;
}

.cart-empty-fee-msg {
	font-size: 0.9rem;
	color: var(--color-text);
	margin-bottom: 8px;
	line-height: 1.4;
}

.cart-fee-info {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 0.86rem;
	color: var(--color-text-secondary);
}

/* Items List */
.cart-items-list {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin-bottom: 0; /* Removed margin so summary section fits cleanly */
	max-height: min(470px, calc(100vh - 360px)); /* Show roughly 4 items, then scroll */
	overflow-y: auto;
	overflow-x: hidden;
	padding-right: 6px; /* Space for the scrollbar */
	scrollbar-width: thin; /* Firefox */
	scrollbar-color: #ccc transparent;
}

html[dir="rtl"] .cart-items-list {
	padding-right: 0;
	padding-left: 6px;
}

/* Custom Scrollbar for Webkit */
.cart-items-list::-webkit-scrollbar {
	width: 6px;
}
.cart-items-list::-webkit-scrollbar-track {
	background: transparent;
	border-radius: 4px;
}
.cart-items-list::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 4px;
}
.cart-items-list::-webkit-scrollbar-thumb:hover {
	background: #999;
}

.cart-item {
	display: flex;
	flex-direction: row;
	gap: 12px;
	padding: 16px 0;
	border-bottom: 1px solid var(--color-border);
}

.cart-item:last-child {
	border-bottom: none;
}

.cart-item-image {
	width: 58px;
	height: 58px;
	border-radius: 10px;
	overflow: hidden;
	flex-shrink: 0;
	background: var(--color-background-alt);
}

.cart-item-image img {
	flex: 1;
	height: 100%;
	object-fit: cover;
}

.cart-item-details {
	width: 100%;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cart-item-title-row {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 10px;
}

.cart-item-title {
	font-size: 0.94rem;
	font-weight: 800;
	margin: 0;
	color: var(--color-text);
	line-height: 1.25;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cart-item-price-val {
	font-size: 0.9rem;
	color: var(--color-text);
	font-weight: 750;
	white-space: nowrap;
}

/* Item Meta (Supplements) */
.cart-item-meta {
	font-size: 0.85rem;
	color: var(--color-text-secondary);
	background: transparent;
	padding: 0;
}

.cart-item-meta dl {
	margin: 0;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 4px 8px;
}

.cart-item-meta dt {
	font-weight: 600;
}

.cart-item-meta dd {
	margin: 0;
}

.cart-item-meta p {
	margin: 0;
}

/* Item Footer (Qty & Subtotal) */
.cart-item-controls-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
}

.cart-edit-btn {
	background: none;
	border: none;
	font-weight: 800;
	font-size: 0.82rem;
	color: var(--color-text);
	cursor: pointer;
	padding: 0;
}

.cart-qty-group {
	display: flex;
	align-items: center;
	background: #f5f5f5;
	border-radius: 20px;
	padding: 3px 7px;
	border: none;
	gap: 8px;
}

.cart-item-remove {
	color: var(--color-text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color var(--transition-fast);
}

.cart-item-remove:hover {
	color: var(--color-primary-700);
}

.cart-qty-controller {
	display: flex;
	align-items: center;
	gap: 7px;
}

.cart-qty-btn {
	background: none;
	border: none;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--color-text);
	font-size: 1rem;
}

.cart-qty-btn.is-disabled,
.cart-qty-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.cart-qty-val {
	font-size: 0.9rem;
	font-weight: 700;
	min-width: 16px;
	text-align: center;
}

/* Summary Section */
.cart-summary-section {
	padding-top: 16px;
	margin-top: 16px;
	border-top: 2px solid var(--moulfood-checkout-primary, #f97316);
	flex-shrink: 0;
	background: var(--color-white);
}

.cart-savings-row {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-bottom: 14px;
	font-size: 0.85rem;
	color: var(--color-text);
}

.cart-savings-row strong {
	font-weight: 800;
}

.btn-checkout {
	display: flex;
	width: 100%;
	justify-content: center;
	align-items: center;
	min-height: 48px;
	padding: 13px 16px;
	border-radius: var(--radius-full);
	font-weight: 850;
	font-size: 1rem;
	gap: 8px;
	background-color: var(--moulfood-checkout-primary, #f97316);
	color: white;
	border: none;
}

.btn-checkout:hover {
	background-color: var(--color-primary-700);
	color: var(--color-white);
}

.btn-checkout.is-disabled,
.btn-checkout:disabled {
	opacity: 0.58;
	cursor: not-allowed;
	box-shadow: none;
}

.btn-checkout.is-disabled:hover,
.btn-checkout:disabled:hover {
	background-color: var(--moulfood-checkout-primary, #f97316);
}

.cart-closed-message {
	margin-bottom: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	background: rgba(239, 68, 68, 0.08);
	color: var(--color-error-500);
	font-size: 0.86rem;
	font-weight: 700;
	line-height: 1.35;
	text-align: center;
}

.cart-fees-info {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin-top: 16px;
	color: var(--color-text-secondary);
	font-size: 0.85rem;
}

@media (min-width: 1024px) {
	.custom-cart-sidebar {
		padding: 26px 22px 22px;
	}

	.cart-title {
		margin: 0 0 4px;
	}

	.cart-product-count {
		margin-bottom: 14px;
	}

	.cart-empty-state {
		padding: 4px 0 10px;
	}

	.cart-empty-icon {
		margin-bottom: 16px;
	}

	.cart-empty-footer {
		margin-top: 28px;
		padding-top: 16px;
	}

	.cart-item {
		display: grid;
		grid-template-columns: 58px minmax(0, 1fr);
		align-items: start;
		gap: 14px;
		padding: 18px 0;
	}

	.cart-item-details {
		width: 100%;
		min-width: 0;
	}

	.cart-item-title-row {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: start;
		gap: 12px;
	}

	.cart-item-price-val {
		text-align: right;
	}

	.cart-item-controls-row {
		margin-top: 12px;
		min-height: 30px;
	}

	.cart-qty-group {
		margin-left: auto;
	}

	.cart-summary-section {
		padding-top: 18px;
		margin-top: 18px;
	}
}

/* Mobile Bottom Bar */
.mobile-cart-system {
	margin: 0 !important;
}

.mobile-cart-system.is-empty {
	display: none !important;
}

.mobile-cart-bar {
	position: fixed;
	bottom: 10px;
	left: 12px;
	right: 12px;
	z-index: 50;
	pointer-events: none;
}

.mobile-cart-btn {
	background: var(--color-primary-500);
	color: var(--color-white);
	border-radius: var(--radius-full);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	text-decoration: none;
	box-shadow: 0 10px 25px rgba(var(--color-primary-rgb), 0.28);
	border: none;
	cursor: pointer;
	pointer-events: auto;
}

.mobile-cart-count {
	background: rgba(255, 255, 255, 0.2);
	border-radius: var(--radius-full);
	padding: 3px 9px;
	font-weight: 700;
	font-size: 0.875rem;
	min-width: 28px;
	text-align: center;
}

.mobile-cart-text {
	font-weight: 700;
	font-size: 1rem;
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: center;
	flex: 1;
	text-align: center;
	line-height: 1.2;
}

.mobile-cart-fees-info {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 7px;
	color: var(--color-text-secondary);
	font-size: 0.82rem;
	pointer-events: auto;
}

.mobile-cart-fees-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 15px;
	height: 15px;
	border: 1px solid currentColor;
	border-radius: 50%;
	font-size: 0.68rem;
	font-weight: 800;
	line-height: 1;
}

/* Loader state */
.custom-cart-sidebar.loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Mobile Drawer Overlay */
.mobile-cart-drawer-overlay {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.5);
	z-index: 100;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}
.mobile-cart-drawer-overlay.active {
	opacity: 1;
	visibility: visible;
}

/* Mobile Drawer Content */
.mobile-cart-drawer {
	position: fixed;
	bottom: -100%; left: 0; right: 0;
	background: var(--color-white);
	border-radius: 24px 24px 0 0;
	z-index: 101;
	transition: bottom 0.3s ease;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
}
.mobile-cart-drawer.active {
	bottom: 0;
}
.mobile-cart-drawer-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 18px 20px;
	border-bottom: 1px solid var(--color-border);
}
.mobile-cart-drawer-close {
	background: none;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	color: var(--color-text);
}
.mobile-cart-drawer-body {
	padding: 0 20px 20px;
	overflow-y: auto;
}

.mobile-cart-drawer-body .cart-items-list {
	max-height: 48vh;
}

.mobile-cart-drawer-body .cart-summary-section {
	position: sticky;
	bottom: 0;
	padding-bottom: 4px;
}

@media (max-width: 420px) {
	.cart-item {
		gap: 10px;
	}

	.cart-item-image {
		width: 50px;
		height: 50px;
	}

	.cart-item-title-row {
		flex-direction: column;
		gap: 2px;
	}

	.cart-item-controls-row {
		align-items: flex-start;
		flex-direction: column;
	}
}
