/* =============================================================================
   Pagina TEST di valutazione — "focus mode" (versione compatta).
   Fondo blu profondo del brand durante il test, card bianche pulite, accento
   azzurro (--color-4) per progresso e selezioni.
   ============================================================================= */

.test-main {
	min-height: 100vh;
	/* compensa top-bar istituzionale + header fisso (come .miniera-main) */
	padding: 12rem 0 3rem;
	background:
		radial-gradient(900px 420px at 18% -10%, rgba(96, 204, 255, 0.22), transparent 60%),
		radial-gradient(700px 380px at 92% 8%, rgba(132, 163, 223, 0.18), transparent 55%),
		linear-gradient(178deg, #02224b 0%, var(--color-2) 45%, #053a7d 100%);
}

.test-main .container {
	max-width: 1040px;
}

/* Lo svolgimento resta su una colonna comoda e centrata, anche se il
   container e' piu' largo per ospitare la copertina a due colonne. */
.test-quiz {
	max-width: 760px;
	margin: 0 auto;
}

.test-intro {
	margin: 0 auto;
}

/* ---- bottoni ------------------------------------------------------------- */

.test-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.55rem 1.25rem;
	border-radius: 999px;
	border: none;
	font-family: 'Noto Sans', sans-serif;
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.test-btn-primary {
	background: var(--color-4);
	color: var(--color-2);
	box-shadow: 0 6px 16px rgba(96, 204, 255, 0.32);
}

.test-btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 22px rgba(96, 204, 255, 0.45);
	background: #7cd6ff;
}

.test-btn-ghost {
	background: rgba(2, 43, 95, 0.06);
	color: var(--color-2);
}

.test-btn-ghost:hover {
	background: rgba(2, 43, 95, 0.12);
}

.test-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

/* ---- card base -------------------------------------------------------------- */

.test-intro-card,
.test-question-card,
.test-review-card,
.test-result-card {
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(1, 16, 38, 0.4);
	animation: test-pop-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ---- STEP 0: copertina ---------------------------------------------------- */

.test-intro-card {
	max-width: 560px;
	margin: 0 auto;
	padding: 1.85rem 2rem;
}

/* Quando c'e' lo storico la card diventa a due colonne e si allarga */
.test-intro-card.has-history {
	max-width: 1040px;
	display: grid;
	grid-template-columns: 1fr 360px;
	gap: 2.25rem;
	align-items: stretch;
}

.test-intro-card.has-history .test-intro-left {
	display: flex;
	flex-direction: column;
}

.test-intro-card.has-history .test-rules {
	flex: 1;
}

.test-intro-card.has-history .test-history {
	border-left: 1px solid #e6ecf5;
	padding-left: 1.75rem;
}

.test-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	background: rgba(96, 204, 255, 0.18);
	color: #056aa3;
	font-size: 0.72rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.13em;
	padding: 0.28rem 0.8rem;
	border-radius: 999px;
}

.test-title {
	margin: 0.7rem 0 0.25rem;
	text-align: left;
	color: var(--color-2);
	font-size: 1.9rem;
}

.test-title .rock-salt {
	color: #0a9bdb;
}

.test-intro-user {
	color: #5a6c86;
	margin: 0.2rem 0 1.2rem;
	font-size: 0.98rem;
}

.test-rules {
	list-style: none;
	margin: 0 0 1.5rem;
	padding: 1rem 1.15rem;
	background: #f4f8fd;
	border-radius: 12px;
	display: grid;
	gap: 0.5rem;
	color: var(--color-2);
	font-size: 0.95rem;
}

.test-rules li {
	display: flex;
	align-items: baseline;
	gap: 0.6rem;
}

.test-rules i {
	color: #0a9bdb;
	width: 1.1rem;
	text-align: center;
	flex: 0 0 auto;
}

.test-btn-start {
	font-size: 1.02rem;
	padding: 0.7rem 1.8rem;
	width: 100%;
}

/* ---- storico tentativi (copertina) ----------------------------------------- */

.test-history {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.test-history-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 1rem;
	font-weight: 800;
	color: var(--color-2);
	margin: 0 0 0.9rem;
}

