/* KV Download Feedback
 *
 * Visual feedback for WooCommerce download link clicks: a confirmation modal
 * plus a busy state applied to the clicked link while a short cooldown is
 * active. Brand colours mirror the audiobook UI (#048f26 brand green on a
 * cream/off-white surface) so the modal looks at home on every page that
 * shows download links (thank-you, my-account, view-order, audiobook player).
 */

/* ---------------------------------------------------------------- modal */

.kv-dlfb-modal[hidden] {
	display: none !important;
}

.kv-dlfb-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(20, 20, 20, 0.55);
	opacity: 0;
	transition: opacity 0.18s ease-out;
}

.kv-dlfb-modal.is-open {
	opacity: 1;
}

.kv-dlfb-modal__card {
	background: #fff;
	color: #333;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	max-width: 480px;
	width: 100%;
	padding: 1.5rem 1.5rem 1.25rem;
	box-sizing: border-box;
	transform: translateY(8px);
	transition: transform 0.18s ease-out;
}

.kv-dlfb-modal.is-open .kv-dlfb-modal__card {
	transform: translateY(0);
}

.kv-dlfb-modal__title {
	margin: 0 0 0.75rem;
	font-size: 1.25rem;
	line-height: 1.3;
	color: #048f26;
}

.kv-dlfb-modal__body {
	margin: 0 0 1.25rem;
}

.kv-dlfb-modal__text {
	margin: 0 0 0.75rem;
	font-size: 1rem;
	line-height: 1.45;
}

.kv-dlfb-modal__warning {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.45;
	color: #555;
	font-style: italic;
}

.kv-dlfb-modal__actions {
	display: flex;
	justify-content: flex-end;
}

.kv-dlfb-modal__close {
	appearance: none;
	border: 1px solid #048f2680;
	background: #048f26;
	color: #fff;
	font-weight: 600;
	font-size: 0.95rem;
	padding: 0.55rem 1.1rem;
	border-radius: 54px;
	cursor: pointer;
	transition: background 0.15s ease-out, border-color 0.15s ease-out;
}

.kv-dlfb-modal__close:hover,
.kv-dlfb-modal__close:focus {
	background: #03741f;
	border-color: #03741f;
	outline: none;
}

.kv-dlfb-modal__close:focus-visible {
	box-shadow: 0 0 0 3px #048f2640;
}

/* ----------------------------------------------------- busy link state */

a[data-kv-dlfb-busy="1"] {
	/* Keep pointer events on so the JS delegated handler still receives the
	 * click and can re-flash the modal. We rely on aria-disabled + the busy
	 * label + cursor to communicate the disabled state. */
	cursor: wait;
	opacity: 0.75;
}

a[data-kv-dlfb-busy="1"]:hover {
	opacity: 0.75;
}

.kv-dlfb-spinner {
	display: inline-block;
	width: 1em;
	height: 1em;
	border-radius: 50%;
	border: 2px solid currentColor;
	border-right-color: transparent;
	vertical-align: middle;
	margin-right: 0.4em;
	animation: kv-dlfb-spin 0.8s linear infinite;
}

.kv-dlfb-busy-label {
	font-weight: 500;
}

@keyframes kv-dlfb-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.kv-dlfb-modal,
	.kv-dlfb-modal__card {
		transition: none;
	}
	.kv-dlfb-spinner {
		animation: none;
		border-right-color: currentColor;
		opacity: 0.6;
	}
}
