/**
 * Product Diagnostic Wizard — Frontend styles.
 * Modern, luxury, clean. Scoped under .bb-pdw-* to avoid theme clashes.
 *
 * Every color is driven by a CSS variable so it can be customized from
 * the plugin settings (the plugin prints overrides on .bb-pdw-overlay).
 *
 * Engineered By BiggBits — Developer: Emon Adi
 */

.bb-pdw-overlay {
	--bb-pdw-accent: #b8860b;
	--bb-pdw-overlay: rgba(10, 12, 18, 0.62);
	--bb-pdw-modal-bg: #ffffff;
	--bb-pdw-modal-radius: 24px;
	--bb-pdw-title: #14161c;
	--bb-pdw-text: #6b7078;
	--bb-pdw-card-bg: #ffffff;
	--bb-pdw-card-border: #e8e6e1;
	--bb-pdw-card-text: #14161c;
	--bb-pdw-card-muted: #9aa0a8;
	--bb-pdw-progress-bg: #14161c;
	--bb-pdw-progress-text: #ffffff;
	--bb-pdw-progress-inactive-bg: rgba(0, 0, 0, 0.04);
	--bb-pdw-progress-inactive-text: #9aa0a8;
	--bb-pdw-progress-step-radius: 999px;
	--bb-pdw-option-card-radius: 16px;
	--bb-pdw-option-card-hover-border: #b8860b;
	--bb-pdw-cta-bg: #14161c;
	--bb-pdw-cta-text: #ffffff;
	--bb-pdw-divider: rgba(0, 0, 0, 0.08);
	--bb-pdw-soft: rgba(0, 0, 0, 0.05);
}

.bb-pdw-shortcode-trigger,
.pdw-trigger {
	appearance: none;
	-webkit-appearance: none;
	border: none;
	cursor: pointer;
	font-family: inherit;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.2;
	transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

/* ------------------------------------------------------------------ *
 * Trigger button (shortcode output)
 * ------------------------------------------------------------------ */

.pdw-trigger {
	appearance: none;
	-webkit-appearance: none;
	border: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.2;
	transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.pdw-trigger--filled {
	padding: 15px 34px;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.pdw-trigger--filled:hover {
	transform: translateY(-2px);
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.pdw-trigger--link {
	background: transparent !important;
	padding: 4px 2px;
	text-decoration: underline;
	text-underline-offset: 5px;
	text-decoration-thickness: 1.5px;
	box-shadow: none;
}

.pdw-trigger--link:hover {
	opacity: 0.7;
}

/* ------------------------------------------------------------------ *
 * Overlay + modal
 * ------------------------------------------------------------------ */

body.bb-pdw-no-scroll {
	overflow: hidden;
}

.bb-pdw-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: var(--bb-pdw-overlay);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.28s ease, visibility 0.28s ease;
}

.bb-pdw-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

.bb-pdw-modal {
	position: relative;
	width: 100%;
	max-width: 760px;
	max-height: min(90vh, 900px);
	height: auto;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--bb-pdw-modal-bg);
	color: var(--bb-pdw-text);
	border-radius: var(--bb-pdw-modal-radius);
	box-shadow: 0 40px 90px rgba(0, 0, 0, 0.4);
	padding: 42px 46px 24px;
	transform: translateY(24px) scale(0.97);
	transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
	box-sizing: border-box;
	font-family: inherit;
}

.bb-pdw-overlay.is-open .bb-pdw-modal {
	transform: translateY(0) scale(1);
}

.bb-pdw-modal *,
.bb-pdw-modal *::before,
.bb-pdw-modal *::after {
	box-sizing: border-box;
}

.bb-pdw-close {
	position: absolute;
	top: 18px;
	right: 20px;
	appearance: none;
	border: none;
	background: var(--bb-pdw-soft);
	color: var(--bb-pdw-title);
	width: 38px;
	height: 38px;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.18s ease, transform 0.18s ease;
}

.bb-pdw-close:hover {
	background: var(--bb-pdw-divider);
	transform: rotate(90deg);
}

/* Head */
.bb-pdw-modal-head {
	flex-shrink: 0;
	text-align: center;
	margin-bottom: 22px;
}

.bb-pdw-eyebrow {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--bb-pdw-accent);
	margin-bottom: 10px;
}

.bb-pdw-title {
	margin: 0 0 6px;
	font-size: 28px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--bb-pdw-title);
	line-height: 1.2;
}