.test-history-title i {
	color: #0a9bdb;
}

.test-history-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.5rem;
	margin-bottom: 0.9rem;
}

.test-stat {
	background: #f4f8fd;
	border-radius: 11px;
	padding: 0.6rem 0.3rem;
	text-align: center;
}

.test-stat-value {
	display: block;
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--color-2);
	line-height: 1.1;
}

.test-stat-value small {
	font-size: 0.72rem;
	font-weight: 600;
	color: #8294ad;
}

.test-stat-label {
	display: block;
	font-size: 0.66rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #8294ad;
	margin-top: 0.25rem;
}

.test-history-list {
	display: grid;
	gap: 0.4rem;
	grid-auto-rows: max-content;
	flex: 1;
	overflow-y: auto;
	max-height: 260px;
	padding-right: 2px;
}

.test-history-row {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 0.5rem;
	padding: 0.45rem 0.6rem;
	background: #fbfdff;
	border: 1px solid #e6ecf5;
	border-left-width: 4px;
	border-radius: 9px;
	font-size: 0.8rem;
}

.test-history-row.pass {
	border-left-color: #27ae60;
}

.test-history-row.fail {
	border-left-color: #d64541;
}

.test-history-row .th-n {
	font-weight: 800;
	color: #8294ad;
}

.test-history-row .th-date {
	color: #5a6c86;
}

.test-history-row .th-score {
	font-weight: 800;
	color: var(--color-2);
	white-space: nowrap;
}

.test-history-row.pass .th-score {
	color: #1e8e50;
}

.test-history-row.fail .th-score {
	color: #d64541;
}

/* ---- STEP 1: barra di avanzamento e navigatore ----------------------------- */

.test-progress-bar-track {
	height: 5px;
	background: rgba(255, 255, 255, 0.18);
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 0.9rem;
}

.test-progress-bar {
	height: 100%;
	width: 0;
	background: var(--color-4);
	border-radius: 999px;
	transition: width 0.35s ease;
	box-shadow: 0 0 12px rgba(96, 204, 255, 0.8);
}

.test-topbar {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	flex-wrap: wrap;
	margin-bottom: 1.1rem;
}

.test-counter {
	font-weight: 800;
	color: #fff;
	white-space: nowrap;
	font-size: 0.9rem;
	letter-spacing: 0.02em;
}

/* Navigatore minimale: un punto per domanda */
.test-navigator {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	flex: 1;
	align-items: center;
}

.test-nav-cell {
	width: 11px;
	height: 11px;
	border-radius: 50%;
	border: none;
	background: rgba(255, 255, 255, 0.28);
	cursor: pointer;
	padding: 0;
	font-size: 0;
	transition: all 0.18s ease;
}

.test-nav-cell:hover {
	transform: scale(1.35);
	background: rgba(255, 255, 255, 0.55);
}

.test-nav-cell.answered {
	background: var(--color-4);
	box-shadow: 0 0 8px rgba(96, 204, 255, 0.7);
}

.test-nav-cell.current {
	transform: scale(1.45);
	background: #fff;
}

