/**
 * Skin Type Quiz – Styles
 *
 * Modular, mobile-first CSS. Uses BEM-like prefixes (stq-).
 * Primary color is set dynamically via inline --stq-primary (from functions.php).
 * No external dependencies.
 */

/* -------------------------------------------------------------------------
   Variables (fallbacks; overridden by inline style from PHP when using theme primary)
   ------------------------------------------------------------------------- */
#skin-type-quiz.stq-quiz {
	--stq-radius: 10px;
	--stq-radius-lg: 16px;
	--stq-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
	--stq-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.1);
	--stq-transition: 0.25s ease;
	--stq-primary: #166534;
	--stq-primary-hover: #14532d;
	--stq-text: #1a1a1a;
	--stq-text-muted: #5a5a5a;
	--stq-bg: #fff;
	--stq-border: #e8e8ec;
	--stq-progress-bg: #eef0f2;
	--stq-progress-fill: var(--stq-primary);
}

/* -------------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------------- */
.stq-quiz {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
	color: var(--stq-text);
	max-width: 880px;
	margin: 2.5rem auto;
	padding: 0 1.25rem;
}

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

.stq-container {
	background: var(--stq-bg);
	border-radius: var(--stq-radius-lg);
	box-shadow: var(--stq-shadow), 0 0 0 1px rgba(0, 0, 0, 0.04);
	padding: 2rem 1.75rem;
	position: relative;
	overflow: hidden;
}

/* -------------------------------------------------------------------------
   Header & progress bar
   ------------------------------------------------------------------------- */
.stq-header {
	margin-bottom: 2rem;
}

.stq-title {
	margin: 0 0 1.25rem;
	font-size: 1.625rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.25;
	color: var(--stq-text);
}

.stq-progress-wrap {
	height: 8px;
	background: var(--stq-progress-bg);
	border-radius: 999px;
	overflow: hidden;
}

.stq-progress-bar {
	height: 100%;
	width: 0%;
	background: var(--stq-progress-fill);
	border-radius: 999px;
	transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -------------------------------------------------------------------------
   Steps (one question per screen)
   ------------------------------------------------------------------------- */
.stq-step {
	display: none;
	min-height: 220px;
	opacity: 0;
	transform: translateX(16px);
	transition: opacity 0.4s ease, transform 0.4s ease;
}

.stq-step.stq-step-active {
	display: block;
	opacity: 1;
	transform: translateX(0);
}

.stq-step.stq-step-prev {
	display: none;
}

.stq-question {
	margin: 0 0 1.5rem;
	font-size: 1.1875rem;
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.45;
	color: var(--stq-text);
	text-align: center;
}

.stq-step-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	margin-right: 0.5rem;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	background: var(--stq-primary);
	border-radius: 50%;
	vertical-align: middle;
}

/* -------------------------------------------------------------------------
   Options: horizontal row, each option = image on top + label below
   ------------------------------------------------------------------------- */
.stq-options {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.875rem;
}

.stq-options--cards .stq-option {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	padding: 0;
	background: var(--stq-bg);
	border: 2px solid var(--stq-border);
	border-radius: var(--stq-radius);
	cursor: pointer;
	position: relative;
	overflow: hidden;
	transition: border-color var(--stq-transition), background var(--stq-transition), box-shadow var(--stq-transition), transform var(--stq-transition);
	min-height: 0;
	flex: 1 1 0;
	min-width: 100px;
	max-width: 180px;
}

.stq-option::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 4px;
	width: 100%;
	background: var(--stq-primary);
	transform: scaleX(0);
	transform-origin: center;
	border-radius: 0 0 var(--stq-radius) var(--stq-radius);
	transition: transform 0.25s ease;
}

.stq-option:hover {
	border-color: var(--stq-primary);
	background: color-mix(in srgb, var(--stq-primary) 6%, transparent);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
	transform: translateY(-2px);
}

