/*
 * buy-all.css
 * Minimal, scoped styling for the [nexio_buy_all] shortcode.
 * Every rule is nested under .nexio-buy-all so nothing here can
 * ever leak onto unrelated markup. Only loaded on pages where the
 * shortcode actually renders.
 *
 * Colors intentionally lean on currentColor / inherited values so
 * the widget adapts to whatever palette the theme or Elementor
 * controls set — only semantic success/error hues are fixed.
 */

.nexio-buy-all {
	display: inline-flex;
	flex-direction: column;
	/* No gap: a flex gap applies between children whether or not the
	   second one has any size, so the 8px meant for a visible status
	   message was reserved under every button that had nothing to
	   say. The message supplies its own spacing when it appears. */
}

/* Written at .nexio-buy-all button.… strength (0,2,1) on purpose:
 * this is a <button>, so theme/Elementor-kit global button skins
 * (e.g. `.elementor-kit-6 button { color: #fdfdff }`, written for
 * solid dark buttons) apply to it at 0,1,1 — and since this default
 * is an OUTLINE style on a transparent background, inheriting a
 * white button-skin text color rendered it invisible on light pages.
 * color: inherit re-anchors text (and the currentColor border) to
 * the surrounding page text color instead of the kit's button skin.
 */
.nexio-buy-all button.nexio-buy-all__button,
.nexio-buy-all__button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--nexio-buy-all-icon-gap, 8px);
	cursor: pointer;
	color: inherit;
	border: 1px solid currentColor;
	border-radius: 8px;
	padding: 11px 22px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.01em;
	background: transparent;
	transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease, opacity 0.18s ease;
}

/* Icon sits inline with the label; inherits the button's text color
 * unless the Icon Color control overrides it. */
.nexio-buy-all__button-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	color: inherit;
}

.nexio-buy-all__button-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.nexio-buy-all__button-label:empty {
	display: none;
}

/* Hover tint drawn from the button's own text color, so it works on
   any background. Older browsers without color-mix() simply skip it. */
.nexio-buy-all__button:hover:not(:disabled):not(.nexio-buy-all__button--loading) {
	background-color: color-mix(in srgb, currentColor 8%, transparent);
}

.nexio-buy-all__button:active:not(:disabled):not(.nexio-buy-all__button--loading) {
	transform: translateY(1px);
}

.nexio-buy-all__button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.nexio-buy-all__button:disabled,
.nexio-buy-all__button--loading {
	cursor: default;
	opacity: 0.55;
}

/* Owned state — the visitor already has access to every product this
   button would add, so it renders disabled as "Already Purchased". */
.nexio-buy-all button.nexio-buy-all__button--owned {
	cursor: not-allowed;
	opacity: 0.6;
}

/* Loading spinner, drawn with the button's own text color. */

.nexio-buy-all__button--loading {
	opacity: 0.8;
}

.nexio-buy-all__button--loading::after {
	content: "";
	display: inline-block;
	width: 13px;
	height: 13px;
	/* The button is flex with a `gap`, which already spaces the
	 * spinner from the label — so no explicit margin here (a
	 * margin-left would double up against the gap). */
	vertical-align: -2px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: nexio-buy-all-spin 0.7s linear infinite;
}

@keyframes nexio-buy-all-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Result messages — icon + short fade/rise so feedback registers
   without shouting. */

.nexio-buy-all__message {
	display: inline-flex;
	margin-top: 8px;
	align-items: baseline;
	gap: 6px;
	font-size: 13px;
	line-height: 1.5;
	animation: nexio-buy-all-message-in 0.22s ease-out both;
}

