/**
 * Zip lookup widget + provider modal (scoped to plugin wrapper).
 * Colors: --iwm-zip-p, --iwm-zip-pd, --iwm-zip-a on .iwm-zip-lookup-wrap
 *
 * We load bootstrap-grid + bootstrap-utilities only (see PHP). This block
 * replaces components that lived in bootstrap.min.css without loading Reboot
 * (Reboot resets body/fonts and breaks the whole theme).
 */

/* Spinner — not in grid/utilities */
@keyframes iwm-bs-spinner-border {
	to {
		transform: rotate(360deg);
	}
}
.spinner-border {
	display: inline-block;
	width: 2rem;
	height: 2rem;
	vertical-align: -0.125em;
	border: 0.25em solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: 0.75s linear infinite iwm-bs-spinner-border;
}
@media (prefers-reduced-motion: reduce) {
	.spinner-border {
		animation-duration: 1.5s;
	}
}

/* Modal + backdrop (Bootstrap 5–compatible, minimal) */
.modal {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 1055;
	display: none;
	width: 100%;
	height: 100%;
	overflow-x: hidden;
	overflow-y: auto;
	outline: 0;
}
.modal.show {
	display: block;
}
.modal.fade .modal-dialog {
	transition: transform 0.3s ease-out;
	transform: translate(0, -50px);
}
.modal.show .modal-dialog {
	transform: none;
}
@media (prefers-reduced-motion: reduce) {
	.modal.fade .modal-dialog {
		transition: none;
		transform: none;
	}
}

.modal-dialog {
	position: relative;
	width: auto;
	margin: 0.5rem;
	pointer-events: none;
}
@media (min-width: 576px) {
	.modal-dialog {
		max-width: 500px;
		margin: 1.75rem auto;
	}
}
.modal-dialog-centered {
	display: flex;
	align-items: center;
	min-height: calc(100% - 1rem);
}
@media (min-width: 576px) {
	.modal-dialog-centered {
		min-height: calc(100% - 3.5rem);
	}
}
.modal-dialog-scrollable {
	height: calc(100% - 1rem);
}
.modal-dialog-scrollable .modal-content {
	max-height: 100%;
	overflow: hidden;
}
.modal-dialog-scrollable .modal-body {
	overflow-y: auto;
}

.modal-xl {
	max-width: 100%;
}
@media (min-width: 1200px) {
	.modal-xl {
		max-width: 1140px;
	}
}

.modal-content {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	pointer-events: auto;
	background-color: #fff;
	background-clip: padding-box;
	border: 1px solid rgba(0, 0, 0, 0.175);
	border-radius: 0.5rem;
	outline: 0;
}

.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1050;
	width: auto;
	height: auto;
	background-color: #000;
}
.modal-backdrop.fade {
	opacity: 0;
}
.modal-backdrop.show {
	opacity: 0.5;
}

.modal-header {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-between;
	padding: 1rem;
	border-bottom: 1px solid #dee2e6;
}

.modal-body {
	position: relative;
	flex: 1 1 auto;
	padding: 1rem;
}

.modal-footer {
	display: flex;
	flex-wrap: wrap;
	flex-shrink: 0;
	align-items: center;
	justify-content: flex-end;
	padding: calc(1rem - 0.125rem);
	border-top: 1px solid #dee2e6;
}

.btn-close {
	box-sizing: content-box;
	width: 1em;
	height: 1em;
	padding: 0.25em;
	color: #000;
	background: transparent
		url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e")
		center / 1em auto no-repeat;
	border: 0;
	border-radius: 0.25rem;
	opacity: 0.5;
	cursor: pointer;
}
.btn-close:hover {
	opacity: 0.75;
}

.btn {
	display: inline-block;
	font-weight: 500;
	line-height: 1.5;
	text-align: center;
	text-decoration: none;
	vertical-align: middle;
	cursor: pointer;
	user-select: none;
	border: 1px solid transparent;
	padding: 0.375rem 0.75rem;
	font-size: 1rem;
	border-radius: 0.375rem;
	transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
		border-color 0.15s ease-in-out;
}
.btn-outline-secondary {
	color: #64748b;
	border-color: #cbd5e1;
	background-color: transparent;
}
.btn-outline-secondary:hover {
	color: #fff;
	background-color: #64748b;
	border-color: #64748b;
}

.iwm-zip-lookup-wrap {
	--iwm-zip-p: #0f8a55;
	--iwm-zip-pd: #0c6f44;
	--iwm-zip-a: #38bdf8;
	max-width: 100%;
	box-sizing: border-box;
}

.iwm-zip-lookup-wrap .zip-widget {
	margin: 18px 0 14px;
}

.iwm-zip-lookup-wrap .zip-widget-inner {
	position: relative;
	display: flex;
	align-items: stretch;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 18px 38px rgba(2, 6, 23, 0.22), 0 2px 6px rgba(2, 6, 23, 0.1);
	overflow: hidden;
	transition: box-shadow 220ms ease, transform 220ms ease;
}