.stq-option input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.stq-option-media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1;
	min-height: 80px;
	background: rgba(0, 0, 0, 0.03);
	border-radius: var(--stq-radius) var(--stq-radius) 0 0;
	transition: background var(--stq-transition);
}

.stq-option-media svg {
	width: 36px;
	height: 36px;
	color: var(--stq-text-muted);
	transition: color var(--stq-transition), transform var(--stq-transition);
}

.stq-option:hover .stq-option-media svg,
.stq-option:has(input:checked) .stq-option-media svg {
	color: var(--stq-primary);
}

.stq-option-media-img {
	background: rgba(0, 0, 0, 0.04);
	padding: 0;
}

.stq-option-media-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Skin type step: 5 options in a row, image on top + label below */
.stq-options--skin-type .stq-option {
	max-width: 160px;
}

.stq-options--skin-type .stq-option-media {
	aspect-ratio: 3/4;
	min-height: 100px;
}

.stq-options--skin-type .stq-option-label {
	padding: 0.625rem 0.5rem;
	font-size: 0.875rem;
	font-weight: 600;
}

.stq-option-label {
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.35;
	color: var(--stq-text);
	padding: 0.75rem 0.5rem;
	text-align: center;
	transition: color var(--stq-transition), font-weight var(--stq-transition);
}

.stq-option input:focus-visible ~ .stq-option-label {
	outline: 2px solid var(--stq-primary);
	outline-offset: 2px;
	border-radius: 2px;
}

.stq-option:has(input:checked) .stq-option-label {
	font-weight: 600;
	color: var(--stq-primary);
}

.stq-option:has(input:checked) {
	border-color: var(--stq-primary);
	background: color-mix(in srgb, var(--stq-primary) 10%, transparent);
	box-shadow: 0 0 0 1px var(--stq-primary), 0 6px 20px rgba(0, 0, 0, 0.08);
}

.stq-option:has(input:checked)::before {
	transform: scaleX(1);
}

.stq-option:has(input:checked) .stq-option-media {
	background: color-mix(in srgb, var(--stq-primary) 12%, transparent);
}

/* -------------------------------------------------------------------------
   Result screen
   ------------------------------------------------------------------------- */
.stq-result {
	padding: 1.5rem 0;
	text-align: center;
}

.stq-result[hidden] {
	display: none !important;
}

.stq-result-inner {
	max-width: 420px;
	margin: 0 auto;
}

.stq-result-title {
	margin: 0 0 0.75rem;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--stq-primary);
}

.stq-result-desc {
	margin: 0 0 1.5rem;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--stq-text-muted);
}

.stq-result-cta {
	margin-bottom: 1rem;
}

.stq-result-cta .stq-btn {
	display: inline-block;
	text-decoration: none;
	text-align: center;
}

/* Recommended products grid (4 steps) */
.stq-result-products {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
	margin: 1.5rem 0;
	text-align: center;
}

.stq-product-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	border: 1px solid var(--stq-border);
	border-radius: var(--stq-radius);
	overflow: hidden;
	background: var(--stq-bg);
}

.stq-product-step-label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--stq-primary);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.5rem 0.5rem 0;
}

.stq-product-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0.75rem;
	text-decoration: none;
	color: inherit;
	flex: 1;
	transition: background var(--stq-transition);
}

.stq-product-link:hover {
	background: color-mix(in srgb, var(--stq-primary) 8%, transparent);
}

.stq-product-img {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: var(--stq-radius);
	margin-bottom: 0.5rem;
}

.stq-product-name {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--stq-text);
	margin-bottom: 0.25rem;
	line-height: 1.3;
}

.stq-product-price {
	display: block;
	font-size: 0.875rem;
	color: var(--stq-primary);
	font-weight: 600;
}

.stq-product-price del {
	color: var(--stq-text-muted);
	font-weight: 400;
}

.stq-product-empty {
	font-size: 0.8125rem;
	color: var(--stq-text-muted);
	padding: 1rem 0.5rem;
}

