/**
 * EAFIT Quizzes — front-end styles.
 * Scoped under .eafit-quiz so it stays out of the host theme's way.
 *
 * @package EAFIT_Quizzes
 */

.eafit-quiz {
	--eq-bg: #ffffff;
	--eq-fg: #0f172a;
	--eq-muted: #64748b;
	--eq-primary: #1d4ed8;
	--eq-primary-dark: #1e3a8a;
	--eq-ring: #e2e8f0;
	--eq-card: #f8fafc;
	--eq-card-border: #e2e8f0;
	--eq-right: #10b981;
	--eq-right-bg: #ecfdf5;
	--eq-wrong: #ef4444;
	--eq-wrong-bg: #fef2f2;
	--eq-radius: 18px;
	--eq-shadow: 0 18px 40px -20px rgba(15, 23, 42, 0.35);

	position: relative;
	max-width: 720px;
	margin: 2rem auto;
	color: var(--eq-fg);
	font-family: inherit;
	line-height: 1.55;
	box-sizing: border-box;
}

.eafit-quiz *,
.eafit-quiz *::before,
.eafit-quiz *::after {
	box-sizing: border-box;
}

.eq-stage {
	position: relative;
	background: var(--eq-bg);
	border: 1px solid var(--eq-card-border);
	border-radius: var(--eq-radius);
	box-shadow: var(--eq-shadow);
	padding: clamp(1.5rem, 4vw, 2.75rem);
	overflow: hidden;
	min-height: 280px;
}

/* ---- screen transitions ------------------------------------------------ */

.eq-screen {
	transition: opacity 0.28s ease, transform 0.28s ease;
}

.eq-enter {
	opacity: 0;
	transform: translateY(14px);
}

.eq-leave {
	position: absolute;
	inset: clamp(1.5rem, 4vw, 2.75rem);
	opacity: 0;
	transform: translateY(-12px);
	pointer-events: none;
}

/* ---- typography / shared ---------------------------------------------- */

.eq-kicker {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--eq-primary);
	background: rgba(29, 78, 216, 0.08);
	padding: 0.3rem 0.7rem;
	border-radius: 999px;
	margin-bottom: 1rem;
}

.eq-title {
	font-size: clamp(1.4rem, 3.4vw, 1.9rem);
	line-height: 1.2;
	margin: 0 0 0.75rem;
	font-weight: 800;
}

.eq-lead-text {
	color: var(--eq-muted);
	font-size: 1.02rem;
	margin: 0 0 1.5rem;
}

/* ---- buttons ----------------------------------------------------------- */

.eq-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	font: inherit;
	font-weight: 700;
	border: none;
	border-radius: 12px;
	padding: 0.85rem 1.6rem;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.eq-btn-primary {
	background: var(--eq-primary);
	color: #fff;
	box-shadow: 0 12px 24px -12px rgba(29, 78, 216, 0.8);
}

.eq-btn-primary:hover {
	background: var(--eq-primary-dark);
	transform: translateY(-2px);
}

.eq-btn-ghost {
	background: transparent;
	color: var(--eq-primary);
	border: 2px solid var(--eq-ring);
	margin-top: 1.5rem;
}

.eq-btn-ghost:hover {
	border-color: var(--eq-primary);
	transform: translateY(-2px);
}

/* ---- lead form --------------------------------------------------------- */

.eq-lead-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.eq-lead-prompt {
	font-weight: 600;
	margin: 0;
}

.eq-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--eq-muted);
}

.eq-field input {
	font: inherit;
	color: var(--eq-fg);
	padding: 0.8rem 1rem;
	border: 1.5px solid var(--eq-card-border);
	border-radius: 12px;
	background: var(--eq-card);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.eq-field input:focus {
	outline: none;
	border-color: var(--eq-primary);
	box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.eq-error {
	color: var(--eq-wrong);
	font-size: 0.88rem;
	font-weight: 600;
	margin: 0;
}

/* ---- progress ---------------------------------------------------------- */

.eq-progress {
	margin-bottom: 1.5rem;
}

.eq-progress-meta {
	display: flex;
	justify-content: space-between;
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--eq-muted);
	margin-bottom: 0.5rem;
}

.eq-progress-track {
	height: 8px;
	background: var(--eq-ring);
	border-radius: 999px;
	overflow: hidden;
}

.eq-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--eq-primary), #38bdf8);
	border-radius: 999px;
	transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- questions --------------------------------------------------------- */

.eq-statement {
	font-size: clamp(1.15rem, 2.8vw, 1.5rem);
	font-weight: 700;
	line-height: 1.32;
	margin: 0 0 1.5rem;
}

