@use "../styles/connection-banner" as *;

@keyframes ch-fadeInUp {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.crawl-hunt-home {
	max-width: 1400px;
	margin: 0 auto;
	padding: 20px;
	--ch-color-primary:        #2563eb;
	--ch-color-primary-light:  #eff6ff;
	--ch-color-primary-border: #bfdbfe;
	--ch-color-success:        #16a34a;
	--ch-color-error:          #d63638;
	--ch-surface-shadow:       0 8px 24px rgba(15, 23, 42, 0.08);
	--ch-surface-shadow-hover: 0 12px 28px rgba(15, 23, 42, 0.12);

	.crawl-hunt-page-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 30px;

		h1 {
			margin-bottom: 0;
		}

		// Give the tour button a subtle outlined look
		.components-button {
			border: 1px solid #d0d5dd;
			border-radius: 6px;
		}
	}

	.components-card {
		border: 1px solid #e6e8eb;
		box-shadow: var(--ch-surface-shadow);
		transition: box-shadow 0.2s ease, transform 0.2s ease;
		animation: ch-fadeInUp 0.35s ease both;
	}

	.components-card:hover {
		box-shadow: var(--ch-surface-shadow-hover);
		transform: translateY(-1px);
	}

	h3 {
		font-size: 20px;
		margin-bottom: 10px;
	}

	// ── Hero Section ─────────────────────────────────────────────────────────
	.hero-section {
		margin-bottom: 60px;
		background: #ffffff;
		border: 1px solid #e6e8eb;
		border-radius: 16px;
		padding: 40px;

		@media (max-width: 968px) {
			padding: 24px;
		}

		.hero-content {
			display: grid;
			grid-template-columns: 1fr 1fr;
			gap: 40px;
			align-items: center;

			@media (max-width: 968px) {
				grid-template-columns: 1fr;
			}
		}

		.hero-text {
			.hero-greeting {
				font-size: 14px;
				font-weight: 600;
				color: var(--ch-color-primary);
				margin: 0 0 8px;
			}

			p {
				font-size: 18px;
				color: #666;
				margin-bottom: 25px;
			}

			.hero-buttons {
				display: flex;
				gap: 15px;
				margin-bottom: 20px;
			}
		}

		.hero-image {
			display: flex;
			align-items: center;
			justify-content: center;

			img {
				width: 100%;
				height: auto;
				max-width: 480px;
			}
		}
	}

	// ── Sections ─────────────────────────────────────────────────────────────
	.section {
		margin-bottom: 60px;

		.section-subtitle {
			font-size: 16px;
			color: #666;
			text-align: center;
			margin-bottom: 30px;
		}
	}

	// ── Live stat strip — single card, tiles divided by vertical rules ────────
	.stat-strip {
		.stats-grid {
			display: flex;

			@media (max-width: 900px) {
				flex-wrap: wrap;
			}
		}

		.stat-card {
			flex: 1;
			min-width: 140px;
			padding: 0 20px;
			text-align: left;
			border-left: 1px solid #e6e8eb;

			&:first-child {
				border-left: none;
				padding-left: 0;
			}

			@media (max-width: 900px) {
				flex: 1 1 40%;
				border-left: none;
				padding: 12px 20px;
			}

			.stat-label {
				font-size: 13px;
				color: #666;
				margin-bottom: 4px;
				text-transform: uppercase;
				font-weight: 600;
				letter-spacing: 0.02em;
				line-height: 1.2;
			}

			.stat-value {
				font-size: 28px;
				font-weight: bold;
				margin: 8px 0;
				line-height: 1.05;
				color: #1e1e1e;
			}

			.stat-description {
				font-size: 12px;
				color: #999;
				margin-top: 4px;
				line-height: 1.2;
			}

			.stat-gauge {
				position: relative;
				width: 100%;
				max-width: 180px;
				margin: 8px 0;

				.stat-gauge-svg {
					display: block;
					width: 100%;
					height: auto;
				}

				.stat-gauge-value {
					position: absolute;
					bottom: 0;
					left: 50%;
					transform: translateX(-50%);
					font-size: 24px;
					font-weight: bold;
					color: #1e1e1e;
				}
			}
		}
	}

	// ── "What You'll Get After Your First Scan" (5 columns) ──────────────────
	.first-scan-preview-grid {
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		gap: 20px;

		@media (max-width: 1200px) {
			grid-template-columns: repeat(3, 1fr);
		}

		@media (max-width: 700px) {
			grid-template-columns: 1fr 1fr;
		}

		.components-card {
			height: 100%;

			&:nth-child(2) { animation-delay: 0.05s; }
			&:nth-child(3) { animation-delay: 0.1s; }
			&:nth-child(4) { animation-delay: 0.15s; }
			&:nth-child(5) { animation-delay: 0.2s; }

			.components-card__body {
				text-align: center;
				padding: 24px 20px;
			}
		}
	}

	.first-scan-preview-card {
		h3 {
			font-size: 15px;
			margin-bottom: 6px;
		}

		p {
			color: #666;
			font-size: 13px;
			margin: 0;
			line-height: 1.4;
		}
	}

	// ── Quick action cards (AI Recommendations / GSC / Crawl History) ────────
	.quick-actions-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 20px;

		@media (max-width: 968px) {
			grid-template-columns: 1fr;
		}

		.components-card:nth-child(2) { animation-delay: 0.07s; }
		.components-card:nth-child(3) { animation-delay: 0.14s; }
	}

	.quick-action-card {
		display: flex;
		flex-direction: column;
		gap: 20px;
		height: 100%;

		&__row {
			display: flex;
			align-items: flex-start;
			gap: 14px;
		}

		&__text {
			h3 {
				font-size: 16px;
				margin-bottom: 4px;
			}

			p {
				color: #666;
				font-size: 13px;
				margin: 0;
				line-height: 1.4;
			}
		}

		.components-button {
			align-self: flex-start;
			margin-top: auto;
		}
	}

	// ── Illustrated icons (preview cards + quick action cards) ───────────────
	// SVGs carry their own colors/backgrounds, so these wrappers only size &
	// position them — no badge background here.
	.preview-icon-wrap {
		width: 100%;
		max-width: 160px;
		margin: 14px auto 0;

		svg {
			display: block;
			width: 100%;
			height: auto;
		}
	}

	.quick-action-icon-wrap {
		width: 72px;
		height: 72px;
		flex-shrink: 0;

		svg {
			width: 100%;
			height: 100%;
		}
	}

	// ── How It Works feature grid ─────────────────────────────────────────────
	.feature-grid {
		display: grid;
		gap: 20px;
		align-items: center;

		&.trio {
			grid-template-columns: 1fr auto 1fr auto 1fr;

			@media (max-width: 968px) {
				grid-template-columns: 1fr;
			}
		}

		.feature-grid-arrow {
			display: flex;
			align-items: center;
			justify-content: center;
			color: #b0b7c3;

			svg {
				width: 22px;
				height: 22px;
			}

			@media (max-width: 968px) {
				display: none;
			}
		}

		.components-card {
			height: 100%;
			position: relative;

			&:nth-child(3) { animation-delay: 0.07s; }
			&:nth-child(5) { animation-delay: 0.14s; }

			.components-card__body {
				text-align: center;
				padding: 30px;
			}
		}

		// Step number badge (top-left corner of the card)
		.feature-step-number {
			position: absolute;
			top: 16px;
			left: 16px;
			width: 22px;
			height: 22px;
			border-radius: 50%;
			background: var(--ch-color-primary);
			color: #ffffff;
			font-size: 12px;
			font-weight: 700;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		// Illustrated step icon
		.feature-icon {
			width: 68px;
			height: 68px;
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 0 auto 16px;

			svg {
				width: 80px;
				height: 80px;
			}
		}

		p {
			color: #666;
			margin: 0;
		}
	}

	// ── Final CTA ─────────────────────────────────────────────────────────────
	.final-cta {
		margin-top: 40px;
		background: #ffffff;
		border: 1px solid #e6e8eb;
		border-radius: 16px;
		padding: 40px;
		display: grid;
		grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.4fr) minmax(0, 1fr);
		gap: 32px;
		align-items: center;

		@media (max-width: 968px) {
			grid-template-columns: 1fr;
			text-align: center;
		}

		.final-cta-illustration {
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 72px;
			line-height: 1;
		}

		h3 {
			font-size: 20px;
			font-weight: 700;
			margin: 0 0 6px;
		}

		.section-subtitle {
			font-size: 13px;
			text-align: left;
			margin: 0 0 20px;

			@media (max-width: 968px) {
				text-align: center;
			}
		}

		.cta-buttons {
			display: flex;
			gap: 12px;

			@media (max-width: 968px) {
				justify-content: center;
				flex-direction: column;
			}
		}

		.final-cta-trust-list {
			display: flex;
			flex-direction: column;
			gap: 10px;
		}

		.final-cta-trust-item {
			display: flex;
			align-items: center;
			gap: 10px;
			font-size: 13px;
			font-weight: 600;

			@media (max-width: 968px) {
				justify-content: center;
			}

			svg {
				width: 16px;
				height: 16px;
				color: #059669;
				flex-shrink: 0;
			}
		}
	}

	// ── Footer link ───────────────────────────────────────────────────────────
	.home-footer {
		text-align: center;
		font-size: 13px;
		color: #666;
		margin-top: 24px;

		a {
			display: inline-flex;
			align-items: center;
			gap: 4px;
			color: inherit;
			text-decoration: none;

			svg {
				width: 14px;
				height: 14px;
			}
		}
	}

	// ── Button arrow decoration ───────────────────────────────────────────────
	.btn-arrow {
		margin-left: 6px;
		display: inline-block;
		transition: transform 0.2s ease;
	}

	.components-button:hover .btn-arrow {
		transform: translateX(3px);
	}
}

