/* Site Cart Drawer — structural CSS only. Cart-item markup (thumbnails,
 * remove button, totals, buttons row) reuses WooCommerce core's own
 * `.widget_shopping_cart` classes on purpose so it inherits WC's existing
 * styling for free and stays visually consistent with any other cart widget
 * on the site — no need to re-style product rows here. */

:root {
	--scd-z: 999990;
}

/* ---- Floating toggle button ---- */
.scd-toggle {
	position: fixed;
	right: max(20px, env(safe-area-inset-right));
	bottom: max(20px, env(safe-area-inset-bottom));
	z-index: calc(var(--scd-z) - 3);
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: none;
	background: var(--bg-dark, #1e1e1e);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	padding: 0;
}

.scd-toggle:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.scd-icon {
	width: 26px;
	height: 26px;
	fill: currentColor;
	pointer-events: none;
}

.scd-count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #d63638;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	pointer-events: none;
}

.scd-count[hidden] {
	display: none;
}

/* ---- Overlay ---- */
.scd-overlay {
	position: fixed;
	inset: 0;
	z-index: calc(var(--scd-z) - 2);
	background: rgba(0, 0, 0, 0.4);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.scd-overlay.scd-visible {
	opacity: 1;
}

.scd-overlay[hidden] {
	display: none;
}

/* ---- Drawer ---- */
.scd-drawer {
	position: fixed;
	top: 0;
	right: 0;
	z-index: calc(var(--scd-z) - 1);
	width: min(400px, 100vw);
	height: 100vh;
	height: 100dvh;
	background: #fff;
	box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.25s ease;
	padding-top: env(safe-area-inset-top);
	padding-bottom: env(safe-area-inset-bottom);
}

.scd-drawer[hidden] {
	display: none;
}

.scd-drawer.scd-open {
	transform: translateX(0);
}

.scd-drawer-head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid #e5e5e5;
}

.scd-drawer-head h2 {
	margin: 0;
	font-size: 1.1em;
}

.scd-close {
	border: none;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	color: inherit;
}

.scd-body {
	flex: 1 1 auto;
	overflow: hidden;
	padding: 16px 20px;
	display: flex;
	flex-direction: column;
	-webkit-overflow-scrolling: touch;
}

/* Only the item list scrolls; subtotal + buttons below stay pinned in
 * view so a long list of configuration meta (Part No, Latch, Hinge, …)
 * never buries the checkout button off-screen. */
.scd-body .widget_shopping_cart_content {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

.scd-body .woocommerce-mini-cart.cart_list {
	flex: 1 1 auto;
	overflow-y: auto;
	min-height: 0;
	margin: 0;
	-webkit-overflow-scrolling: touch;
}

.scd-body .woocommerce-mini-cart-item {
	padding-bottom: 14px;
	margin-bottom: 14px;
	border-bottom: 1px solid #eee;
}

.scd-body .woocommerce-mini-cart-item:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

/* Collapsed-by-default configuration meta — see the theme's
 * woocommerce/cart/cart-item-data.php override, shared by this drawer
 * and the full cart page. Was the main source of clutter here: a fully
 * configured locker's ~10 meta rows always rendered open. */
.scd-body .penco-cart-item-meta {
	margin-top: 4px;
}

.scd-body .penco-cart-item-meta summary {
	cursor: pointer;
	font-size: 0.82em;
	font-weight: 600;
	color: #1e73be;
	list-style: none;
}

.scd-body .penco-cart-item-meta summary::-webkit-details-marker {
	display: none;
}

.scd-body .penco-cart-item-meta summary::before {
	content: "▸ ";
}

.scd-body .penco-cart-item-meta[open] summary::before {
	content: "▾ ";
}

.scd-body .penco-cart-item-meta dl.variation {
	margin: 6px 0 0;
	font-size: 0.9em;
}

.scd-body .woocommerce-mini-cart__empty-message {
	margin-top: 40px;
	text-align: center;
	color: #777;
}

.scd-body .woocommerce-mini-cart__total {
	flex: 0 0 auto;
	margin: 12px 0 0;
	padding-top: 12px;
	border-top: 1px solid #e5e5e5;
}

.scd-body .woocommerce-mini-cart__buttons {
	flex: 0 0 auto;
	margin: 8px 0 0;
}

.scd-body .woocommerce-mini-cart__buttons .button {
	display: block;
	text-align: center;
	margin-bottom: 8px;
}

/* ---- Toast ---- */
.scd-toast {
	position: fixed;
	right: max(20px, env(safe-area-inset-right));
	bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px));
	z-index: calc(var(--scd-z) - 1);
	background: var(--bg-dark, #1e1e1e);
	color: #fff;
	padding: 10px 16px;
	border-radius: 8px;
	font-size: 14px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.scd-toast[hidden] {
	display: none;
}

.scd-toast.scd-visible {
	opacity: 1;
	transform: translateY(0);
}

@media (max-width: 480px) {
	.scd-drawer {
		width: 100vw;
	}
}

/* Prevents the page behind the drawer from scrolling while it's open,
 * applied to <body> by openDrawer()/closeDrawer() in the JS. */
body.scd-locked {
	overflow: hidden;
}
