/**
 * IW Survey Step — gợi ý gói Internet qua khảo sát 4 bước.
 * Element: mu-plugins/iw-integration/includes/elements/global/survey.php
 * Design: Figma cam (orange). Mobile-first; desktop override @ min-width:850px.
 * Scope: mọi rule dưới .iw-survey (không bleed ra Flatsome global).
 */

.iw-survey {
	/* Accent ăn theo color scheme (body.tcdt-color-t{N} set --iw-accent),
	   fallback cam Figma. Đổi --iw-accent → đổi cả icon + nút + giá + ring +
	   nền badge/option-selected (qua --iw-accent-soft). */
	--iw-sv-primary: var(--iw-accent, #f56011);
	--iw-sv-bg-brand: var(--iw-accent-soft, #ffe8db);
	--iw-sv-bg-light: #f7f7f8;
	--iw-sv-border: #d1d1d1;
	--iw-sv-border-light: #e7e7e7;
	--iw-sv-dark: #252525;
	--iw-sv-text: #3d3d3d;
	--iw-sv-muted: #888888;

	font-family: inherit;
	color: var(--iw-sv-text);
	padding: 24px 0;

	/* Full-width breakout — match các iw section khác (hero, banner-cta). */
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

.iw-survey *,
.iw-survey *::before,
.iw-survey *::after {
	box-sizing: border-box;
}

.iw-survey__container {
	max-width: var(--iw-container-max, 1488px);
	margin: 0 auto;
	padding: 0 var(--iw-container-pad-x, 24px);
}

/* Heading */
.iw-survey__heading {
	margin: 0 0 28px;
	text-align: center;
	font-weight: 700;
	font-size: 28px;
	line-height: 1.3;
	color: var(--iw-sv-dark);
}
.iw-survey__heading span {
	display: block;
}

/* Panel (white rounded card + step badge overlapping top edge) */
.iw-survey__panel {
	position: relative;
	margin-top: 36px;
	padding: 52px 16px 28px;
	background: #fff;
	border: 1px solid var(--iw-sv-border-light);
	border-radius: 20px;
}

/* Step badge */
.iw-survey__badge {
	position: absolute;
	top: -36px;
	left: 50%;
	transform: translateX(-50%);
	width: 72px;
	height: 72px;
	display: flex;
	align-items: center;
	justify-content: center;
}
/* class display:flex thắng [hidden] mặc định → ẩn tường minh ở bước kết quả. */
.iw-survey__badge[hidden] {
	display: none;
}
.iw-survey__badge::before {
	content: "";
	position: absolute;
	inset: 8px;
	border-radius: 50%;
	background: var(--iw-sv-bg-brand);
}
.iw-survey__ring {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.iw-survey__ring-track {
	stroke: var(--iw-accent-soft, #fcd9c4);
}
.iw-survey__ring-fill {
	stroke: var(--iw-sv-primary);
	transition: stroke-dashoffset .4s ease;
}
.iw-survey__badge-num {
	position: relative;
	font-weight: 700;
	font-size: 26px;
	line-height: 1;
	color: var(--iw-sv-primary);
}

/* Steps */
.iw-survey__step[hidden] {
	display: none;
}
.iw-survey__question {
	margin: 0 0 8px;
	text-align: center;
	font-weight: 700;
	font-size: 18px;
	line-height: 1.4;
	color: var(--iw-sv-dark);
}
.iw-survey__desc {
	margin: 0 auto 6px;
	max-width: 760px;
	text-align: center;
	font-size: 15px;
	line-height: 1.5;
	color: var(--iw-sv-muted);
}
.iw-survey__note {
	margin: 0 0 4px;
	text-align: center;
	font-size: 13px;
	font-style: italic;
	color: var(--iw-sv-muted);
}

/* Options grid */
.iw-survey__options {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	margin: 20px 0 24px;
}

.iw-survey__option {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	/* Vuông 1:1 — scale ở mọi viewport vẫn giữ tỉ lệ (mobile/tablet). */
	aspect-ratio: 1 / 1;
	padding: 16px 14px;
	background: var(--iw-sv-bg-light);
	border: 1.5px solid transparent;
	border-radius: 16px;
	cursor: pointer;
	text-align: center;
	font-family: inherit;
	text-transform: none; /* chặn uppercase bleed từ button của theme */
	-webkit-tap-highlight-color: transparent;
	transition: background .2s ease, border-color .2s ease, transform .12s ease, box-shadow .2s ease;
	margin: 0;
}
.iw-survey__option:hover {
	border-color: var(--iw-sv-bg-brand);
}
/* Press / touch effect — nhấn xuống hơi thu lại. */
.iw-survey__option:active {
	transform: scale(.97);
}
.iw-survey__option.is-selected {
	background: var(--iw-sv-bg-brand);
	border-color: var(--iw-sv-primary);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--iw-sv-primary) 12%, transparent);
}
.iw-survey__option-icon {
	display: block;
	width: 64px;
	height: 64px;
	/* Icon SVG dùng currentColor → ăn theo accent template. */
	color: var(--iw-sv-primary);
}
.iw-survey__option-icon img,
.iw-survey__option-icon svg,
.iw-survey__option-icon .iw-survey__svg {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.iw-survey__option-label {
	font-weight: 700;
	font-size: 14px;
	line-height: 1.3;
	color: var(--iw-sv-text);
	text-transform: none; /* chữ thường như nhập, không in hoa */
}

/* Selection mark */
.iw-survey__option-mark {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1.5px solid var(--iw-sv-border);
	background: #fff;
}
.iw-survey__option-mark.is-checkbox {
	top: 12px;
	right: 12px;
	width: 20px;
	height: 20px;
	border-radius: 5px;
}
.iw-survey__option-mark.is-radio {
	top: 12px;
	right: 12px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
}
.iw-survey__option.is-selected .iw-survey__option-mark {
	border-color: var(--iw-sv-primary);
	background: var(--iw-sv-primary);
}
.iw-survey__option-mark.is-checkbox::after {
	content: "";
	width: 10px;
	height: 6px;
	border-left: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: rotate(-45deg) translateY(-1px);
	opacity: 0;
}
.iw-survey__option-mark.is-radio::after {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
	opacity: 0;
}
.iw-survey__option.is-selected .iw-survey__option-mark::after {
	opacity: 1;
}

/* Actions */
.iw-survey__actions {
	display: flex;
	justify-content: center;
	align-items: stretch;
	gap: 12px;
}

/* Nút Quay lại — outline accent, cùng cỡ/dáng với nút Tiếp tục (chỉ khác fill). */
.iw-survey__back {
	margin: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex: 0 0 auto;
	padding: 13px 32px;
	border: 1px solid var(--iw-sv-primary);
	border-radius: 999px;
	box-sizing: border-box;
	background: #fff;
	color: var(--iw-sv-primary);
	font-family: inherit;
	font-weight: 700;
	font-size: 16px;
	line-height: 22px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease;
}
.iw-survey__back:hover,
.iw-survey__back:focus-visible {
	background: var(--iw-sv-bg-brand);
}
.iw-survey__back:active {
	transform: translateY(1px);
}
.iw-survey__back svg {
	flex: 0 0 auto;
}

/* Nút Tiếp tục — đồng bộ style với .hf-header-t{N}__cta:
   gradient theo CTA token + ring 5px, hover invert (nền trắng, viền+chữ accent). */
.iw-survey__continue {
	margin: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex: 1 1 auto;
	padding: 13px 32px;
	border: 1px solid transparent;
	border-radius: 999px;
	box-sizing: border-box;
	background: linear-gradient(
		180deg,
		var(--iw-cta-grad-from, var(--iw-accent, #f56011)),
		var(--iw-cta-grad-to,   var(--iw-accent-strong, #d6196e))
	);
	color: #fff;
	box-shadow: 0 0 0 5px color-mix(in srgb, var(--iw-accent, #f56011) 12%, transparent);
	font-family: inherit;
	font-weight: 700;
	font-size: 16px;
	line-height: 22px;
	cursor: pointer;
	transition: background .18s ease, color .18s ease, box-shadow .18s ease, border-color .18s ease, transform .12s;
}
.iw-survey__continue:hover:not(:disabled),
.iw-survey__continue:focus-visible:not(:disabled) {
	border-color: var(--iw-accent, #f56011);
	background: #fff;
	color: var(--iw-accent, #f56011);
	box-shadow: none;
}
.iw-survey__continue:active:not(:disabled) {
	transform: translateY(1px);
}
.iw-survey__continue:disabled {
	background: #d1d1d1;
	box-shadow: none;
	cursor: not-allowed;
}
.iw-survey__continue svg {
	flex: 0 0 auto;
}

/* ── Result step ── */
.iw-survey__rec {
	font-weight: 500;
	color: var(--iw-sv-text);
	font-size: 16px;
}
.iw-survey__rec-speed {
	color: var(--iw-sv-primary);
	font-weight: 700;
}

.iw-survey__loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 32px 0;
	color: var(--iw-sv-muted);
}
.iw-survey__loading[hidden] {
	display: none;
}
.iw-survey__spinner {
	width: 36px;
	height: 36px;
	border: 3px solid var(--iw-sv-bg-brand);
	border-top-color: var(--iw-sv-primary);
	border-radius: 50%;
	animation: iw-survey-spin .8s linear infinite;
}
@keyframes iw-survey-spin {
	to { transform: rotate(360deg); }
}

/* Results container.
   - carousel (v1/v3/v4): .iw-survey__results cũng là .swiper-wrapper → Swiper điều khiển.
   - list (v2/T2): mobile scroll ngang, desktop stack dọc (@media). */
.iw-survey__results {
	display: flex;
	margin-top: 20px;
}

/* Swiper slider (carousel) */
.iw-survey__slider {
	position: relative;
	margin-top: 20px;
}
.iw-survey__slider .iw-survey__results {
	margin-top: 0;
}
.iw-survey__slider .swiper-slide {
	height: auto;   /* card cao đều theo slide cao nhất */
	display: flex;
}

/* Nav prev/next — ẩn ở mobile (vuốt), hiện desktop (@media). */
.iw-survey__nav {
	position: absolute;
	top: 38%;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--iw-sv-border-light);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 4px 16px rgba(16, 24, 40, .08);
	cursor: pointer;
	z-index: 2;
	display: none;
}
.iw-survey__nav::before {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 9px;
	height: 9px;
	border-right: 2px solid var(--iw-sv-text);
	border-bottom: 2px solid var(--iw-sv-text);
}
.iw-survey__nav--prev { left: -10px; }
.iw-survey__nav--prev::before { transform: translateX(2px) rotate(135deg); }
.iw-survey__nav--next { right: -10px; }
.iw-survey__nav--next::before { transform: translateX(-2px) rotate(-45deg); }
.iw-survey__nav.swiper-button-disabled { opacity: .4; cursor: default; }

/* List (v2/T2): ≤1199 dùng Swiper (như PDH grid T2); desktop ≥1200 stack dọc
   (Swiper bị destroy) — xem @media (min-width:1200px) dưới. */

/* No-result state (Figma 3723:413972) — heading dùng h3 phía trên,
   khối này = illustration + phụ đề. */
.iw-survey__noresult {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	text-align: center;
	padding: 4px 16px 16px;
}
.iw-survey__noresult[hidden] {
	display: none;
}
.iw-survey__noresult-img {
	display: block;
	width: 100%;
	max-width: 160px; /* mobile; desktop nâng lên ở @media dưới */
	height: auto;
}
.iw-survey__noresult-text {
	margin: 0;
	font-size: 16px;
	line-height: 1.5;
	color: var(--iw-sv-muted);
}

/* Result item = wrapper quanh card PDH. Carousel: Swiper set width slide.
   List: ép ~80% viewport mobile để scroll-snap. */
.iw-survey__result-item {
	display: flex;
}
.iw-survey__result-item > .pdh-card-t1,
.iw-survey__result-item > .pdh-card-t2,
.iw-survey__result-item > .pdh-card-t3,
.iw-survey__result-item > .pdh-card-t4 {
	width: 100%;
}

/* Card row (v2 / T2 auto): mobile vẫn scroll ngang (kế thừa base); desktop mới
   stack dọc 1 cột — xem @media dưới. */

/* Restart */
.iw-survey__actions--result {
	margin-top: 20px;
}
.iw-survey__restart {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: 0;
	background: transparent;
	color: var(--iw-sv-text);
	font-family: inherit;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
}
.iw-survey__restart:hover {
	color: var(--iw-sv-primary);
}

/* ────────────────────────── Desktop ────────────────────────── */
@media (min-width: 850px) {
	.iw-survey__heading {
		font-size: 40px;
		margin-bottom: 36px;
	}
	.iw-survey__panel {
		padding: 64px 40px 36px;
		border-radius: 24px;
	}
	.iw-survey__question {
		font-size: 24px;
		margin-bottom: 10px;
	}
	.iw-survey__desc {
		font-size: 16px;
	}

	/* needs/device = 4 cards, room = 3 cards. Mỗi card cố định 280px vuông 1:1,
	   hàng canh giữa (không kéo giãn lệch tỉ lệ). */
	.iw-survey__options {
		display: flex;
		flex-wrap: nowrap;
		justify-content: center;
		gap: 24px;
		margin: 28px 0 28px;
	}
	.iw-survey__option {
		flex: 0 1 280px;
		max-width: 280px;
		gap: 18px;
		padding: 28px 16px;
		/* aspect-ratio:1 kế thừa từ base → 280×280. */
	}
	.iw-survey__option-icon {
		width: 88px;
		height: 88px;
	}
	.iw-survey__option-label {
		font-size: 16px;
	}

	.iw-survey__continue {
		flex: 0 1 auto;
		min-width: 180px;
	}

	.iw-survey__noresult-img {
		max-width: 360px;
	}

	/* Carousel + list ≤1199: Swiper điều khiển width slide. Hiện nav (mũi tên). */
	.iw-survey__nav {
		display: block;
	}
}

/* List v2/T2: desktop ≥1200 Swiper bị destroy → stack dọc 1 cột, ẩn nav. */
@media (min-width: 1200px) {
	.iw-survey__slider--list .iw-survey__results {
		flex-direction: column;
		gap: 16px;
	}
	.iw-survey__slider--list .iw-survey__result-item {
		width: 100%;
	}
	.iw-survey__slider--list .iw-survey__nav {
		display: none;
	}
}