@keyframes nexio-buy-all-message-in {
	from {
		opacity: 0;
		transform: translateY(3px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.nexio-buy-all__message::before {
	flex-shrink: 0;
	width: 14px;
	height: 14px;
	align-self: center;
	background-color: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.nexio-buy-all__message--success {
	color: #15803d;
}

.nexio-buy-all__message--success::before {
	content: "";
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8.5 12.5 2.5 2.5 4.5-5.5'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8.5 12.5 2.5 2.5 4.5-5.5'/%3E%3C/svg%3E");
}

.nexio-buy-all__message--error {
	color: #b42318;
}

.nexio-buy-all__message--error::before {
	content: "";
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 7v6'/%3E%3Cpath d='M12 16.5v.5'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 7v6'/%3E%3Cpath d='M12 16.5v.5'/%3E%3C/svg%3E");
}

.nexio-buy-all__admin-notice {
	font-size: 13px;
	color: #b42318;
	background: #fef3f2;
	border: 1px dashed #f9a8a1;
	padding: 10px 14px;
	border-radius: 8px;
	line-height: 1.5;
}

/* Phase 8.3 — Download Now button on included-product single pages. */
.nexio-download-now {
	margin: 12px 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.nexio-download-now__button {
	display: inline-block;
}

/* Phase 12 — Elementor Bundle Card widget. */

.nexio-bundle-card {
	display: block;
}

.nexio-bundle-card__title {
	margin: 0 0 8px;
}

.nexio-bundle-card__description {
	margin: 0 0 10px;
	opacity: 0.85;
}

.nexio-bundle-card__count,
.nexio-bundle-card__total-value,
.nexio-bundle-card__bundle-price,
.nexio-bundle-card__savings {
	margin: 0 0 4px;
	font-variant-numeric: tabular-nums;
}

.nexio-bundle-card__savings span {
	color: #15803d;
	font-weight: 600;
}

.nexio-bundle-card .nexio-buy-all {
	margin-top: 12px;
}

/* Phase 12 — Elementor editor/preview-only notice, both widgets. */
.nexio-elementor-widget-notice {
	padding: 10px 14px;
	border: 1px dashed #f9a8a1;
	border-radius: 8px;
	color: #b42318;
	font-size: 13px;
	line-height: 1.5;
	background: #fef3f2;
}

/* Phase 13.1 — button width + view cart link.
 *
 * Full width has to widen the WRAPPER as well: .nexio-buy-all is
 * inline-flex (shrinks to its content), so a button at width:100%
 * would only fill that shrunk wrapper. Stretch both. The button stays
 * flex (not block) so an icon + label still align via gap. */

.nexio-buy-all--full-width {
	display: flex;
	width: 100%;
}

.nexio-buy-all--full-width .nexio-buy-all__button {
	width: 100%;
}

.nexio-buy-all__message__view-cart {
	text-decoration: underline;
	text-underline-offset: 2px;
	margin-left: 4px;
	font-weight: 600;
	color: inherit;
}

.nexio-buy-all__message__view-cart:hover,
.nexio-buy-all__message__view-cart:focus {
	text-decoration-thickness: 2px;
}

/* Reduced motion: keep feedback, drop the movement. */

@media (prefers-reduced-motion: reduce) {

	.nexio-buy-all__button,
	.nexio-buy-all__message {
		transition: none;
		animation: none;
	}

	.nexio-buy-all__button--loading::after {
		animation-duration: 1.5s;
	}
}

/* ---- Owned states ---- */

/* Disabled cart control on a product owned through a bundle. */
.nexio-cart-owned,
.nexio-cart-owned:hover {
	opacity: 0.55;
	cursor: not-allowed;
	margin-right: 10px;
}

/* Grid card action button in its download form. */
.nexio-product-card__fab--download {
	cursor: pointer;
}

.nexio-product-card__fab--download[data-nexio-busy] {
	opacity: 0.6;
	pointer-events: none;
}

/* The download form of the button is fully alive — never dimmed, never
   the not-allowed cursor, whatever other modifiers ride along. */
.nexio-buy-all .nexio-buy-all__button--download,
.nexio-buy-all a.nexio-buy-all__button--download,
.nexio-buy-all button.nexio-buy-all__button--download {
	cursor: pointer;
	opacity: 1;
}

/* Same neutral treatment for the Buy All button's owned fallback and
   the classic-theme disabled cart control — one visual language for
   "you already have this" everywhere. */
.nexio-buy-all button.nexio-buy-all__button--owned,
.nexio-cart-owned,
.nexio-cart-owned:hover {
	opacity: 1;
	background: #f2f4f7 !important;
	background-image: none !important;
	border: 1px solid #d0d5dd !important;
	color: #667085 !important;
	box-shadow: none !important;
	text-shadow: none !important;
}

/* Owner's shop link: a normal, fully alive button. */
.nexio-buy-all .nexio-buy-all__button--shop-link {
	cursor: pointer;
	opacity: 1;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

/* ---- Hover animations ----
   Chosen per widget; the wrapper carries nexio-buy-all-anim-<name>.
   Speed comes from --nexio-anim-speed (Animation Speed control). */

.nexio-buy-all__button {
	--nexio-anim-speed: 260ms;
	position: relative;
	overflow: hidden;
	transition:
		transform var(--nexio-anim-speed) cubic-bezier(0.34, 1.4, 0.64, 1),
		box-shadow var(--nexio-anim-speed) ease,
		filter var(--nexio-anim-speed) ease,
		background-position var(--nexio-anim-speed) ease;
}

/* Lift */
.nexio-buy-all-anim-lift .nexio-buy-all__button:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 22px -8px rgba(16, 24, 40, 0.45);
}

/* Grow */
.nexio-buy-all-anim-grow .nexio-buy-all__button:hover {
	transform: scale(1.035);
}

/* Shine sweep — a highlight crossing the face of the button. The
   pseudo-element is skewed so the edge reads as a light sweep rather
   than a moving rectangle. */
.nexio-buy-all-anim-shine .nexio-buy-all__button::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: -120%;
	width: 55%;
	transform: skewX(-22deg);
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
	transition: left calc(var(--nexio-anim-speed) * 2.2) ease;
	pointer-events: none;
}

.nexio-buy-all-anim-shine .nexio-buy-all__button:hover::after {
	left: 130%;
}

/* Gradient slide — needs a gradient background to have anything to
   move; on a flat colour it simply does nothing. */
.nexio-buy-all-anim-slide .nexio-buy-all__button {
	background-size: 200% 100%;
	background-position: 0% 50%;
}

.nexio-buy-all-anim-slide .nexio-buy-all__button:hover {
	background-position: 100% 50%;
}

/* Pulse */
@keyframes nexio-buy-all-pulse {
	0%   { transform: scale(1); }
	50%  { transform: scale(1.04); }
	100% { transform: scale(1); }
}

.nexio-buy-all-anim-pulse .nexio-buy-all__button:hover {
	animation: nexio-buy-all-pulse calc(var(--nexio-anim-speed) * 3) ease-in-out infinite;
}

/* Focus keeps the same feedback as hover for keyboard users. */
.nexio-buy-all-anim-lift .nexio-buy-all__button:focus-visible { transform: translateY(-3px); }
.nexio-buy-all-anim-grow .nexio-buy-all__button:focus-visible { transform: scale(1.035); }

/* An inert owned button never animates. */
.nexio-buy-all__button--owned,
.nexio-buy-all__button--owned:hover {
	transform: none !important;
	animation: none !important;
	box-shadow: none !important;
}

.nexio-buy-all__button--owned::after {
	content: none !important;
}

@media ( prefers-reduced-motion: reduce ) {
	.nexio-buy-all__button,
	.nexio-buy-all__button:hover,
	.nexio-buy-all__button::after {
		transition: none !important;
		animation: none !important;
		transform: none !important;
	}
}

/* The status message renders on every button so the aria-live region
   exists before JS writes to it — but while empty it was still an
   inline-flex box with a 1.5 line-height, reserving ~20px under every
   button. Collapsed to nothing until it has something to say.

   Deliberately NOT display:none: a live region has to stay in the
   accessibility tree for changes to it to be announced. Zero height
   plus overflow:hidden keeps it rendered but invisible, and :empty
   stops matching the moment JS sets any text. */
.nexio-buy-all__message:empty {
	display: block;
	height: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
	animation: none;
}

.nexio-buy-all__message:empty::before {
	content: none;
}