/* ── Driver.js tour popover overrides ─────────────────────────────────────── */
.driver-popover.crawl-hunt-tour-popover {
	max-width: 440px;
	min-width: 400px;
	padding: 28px 28px 20px;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.12);
	border: 1px solid #e2e8f0;
	background: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;

	.driver-popover-title {
		font-size: 20px;
		font-weight: 700;
		color: #0f172a;
		margin-bottom: 10px;
		line-height: 1.35;
		letter-spacing: -0.01em;
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
	}

	.driver-popover-description {
		font-size: 15px;
		line-height: 1.7;
		color: #374151;
		margin-bottom: 0;
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		font-weight: 400;

		strong {
			color: #111827;
			font-weight: 600;
		}
	}

	.driver-popover-progress-text {
		font-size: 13px;
		font-weight: 500;
		color: #9ca3af;
		margin-right: auto;
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
		-webkit-font-smoothing: antialiased;
	}

	.driver-popover-footer {
		margin-top: 20px;
		padding-top: 16px;
		border-top: 1px solid #f1f5f9;
		display: flex;
		align-items: center;
		gap: 8px;
	}

	.driver-popover-prev-btn,
	.driver-popover-next-btn,
	.driver-popover-close-btn {
		padding: 9px 20px;
		border-radius: 6px;
		font-size: 14px;
		font-weight: 600;
		cursor: pointer;
		line-height: 1.4;
		transition: background 0.15s ease, color 0.15s ease;
		border: none;
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		letter-spacing: 0.01em;
	}

	.driver-popover-next-btn {
		background: #2563eb;
		color: #ffffff;

		&::after {
			content: '';
			display: inline-block;
			width: 6px;
			height: 6px;
			border-right: 2px solid #ffffff;
			border-top: 2px solid #ffffff;
			transform: rotate(45deg);
			margin-left: 8px;
			vertical-align: middle;
			position: relative;
			top: -1px;
		}

		&:hover {
			background: #1d4ed8;
		}
	}

	.driver-popover-prev-btn {
		background: #f1f5f9;
		color: #374151;

		&::before {
			content: '';
			display: inline-block;
			width: 6px;
			height: 6px;
			border-left: 2px solid #374151;
			border-top: 2px solid #374151;
			transform: rotate(-45deg);
			margin-right: 8px;
			vertical-align: middle;
			position: relative;
			top: -1px;
		}

		&:hover {
			background: #e2e8f0;
			color: #0f172a;

			&::before {
				border-color: #0f172a;
			}
		}
	}

	.driver-popover-close-btn {
		position: absolute;
		top: 14px;
		right: 14px;
		padding: 4px 8px;
		background: transparent;
		color: #9ca3af;
		font-size: 20px;
		line-height: 1;

		&:hover {
			color: #0f172a;
		}
	}

	.driver-popover-arrow {
		&::before {
			border-color: #ffffff transparent transparent transparent;
		}
	}
}

/* Highlight border for spotlighted element */
.driver-active .driver-popover-content {
	background: #ffffff;
}
