/* =========================================================
 * GP Quiz — Apple-inspired theme
 * Scales with --gpq-base and --gpq-font-family from admin.
 * ========================================================= */

.gp-quiz-wrapper {
	--gpq-blue: #0071e3;
	--gpq-blue-strong: #0058b0;
	--gpq-blue-soft: rgba(0, 113, 227, 0.08);
	--gpq-blue-ring: rgba(0, 113, 227, 0.18);
	--gpq-green: #34c759;
	--gpq-red: #ff3b30;
	--gpq-text: #1d1d1f;
	--gpq-text-2: #515154;
	--gpq-text-3: #86868b;
	--gpq-border: rgba(60, 60, 67, 0.12);
	--gpq-border-strong: rgba(60, 60, 67, 0.18);
	--gpq-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
	--gpq-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.08);

	/* Can be overridden via inline style from admin settings. */
	--gpq-base: 16px;
	--gpq-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--gpq-form-bg: transparent;

	max-width: 760px;
	margin: 0 auto;
	padding: 8px;
	color: var(--gpq-text);
	font-family: var(--gpq-font-family);
	font-size: var(--gpq-base);
	font-feature-settings: "ss01", "ss02";
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

/* ---------- Form container ---------- */
.gp-quiz-form {
	background: var(--gpq-form-bg);
	border-radius: 22px;
	padding: 32px 28px;
	box-shadow: var(--gpq-form-shadow, var(--gpq-shadow));
	border: var(--gpq-form-border, 0 solid transparent);
}

.gp-quiz-section {
	margin-bottom: 32px;
}

.gp-quiz-section:last-of-type {
	margin-bottom: 0;
}

.gp-quiz-section-title {
	font-size: var(--gpq-fs-section, calc(var(--gpq-base) * 1.75));
	font-weight: var(--gpq-fw-section, 700);
	letter-spacing: -0.02em;
	line-height: 1.2;
	color: var(--gpq-text);
	margin: 0 0 8px;
	text-align: center;
}

.gp-quiz-section-note {
	margin: 0 0 22px;
	text-align: center;
	font-size: 13px;
	font-style: italic;
	color: var(--gpq-text-2);
}

