/* Carroll Arms Cart Panel 1.0.0
   1) Listing cards never change size when Add to Cart is pressed.
   2) Cart panel: desktop right drawer, phone (<=781px) bottom sheet.
   3) Variable-product quick-add popup: desktop centered modal, phone bottom sheet.
   Colors, fonts and radii follow the site: gold #8C760E buttons, green #58762ede
   stock text, white sheets with 16px top radius on phones (ca-bis.css options sheet),
   square 420px modal with shadow on desktop (ca-bis.css Notify popup). */

/* ---------- 1. No layout shift on listing grids ---------- */

/* WooCommerce injects a.added_to_cart.wc-forward ("View cart") after the clicked
   button, and the search grid reveals a hidden span holding the same link. Both
   grow the card, so they are hidden on every grid. The panel replaces them. */
ul.products li.product a.added_to_cart,
.wc-block-grid__product a.added_to_cart,
.wc-block-grid__product-add-to-cart a.added_to_cart,
li.wp-block-post a.added_to_cart,
.ca-bis-listing-cta a.added_to_cart,
.wc-block-components-product-button a.added_to_cart,
.wc-block-components-product-button > span[data-wp-bind--hidden] {
	display: none !important;
}

/* Keep the button the same box while loading / added / "N in cart".
   WooCommerce widens padding-right on .loading and adds an inline ::after icon
   on .added; both are taken out of the flow here (icon is absolutely placed
   inside the unchanged padding). */
ul.products li.product a.add_to_cart_button,
.wc-block-grid__product-add-to-cart .wp-block-button__link.add_to_cart_button,
.wc-block-components-product-button .wc-block-components-product-button__button {
	position: relative;
}
ul.products li.product a.add_to_cart_button.loading::after,
ul.products li.product a.add_to_cart_button.added::after,
.wc-block-grid__product-add-to-cart .wp-block-button__link.loading::after,
.wc-block-grid__product-add-to-cart .wp-block-button__link.added::after,
.wc-block-components-product-button .wc-block-components-product-button__button.loading::after {
	position: absolute !important;
	top: 50% !important;
	right: .5em !important;
	margin: -.5em 0 0 0 !important;
	width: 1em !important;
	height: 1em !important;
	line-height: 1 !important;
	display: block !important;
}
ul.products li.product a.add_to_cart_button,
.wc-block-grid__product-add-to-cart .wp-block-button__link,
.wc-block-components-product-button .wc-block-components-product-button__button {
	white-space: nowrap;
}

/* ---------- shared bits ---------- */
body.ca-cp-lock { overflow: hidden; }
.ca-cp *, .ca-qa * { box-sizing: border-box; }
.ca-cp[hidden], .ca-qa[hidden] { display: none !important; }
.ca-cp, .ca-qa {
	position: fixed;
	inset: 0;
	visibility: hidden;
	pointer-events: none;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.4;
	color: #111;
	text-transform: none;
	letter-spacing: normal;
}
.ca-cp { z-index: 99000; }
.ca-qa { z-index: 99500; }
.ca-cp.is-open, .ca-qa.is-open { visibility: visible; pointer-events: auto; }
.ca-cp-backdrop, .ca-qa-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity .25s ease;
}
.is-open > .ca-cp-backdrop, .is-open > .ca-qa-backdrop { opacity: 1; }