.iwm-zip-lookup-wrap .zip-widget-inner::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	padding: 1.5px;
	background: linear-gradient(135deg, rgba(15, 138, 85, 0.75), rgba(56, 189, 248, 0.45) 50%, rgba(15, 138, 85, 0.75));
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
	opacity: 0.85;
}

.iwm-zip-lookup-wrap .zip-widget-inner:focus-within {
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--iwm-zip-p) 18%, transparent), 0 22px 44px rgba(2, 6, 23, 0.28);
	transform: translateY(-1px);
}

.iwm-zip-lookup-wrap .zip-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	color: var(--iwm-zip-p);
	font-size: 20px;
	background: linear-gradient(180deg, #f0fdf4, #f8fafc);
	border-right: 1px solid rgba(15, 23, 42, 0.06);
}

.iwm-zip-lookup-wrap .zip-input {
	flex: 1 1 auto;
	border: 0;
	outline: 0;
	padding: 0 16px;
	height: 56px;
	font-size: 16px;
	color: #0f172a;
	background: transparent;
	min-width: 0;
}

.iwm-zip-lookup-wrap .zip-input.is-invalid {
	box-shadow: inset 0 0 0 2px #dc2626;
	animation: iwmZipShake 0.4s ease-in-out;
}

@keyframes iwmZipShake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-4px); }
	75% { transform: translateX(4px); }
}