.test-btn-review {
	margin-left: auto;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

.test-btn-review:hover {
	background: rgba(255, 255, 255, 0.22);
}

/* ---- STEP 1: card della domanda -------------------------------------------- */

.test-question-card {
	position: relative;
	padding: 1.75rem 1.9rem 1.6rem;
	overflow: hidden;
}

.test-question-card.changing {
	animation: test-slide-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.test-question-watermark {
	position: absolute;
	top: 1.1rem;
	right: 1.35rem;
	font-size: 0.8rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	color: #9fb3cf;
	user-select: none;
	pointer-events: none;
}

.test-question-text {
	font-size: 1.2rem;
	line-height: 1.4;
	margin: 0 0 1.3rem;
	padding-right: 2.5rem;
	color: var(--color-2);
	font-weight: 700;
}

.test-options {
	display: grid;
	gap: 0.55rem;
	margin-bottom: 1.5rem;
}

.test-option {
	display: flex;
	align-items: center;
	gap: 0.8rem;
	width: 100%;
	text-align: left;
	background: #fff;
	border: 1.5px solid #dfe7f3;
	border-radius: 12px;
	padding: 0.7rem 0.9rem;
	font-family: 'Noto Sans', sans-serif;
	font-size: 0.98rem;
	color: var(--color-2);
	cursor: pointer;
	transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
	animation: test-option-in 0.32s ease both;
}

.test-option:nth-child(1) { animation-delay: 0.02s; }
.test-option:nth-child(2) { animation-delay: 0.06s; }
.test-option:nth-child(3) { animation-delay: 0.1s; }
.test-option:nth-child(4) { animation-delay: 0.14s; }

.test-option:hover {
	border-color: var(--color-4);
	background: rgba(96, 204, 255, 0.07);
	transform: translateY(-1px);
}

.test-option-letter {
	flex: 0 0 auto;
	width: 1.85rem;
	height: 1.85rem;
	border-radius: 50%;
	background: #eef3fa;
	color: #5a6c86;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 0.9rem;
	transition: all 0.16s ease;
}

.test-option.selected {
	background: var(--color-2);
	border-color: var(--color-2);
	color: #fff;
	box-shadow: 0 8px 20px rgba(2, 43, 95, 0.32);
}

.test-option.selected .test-option-letter {
	background: var(--color-4);
	color: var(--color-2);
}

.test-question-nav {
	display: flex;
	justify-content: space-between;
	gap: 0.8rem;
}

/* ---- STEP 2: riepilogo ------------------------------------------------------ */

.test-review-card,
.test-result-card {
	max-width: 540px;
	margin: 0 auto;
	padding: 1.85rem 2rem;
	text-align: center;
}

.test-review-title {
	font-size: 1.5rem;
	margin: 0 0 0.4rem;
	color: var(--color-2);
}

.test-review-title .rock-salt {
	color: #0a9bdb;
}

.test-review-status {
	color: #5a6c86;
	margin-bottom: 1.4rem;
	font-size: 0.95rem;
}

.test-review-status strong.missing {
	color: #d64541;
}

.test-review-grid {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	justify-content: center;
	margin-bottom: 1.6rem;
}

/* Nel riepilogo i punti tornano numerati e piu' grandi */
.test-review-grid .test-nav-cell {
	width: 32px;
	height: 32px;
	border-radius: 9px;
	font-size: 0.78rem;
	font-weight: 800;
	background: #eef3fa;
	color: #5a6c86;
}

.test-review-grid .test-nav-cell.answered {
	background: var(--color-2);
	color: #fff;
	box-shadow: none;
}

.test-review-grid .test-nav-cell.missing {
	background: rgba(214, 69, 65, 0.1);
	color: #d64541;
	box-shadow: inset 0 0 0 2px rgba(214, 69, 65, 0.5);
}

.test-review-actions,
.test-result-actions {
	display: flex;
	justify-content: center;
	gap: 0.7rem;
	flex-wrap: wrap;
}

/* ---- STEP 3: risultato ------------------------------------------------------ */

.test-verdict {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.8rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.13em;
	padding: 0.38rem 1rem;
	border-radius: 999px;
	margin-bottom: 1.1rem;
}

.test-verdict.pass {
	background: rgba(39, 174, 96, 0.12);
	color: #1e8e50;
}

.test-verdict.fail {
	background: rgba(214, 69, 65, 0.1);
	color: #d64541;
}

.test-score-ring-wrapper {
	position: relative;
	width: 140px;
	margin: 0 auto 1.1rem;
}

.test-score-ring {
	width: 140px;
	height: 140px;
	transform: rotate(-90deg);
}

.test-ring-track,
.test-ring-value {
	fill: none;
	stroke-width: 9;
	stroke-linecap: round;
}

.test-ring-track {
	stroke: #eef3fa;
}

.test-ring-value {
	stroke: var(--color-4);
	stroke-dasharray: 326.7; /* 2 * PI * 52 */
	stroke-dashoffset: 326.7;
	transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.test-result-card.pass .test-ring-value {
	stroke: #27ae60;
}

.test-result-card.fail .test-ring-value {
	stroke: #d64541;
}

.test-score-label {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 2rem;
	color: var(--color-2);
	line-height: 1;
}

.test-score-label small {
	font-size: 0.8rem;
	font-weight: 600;
	color: #8294ad;
	margin-top: 0.2rem;
}

.test-result-title {
	font-size: 1.45rem;
	margin: 0 0 0.4rem;
	color: var(--color-2);
}

.test-result-msg {
	color: #5a6c86;
	margin-bottom: 1.5rem;
	font-size: 0.95rem;
}

.test-result-line {
	display: block;
}

.test-result-line + .test-result-line {
	margin-top: 0.55rem;
}

.test-result-line-soft {
	font-size: 0.9rem;
	color: #8294ad;
}

.test-result-msg strong {
	color: var(--color-2);
}

/* Revisione finale delle risposte */
.test-answers-review {
	margin-top: 1.75rem;
	text-align: left;
	display: grid;
	gap: 0.55rem;
}

.test-answer-row {
	border: 1.5px solid #e6ecf5;
	border-left-width: 5px;
	border-radius: 11px;
	padding: 0.7rem 0.9rem;
	background: #fbfdff;
}

.test-answer-row.ok {
	border-left-color: #27ae60;
}

.test-answer-row.ko {
	border-left-color: #d64541;
}

.test-answer-row .q {
	font-weight: 700;
	margin: 0 0 0.25rem;
	color: var(--color-2);
	font-size: 0.92rem;
}

.test-answer-row .a {
	margin: 0;
	font-size: 0.9rem;
	color: #5a6c86;
}

.test-answer-row .a i.fa-check {
	color: #27ae60;
}

.test-answer-row .a i.fa-xmark {
	color: #d64541;
}

/* ---- animazioni ------------------------------------------------------------- */

@keyframes test-pop-in {
	from {
		opacity: 0;
		transform: translateY(14px) scale(0.985);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes test-slide-in {
	from {
		opacity: 0;
		transform: translateX(20px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes test-option-in {
	from {
		opacity: 0;
		transform: translateY(7px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* ---- responsive -------------------------------------------------------------- */

@media (max-width: 640px) {
	.test-main {
		padding-top: 11rem;
	}

	.test-intro-card,
	.test-question-card,
	.test-review-card,
	.test-result-card {
		padding: 1.4rem 1.2rem;
		border-radius: 14px;
	}

	.test-question-text {
		font-size: 1.08rem;
		padding-right: 1.75rem;
	}

	.test-topbar {
		flex-direction: column;
		align-items: stretch;
	}

	.test-navigator {
		justify-content: center;
	}

	.test-btn-review {
		margin-left: 0;
	}

	.test-history-stats {
		gap: 0.4rem;
	}

	.test-stat-value {
		font-size: 1.2rem;
	}

	/* su mobile le due colonne della copertina si impilano */
	.test-intro-card.has-history {
		grid-template-columns: 1fr;
		gap: 1.25rem;
	}

	/* min-width:0 indispensabile: senza, i grid item restano a min-content
	   (auto) e la colonna 1fr non si restringe -> overflow orizzontale */
	.test-intro-card.has-history .test-intro-left,
	.test-intro-card.has-history .test-history {
		min-width: 0;
	}

	.test-intro-card.has-history .test-history {
		border-left: none;
		border-top: 1px solid #e6ecf5;
		padding-left: 0;
		padding-top: 1.25rem;
	}

	/* le statistiche si adattano e vanno a capo se serve */
	.test-history-stats {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.test-history-row {
		min-width: 0;
	}
	.test-history-row .th-date {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* selettore test a tutta larghezza */
	.test-picker-wrap select {
		width: 100%;
		max-width: 100%;
		min-width: 0 !important;
	}

	/* Prec./Succ.(Consegna): due bottoni a meta' larghezza, testo su una riga,
	   niente overflow oltre il bordo della card */
	.test-question-nav {
		gap: 0.6rem;
	}
	.test-question-nav .test-btn {
		flex: 1 1 0;
		min-width: 0;
		white-space: nowrap;
		padding-left: 0.7rem;
		padding-right: 0.7rem;
	}
}