.ca-cp button, .ca-qa button { font-family: inherit; text-transform: none; letter-spacing: normal; }
.ca-cp-btn, .ca-qa-btn {
	display: block;
	width: 100%;
	margin: 0;
	padding: 14px 16px;
	border: 2px solid #8C760E;
	border-radius: 0;
	background: #8C760E;
	color: #fff !important;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	text-decoration: none !important;
	text-transform: uppercase !important;
	cursor: pointer;
}
.ca-cp-btn:hover, .ca-cp-btn:focus-visible, .ca-qa-btn:hover:not(:disabled), .ca-qa-btn:focus-visible {
	background: #000;
	border-color: #000;
	color: #fff !important;
}
.ca-cp-btn--ghost {
	background: #fff;
	color: #111 !important;
	border-color: #111;
}
.ca-cp-btn--ghost:hover, .ca-cp-btn--ghost:focus-visible { background: #111; border-color: #111; color: #fff !important; }
.ca-qa-btn:disabled { opacity: .45; cursor: not-allowed; }
.ca-cp button:focus-visible, .ca-cp a:focus-visible, .ca-qa button:focus-visible, .ca-qa select:focus-visible, .ca-qa a:focus-visible {
	outline: 2px solid #111;
	outline-offset: 2px;
}
.ca-cp-thumb, .ca-qa-thumb {
	width: 80px;
	height: 80px;
	flex: 0 0 auto;
	object-fit: contain;
	background: #f6f6f6;
	border: 1px solid #e5e5e5;
}
.ca-cp-stepper, .ca-qa-stepper {
	display: inline-flex;
	align-items: center;
}
.ca-cp-stepper button, .ca-qa-stepper button {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #ccc;
	background: #f7f7f7;
	color: #111;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	border-radius: 0;
}
.ca-cp-stepper button:disabled, .ca-qa-stepper button:disabled { opacity: .4; cursor: not-allowed; }
.ca-cp-stepper input, .ca-qa-stepper input {
	width: 52px;
	height: 36px;
	margin: 0;
	padding: 0 4px;
	border: 1px solid #ccc;
	border-left: 0;
	border-right: 0;
	border-radius: 0;
	background: #fff;
	color: #111;
	font-size: 16px;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}
.ca-cp-stepper input::-webkit-outer-spin-button, .ca-cp-stepper input::-webkit-inner-spin-button,
.ca-qa-stepper input::-webkit-outer-spin-button, .ca-qa-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ca-cp .ca-price ins, .ca-qa .ca-qa-price ins, .ca-qa .ca-qa-price ins .amount, .ca-qa .ca-qa-price ins bdi {
	text-decoration: none !important;
	color: #58762ede !important;
	background: transparent !important;
}
.ca-qa .ca-qa-price del, .ca-cp .ca-price del { color: #000; text-decoration: line-through; }

/* ---------- 2. Cart panel ---------- */
.ca-cp-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: 100vw;
	height: 100%;
	background: #fff;
	color: #111;
	box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
	transform: translateX(100%);
	transition: transform .25s ease;
	outline: 0;
}
.ca-cp.is-open .ca-cp-panel { transform: translateX(0); }
.ca-cp-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex: 0 0 auto;
	padding: 16px 20px;
	border-bottom: 1px solid #e5e5e5;
}
.ca-cp-title {
	margin: 0;
	padding: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: #111;
}
.ca-cp-close {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px 0 6px 8px;
	border: 0;
	background: transparent;
	color: #111;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
	cursor: pointer;
}
.ca-cp-close span { font-size: 24px; line-height: 1; font-weight: 400; }
.ca-cp-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 18px 20px;
}
.ca-cp-msg {
	margin: 0 0 14px;
	font-size: 15px;
	font-weight: 700;
	color: #58762ede;
	text-transform: uppercase;
}
.ca-cp-item {
	display: flex;
	gap: 14px;
	align-items: flex-start;
}
.ca-cp-info { min-width: 0; flex: 1 1 auto; }
.ca-cp-name {
	display: block;
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: #111;
	text-decoration: none;
	overflow-wrap: anywhere;
}
a.ca-cp-name:hover { text-decoration: underline; }
.ca-cp-meta { margin: 0 0 2px; font-size: 13px; color: #555; overflow-wrap: anywhere; }
.ca-cp-price { margin: 6px 0 10px; font-size: 15px; color: #000; }
.ca-cp-price del { color: #777; margin-right: 6px; }
.ca-cp-qtyrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ca-cp-remove {
	margin: 0;
	padding: 4px 0;
	border: 0;
	background: transparent;
	color: #111;
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
}
.ca-cp-remove:hover { text-decoration: none; }
.ca-cp-err { margin: 12px 0 0; font-size: 14px; color: #a00; }
.ca-cp-err:empty { display: none; }
.ca-cp-empty { margin: 4px 0 0; font-size: 15px; color: #444; }
.ca-cp.is-busy .ca-cp-body { opacity: .55; pointer-events: none; }
.ca-cp-foot {
	flex: 0 0 auto;
	padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid #e5e5e5;
	background: #fff;
}
.ca-cp-sub {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin: 0 0 4px;
	font-size: 16px;
	font-weight: 700;
	text-transform: uppercase;
}
.ca-cp-count { margin: 0 0 12px; font-size: 13px; color: #555; }
.ca-cp-foot .ca-cp-btn + .ca-cp-btn { margin-top: 8px; }
.ca-cp-foot[hidden] { display: none; }

/* ---------- 3. Quick-add popup ---------- */
.ca-qa { display: flex; align-items: center; justify-content: center; padding: 16px; }
.ca-qa-dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 420px;
	max-height: 90vh;
	overflow: auto;
	padding: 24px 24px 20px;
	background: #fff;
	color: #111;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .2s ease, transform .2s ease;
	outline: 0;
}
.ca-qa.is-open .ca-qa-dialog { opacity: 1; transform: none; }
.ca-qa-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #333;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}
.ca-qa-product { display: flex; align-items: center; gap: 12px; margin: 0 32px 16px 0; }
.ca-qa-thumb { width: 72px; height: 72px; }
.ca-qa-name { margin: 0; padding: 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: #111; text-transform: none; }
.ca-qa-price { margin: 4px 0 0; font-size: 16px; color: #000; }
.ca-qa-group { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.ca-qa-label { display: block; margin: 0 0 8px; padding: 0; font-size: 15px; font-weight: 700; color: #111; }
.ca-qa-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ca-qa-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 8px 14px;
	border: 1.5px solid #222;
	border-radius: 20px;
	background: #fff;
	color: #111;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.2;
	cursor: pointer;
}
.ca-qa-chip.is-selected { background: #8C760E; border-color: #8C760E; color: #000; }
.ca-qa-chip.is-oos, .ca-qa-chip.is-unavailable {
	border-style: dashed;
	border-color: #999;
	color: #888;
	background-color: #f7f7f7;
	background-image: repeating-linear-gradient(-45deg, transparent, transparent 4px, rgba(0, 0, 0, 0.06) 4px, rgba(0, 0, 0, 0.06) 8px);
}
.ca-qa-chip.is-unavailable { cursor: not-allowed; }
.ca-qa-chip.is-selected.is-oos { background-color: #e8e2c8; border-color: #8C760E; color: #333; }
.ca-qa-select {
	display: block;
	width: 100%;
	padding: 10px 12px;
	border: 1.5px solid #222;
	border-radius: 8px;
	background: #fff;
	color: #111;
	font-size: 16px;
}
.ca-qa-status { min-height: 1.6em; margin: 0 0 12px; font-size: 14px; line-height: 1.45; }
.ca-qa-stock { margin: 0; font-size: 16px; font-weight: 700; text-transform: uppercase; color: #58762ede; }
.ca-qa-hint { margin: 0; color: #444; }
.ca-qa-qtyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.ca-qa-qtyrow[hidden] { display: none; }
.ca-qa-qtyrow > span { font-weight: 600; }
.ca-qa-msg { min-height: 1.3em; margin: 0 0 8px; font-size: 14px; color: #a00; }
.ca-qa-msg:empty { min-height: 0; margin: 0; }
.ca-qa-actions .ca-qa-btn[hidden] { display: none !important; }
.ca-qa-actions .ca-bis-notify-btn.ca-qa-btn { width: 100%; margin: 0; }
.ca-qa-loading { margin: 0 0 14px; font-size: 15px; color: #444; }
.ca-qa-err a { color: #111; }

/* ---------- phones: both become bottom sheets ---------- */
@media (max-width: 781px) {
	body.ca-cp-lock { overflow: hidden; }
	.ca-cp-panel {
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: auto;
		max-height: 92vh;
		max-height: 92dvh;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
		transform: translateY(100%);
	}
	.ca-cp.is-open .ca-cp-panel { transform: translateY(0); }
	.ca-cp-head { padding: 14px 16px 12px; }
	.ca-cp-body { padding: 14px 16px; }
	.ca-cp-foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
	.ca-cp-thumb { width: 64px; height: 64px; }
	.ca-qa { align-items: flex-end; padding: 0; }
	.ca-qa-dialog {
		max-width: none;
		max-height: 92vh;
		max-height: 92dvh;
		padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px));
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
		transform: translateY(100%);
		opacity: 1;
		transition: transform .25s ease;
	}
	.ca-qa.is-open .ca-qa-dialog { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
	.ca-cp-panel, .ca-qa-dialog, .ca-cp-backdrop, .ca-qa-backdrop { transition: none !important; }
}
