/**
 * START OF: PesaPop for WooCommerce front-end styles
 *
 * Purpose:
 * Checkout field, Checkout block label and field, and the order-received
 * status panel.
 *
 * Context:
 * Enqueued as mpesawoo-css on checkout and order-received pages only.
 *
 * Safety:
 * Every selector is scoped to .mpesawoo-*, so theme and Elementor styles are
 * not affected. Each status pairs colour with a heading word.
 *
 * Responsive:
 * Single column at every width; the retry row stacks below 480 px.
 *
 * Author: Benson Matheka
 * Email: benson.matheka@outlook.com
 * Phone: +254728121374
 */

.mpesawoo-field input[type="tel"],
.mpesawoo-block-field input[type="tel"] {
	width: 100%;
	max-width: 22rem;
	font-size: 1rem;
}

/* M-Pesa logo beside the method title: small and never stretched by the
   theme. The wordmark is wide, so only the height is fixed. */
.mpesawoo-icon,
.mpesawoo-block-icon {
	display: inline-block;
	height: 20px !important;
	max-height: 20px;
	width: auto !important;
	max-width: 140px;
	margin: 0 0 0 0.5rem;
	vertical-align: middle;
	float: none;
}

.mpesawoo-block-icon {
	margin: 0;
}

/* The logo stands in for the title. Classic: the title is a bare text node
   in WooCommerce's label, so the label's text is shrunk to nothing; it stays
   readable to screen readers. Only when the logo is there (:has), so a
   missing file falls back to the plain title. */
.payment_method_mpesa_stk > label:has(> .mpesawoo-icon) {
	font-size: 0;
}

.payment_method_mpesa_stk > label > .mpesawoo-icon {
	margin-left: 0;
}

/* Blocks: the title span is visually hidden next to the logo. */
.mpesawoo-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.mpesawoo-block-label {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.mpesawoo-block-field label {
	display: block;
	margin: 0.5rem 0 0.25rem;
	font-weight: 600;
}

.mpesawoo-block-error,
.mpesawoo-status__error {
	color: #b32d2e;
	margin: 0.25rem 0 0;
}

/* Status panel */
.mpesawoo-status {
	border: 2px solid #c3c4c7;
	border-left-width: 6px;
	border-radius: 6px;
	padding: 1rem 1.25rem;
	margin: 0 0 1.5rem;
	background: #fff;
}

.mpesawoo-status__heading {
	margin: 0 0 0.25rem;
	font-size: 1.25rem;
}

.mpesawoo-status__message {
	margin: 0 0 0.5rem;
}

.mpesawoo-status__countdown {
	margin: 0;
	color: #50575e;
	font-variant-numeric: tabular-nums;
}

.mpesawoo-status--accepted,
.mpesawoo-status--initiated {
	border-color: #2271b1;
}

.mpesawoo-status--paid {
	border-color: #00a32a;
}

.mpesawoo-status--paid_review,
.mpesawoo-status--expired {
	border-color: #dba617;
}

.mpesawoo-status--failed,
.mpesawoo-status--cancelled,
.mpesawoo-status--timeout,
.mpesawoo-status--error {
	border-color: #b32d2e;
}

.mpesawoo-status__retry {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.mpesawoo-status__retry label {
	flex-basis: 100%;
	font-weight: 600;
}

.mpesawoo-status__retry input {
	flex: 1 1 12rem;
	max-width: 18rem;
}

.mpesawoo-status__retry .mpesawoo-status__error {
	flex-basis: 100%;
}

.mpesawoo-status [hidden] {
	display: none !important;
}

.mpesawoo-status button:focus-visible,
.mpesawoo-status input:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: 2px;
}

@media (max-width: 480px) {
	.mpesawoo-status__retry input,
	.mpesawoo-status__retry button {
		flex-basis: 100%;
		max-width: none;
	}
}

/* END OF: PesaPop for WooCommerce front-end styles */

/* Live check line under the classic M-Pesa number field (classic-checkout.js). */
.mpesawoo-phone-check { display: block; margin-top: .35em; font-size: .9em; line-height: 1.4; }
.mpesawoo-phone-check[hidden], #mpesawoo-phone-help[hidden] { display: none !important; }
.mpesawoo-phone-check--ok { color: #1b6e2a; }
.mpesawoo-phone-check--warn { color: #8a5a00; }
.mpesawoo-phone-check--error { color: #b3261e; }
#mpesawoo-phone[aria-invalid="true"] { border-color: #b3261e; }
