/**
 * @package ProMart
 *
 * Mobile "added to cart" bottom sheet (template-parts/mobile/mini-cart-sheet.php).
 * Mirrors the desktop header mini-cart dropdown for the breakpoint where the
 * header has no cart trigger of its own; the reused `.promart-mini-cart-*`
 * item/subtotal/footer styles live in header.css, since the sheet renders
 * the exact same promart_render_mini_cart_content() markup.
 *
 * Follows the same fixed-overlay + sliding-sheet convention used by the
 * mobile filter drawer and hamburger menu (category.css, mobile-hamburger-menu.css):
 * `visibility` + `pointer-events` gate interactivity/hit-testing while a
 * `transform: translateY(100%) → translateY(0)` on the panel drives the
 * actual slide animation.
 */

.promart-mini-cart-sheet {
	position: fixed;
	inset: 0;
	z-index: 97;
	pointer-events: none;
	visibility: hidden;
}

.promart-mini-cart-sheet.is-open {
	pointer-events: auto;
	visibility: visible;
}

.promart-mini-cart-sheet::before {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0, 32, 63, 0.48);
	opacity: 0;
	transition: opacity 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

.promart-mini-cart-sheet.is-open::before {
	opacity: 1;
}

.promart-mini-cart-sheet__panel {
	position: absolute;
	inset-inline: 0;
	bottom: var(--promart-bottom-nav-offset, calc(4.5rem + env(safe-area-inset-bottom, 0px)));
	display: flex;
	flex-direction: column;
	max-height: min(80vh, 640px);
	background: #fff;
	border-radius: 1rem 1rem 0 0;
	box-shadow: 0 -8px 32px rgba(13, 49, 85, 0.18);
	transform: translateY(100%);
	transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
}

.promart-mini-cart-sheet.is-open .promart-mini-cart-sheet__panel {
	transform: translateY(0);
}

.promart-mini-cart-sheet__grabber {
	flex-shrink: 0;
	width: 2.5rem;
	height: 0.25rem;
	margin: 0.6rem auto 0;
	border-radius: 999px;
	background: #e2e5ea;
}

.promart-mini-cart-sheet__top {
	display: flex;
	justify-content: flex-end;
	flex-shrink: 0;
	padding: 0.3rem 0.6rem 0;
}

.promart-mini-cart-sheet__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border: none;
	border-radius: 999px;
	background: #f3f3f3;
	color: #0d3155;
	cursor: pointer;
	transition: background-color 0.18s ease;
}

.promart-mini-cart-sheet__close:hover {
	background: #eef0f3;
}

.promart-mini-cart-sheet__close .material-symbols-outlined {
	font-size: 1.15rem;
}

.promart-mini-cart-sheet__hero {
	position: relative;
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 0.75rem;
	padding: 0.35rem 1.1rem 0.9rem;
}

.promart-mini-cart-sheet__hero-check {
	position: absolute;
	top: -0.15rem;
	inset-inline-start: 2.6rem;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.3rem;
	height: 1.3rem;
	border-radius: 50%;
	background: #16a34a;
	color: #fff;
	box-shadow: 0 0 0 3px #fff;
	animation: promart-mini-cart-sheet-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.promart-mini-cart-sheet__hero-check .material-symbols-outlined {
	font-size: 0.85rem;
	font-variation-settings: 'wght' 700;
}

.promart-mini-cart-sheet__hero-media {
	display: block;
	width: 3.5rem;
	height: 3.5rem;
	flex-shrink: 0;
	overflow: hidden;
	border-radius: 0.65rem;
	background: #f3f3f3;
	border: 1px solid #e2e5ea;
}

.promart-mini-cart-sheet__hero-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.promart-mini-cart-sheet__hero-body {
	flex: 1;
	min-width: 0;
}

.promart-mini-cart-sheet__hero-title {
	margin: 0 0 0.15rem;
	font-size: 0.72rem;
	font-weight: 700;
	color: #16a34a;
}

.promart-mini-cart-sheet__hero-name {
	margin: 0;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	font-size: 0.84rem;
	font-weight: 700;
	line-height: 1.4;
	color: #0d3155;
}

.promart-mini-cart-sheet__hero-meta {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.25rem;
	font-size: 0.75rem;
	color: #717171;
}

.promart-mini-cart-sheet__hero-price {
	font-weight: 800;
	color: #0d3155;
}

.promart-mini-cart-sheet__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-top: 1px solid #eef0f3;
}

/* The reused mini-cart content sizes its own item list against a desktop
 * dropdown's dimensions; let it breathe to the sheet's available height
 * instead. */
.promart-mini-cart-sheet__body .promart-mini-cart-items {
	max-height: none;
}

@keyframes promart-mini-cart-sheet-pop {
	0% {
		transform: scale(0);
	}

	70% {
		transform: scale(1.15);
	}

	100% {
		transform: scale(1);
	}
}

body.promart-mini-cart-sheet-open {
	overflow: hidden;
}

body.promart-mini-cart-sheet-open .float-support {
	opacity: 0;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.promart-mini-cart-sheet::before,
	.promart-mini-cart-sheet__panel,
	.promart-mini-cart-sheet__hero-check {
		transition: none;
		animation: none;
	}
}

/* Desktop has its own header mini-cart dropdown; this sheet is mobile-only. */
@media (min-width: 768px) {
	.promart-mini-cart-sheet {
		display: none !important;
	}
}