.eq-choice {
	font: inherit;
	text-align: left;
	cursor: pointer;
	background: var(--eq-card);
	border: 2px solid var(--eq-card-border);
	border-radius: 14px;
	transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.eq-choice:hover:not(:disabled) {
	border-color: var(--eq-primary);
	transform: translateY(-2px);
	box-shadow: 0 12px 22px -16px rgba(29, 78, 216, 0.9);
}

.eq-choice:disabled {
	cursor: default;
}

/* True / False */
.eq-tf-choices {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

.eq-tf-btn {
	padding: 1.4rem 1rem;
	font-size: 1.1rem;
	font-weight: 800;
	text-align: center;
}

/* Majority options */
.eq-options {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.eq-option {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding: 1rem 1.1rem;
}

.eq-opt-key {
	flex: 0 0 auto;
	width: 2rem;
	height: 2rem;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--eq-primary);
	color: #fff;
	font-weight: 800;
	font-size: 0.9rem;
}

.eq-opt-text {
	font-size: 1rem;
	font-weight: 500;
}

.eq-selected {
	border-color: var(--eq-primary);
	background: rgba(29, 78, 216, 0.08);
}

/* TF answered states */
.eq-correct {
	border-color: var(--eq-right);
	background: var(--eq-right-bg);
	color: #047857;
}

.eq-wrong {
	border-color: var(--eq-wrong);
	background: var(--eq-wrong-bg);
	color: #b91c1c;
}

/* ---- feedback ---------------------------------------------------------- */

.eq-feedback {
	margin-top: 1.5rem;
	padding: 1.4rem;
	border-radius: 14px;
	background: var(--eq-card);
	border: 1px solid var(--eq-card-border);
}

.eq-reveal {
	animation: eqReveal 0.4s ease both;
}

@keyframes eqReveal {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.eq-fb-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 800;
	font-size: 1.05rem;
	margin-bottom: 0.75rem;
}

.eq-fb-badge.is-right {
	color: var(--eq-right);
}

.eq-fb-badge.is-wrong {
	color: var(--eq-wrong);
}

.eq-fb-icon {
	display: grid;
	place-items: center;
	width: 1.7rem;
	height: 1.7rem;
	border-radius: 50%;
	color: #fff;
	font-size: 0.95rem;
}

.is-right .eq-fb-icon {
	background: var(--eq-right);
}

.is-wrong .eq-fb-icon {
	background: var(--eq-wrong);
}

.eq-fb-text {
	margin: 0 0 0.75rem;
	font-size: 0.98rem;
}

.eq-fb-source {
	font-size: 0.85rem;
	color: var(--eq-muted);
	margin: 0 0 0.75rem;
}

.eq-fb-quote {
	margin: 0 0 1rem;
	padding: 0.9rem 1.1rem;
	border-left: 4px solid var(--eq-primary);
	background: #fff;
	border-radius: 0 10px 10px 0;
	font-style: italic;
	color: #334155;
}

.eq-fb-quote cite {
	display: block;
	margin-top: 0.5rem;
	font-style: normal;
	font-weight: 700;
	color: var(--eq-primary);
	font-size: 0.85rem;
}

.eq-feedback .eq-btn {
	margin-top: 0.5rem;
}

/* ---- loading ----------------------------------------------------------- */

.eq-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	min-height: 200px;
	color: var(--eq-muted);
	font-weight: 600;
}

.eq-spinner {
	width: 44px;
	height: 44px;
	border: 4px solid var(--eq-ring);
	border-top-color: var(--eq-primary);
	border-radius: 50%;
	animation: eqSpin 0.8s linear infinite;
}

@keyframes eqSpin {
	to {
		transform: rotate(360deg);
	}
}

/* ---- result ------------------------------------------------------------ */

.eq-result {
	text-align: center;
}

.eq-save-warn {
	font-size: 0.82rem;
	color: var(--eq-muted);
	margin: 0 0 1rem;
}

.eq-score-ring {
	--eq-pct: 0;
	width: 150px;
	height: 150px;
	margin: 0.5rem auto 1.5rem;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background:
		radial-gradient(closest-side, #fff 78%, transparent 79% 100%),
		conic-gradient(var(--eq-primary) calc(var(--eq-pct) * 1%), var(--eq-ring) 0);
	animation: eqRing 0.9s ease both;
}

@keyframes eqRing {
	from {
		transform: scale(0.8);
		opacity: 0;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}

.eq-score-num {
	font-size: 2.5rem;
	font-weight: 800;
	color: var(--eq-primary);
}

.eq-score-num small {
	font-size: 1.1rem;
	color: var(--eq-muted);
}

.eq-archetype-img {
	max-width: 180px;
	height: auto;
	margin: 0 auto 1.25rem;
	display: block;
	border-radius: 14px;
}

.eq-archetype-authors {
	margin-top: 1rem;
	font-weight: 700;
	color: var(--eq-primary);
	font-size: 0.95rem;
}

/* ---- confetti ---------------------------------------------------------- */

.eq-confetti {
	position: absolute;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
	z-index: 5;
}

.eq-confetti i {
	position: absolute;
	top: -12px;
	width: 9px;
	height: 14px;
	border-radius: 2px;
	opacity: 0.9;
	animation: eqFall 1.6s ease-in forwards;
}

@keyframes eqFall {
	to {
		top: 110%;
		opacity: 0;
	}
}

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

@media (max-width: 520px) {
	.eq-tf-choices {
		grid-template-columns: 1fr;
	}
	.eq-stage {
		border-radius: 14px;
	}
}

/* ---- reduced motion ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.eafit-quiz *,
	.eafit-quiz *::before,
	.eafit-quiz *::after {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
	}
}

/* ---- admin shortcode error -------------------------------------------- */

.eafit-quiz-error {
	border: 1px dashed #f59e0b;
	background: #fffbeb;
	color: #92400e;
	padding: 1rem;
	border-radius: 8px;
	font-size: 0.9rem;
}