.iwm-zip-lookup-wrap .zip-btn {
	border: 0;
	background: linear-gradient(135deg, color-mix(in srgb, var(--iwm-zip-p) 88%, #fff), var(--iwm-zip-p) 55%, var(--iwm-zip-pd));
	color: #fff;
	font-weight: 700;
	padding: 0 26px;
	font-size: 15px;
	letter-spacing: 0.3px;
	cursor: pointer;
	white-space: nowrap;
	transition: filter 180ms ease, transform 180ms ease;
}

.iwm-zip-lookup-wrap .zip-btn:hover,
.iwm-zip-lookup-wrap .zip-btn:focus {
	filter: brightness(1.08);
}

.iwm-zip-lookup-wrap p.zip-helper {
	margin: 10px 0 0;
	color: #334155 !important;
	font-size: 13px;
	line-height: 1.5;
}

.iwm-zip-lookup-wrap p.zip-helper i,
.iwm-zip-lookup-wrap p.zip-helper em {
	color: inherit !important;
	opacity: 0.92;
}

.iwm-zip-results-heading i {
	color: var(--iwm-zip-p);
}

/* Modal */
.iwm-provider-modal .modal-content {
	border: 0;
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 30px 60px rgba(2, 6, 23, 0.35);
}

.iwm-provider-modal .provider-modal-hero {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	text-align: center;
	background: linear-gradient(135deg, var(--iwm-zip-p) 0%, var(--iwm-zip-pd) 100%);
	color: #fff;
	padding: 28px 28px 30px;
	border: 0;
}

.iwm-provider-modal .provider-modal-hero .btn-close {
	position: absolute;
	top: 16px;
	right: 16px;
	filter: invert(1);
	opacity: 0.9;
}

.iwm-provider-modal .hero-content {
	width: 100%;
	max-width: 28rem;
	margin: 0 auto;
	padding: 0 2.75rem;
	text-align: center;
}

.iwm-provider-modal .hero-icon {
	font-size: 36px;
	margin-bottom: 8px;
	color: rgba(255, 255, 255, 0.95);
	opacity: 0.95;
}

.iwm-provider-modal .provider-modal-hero h2.hero-title,
.iwm-provider-modal .hero-title {
	font-size: 26px;
	font-weight: 700;
	margin: 0 0 8px;
	color: #fff !important;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.iwm-provider-modal .provider-modal-hero .hero-subtitle,
.iwm-provider-modal .hero-subtitle {
	margin: 0;
	font-size: 15px;
	color: rgba(255, 255, 255, 0.92) !important;
	line-height: 1.45;
}

.iwm-provider-modal .loading-state,
.iwm-provider-modal .error-state {
	text-align: center;
	padding: 36px 16px;
}

.iwm-provider-modal .loading-spinner {
	margin-bottom: 18px;
}

.iwm-provider-modal .loading-spinner .spinner-border {
	color: var(--iwm-zip-p);
	width: 3rem;
	height: 3rem;
}

.iwm-provider-modal .loading-title {
	font-weight: 600;
	color: #0f172a;
	margin-bottom: 22px;
}

.iwm-provider-modal .loading-steps {
	list-style: none;
	padding: 0;
	margin: 0 auto;
	max-width: 22rem;
	text-align: center;
}

.iwm-provider-modal .loading-steps .step {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 8px 0;
	color: #94a3b8;
	font-size: 15px;
	transition: color 200ms ease;
}

.iwm-provider-modal .loading-steps .step.active {
	color: var(--iwm-zip-p);
	font-weight: 600;
}

.iwm-provider-modal .error-state .error-icon {
	font-size: 44px;
	color: #d97706;
	margin-bottom: 8px;
}

.iwm-provider-modal .error-state h4 {
	color: #0f172a;
	font-weight: 700;
	margin-bottom: 8px;
}

.iwm-provider-modal .provider-summary {
	background: #f8fafc;
	border-radius: 14px;
	padding: 16px 8px;
}

.iwm-provider-modal .stat-value {
	font-size: 24px;
	font-weight: 700;
	color: var(--iwm-zip-p);
	line-height: 1.1;
}

.iwm-provider-modal .stat-unit {
	font-size: 13px;
	font-weight: 600;
	color: #64748b;
	margin-left: 3px;
}

.iwm-provider-modal .stat-label {
	font-size: 12px;
	color: #64748b;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	margin-top: 4px;
}

.iwm-provider-modal .provider-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.iwm-provider-modal .filter-chip {
	--chip-color: var(--iwm-zip-p);
	border: 1px solid rgba(15, 23, 42, 0.12);
	background: #fff;
	color: #475569;
	border-radius: 999px;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	transition: all 160ms ease;
}

.iwm-provider-modal .filter-chip .filter-count {
	background: rgba(15, 23, 42, 0.08);
	border-radius: 999px;
	padding: 1px 8px;
	font-size: 11px;
	font-weight: 700;
}

.iwm-provider-modal .filter-chip:hover {
	border-color: var(--chip-color);
	color: var(--chip-color);
}

.iwm-provider-modal .filter-chip.active {
	background: var(--chip-color);
	border-color: var(--chip-color);
	color: #fff;
}

.iwm-provider-modal .filter-chip.active .filter-count {
	background: rgba(255, 255, 255, 0.25);
	color: #fff;
}

.iwm-provider-modal .provider-cards {
	display: grid;
	gap: 12px;
}

.iwm-provider-modal .provider-card {
	display: grid;
	grid-template-columns: 80px 1fr auto;
	align-items: center;
	gap: 16px;
	padding: 16px 18px;
	border: 1px solid rgba(15, 23, 42, 0.1);
	border-radius: 14px;
	background: #fff;
	transition: box-shadow 180ms ease, transform 180ms ease;
}

.iwm-provider-modal .provider-card:hover {
	border-color: color-mix(in srgb, var(--iwm-zip-p) 40%, transparent);
	box-shadow: 0 12px 28px rgba(2, 6, 23, 0.08);
	transform: translateY(-1px);
}

.iwm-provider-modal .provider-card.is-best {
	border-color: var(--iwm-zip-p);
	box-shadow: 0 14px 28px color-mix(in srgb, var(--iwm-zip-p) 16%, transparent);
	position: relative;
}

.iwm-provider-modal .provider-card.is-best::before {
	content: "BEST";
	position: absolute;
	top: -10px;
	left: 18px;
	background: var(--iwm-zip-p);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1px;
	padding: 3px 8px;
	border-radius: 999px;
}

.iwm-provider-modal .provider-logo {
	width: 80px;
	height: 56px;
	object-fit: contain;
	background: #f8fafc;
	border-radius: 10px;
	padding: 6px;
}

.iwm-provider-modal .provider-logo--initials {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 20px;
	color: var(--iwm-zip-p);
	background: color-mix(in srgb, var(--iwm-zip-p) 12%, transparent);
}

.iwm-provider-modal .provider-name {
	font-weight: 700;
	color: #0f172a;
	font-size: 17px;
	margin-bottom: 6px;
}

.iwm-provider-modal .provider-tech {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}

.iwm-provider-modal .provider-speeds {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-top: 8px;
	color: #475569;
	font-size: 14px;
}

.iwm-provider-modal .provider-speeds i {
	color: var(--iwm-zip-p);
}

.iwm-provider-modal .provider-call-btn,
.iwm-provider-modal .provider-cta-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--iwm-zip-p);
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	padding: 10px 16px;
	border-radius: 10px;
	text-decoration: none;
	border: 0;
	transition: background 160ms ease;
}

.iwm-provider-modal .provider-call-btn:hover,
.iwm-provider-modal .provider-cta-btn:hover {
	background: var(--iwm-zip-pd);
	color: #fff;
}

@media (max-width: 575.98px) {
	.iwm-zip-lookup-wrap .zip-widget-inner {
		flex-wrap: wrap;
	}
	.iwm-zip-lookup-wrap .zip-icon {
		width: 40px;
	}
	.iwm-zip-lookup-wrap .zip-input {
		padding: 12px;
		width: calc(100% - 40px);
	}
	.iwm-zip-lookup-wrap .zip-btn {
		flex: 1 1 100%;
		padding: 12px 20px;
		border-top: 1px solid rgba(15, 23, 42, 0.06);
	}
	.iwm-provider-modal .provider-card {
		grid-template-columns: 56px 1fr;
		grid-template-areas: "logo info" "action action";
	}
	.iwm-provider-modal .provider-logo {
		grid-area: logo;
		width: 56px;
		height: 44px;
	}
	.iwm-provider-modal .provider-info {
		grid-area: info;
	}
	.iwm-provider-modal .provider-action {
		grid-area: action;
	}
	.iwm-provider-modal .provider-call-btn {
		width: 100%;
		justify-content: center;
	}
}
