/* Scoped styles — compatible with Gutenberg / Twenty Twenty-Five */
.acwsmart-tool {
	--acw-primary: #1e3a5f;
	--acw-primary-hover: #152a45;
	--acw-accent: #e85d04;
	--acw-border: #dcdcde;
	--acw-bg: #ffffff;
	--acw-muted: #646970;
	--acw-radius: 8px;
	--acw-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);

	box-sizing: border-box;
	max-width: 640px;
	margin: 1.5rem auto;
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	color: inherit;
}

.acwsmart-tool *,
.acwsmart-tool *::before,
.acwsmart-tool *::after {
	box-sizing: border-box;
}

.acwsmart-tool__loader {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 2rem;
	justify-content: center;
	color: var(--acw-muted);
}

/* Il loader viene rimosso dal DOM al primo render; regole di riserva anti-tema */
.acwsmart-tool--ready .acwsmart-tool__loader,
.acwsmart-tool__loader[hidden] {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	overflow: hidden !important;
	padding: 0 !important;
	margin: 0 !important;
}

.acwsmart-tool__error[hidden] {
	display: none !important;
}

.acwsmart-tool--ready .acwsmart-tool__app {
	display: block;
}

.acwsmart-tool__spinner {
	width: 1.25rem;
	height: 1.25rem;
	border: 2px solid var(--acw-border);
	border-top-color: var(--acw-primary);
	border-radius: 50%;
	animation: acwsmart-spin 0.7s linear infinite;
}

@keyframes acwsmart-spin {
	to { transform: rotate(360deg); }
}

.acwsmart-tool__app {
	background: var(--acw-bg);
	border: 1px solid var(--acw-border);
	border-radius: var(--acw-radius);
	box-shadow: var(--acw-shadow);
	padding: 1.5rem;
}

.acwsmart-tool__error {
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	background: #fcf0f1;
	border-left: 4px solid #d63638;
	color: #3c434a;
	border-radius: 4px;
}

.acwsmart-tool__title {
	margin: 0 0 0.5rem;
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.3;
}

.acwsmart-tool__desc {
	margin: 0 0 1.25rem;
	color: var(--acw-muted);
	font-size: 0.95rem;
}

.acwsmart-tool__progress {
	height: 6px;
	background: #f0f0f1;
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 0.5rem;
}

.acwsmart-tool__progress-bar {
	height: 100%;
	background: var(--acw-primary);
	border-radius: 999px;
	transition: width 0.3s ease;
}

.acwsmart-tool__progress-label {
	margin: 0 0 1rem;
	font-size: 0.85rem;
	color: var(--acw-muted);
}

.acwsmart-tool__answers {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
}

.acwsmart-tool__answer {
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--acw-border);
	border-radius: var(--acw-radius);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
}

.acwsmart-tool__answer:hover {
	border-color: var(--acw-primary);
	background: #f6f7f7;
}

.acwsmart-tool__answer input {
	margin-top: 0.2rem;
	accent-color: var(--acw-primary);
	flex-shrink: 0;
}

.acwsmart-tool__answer:has(input:checked) {
	border-color: var(--acw-primary);
	background: #f0f4f8;
}

.acwsmart-tool__field {
	margin-bottom: 1rem;
}

.acwsmart-tool__field label,
.acwsmart-tool__field legend {
	display: block;
	margin-bottom: 0.35rem;
	font-weight: 500;
	font-size: 0.9rem;
}

.acwsmart-tool__field input[type="text"],
.acwsmart-tool__field input[type="email"],
.acwsmart-tool__field input[type="tel"],
.acwsmart-tool__field textarea,
.acwsmart-tool__field select {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--acw-border);
	border-radius: var(--acw-radius);
	font: inherit;
	background: #fff;
}

.acwsmart-tool__field input:focus,
.acwsmart-tool__field textarea:focus,
.acwsmart-tool__field select:focus {
	outline: 2px solid var(--acw-primary);
	outline-offset: 1px;
	border-color: var(--acw-primary);
}

.acwsmart-tool__consent {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 1rem 0;
	font-size: 0.875rem;
	color: var(--acw-muted);
}

.acwsmart-tool__consent input {
	margin-top: 0.2rem;
	accent-color: var(--acw-primary);
}

.acwsmart-tool__hp {
	position: absolute;
	left: -9999px;
	opacity: 0;
	height: 0;
	overflow: hidden;
}

.acwsmart-tool__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1rem;
}

.acwsmart-tool__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.65rem 1.25rem;
	border-radius: var(--acw-radius);
	font: inherit;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	border: none;
	transition: background 0.15s, color 0.15s;
}

.acwsmart-tool__btn--primary {
	background: var(--acw-primary);
	color: #fff;
}

.acwsmart-tool__btn--primary:hover {
	background: var(--acw-primary-hover);
	color: #fff;
}

.acwsmart-tool__btn--primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.acwsmart-tool__btn--ghost {
	background: transparent;
	color: var(--acw-muted);
	border: 1px solid var(--acw-border);
}

.acwsmart-tool__btn--ghost:hover {
	background: #f6f7f7;
}

.acwsmart-tool__score {
	text-align: center;
	padding: 1.25rem;
	margin: 1rem 0;
	background: #f6f7f7;
	border-radius: var(--acw-radius);
}

.acwsmart-tool__score-value {
	display: block;
	font-size: 2.5rem;
	font-weight: 700;
	color: var(--acw-accent);
	line-height: 1;
}

.acwsmart-tool__score-label {
	display: block;
	margin-top: 0.35rem;
	font-size: 1.1rem;
	font-weight: 600;
}

.acwsmart-tool__hook {
	margin: 1rem 0;
	font-size: 1rem;
	line-height: 1.6;
}

.acwsmart-tool__hook p {
	margin: 0 0 0.75rem;
}