.bb-pdw-subtitle {
	margin: 0;
	font-size: 15px;
	color: var(--bb-pdw-text);
}

/* Progress */
.bb-pdw-progress {
	flex-shrink: 0;
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.bb-pdw-progress-step {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px 6px 6px;
	border-radius: var(--bb-pdw-progress-step-radius);
	background: var(--bb-pdw-progress-inactive-bg);
	color: var(--bb-pdw-progress-inactive-text);
	font-size: 12.5px;
	font-weight: 600;
	transition: background 0.25s ease, color 0.25s ease;
}

.bb-pdw-progress-dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--bb-pdw-divider);
	color: var(--bb-pdw-text);
	font-size: 11.5px;
	font-weight: 700;
	transition: background 0.25s ease, color 0.25s ease;
}

.bb-pdw-progress-step.is-current {
	background: var(--bb-pdw-progress-bg);
	color: var(--bb-pdw-progress-text);
}

.bb-pdw-progress-step.is-current .bb-pdw-progress-dot {
	background: var(--bb-pdw-accent);
	color: #fff;
}

.bb-pdw-progress-step.is-done {
	color: var(--bb-pdw-title);
}

.bb-pdw-progress-step.is-done .bb-pdw-progress-dot {
	background: var(--bb-pdw-accent);
	color: #fff;
}

/* Body — scrolls; footer stays pinned inside the modal */
.bb-pdw-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 4px 4px 8px;
}