/* ---------- Info section: grid 2 cột để hỗ trợ field width 50% ---------- */
.gp-quiz-section--info {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.gp-quiz-section--info > * {
	grid-column: 1 / -1;
	margin-bottom: 0;
}

.gp-quiz-section--info > .gp-quiz-field--half {
	grid-column: span 1;
}

.gp-quiz-section--info > .gp-quiz-section-title {
	margin: 0 0 4px;
}

/* ---------- Fields ---------- */
.gp-quiz-field {
	margin-bottom: 0;
}

.gp-quiz-field > label,
.gp-quiz-field-label {
	display: block;
	margin: 0;
	font-size: var(--gpq-fs-flabel, calc(var(--gpq-base) * 0.875));
	font-weight: var(--gpq-fw-flabel, 600);
	letter-spacing: -0.01em;
	color: #000000;
}

.gp-quiz-field .req {
	color: var(--gpq-red);
	margin-left: 2px;
	font-weight: 600;
}

.gp-quiz-field input[type="text"],
.gp-quiz-field input[type="tel"],
.gp-quiz-field input[type="email"],
.gp-quiz-field textarea,
.gp-quiz-field select {
	width: 100%;
	padding: 14px 16px;
	font-size: var(--gpq-base);
	font-family: inherit;
	color: var(--gpq-text);
	background: #fbfbfd;
	border: 1px solid var(--gpq-border);
	border-radius: 12px;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

.gp-quiz-field textarea {
	min-height: 96px;
	resize: vertical;
}

.gp-quiz-field select {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23515154' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
	background-repeat: no-repeat;
	background-position: right 15px center;
	padding: 20px 15px;
	padding-right: 40px;
}

/* Riêng select tỉnh/thành: padding nhỏ hơn */
.gp-quiz-field--province select {
	padding: 14px 15px;
	padding-right: 40px;
}

.gp-quiz-field input:hover,
.gp-quiz-field textarea:hover,
.gp-quiz-field select:hover {
	border-color: var(--gpq-border-strong);
}

.gp-quiz-field input:focus,
.gp-quiz-field textarea:focus,
.gp-quiz-field select:focus {
	outline: none;
	border-color: var(--gpq-blue);
	background: #fff;
	box-shadow: 0 0 0 4px var(--gpq-blue-ring);
}

/* ---------- Inline option groups (radio/checkbox trong form fields) ----------
 * Style giống card đáp án câu hỏi: nền nhạt, bo 14px, custom indicator.
 * Mặc định: stack dọc full-width, text căn trái.
 * Chỉ .gp-quiz-options-inline--horizontal mới chia đều theo width.
 */
.gp-quiz-options-inline {
	display: flex;
	flex-direction: column;
	flex-wrap: nowrap;
	gap: 10px;
}

.gp-quiz-options-inline label {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 14px;
	width: 100%;
	padding: 16px 20px;
	background: #fbfbfd;
	border: 1.5px solid var(--gpq-border);
	border-radius: 14px;
	cursor: pointer;
	font-size: var(--gpq-fs-option, var(--gpq-base));
	font-weight: var(--gpq-fw-option, 400);
	line-height: 1.5;
	color: var(--gpq-text);
	text-align: left;
	transition: all 0.18s ease;
	user-select: none;
	position: relative;
}

.gp-quiz-options-inline label:hover {
	background: #fff;
	border-color: var(--gpq-border-strong);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.gp-quiz-options-inline label:active {
	transform: translateY(0);
}

/* Ẩn native input */
.gp-quiz-options-inline input[type="radio"],
.gp-quiz-options-inline input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

/* Indicator bị ẩn — cả card là target click */
.gp-quiz-options-inline label::before {
	display: none;
}

.gp-quiz-options-inline label:has(input[type="radio"])::before {
	border-radius: 50%;
}

.gp-quiz-options-inline label:has(input[type="checkbox"])::before {
	border-radius: 6px;
}

.gp-quiz-options-inline label > span {
	flex: 1;
	min-width: 0;
}

/* Trạng thái chọn — full vàng */
.gp-quiz-options-inline label:has(input:checked) {
	background: #fef08a;
	border-color: #eab308;
	box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.4);
}

/* Layout: ngang — chia đều theo width trên 1 hàng (text vẫn căn trái) */
.gp-quiz-options-inline--horizontal {
	flex-direction: row;
	flex-wrap: wrap;
}
.gp-quiz-options-inline--horizontal > label {
	flex: 1 1 0;
	width: auto;
	min-width: 0;
}

/* Layout: dọc — giữ default */
.gp-quiz-options-inline--vertical {
	flex-direction: column;
	flex-wrap: nowrap;
}
.gp-quiz-options-inline--vertical > label {
	width: 100%;
}

/* ---------- Questions section ---------- */
.gp-quiz-section--questions {
	padding-top: 8px;
}

.gp-quiz-question {
	background: transparent;
	border-radius: 18px;
	padding: 20px 0 4px;
	margin-bottom: 28px;
}

.gp-quiz-question:first-of-type {
	padding-top: 4px;
}

.gp-quiz-question-label {
	margin: 0 0 6px;
	font-size: var(--gpq-fs-qlabel, calc(var(--gpq-base) * 0.9375));
	font-weight: var(--gpq-fw-qlabel, 700);
	letter-spacing: 0.02em;
	color: var(--gpq-fc-qlabel, #043E54);
	text-transform: none;
	line-height: 1.3;
}

.gp-quiz-question-title {
	margin: 0 0 14px;
	font-size: var(--gpq-fs-qtitle, calc(var(--gpq-base) * 1.125));
	font-weight: var(--gpq-fw-qtitle, 600);
	line-height: 1.45;
	letter-spacing: -0.01em;
	color: var(--gpq-text);
}

.gp-quiz-hint {
	display: inline-block;
	margin-left: 6px;
	font-size: calc(var(--gpq-base) * 0.75);
	font-style: normal;
	font-weight: 600;
	color: var(--gpq-blue);
	background: var(--gpq-blue-soft);
	padding: 3px 10px;
	border-radius: 999px;
	vertical-align: 2px;
}

/* ---------- Question options as cards ---------- */
.gp-quiz-options {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.gp-quiz-options li {
	margin: 0;
}

.gp-quiz-options label {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 16px 20px;
	background: #fbfbfd;
	border: 1.5px solid var(--gpq-border);
	border-radius: 14px;
	cursor: pointer;
	font-size: var(--gpq-fs-option, var(--gpq-base));
	font-weight: var(--gpq-fw-option, 400);
	line-height: 1.5;
	color: var(--gpq-text);
	transition: all 0.18s ease;
	position: relative;
}

.gp-quiz-options label:hover {
	background: #fff;
	border-color: var(--gpq-border-strong);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.gp-quiz-options label:active {
	transform: translateY(0);
}

/* Hide native input, draw a custom indicator */
.gp-quiz-options input[type="radio"],
.gp-quiz-options input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

.gp-quiz-options label::before {
	display: none;
}

.gp-quiz-options li:has(input[type="radio"]) label::before {
	border-radius: 50%;
}

.gp-quiz-options li:has(input[type="checkbox"]) label::before {
	border-radius: 6px;
}

.gp-quiz-options label > span {
	flex: 1;
	min-width: 0;
}

/* Selected state — full vàng: nền, viền, shadow */
.gp-quiz-options label:has(input:checked) {
	background: #fef08a;
	border-color: #eab308;
	box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.4);
}

.gp-quiz-options li:has(input[type="checkbox"]) label:has(input:checked) {
	background: #fef08a;
}

/* ---------- Submit ---------- */
.gp-quiz-submit-wrap {
	text-align: center;
	margin-top: 28px;
}

.gp-quiz-submit {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: #d57b21;
	color: #fff;
	border: none;
	padding: 14px 40px;
	font-family: inherit;
	font-size: var(--gpq-fs-submit, calc(var(--gpq-base) * 1.0625));
	font-weight: var(--gpq-fw-submit, 600);
	letter-spacing: -0.01em;
	border-radius: 999px;
	cursor: pointer;
	transition: transform 0.15s ease, background 0.18s ease, box-shadow 0.18s ease;
	box-shadow: 0 4px 14px rgba(213, 123, 33, 0.3);
	min-width: 220px;
}

.gp-quiz-submit::before {
	content: "";
	display: inline-block;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/></svg>") no-repeat center / contain;
	        mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/></svg>") no-repeat center / contain;
}

.gp-quiz-submit:hover,
.gp-quiz-submit:active,
.gp-quiz-submit:focus {
	background: #043E54;
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(4, 62, 84, 0.4);
}

.gp-quiz-submit:active {
	transform: translateY(0);
}

.gp-quiz-submit:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

/* ---------- Inline message ---------- */
.gp-quiz-message {
	margin-top: 16px;
	padding: 0 8px;
	font-size: calc(var(--gpq-base) * 0.875);
	text-align: center;
	min-height: 20px;
	font-weight: 500;
}

.gp-quiz-message.is-error {
	color: var(--gpq-red);
}

.gp-quiz-message.is-info {
	color: var(--gpq-blue);
}

/* ---------- Result screens ---------- */
.gp-quiz-result {
	margin: 0 auto;
}

.gp-quiz-result-box {
	background: var(--gpq-form-bg);
	border-radius: 22px;
	padding: 56px 36px;
	text-align: center;
	box-shadow: var(--gpq-form-shadow, var(--gpq-shadow));
	border: var(--gpq-form-border, 0 solid transparent);
	animation: gpq-fade-in 0.5s ease;
}

@keyframes gpq-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ---------- Result PASS: theo design ảnh ---------- */
.gp-quiz-result-pass {
	background: linear-gradient(135deg, #c8e8f0 0%, #f4f1d4 100%);
	padding: 56px 48px;
}

.gp-quiz-result-pass h2 {
	font-size: 26px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: #0a2540;
	margin: 0;
	line-height: 1.2;
}

.gp-quiz-result-pass h2::before {
	content: none;
}

.gp-quiz-result-info {
	text-align: left;
	margin: 0 auto 32px;
	max-width: 540px;
	color: #0a2540;
	font-size: 20px;
	line-height: 1.7;
}

.gp-quiz-result-info p {
	margin: 0;
	font-size: inherit;
	font-weight: 500;
	color: #0a2540;
}

.gp-quiz-result-event .gpq-event-name {
	color: #e63838;
	font-weight: 700;
	letter-spacing: 0.01em;
}

.gp-quiz-result-score-wrap {
	margin: 28px 0 24px;
	text-align: center;
}

.gpq-score-label {
	font-size: 22px;
	font-weight: 600;
	color: #0a2540;
	margin: 0 0 18px;
	letter-spacing: -0.01em;
}

.gpq-score-big {
	display: inline-block;
	font-family: 'Be Vietnam Pro', sans-serif;
	font-size: 60px;
	font-weight: 900;
	line-height: 1;
	color: #ff3b30;
	letter-spacing: 0.01em;
	margin: 0;
	/* Outline cream + drop shadow */
	text-shadow:
		-3px -3px 0 #ffe680, 3px -3px 0 #ffe680,
		-3px  3px 0 #ffe680, 3px  3px 0 #ffe680,
		-3px  0   0 #ffe680, 3px  0   0 #ffe680,
		 0   -3px 0 #ffe680, 0    3px 0 #ffe680,
		 0    6px 12px rgba(0, 0, 0, 0.12);
}

.gpq-cta {
	font-size: 16px;
	color: #0a2540;
	line-height: 1.65;
	font-weight: 500;
	margin: 32px 0 0;
	text-align: center;
}

.gpq-sparkle {
	color: #f4c430;
	font-size: 1.2em;
	margin-right: 4px;
	vertical-align: -2px;
}

.gp-quiz-result-fail {
	padding: 72px 36px;
}

.gp-quiz-result-fail::before {
	content: "🙏";
	display: block;
	font-size: 56px;
	margin-bottom: 24px;
}

.gp-quiz-result-fail h2,
.gp-quiz-result-fail h3 {
	color: var(--gpq-text);
	letter-spacing: -0.02em;
	font-weight: 700;
	line-height: 1.2;
	margin: 6px 0;
}

.gp-quiz-result-fail h2 {
	font-size: calc(var(--gpq-base) * 2);
	color: var(--gpq-blue);
}

.gp-quiz-result-fail h3 {
	font-size: calc(var(--gpq-base) * 1.5);
	font-weight: 600;
	color: var(--gpq-text-2);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
	.gp-quiz-form {
		padding: 22px 18px;
		border-radius: 18px;
	}
	.gp-quiz-section-title {
		font-size: calc(var(--gpq-base) * 1.375);
		margin-bottom: 18px;
	}
	.gp-quiz-question-title {
		font-size: var(--gpq-base);
	}
	.gp-quiz-options label {
		padding: 14px 16px;
		font-size: calc(var(--gpq-base) * 0.9375);
	}
	.gp-quiz-submit {
		width: 100%;
		min-width: 0;
		padding: 14px 24px;
	}
	.gp-quiz-result-box {
		padding: 40px 24px;
		border-radius: 18px;
	}
	.gp-quiz-result-pass {
		padding: 40px 24px;
	}
	.gp-quiz-result-info {
		font-size: 20px;
	}
	.gpq-score-big {
		font-size: 36px;
	}
	.gp-quiz-result-fail h2 {
		font-size: calc(var(--gpq-base) * 1.625);
	}
	.gp-quiz-result-fail h3 {
		font-size: calc(var(--gpq-base) * 1.25);
	}
}

/* Fallback cho trình duyệt không hỗ trợ :has() — vẫn show native input. */
@supports not selector(:has(*)) {
	.gp-quiz-options input[type="radio"],
	.gp-quiz-options input[type="checkbox"],
	.gp-quiz-options-inline input[type="radio"],
	.gp-quiz-options-inline input[type="checkbox"] {
		position: static;
		opacity: 1;
		width: 20px;
		height: 20px;
		pointer-events: auto;
		accent-color: var(--gpq-blue);
	}
	.gp-quiz-options label::before,
	.gp-quiz-options-inline label::before {
		display: none;
	}
}
