/**
 * 8171 Eligibility Checker — Frontend Styles
 *
 * Bootstrap-free, responsive, modern card layout.
 */

/* ── Reset scoped to plugin ── */
.ec8171-checker *,
.ec8171-checker *::before,
.ec8171-checker *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* ── Wrapper ── */
.ec8171-checker {
	--ec-primary: #1d4ed8;
	--ec-primary-hover: #1e40af;
	--ec-primary-light: #dbeafe;
	--ec-success: #16a34a;
	--ec-success-light: #dcfce7;
	--ec-danger: #dc2626;
	--ec-danger-light: #fee2e2;
	--ec-warning: #d97706;
	--ec-warning-light: #fef3c7;
	--ec-gray-50: #f9fafb;
	--ec-gray-100: #f3f4f6;
	--ec-gray-200: #e5e7eb;
	--ec-gray-300: #d1d5db;
	--ec-gray-500: #6b7280;
	--ec-gray-700: #374151;
	--ec-gray-900: #111827;
	--ec-radius: 12px;
	--ec-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
	--ec-transition: 0.2s ease;

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
		Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
	max-width: 540px;
	margin: 2rem auto;
	padding: 0 1rem;
	color: var(--ec-gray-900);
	line-height: 1.5;
}

/* ── Card ── */
.ec8171-card {
	background: #fff;
	border-radius: var(--ec-radius);
	box-shadow: var(--ec-shadow);
	border: 1px solid var(--ec-gray-200);
	overflow: hidden;
}

.ec8171-card__header {
	background: linear-gradient(135deg, var(--ec-primary), var(--ec-primary-hover));
	padding: 1.75rem 1.5rem;
	color: #fff;
}

.ec8171-card__title {
	font-size: 1.5rem;
	font-weight: 800;
	margin-bottom: 0.35rem;
	line-height: 1.3;
	color: #fff !important;
	letter-spacing: 0.02em;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ec8171-card__subtitle {
	font-size: 0.9rem;
	opacity: 0.9;
	font-weight: 400;
}

/* ── Form ── */
.ec8171-form {
	padding: 1.5rem;
}

.ec8171-form__group {
	margin-bottom: 1.25rem;
}

.ec8171-form__label {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ec-gray-700);
	margin-bottom: 0.4rem;
}

.ec8171-form__input {
	width: 100%;
	padding: 0.75rem 1rem;
	font-size: 1rem;
	border: 1.5px solid var(--ec-gray-300);
	border-radius: 8px;
	background: var(--ec-gray-50);
	color: var(--ec-gray-900);
	transition: border-color var(--ec-transition), box-shadow var(--ec-transition);
	outline: none;
	font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
	letter-spacing: 0.05em;
}

.ec8171-form__input::placeholder {
	color: var(--ec-gray-500);
	font-family: inherit;
	letter-spacing: normal;
}

.ec8171-form__input:focus {
	border-color: var(--ec-primary);
	box-shadow: 0 0 0 3px var(--ec-primary-light);
	background: #fff;
}

.ec8171-form__input--error {
	border-color: var(--ec-danger);
}

.ec8171-form__input--error:focus {
	box-shadow: 0 0 0 3px var(--ec-danger-light);
}

.ec8171-form__hint {
	display: block;
	font-size: 0.8rem;
	margin-top: 0.35rem;
	min-height: 1.2em;
	color: var(--ec-danger);
}

/* ── Button ── */
.ec8171-form__button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.8rem 1.5rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: var(--ec-primary);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background var(--ec-transition), transform var(--ec-transition);
}

.ec8171-form__button:hover {
	background: var(--ec-primary-hover);
}

.ec8171-form__button:active {
	transform: scale(0.98);
}

.ec8171-form__button:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
}

/* ── Spinner ── */
.ec8171-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2.5px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ec8171-spin 0.6s linear infinite;
}

.ec8171-form__button--loading .ec8171-spinner {
	display: inline-block;
}

.ec8171-form__button--loading .ec8171-form__button-text {
	/* Keep text visible alongside spinner */
}

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

/* ── Result area ── */
.ec8171-result {
	padding: 0 1.5rem 1.5rem;
	outline: none;
}

.ec8171-result:empty {
	padding: 0;
}