.stq-products-loading,
.stq-products-empty {
	grid-column: 1 / -1;
	margin: 0.5rem 0;
	font-size: 0.9375rem;
	color: var(--stq-text-muted);
}

@media (max-width: 640px) {
	.stq-result-products {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.75rem;
		margin: 1.25rem 0;
	}

	.stq-product-step-label {
		font-size: 0.6875rem;
	}

	.stq-product-name {
		font-size: 0.8125rem;
	}
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.stq-btn {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	border: none;
	border-radius: var(--stq-radius);
	cursor: pointer;
	transition: background var(--stq-transition), color var(--stq-transition), opacity var(--stq-transition), transform var(--stq-transition);
	-webkit-appearance: none;
	appearance: none;
}

.stq-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.stq-btn:not(:disabled):hover {
	transform: translateY(-1px);
}

.stq-btn:not(:disabled):active {
	transform: translateY(0);
}

.stq-btn-primary {
	background: var(--stq-primary);
	color: #fff;
}

.stq-btn-primary:hover:not(:disabled) {
	background: var(--stq-primary-hover);
	color: #fff;
}

.stq-btn-secondary {
	background: transparent;
	color: var(--stq-text-muted);
	border: 2px solid var(--stq-border);
}

.stq-btn-secondary:hover:not(:disabled) {
	border-color: var(--stq-primary);
	color: var(--stq-primary);
}

.stq-btn-prev {
	background: transparent;
	color: var(--stq-text-muted);
}

.stq-btn-prev:hover:not(:disabled) {
	color: var(--stq-primary);
}

.stq-btn-next {
	background: var(--stq-primary);
	color: #fff;
}

.stq-btn-next:hover:not(:disabled) {
	background: var(--stq-primary-hover);
	color: #fff;
}

/* -------------------------------------------------------------------------
   Navigation
   ------------------------------------------------------------------------- */
.stq-nav {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin-top: 1.75rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--stq-border);
}

.stq-nav .stq-btn-next,
.stq-nav .stq-btn-prev {
	min-width: 120px;
}

/* -------------------------------------------------------------------------
   Mobile – stacked card layout (image on top)
   ------------------------------------------------------------------------- */
@media (max-width: 480px) {
	.stq-quiz {
		margin: 1.25rem auto;
		padding: 0 1rem;
	}

	.stq-container {
		padding: 1.5rem 1.25rem;
	}

	.stq-title {
		font-size: 1.375rem;
	}

	.stq-question {
		font-size: 1.0625rem;
	}

	.stq-options {
		gap: 0.625rem;
	}

	.stq-options--cards .stq-option {
		min-width: 100px;
		max-width: 140px;
	}

	.stq-option-media {
		min-height: 100px;
	}

	.stq-options--skin-type .stq-option {
		max-width: 130px;
	}

	.stq-options--skin-type .stq-option-media {
		min-height: 120px;
	}

	.stq-option-media svg {
		width: 40px;
		height: 40px;
	}

	.stq-option-label {
		padding: 0.5rem 0.25rem;
		font-size: 0.8125rem;
	}

	.stq-nav {
		flex-wrap: wrap;
		margin-top: 1.5rem;
		padding-top: 1.5rem;
	}

	.stq-nav .stq-btn {
		min-width: 100px;
		padding: 0.7rem 1.1rem;
		font-size: 0.9375rem;
	}
}

/* Fallback for browsers that don't support color-mix (optional tint) */
@supports not (background: color-mix(in srgb, red, blue)) {
	.stq-option:hover {
		background: rgba(0, 0, 0, 0.02);
	}
	.stq-option:has(input:checked) {
		background: rgba(0, 0, 0, 0.04);
	}
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
	.stq-step,
	.stq-progress-bar,
	.stq-option,
	.stq-btn {
		transition: none;
	}

	.stq-btn:not(:disabled):hover,
	.stq-btn:not(:disabled):active {
		transform: none;
	}
}