.bb-pdw-anim-in {
	animation: pdwFadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* Grids + cards */
.bb-pdw-grid {
	display: grid;
	gap: 14px;
}

.bb-pdw-grid-devices {
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.bb-pdw-grid-models,
.bb-pdw-grid-issues {
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.bb-pdw-card {
	appearance: none;
	font-family: inherit;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 22px 16px;
	background: var(--bb-pdw-card-bg);
	border: 1.5px solid var(--bb-pdw-card-border);
	border-radius: var(--bb-pdw-option-card-radius);
	cursor: pointer;
	text-align: center;
	transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bb-pdw-card:hover {
	border-color: var(--bb-pdw-option-card-hover-border);
	transform: translateY(-3px);
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.09);
}

.bb-pdw-card-icon {
	width: 44px;
	height: 44px;
	color: var(--bb-pdw-card-text);
}

.bb-pdw-card-icon svg {
	width: 100%;
	height: 100%;
}

.bb-pdw-card:hover .bb-pdw-card-icon {
	color: var(--bb-pdw-accent);
}

.bb-pdw-card-name {
	font-size: 15px;
	font-weight: 650;
	color: var(--bb-pdw-card-text);
	line-height: 1.3;
}

.bb-pdw-card-count {
	font-size: 12px;
	color: var(--bb-pdw-card-muted);
	letter-spacing: 0.02em;
}

.bb-pdw-card-model {
	flex-direction: row;
	justify-content: space-between;
	padding: 17px 20px;
	text-align: left;
}

.bb-pdw-card-arrow {
	color: var(--bb-pdw-card-muted);
	font-size: 17px;
	transition: transform 0.2s ease, color 0.2s ease;
}

.bb-pdw-card-model:hover .bb-pdw-card-arrow {
	color: var(--bb-pdw-accent);
	transform: translateX(4px);
}

.bb-pdw-card-issue {
	padding: 20px 16px;
}

/* Model search */
.bb-pdw-search {
	width: 100%;
	padding: 13px 18px;
	margin-bottom: 16px;
	border: 1.5px solid var(--bb-pdw-card-border);
	border-radius: 12px;
	font-size: 15px;
	font-family: inherit;
	background: var(--bb-pdw-card-bg);
	color: var(--bb-pdw-card-text);
	outline: none;
	transition: border-color 0.2s ease;
}

.bb-pdw-search:focus {
	border-color: var(--bb-pdw-accent);
}

/* Results */
.bb-pdw-grid-products {
	grid-template-columns: 1fr;
	gap: 10px;
}

/* Thumbnail + full title + icon-only CTA */
.bb-pdw-product-card {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	background: var(--bb-pdw-card-bg);
	border: 1.5px solid var(--bb-pdw-card-border);
	border-radius: var(--bb-pdw-option-card-radius);
	text-decoration: none !important;
	color: inherit;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bb-pdw-product-card:hover {
	border-color: var(--bb-pdw-option-card-hover-border);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}

.bb-pdw-product-img {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	border-radius: 10px;
	background: var(--bb-pdw-soft);
	overflow: hidden;
	color: var(--bb-pdw-card-muted);
}

.bb-pdw-product-img img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.bb-pdw-product-img svg {
	width: 32px;
	height: 32px;
}

.bb-pdw-product-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.bb-pdw-product-name {
	font-size: 14px;
	font-weight: 650;
	color: var(--bb-pdw-card-text);
	line-height: 1.35;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.bb-pdw-product-price {
	font-style: normal;
	font-size: 14px;
	font-weight: 700;
	color: var(--bb-pdw-accent);
}

.bb-pdw-product-cta-icon {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--bb-pdw-cta-bg);
	color: var(--bb-pdw-cta-text);
	transition: background 0.2s ease, color 0.2s ease;
}

.bb-pdw-product-card:hover .bb-pdw-product-cta-icon {
	background: var(--bb-pdw-accent);
	color: #fff;
}

/* Loading + empty states */
.bb-pdw-loader {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 56px 0;
	color: var(--bb-pdw-text);
}

.bb-pdw-spinner {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 3px solid var(--bb-pdw-card-border);
	border-top-color: var(--bb-pdw-accent);
	animation: pdwSpin 0.8s linear infinite;
}

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

.bb-pdw-empty-state {
	grid-column: 1 / -1;
	text-align: center;
	color: var(--bb-pdw-text);
	padding: 30px 10px;
	font-size: 14.5px;
}

.bb-pdw-empty-results {
	text-align: center;
	padding: 40px 20px;
	color: var(--bb-pdw-text);
}

.bb-pdw-empty-icon {
	display: inline-flex;
	width: 52px;
	height: 52px;
	color: var(--bb-pdw-card-muted);
	margin-bottom: 10px;
}

.bb-pdw-empty-icon svg { width: 100%; height: 100%; }

.bb-pdw-empty-results h3 {
	margin: 0 0 6px;
	font-size: 19px;
	color: var(--bb-pdw-title);
}

.bb-pdw-empty-results p {
	margin: 0 auto;
	max-width: 380px;
	font-size: 14.5px;
	line-height: 1.55;
}

/* Footer */
.bb-pdw-foot {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 12px;
	padding: 14px 4px 2px;
	border-top: 1px solid var(--bb-pdw-divider);
	background: var(--bb-pdw-modal-bg);
	position: relative;
	z-index: 2;
}

.bb-pdw-back {
	flex-shrink: 0;
	appearance: none;
	border: none;
	background: transparent;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--bb-pdw-title);
	cursor: pointer;
	padding: 8px 12px;
	border-radius: 8px;
	transition: background 0.18s ease;
}

.bb-pdw-back:hover {
	background: var(--bb-pdw-soft);
}

.bb-pdw-credits {
	flex: 1 1 auto;
	min-width: 0;
	text-align: right;
	font-size: 11px;
	line-height: 1.35;
	letter-spacing: 0.03em;
	color: var(--bb-pdw-card-muted);
	opacity: 0.8;
}

/* Responsive */
@media (max-width: 640px) {
	.bb-pdw-modal {
		padding: 34px 20px 20px;
		border-radius: min(var(--bb-pdw-modal-radius), 18px);
		max-height: min(94vh, 900px);
	}

	.bb-pdw-foot {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	.bb-pdw-credits {
		text-align: center;
	}

	.bb-pdw-title { font-size: 22px; }

	.bb-pdw-progress-label { display: none; }

	.bb-pdw-progress-step { padding: 5px; }

	.bb-pdw-grid-devices { grid-template-columns: repeat(2, 1fr); }

	.bb-pdw-grid-models,
	.bb-pdw-grid-issues { grid-template-columns: 1fr 1fr; }

	.bb-pdw-grid-products { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
	.bb-pdw-grid-models,
	.bb-pdw-grid-issues { grid-template-columns: 1fr; }
}