/* ── Success result ── */
.ec8171-result__card {
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid var(--ec-gray-200);
}

.ec8171-result__header {
	padding: 0.85rem 1rem;
	font-weight: 600;
	font-size: 0.9rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.ec8171-result__header--success {
	background: var(--ec-success-light);
	color: var(--ec-success);
	border-bottom: 1px solid #bbf7d0;
}

.ec8171-result__header--error {
	background: var(--ec-danger-light);
	color: var(--ec-danger);
	border-bottom: 1px solid #fecaca;
}

.ec8171-result__header--warning {
	background: var(--ec-warning-light);
	color: var(--ec-warning);
	border-bottom: 1px solid #fde68a;
}

.ec8171-result__body {
	padding: 0;
}

.ec8171-result__row {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	padding: 0.7rem 1rem;
	font-size: 0.875rem;
	border-bottom: 1px solid var(--ec-gray-100);
}

.ec8171-result__row:last-child {
	border-bottom: none;
}

.ec8171-result__label {
	font-weight: 600;
	color: var(--ec-gray-700);
	flex-shrink: 0;
	margin-right: 1rem;
	text-transform: capitalize;
}

.ec8171-result__value {
	color: var(--ec-gray-900);
	text-align: right;
	word-break: break-word;
}

/* ── Status badges ── */
.ec8171-badge {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.ec8171-badge--eligible {
	background: var(--ec-success-light);
	color: var(--ec-success);
}

.ec8171-badge--not-eligible {
	background: var(--ec-danger-light);
	color: var(--ec-danger);
}

.ec8171-badge--pending {
	background: var(--ec-warning-light);
	color: var(--ec-warning);
}

.ec8171-badge--default {
	background: var(--ec-gray-100);
	color: var(--ec-gray-700);
}

/* ── Error message ── */
.ec8171-result__error {
	padding: 1rem;
	text-align: center;
}

.ec8171-result__error-text {
	font-size: 0.9rem;
	color: var(--ec-gray-700);
	margin-bottom: 0.75rem;
}

.ec8171-result__retry {
	display: inline-block;
	padding: 0.45rem 1.2rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--ec-primary);
	background: var(--ec-primary-light);
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: background var(--ec-transition);
}

.ec8171-result__retry:hover {
	background: #bfdbfe;
}

/* ── Guidance message ── */
.ec8171-result__message {
	padding: 0.85rem 1rem;
	background: var(--ec-primary-light);
	border-top: 1px solid #bfdbfe;
}

.ec8171-result__message p {
	font-size: 0.875rem;
	color: var(--ec-gray-700);
	line-height: 1.55;
	margin: 0;
}

/* ── Official methods cards ── */
.ec8171-methods {
	padding: 1rem;
	border-top: 1px solid var(--ec-gray-200);
}

.ec8171-methods__title {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--ec-gray-700);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 0.75rem;
}

.ec8171-methods__item {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.75rem;
	background: var(--ec-gray-50);
	border: 1px solid var(--ec-gray-200);
	border-radius: 8px;
	margin-bottom: 0.5rem;
}

.ec8171-methods__item:last-child {
	margin-bottom: 0;
}

.ec8171-methods__icon {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ec-primary-light);
	color: var(--ec-primary);
	border-radius: 8px;
}

.ec8171-methods__content strong {
	display: block;
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--ec-gray-900);
	margin-bottom: 0.15rem;
}

.ec8171-methods__content p {
	font-size: 0.8rem;
	color: var(--ec-gray-500);
	line-height: 1.45;
	margin: 0;
}

/* ── Responsive ── */
@media (max-width: 480px) {
	.ec8171-checker {
		padding: 0 0.5rem;
		margin: 1rem auto;
	}

	.ec8171-card__header {
		padding: 1.25rem 1rem;
	}

	.ec8171-card__title {
		font-size: 1.2rem;
	}

	.ec8171-form {
		padding: 1.25rem 1rem;
	}

	.ec8171-result {
		padding: 0 1rem 1rem;
	}

	.ec8171-result__row {
		flex-direction: column;
		gap: 0.2rem;
	}

	.ec8171-result__value {
		text-align: left;
	}

	.ec8171-methods__item {
		padding: 0.6rem;
		gap: 0.6rem;
	}
}
