/**
 * Donation mini-cart — persistent cart launcher + slide-out drawer.
 *
 * Additive chrome injected by assets/js/mini-cart.js; it does not style or alter
 * any existing header/button. Colours + spacing use theme.json tokens. The
 * launcher is hidden until the basket has at least one item (.has-items).
 */

.ab-mc {
	--ab-mc-accent: var( --wp--preset--color--ab-orange, #f08c1e );
	--ab-mc-accent-600: var( --wp--preset--color--ab-orange-600, #d97b12 );
	--ab-mc-navy: var( --wp--preset--color--ab-navy, #0c2e4e );
	--ab-mc-ink: var( --wp--preset--color--ab-ink, #1f2933 );
	--ab-mc-muted: var( --wp--preset--color--ab-muted, #5b6b7a );
	--ab-mc-line: var( --wp--preset--color--ab-line, #e3e8ee );
	--ab-mc-surface: var( --wp--preset--color--ab-surface, #f7f8fa );
	--ab-mc-green: var( --wp--preset--color--ab-green, #1a6b58 );
	--ab-mc-blue: var( --wp--preset--color--ab-blue, #1c6cb0 );
	--ab-mc-white: var( --wp--preset--color--ab-white, #fff );
	--ab-mc-serif: var( --wp--preset--font-family--fraunces, Georgia, serif );
	--ab-mc-sans: var( --wp--preset--font-family--jost, system-ui, sans-serif );
}

/* The `hidden` attribute must win over the component's own display rules
   (a class `display:flex/grid` otherwise keeps a hidden element visible). */
.ab-mc [hidden] {
	display: none !important;
}

/* ---- Launcher ---- */
.ab-mc__launcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	text-decoration: none;
	line-height: 0;
}

.ab-mc__launcher:focus-visible {
	outline: 2px solid var( --ab-mc-blue );
	outline-offset: 3px;
	border-radius: 10px;
}

/* Header variant — an icon button that sits next to "Donate Now" (persistent). */
.ab-mc__launcher--header {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	color: var( --ab-mc-navy );
	transition: color 0.15s ease, background-color 0.15s ease;
}

.ab-mc__launcher--header:hover {
	color: var( --ab-mc-blue );
	background: rgba( 28, 108, 176, 0.08 );
}

/* Floating launcher — a navy FAB, bottom-right. On phones it replaces the header
   icon (so the crowded mobile header keeps its original layout); the --solo
   modifier (no theme header present) shows it on every breakpoint. */
.ab-mc__launcher--float {
	position: fixed;
	bottom: calc( 20px + env( safe-area-inset-bottom, 0px ) );
	right: 18px;
	z-index: 1000;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var( --ab-mc-navy );
	color: var( --ab-mc-white );
	box-shadow: 0 10px 26px rgba( 12, 46, 78, 0.32 );
	display: none;
	transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

/* Solo (no header launcher): visible on all sizes once there are items. */
.ab-mc__launcher--solo.is-visible {
	display: inline-flex;
	animation: ab-mc-pop 0.32s cubic-bezier( 0.34, 1.56, 0.64, 1 );
}

.ab-mc__launcher--float:hover {
	background: #123a63;
	transform: translateY( -2px );
	box-shadow: 0 14px 30px rgba( 12, 46, 78, 0.38 );
}

/* Badge — works whether the launcher is in the header or floating. */
.ab-mc__badge {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: var( --ab-mc-accent );
	color: var( --ab-mc-white );
	font: 700 0.72rem/20px var( --ab-mc-sans );
	text-align: center;
	box-shadow: 0 0 0 2px var( --ab-mc-white );
}

.ab-mc__badge[hidden] {
	display: none;
}

.ab-mc__launcher.is-bump {
	animation: ab-mc-bump 0.45s ease;
}

@keyframes ab-mc-pop {
	0% { transform: scale( 0.4 ); opacity: 0; }
	100% { transform: scale( 1 ); opacity: 1; }
}

@keyframes ab-mc-bump {
	0% { transform: scale( 1 ); }
	35% { transform: scale( 1.16 ); }
	70% { transform: scale( 0.97 ); }
	100% { transform: scale( 1 ); }
}

@media ( prefers-reduced-motion: reduce ) {
	.ab-mc__launcher--float.is-visible,
	.ab-mc__launcher.is-bump {
		animation: none;
	}
}

/* ---- Overlay ---- */
.ab-mc__overlay {
	position: fixed;
	inset: 0;
	z-index: 1001;
	background: rgba( 9, 33, 56, 0.55 );
	-webkit-backdrop-filter: blur( 3px );
	backdrop-filter: blur( 3px );
	opacity: 0;
	transition: opacity 0.28s ease;
}

.ab-mc.is-open .ab-mc__overlay {
	opacity: 1;
}

/* ---- Drawer ---- */
.ab-mc__drawer {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 1002;
	display: flex;
	flex-direction: column;
	width: min( 420px, 94vw );
	height: 100%;
	background: var( --ab-mc-white );
	box-shadow: -18px 0 50px rgba( 9, 33, 56, 0.28 );
	transform: translateX( 100% );
	transition: transform 0.32s cubic-bezier( 0.22, 1, 0.36, 1 );
}

.ab-mc.is-open .ab-mc__drawer {
	transform: translateX( 0 );
}

@media ( prefers-reduced-motion: reduce ) {
	.ab-mc__overlay,
	.ab-mc__drawer {
		transition: none;
	}
}

/* ---- Header ---- */
.ab-mc__head {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1.1rem 1.25rem;
	border-bottom: 1px solid var( --ab-mc-line );
}

.ab-mc__head-icon {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 10px;
	background: rgba( 28, 108, 176, 0.1 );
	color: var( --ab-mc-blue );
}

.ab-mc__head-titles {
	display: flex;
	flex-direction: column;
	gap: 1px;
	margin-right: auto;
	min-width: 0;
}

.ab-mc__title {
	margin: 0;
	font-family: var( --ab-mc-serif );
	color: var( --ab-mc-navy );
	font-size: 1.3rem;
	line-height: 1.15;
	letter-spacing: -0.01em;
}

.ab-mc__count {
	font: 500 0.82rem/1.2 var( --ab-mc-sans );
	color: var( --ab-mc-muted );
}

.ab-mc__close {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: var( --ab-mc-surface );
	color: var( --ab-mc-muted );
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ab-mc__close:hover {
	background: #eef1f5;
	color: var( --ab-mc-ink );
}

.ab-mc__close:focus-visible,
.ab-mc__step:focus-visible,
.ab-mc__item-remove:focus-visible,
.ab-mc__checkout:focus-visible,
.ab-mc__continue:focus-visible,
.ab-mc__empty-cta:focus-visible {
	outline: 2px solid var( --ab-mc-blue );
	outline-offset: 2px;
}

/* ---- Scroll region ---- */
.ab-mc__scroll {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0.5rem 1.35rem;
}

/* ---- Items ---- */
.ab-mc__items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.7rem;
}

/* Each gift is a soft-tinted card (inspired by oinusa.org, in Al Basar tokens). */
.ab-mc__item {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: 0.85rem 0.95rem;
	background: var( --ab-mc-surface );
	border: 1px solid var( --ab-mc-line );
	border-radius: 12px;
}

.ab-mc__item-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.6rem;
}

.ab-mc__item-title {
	font: 600 0.98rem/1.35 var( --ab-mc-sans );
	color: var( --ab-mc-ink );
	min-width: 0;
	overflow-wrap: anywhere;
}

.ab-mc__item-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.ab-mc__item-foot .ab-mc__item-total {
	margin-left: auto;
}

.ab-mc__item-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.ab-mc__chip {
	font: 600 0.68rem/1 var( --ab-mc-sans );
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.28rem 0.5rem;
	border-radius: 999px;
	background: var( --ab-mc-surface );
	color: var( --ab-mc-muted );
	border: 1px solid var( --ab-mc-line );
}

.ab-mc__chip--monthly {
	background: rgba( 28, 108, 176, 0.1 );
	color: var( --ab-mc-blue );
	border-color: transparent;
}

.ab-mc__chip--zakat {
	background: rgba( 26, 107, 88, 0.12 );
	color: var( --ab-mc-green );
	border-color: transparent;
}

.ab-mc__chip--fund {
	background: rgba( 12, 46, 78, 0.08 );
	color: var( --ab-mc-navy );
	border-color: transparent;
}

.ab-mc__chip--muted {
	text-transform: none;
	letter-spacing: 0;
	font-weight: 500;
}

/* Quantity stepper — white pill so it lifts off the tinted card. */
.ab-mc__qty {
	display: inline-flex;
	align-items: center;
	gap: 0.15rem;
	background: var( --ab-mc-white );
	border: 1px solid var( --ab-mc-line );
	border-radius: 999px;
	padding: 0.15rem;
}

.ab-mc__step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.7rem;
	height: 1.7rem;
	border: 0;
	background: transparent;
	color: var( --ab-mc-navy );
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.ab-mc__step:hover {
	background: var( --ab-mc-surface );
}

.ab-mc__qty-value {
	min-width: 1.9ch;
	text-align: center;
	font: 700 0.95rem/1 var( --ab-mc-sans );
	color: var( --ab-mc-ink );
}

.ab-mc__item-total {
	font: 700 1.1rem/1 var( --ab-mc-sans );
	color: var( --ab-mc-navy );
}

/* Remove — a subtle trash icon top-right of the card. */
.ab-mc__item-remove {
	flex: none;
	margin: -2px -3px 0 0;
	width: 30px;
	height: 30px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: transparent;
	color: var( --ab-mc-muted );
	border-radius: 8px;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.ab-mc__item-remove:hover {
	color: #b3261e;
	background: rgba( 179, 38, 30, 0.08 );
}

/* ---- Empty state ---- */
.ab-mc__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.9rem;
	padding: 3rem 1rem;
}

.ab-mc__empty-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 76px;
	height: 76px;
	border-radius: 50%;
	background: var( --ab-mc-surface );
	color: var( --ab-mc-accent );
}

.ab-mc__empty-text {
	margin: 0;
	color: var( --ab-mc-muted );
	font-size: 1rem;
}

.ab-mc__empty-cta {
	font: 700 0.95rem/1 var( --ab-mc-sans );
	color: var( --ab-mc-blue );
	text-decoration: none;
	border-bottom: 2px solid currentColor;
	padding-bottom: 2px;
}

/* ---- Footer ---- */
.ab-mc__foot {
	border-top: 1px solid var( --ab-mc-line );
	padding: 1rem 1.35rem calc( 1.15rem + env( safe-area-inset-bottom, 0px ) );
	background: var( --ab-mc-white );
	box-shadow: 0 -8px 24px rgba( 9, 33, 56, 0.06 );
}

.ab-mc__zakat {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	background: rgba( 26, 107, 88, 0.09 );
	color: var( --ab-mc-green );
	border-radius: 10px;
	padding: 0.55rem 0.75rem;
	font: 600 0.82rem/1.3 var( --ab-mc-sans );
	margin-bottom: 0.85rem;
}

.ab-mc__zakat-dot {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var( --ab-mc-green );
}

.ab-mc__subtotal {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-family: var( --ab-mc-sans );
	margin-bottom: 0.2rem;
}

.ab-mc__subtotal > span:first-child {
	font-size: 0.95rem;
	color: var( --ab-mc-muted );
}

.ab-mc__subtotal > span:last-child {
	font-size: 1.5rem;
	font-weight: 800;
	color: var( --ab-mc-navy );
	letter-spacing: -0.01em;
}

.ab-mc__freq {
	margin: 0 0 0.85rem;
	font-size: 0.8rem;
	color: var( --ab-mc-blue );
}

.ab-mc__foot > .ab-mc__subtotal + .ab-mc__checkout {
	margin-top: 0.85rem;
}

.ab-mc__checkout {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	text-decoration: none;
	background: var( --ab-mc-accent );
	color: var( --ab-mc-white );
	font: 700 1.05rem/1 var( --ab-mc-sans );
	border-radius: 12px;
	padding: 0.95rem 1rem;
	box-shadow: 0 8px 18px rgba( 240, 140, 30, 0.32 );
	transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.ab-mc__checkout:hover {
	background: var( --ab-mc-accent-600 );
	color: var( --ab-mc-white );
	transform: translateY( -1px );
	box-shadow: 0 12px 22px rgba( 240, 140, 30, 0.4 );
}

.ab-mc__checkout svg {
	transition: transform 0.15s ease;
}

.ab-mc__checkout:hover svg {
	transform: translateX( 3px );
}

.ab-mc__continue {
	display: block;
	width: 100%;
	margin-top: 0.55rem;
	border: 0;
	background: transparent;
	color: var( --ab-mc-muted );
	font: 600 0.9rem/1 var( --ab-mc-sans );
	padding: 0.6rem;
	border-radius: 8px;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.ab-mc__continue:hover {
	color: var( --ab-mc-ink );
	background: var( --ab-mc-surface );
}

.ab-mc__trust {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	margin: 0.7rem 0 0;
	color: var( --ab-mc-muted );
	font-size: 0.72rem;
	line-height: 1.3;
	text-align: center;
}

.ab-mc__trust svg {
	flex: none;
	color: var( --ab-mc-green );
}

@media ( prefers-reduced-motion: reduce ) {
	.ab-mc__checkout:hover {
		transform: none;
	}
	.ab-mc__checkout:hover svg {
		transform: none;
	}
}

/* Phones: the header icon steps aside for the floating cart so the mobile navbar
   keeps its original, uncrowded layout; the drawer goes full-width. */
@media ( max-width: 780px ) {
	.ab-mc__launcher--header {
		display: none;
	}

	.ab-mc__launcher--float.is-visible {
		display: inline-flex;
		animation: ab-mc-pop 0.32s cubic-bezier( 0.34, 1.56, 0.64, 1 );
	}

	.ab-mc__drawer {
		width: 100vw;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.ab-mc__launcher--float.is-visible,
	.ab-mc__launcher--solo.is-visible {
		animation: none;
	}
}
