/* GS ANAF — input-group + status + inline actions. Loaded only on checkout. */

/* ---------------------------------------------------------- Input group layout */
/* The .woocommerce-input-wrapper becomes a 2-col grid (input | button) on row 1,
 * with status + actions spanning both columns on row 2/3. We don't move the input
 * in the DOM — Flatsome floating labels keep working unchanged. */
.woocommerce-input-wrapper.gs-anaf-input-wrap {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	column-gap: 8px;
	row-gap: 6px;
	align-items: stretch;
	width: 100%;
}

.woocommerce-input-wrapper.gs-anaf-input-wrap > input {
	grid-column: 1;
	width: 100%;
	min-width: 0;
	margin: 0;
}

.woocommerce-input-wrapper.gs-anaf-input-wrap > .gs-anaf-btn {
	grid-column: 2;
	align-self: stretch;
	margin: 0;
}

.woocommerce-input-wrapper.gs-anaf-input-wrap > .gs-anaf-status,
.woocommerce-input-wrapper.gs-anaf-input-wrap > .gs-anaf-actions {
	grid-column: 1 / -1;
	margin: 0;
}

/* ----------------------------------------------------------------- Verify button */
.gs-anaf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 0 14px;
	min-height: 38px;
	max-height: 3.0084em;
	height: auto;
	font: 500 13px/1.2 inherit !important;
	color: #1a202c;
	background: #f1f5f9;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none;
	text-transform: none !important;
	letter-spacing: 0 !important;
	text-decoration: none;
}

.gs-anaf-btn:hover {
	background: #e2e8f0;
	border-color: #94a3b8;
	color: #0f172a;
}

.gs-anaf-btn:active {
	background: #cbd5e1;
}

.gs-anaf-btn:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 1px;
}

.gs-anaf-btn:disabled,
.gs-anaf-btn.is-loading {
	cursor: progress;
	opacity: .85;
}

/* Inline spinner */
.gs-anaf-spinner {
	display: inline-block;
	width: 12px;
	height: 12px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: gs-anaf-spin .7s linear infinite;
	flex: 0 0 auto;
}

@keyframes gs-anaf-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.gs-anaf-spinner { animation-duration: 1.6s; }
}

/* --------------------------------------------------------------- Status message */
.gs-anaf-status {
	display: none;
	margin-top: 0;
	font-size: 12.5px;
	line-height: 1.45;
	color: #475569;
	background: transparent;
	padding: 0;
	border: 0;
	border-radius: 0;
}

.gs-anaf-status[data-kind] {
	display: flex;
	align-items: flex-start;
	gap: 6px;
}

.gs-anaf-status[data-kind="info"] { color: #475569; }
.gs-anaf-status[data-kind="ok"]   { color: #15803d; }
.gs-anaf-status[data-kind="warn"] { color: #a16207; }
.gs-anaf-status[data-kind="err"]  { color: #b91c1c; }

.gs-anaf-status .gs-anaf-icon {
	flex: 0 0 auto;
	width: 13px;
	height: 13px;
	margin-top: 2px;
}

.gs-anaf-status .gs-anaf-status-text {
	flex: 1 1 auto;
}

/* --------------------------------------------------------- Inline action links */
.gs-anaf-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: -2px;
	padding-left: 19px; /* aligns with status text (icon width + gap) */
	font-size: 12.5px;
	line-height: 1.4;
}

.gs-anaf-action {
	display: inline;
	margin: 0;
	padding: 0;
	font: inherit;
	color: #2563eb;
	background: transparent;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
	text-transform: none !important;
	letter-spacing: 0 !important;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none;
	min-height: 0;
	height: auto;
	line-height: inherit;
}

.gs-anaf-action:hover {
	color: #1d4ed8;
	background: transparent;
	text-decoration-thickness: 2px;
}

.gs-anaf-action:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
	border-radius: 2px;
}

.gs-anaf-sep {
	color: #94a3b8;
	user-select: none;
}

/* ----------------------------------------------------------- Mobile breakpoint */
/* Below 480px: button drops to a second row, full-width, but still inside the same
 * grid wrapper so status/actions remain anchored to the input. */
@media (max-width: 480px) {
	.woocommerce-input-wrapper.gs-anaf-input-wrap {
		grid-template-columns: minmax(0, 1fr);
	}
	.woocommerce-input-wrapper.gs-anaf-input-wrap > input,
	.woocommerce-input-wrapper.gs-anaf-input-wrap > .gs-anaf-btn {
		grid-column: 1;
	}
	.gs-anaf-btn {
		min-height: 42px;
		padding: 0 16px;
		font-size: 14px;
	}
}
