/**
 * Cart drawer — the cart-specific parts only.
 *
 * Layout, transitions, head and scrollable body come from assets/css/drawer.css.
 * What lives here: the "Added to your cart" flash, and restyling WooCommerce's
 * mini-cart markup, which renders a thumbnail and name inside a single <a>.
 * The quantity stepper's own look is shared with the cart page, in
 * woocommerce.css.
 *
 * Mobile-first, enqueued site-wide with the drawer (see inc/woocommerce.php).
 *
 * @package FairyFlower_Custom
 */

/* "Added to your cart" flash -------------------------------------------- */
.ff-cart-drawer__flash {
	display: flex;
	align-items: center;
	gap: .4rem;
	margin: 0;
	padding: .65rem 1.25rem;
	background: var(--ff-color-success-bg);
	color: var(--ff-color-text);
	font-size: .9rem;
	flex: 0 0 auto;
}
.ff-cart-drawer__flash[hidden] { display: none; }
.ff-cart-drawer__flash .ff-icon { width: 18px; height: 18px; color: var(--ff-color-success); }

/* WooCommerce mini-cart, restyled to match the theme ------------------- */
.ff-cart-drawer .woocommerce-mini-cart {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1 1 auto;
	display: grid;
	gap: 1rem;
	align-content: start;
}
.ff-cart-drawer .woocommerce-mini-cart__empty-message {
	margin: auto 0;
	text-align: center;
	color: var(--ff-color-muted);
}

/*
 * WooCommerce renders each item as a single <a> (thumbnail + name together)
 * followed by a .quantity span, so a column grid mis-wraps the name. Instead
 * pin the thumbnail to the left and let the name + quantity flow in a padded
 * column — robust from the narrowest phone up.
 */
.ff-cart-drawer .woocommerce-mini-cart li.woocommerce-mini-cart-item {
	position: relative;
	margin: 0;
	padding: 0 1.75rem 1rem 70px;   /* reserve the left column for the thumbnail */
	min-height: 56px;
	border-bottom: 1px solid var(--ff-color-border);
}
.ff-cart-drawer .woocommerce-mini-cart li.woocommerce-mini-cart-item img {
	position: absolute;
	left: 0;
	top: 0;
	width: 56px !important;
	height: 56px;
	margin: 0 !important;
	float: none !important;
	object-fit: cover;
	border-radius: var(--ff-radius);
}
.ff-cart-drawer .woocommerce-mini-cart li.woocommerce-mini-cart-item > a:not(.remove) {
	display: block;
	color: inherit;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.3;
}
/* WooCommerce's "1 × 12,00 €", left on items whose quantity cannot change. */
.ff-cart-drawer .woocommerce-mini-cart li.woocommerce-mini-cart-item > .quantity {
	display: block;
	margin-top: .25rem;
	color: var(--ff-color-muted);
	font-size: .9rem;
}

/*
 * Every other item: the price on the left, the stepper on the right
 * (fairyflower_custom_wc_mini_cart_quantity()). The row reaches out over the
 * item's right padding, so the stepper lines up under the ×.
 */
.ff-cart-drawer__qty {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	margin: .5rem -1.75rem 0 0;
}
.ff-cart-drawer__price {
	color: var(--ff-color-muted);
	font-size: .9rem;
}
.ff-cart-drawer .ff-qty { --ff-qty-size: 36px; }

/* While a new quantity is being saved, the total is out of date: dim it, and
   hold the buttons so checkout does not start from the old cart. */
.ff-cart-drawer__content.is-updating .woocommerce-mini-cart__total,
.ff-cart-drawer__content.is-updating .woocommerce-mini-cart__buttons {
	opacity: .5;
	pointer-events: none;
	transition: opacity var(--ff-transition-fast);
}
.ff-cart-drawer a.remove {
	position: absolute;
	top: 0;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--ff-color-tint);
	color: var(--ff-color-error) !important;
	font-size: 1rem;
	line-height: 1;
	text-decoration: none;
}
.ff-cart-drawer a.remove:hover { background: var(--ff-color-error); color: var(--ff-color-on-dark) !important; }

/* Subtotal + action buttons (pinned to the bottom of the panel) -------- */
.ff-cart-drawer .woocommerce-mini-cart__total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin: 1rem 0 0;
	padding-top: 1rem;
	border-top: 1px solid var(--ff-color-border);
	font-size: 1.05rem;
}
.ff-cart-drawer .woocommerce-mini-cart__total strong { font-weight: 600; }
.ff-cart-drawer .woocommerce-mini-cart__total .amount { font-weight: 700; }

.ff-cart-drawer .woocommerce-mini-cart__buttons {
	display: grid;
	gap: .6rem;
	margin: 1rem 0 0;
	padding: 0;
}
.ff-cart-drawer .woocommerce-mini-cart__buttons .button {
	display: block;
	margin: 0;
	padding: .7rem 1rem;
	text-align: center;
	text-decoration: none;
	border-radius: var(--ff-radius);
	border: 1px solid var(--ff-color-accent);
	background: transparent;
	color: var(--ff-color-accent-text);
	font-weight: 600;
}
.ff-cart-drawer .woocommerce-mini-cart__buttons .button.checkout {
	background: var(--ff-color-accent);
	color: var(--ff-color-accent-ink);
}
.ff-cart-drawer .woocommerce-mini-cart__buttons .button:hover { opacity: .9; }
