/**
 * Демо-панель Hq Pages.
 * Стили намеренно не используют переменные темы — панель не должна
 * перекрашиваться вместе с сайтом, который настраивает посетитель.
 *
 * ВАЖНО: ни на одном предке элементов с position:fixed не должно быть
 * transform / filter / perspective — иначе fixed начинает считаться
 * от этого предка, а не от окна.
 */

.hq-demo,
.hq-demo-cta,
.hq-demo-topbar {
	--hqd-bg: #ffffff;
	--hqd-text: #1b2432;
	--hqd-muted: #6b7a8d;
	--hqd-line: #e2e8f2;
	--hqd-accent: #2e86de;
	--hqd-accent-hover: #1f6fbf;
	--hqd-dark: #1b2432;
	--hqd-radius: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--hqd-text);
	box-sizing: border-box;
}

.hq-demo *,
.hq-demo-cta *,
.hq-demo-topbar * {
	box-sizing: border-box;
}

.hq-demo svg,
.hq-demo-cta svg,
.hq-demo-topbar svg {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
}

/* Обёртка НЕ позиционируется и не трансформируется — только держит переменные. */
.hq-demo {
	position: static;
}

/* ---------- верхняя полоса ---------- */

.hq-demo-topbar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000001;
	display: flex;
	align-items: center;
	gap: 16px;
	height: 54px;
	padding: 0 18px;
	background: var(--hqd-dark);
	color: #fff;
	font-size: 14px;
}

html.hq-demo-has-topbar {
	margin-top: 54px !important;
}

html.hq-demo-has-topbar .header--fix {
	top: 54px !important;
}

html.hq-demo-has-topbar .hq-demo__panel {
	top: 54px;
}

/* если у залогиненного пользователя есть админ-бар — уходим под него */
html.hq-demo-with-adminbar .hq-demo-topbar {
	top: 32px;
}

.hq-demo-topbar__label {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	font-weight: 700;
}

.hq-demo-topbar__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #46d18d;
	flex: 0 0 auto;
}

.hq-demo-topbar__text {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	max-width: 44%;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	text-align: center;
	pointer-events: none;
	color: rgba(255, 255, 255, 0.75);
}

.hq-demo-topbar__spacer {
	flex: 1 1 auto;
}

.hq-demo-topbar__actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
}

.hq-demo-topbar__price {
	color: rgba(255, 255, 255, 0.9);
	font-weight: 600;
	white-space: nowrap;
}

.hq-demo-topbar__link {
	color: rgba(255, 255, 255, 0.85);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.hq-demo-topbar__link:hover {
	color: #fff;
	text-decoration: underline;
}

.hq-demo-topbar__btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 16px;
	border-radius: 100px;
	background: var(--hqd-accent);
	color: #fff;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.18s ease;
}

.hq-demo-topbar__btn:hover {
	background: var(--hqd-accent-hover);
	color: #fff;
}

.hq-demo-topbar__btn svg {
	width: 16px;
	height: 16px;
}

.hq-demo-topbar__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: rgba(255, 255, 255, 0.6);
	cursor: pointer;
}

.hq-demo-topbar__close:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

.hq-demo-topbar__close svg {
	width: 16px;
	height: 16px;
}

/* ---------- левая кнопка открытия ---------- */

.hq-demo__toggle {
	position: fixed;
	top: 50%;
	left: 0;
	z-index: 999998;
	transform: translateY(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 104px;
	padding: 16px 10px;
	border: 0;
	border-radius: 0 var(--hqd-radius) var(--hqd-radius) 0;
	background: var(--hqd-accent);
	color: #fff;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	cursor: pointer;
	box-shadow: 0 6px 22px rgba(46, 134, 222, 0.4);
	transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.hq-demo__toggle:hover {
	background: var(--hqd-accent-hover);
	box-shadow: 0 10px 28px rgba(46, 134, 222, 0.5);
}

.hq-demo.is-open .hq-demo__toggle {
	opacity: 0;
	pointer-events: none;
}

/* ---------- панель ---------- */

.hq-demo__overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(15, 25, 40, 0.35);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.hq-demo.is-open .hq-demo__overlay {
	opacity: 1;
	visibility: visible;
}

.hq-demo__panel {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	z-index: 1000000;
	display: flex;
	flex-direction: column;
	width: 420px;
	max-width: 92vw;
	background: var(--hqd-bg);
	border-right: 1px solid var(--hqd-line);
	box-shadow: 0 0 40px rgba(20, 35, 60, 0.18);
	transform: translateX(-102%);
	transition: transform 0.28s ease;
}

.hq-demo.is-open .hq-demo__panel {
	transform: translateX(0);
}

.hq-demo__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex: 0 0 auto;
	padding: 15px 18px;
	border-bottom: 1px solid var(--hqd-line);
}

.hq-demo__title {
	font-size: 15px;
	font-weight: 700;
}

.hq-demo__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--hqd-muted);
	cursor: pointer;
}

.hq-demo__close:hover {
	background: #f1f5fa;
	color: var(--hqd-text);
}

/* ---------- вкладки ---------- */

.hq-demo__tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	flex: 0 0 auto;
	border-bottom: 1px solid var(--hqd-line);
}

.hq-demo__tab {
	padding: 12px 8px;
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	color: var(--hqd-muted);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.hq-demo__tab.is-active {
	color: var(--hqd-accent);
	border-bottom-color: var(--hqd-accent);
}

.hq-demo__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 18px;
}

/* ---------- пояснение в точной настройке ---------- */

.hq-demo__partial {
	margin: 0 0 18px;
	padding: 11px 13px;
	border: 1px solid #dbe6f5;
	border-left: 3px solid var(--hqd-accent);
	border-radius: 8px;
	background: #f4f8fd;
	color: #40546b;
	font-size: 12px;
	line-height: 1.5;
}

/* ---------- пресеты ---------- */

.hq-demo__preset {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	margin-bottom: 8px;
	padding: 12px;
	border: 1px solid var(--hqd-line);
	border-radius: var(--hqd-radius);
	background: var(--hqd-bg);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.hq-demo__preset:hover {
	border-color: #b9c9e0;
	box-shadow: 0 4px 14px rgba(20, 35, 60, 0.08);
}

.hq-demo__preset.is-active {
	border-color: var(--hqd-accent);
	box-shadow: 0 0 0 1px var(--hqd-accent) inset;
}

.hq-demo__preset-swatch {
	display: flex;
	flex: 0 0 auto;
	gap: 3px;
}

.hq-demo__preset-swatch span {
	width: 14px;
	height: 28px;
	border-radius: 4px;
	border: 1px solid rgba(0, 0, 0, 0.06);
}

.hq-demo__preset-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.hq-demo__preset-name {
	font-size: 13px;
	font-weight: 600;
}

.hq-demo__preset-note {
	color: var(--hqd-muted);
	font-size: 11px;
	line-height: 1.35;
}

/* ---------- группы и контролы ---------- */

.hq-demo__group {
	margin-bottom: 30px;
}

.hq-demo__group:last-child {
	margin-bottom: 0;
}

.hq-demo__group-title {
	margin-bottom: 12px;
	color: var(--hqd-muted);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.hq-demo__control {
	padding-bottom: 20px;
	margin-bottom: 20px;
	border-bottom: 1px solid #eef2f7;
}

.hq-demo__control:last-child {
	padding-bottom: 0;
	margin-bottom: 0;
	border-bottom: 0;
}

.hq-demo__label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 10px;
	font-size: 13px;
	font-weight: 600;
}

.hq-demo__value {
	color: var(--hqd-muted);
	font-weight: 500;
}

.hq-demo__palette {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 5px;
	margin-bottom: 8px;
}

.hq-demo__swatch {
	height: 22px;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 5px;
	cursor: pointer;
}

.hq-demo__swatch.is-active {
	box-shadow: 0 0 0 2px var(--hqd-bg), 0 0 0 4px var(--hqd-accent);
}

.hq-demo__color-row {
	display: flex;
	gap: 8px;
}

.hq-demo__color {
	width: 44px;
	height: 34px;
	padding: 2px;
	border: 1px solid var(--hqd-line);
	border-radius: 8px;
	background: var(--hqd-bg);
	cursor: pointer;
}

.hq-demo__hex {
	flex: 1 1 auto;
	width: 100%;
	height: 34px;
	padding: 0 10px;
	border: 1px solid var(--hqd-line);
	border-radius: 8px;
	background: var(--hqd-bg);
	font: inherit;
	font-size: 13px;
	color: var(--hqd-text);
}

.hq-demo__hex:focus,
.hq-demo__select:focus {
	outline: 2px solid var(--hqd-accent);
	outline-offset: 1px;
}

.hq-demo__select {
	width: 100%;
	padding: 6px;
	border: 1px solid var(--hqd-line);
	border-radius: 8px;
	background: var(--hqd-bg);
	font: inherit;
	font-size: 13px;
	color: var(--hqd-text);
}

.hq-demo__choices {
	display: flex;
	gap: 6px;
}

.hq-demo__choice {
	flex: 1 1 0;
	min-width: 0;
	padding: 8px 4px;
	border: 1px solid var(--hqd-line);
	border-radius: 8px;
	background: var(--hqd-bg);
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	color: var(--hqd-text);
	cursor: pointer;
}

.hq-demo__choice.is-active {
	border-color: var(--hqd-accent);
	background: var(--hqd-accent);
	color: #fff;
}

.hq-demo__range {
	width: 100%;
	height: 22px;
	accent-color: var(--hqd-accent);
	cursor: pointer;
}

/* ---------- низ панели ---------- */

.hq-demo__foot {
	flex: 0 0 auto;
	padding: 14px 18px;
	border-top: 1px solid var(--hqd-line);
	background: #f8fafd;
}

.hq-demo__reset {
	width: 100%;
	padding: 10px;
	border: 1px solid var(--hqd-line);
	border-radius: 9px;
	background: var(--hqd-bg);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var(--hqd-text);
	cursor: pointer;
}

.hq-demo__reset:hover {
	border-color: var(--hqd-accent);
	color: var(--hqd-accent);
}

.hq-demo__note {
	margin: 10px 0 0;
	color: var(--hqd-muted);
	font-size: 11px;
	line-height: 1.5;
}

/* ---------- правая полоса действий ---------- */

.hq-demo-cta {
	position: fixed;
	top: 50%;
	right: 0;
	z-index: 999998;
	transform: translateY(-50%);
	display: flex;
	flex-direction: column;
	gap: 1px;
	width: 104px;
	overflow: hidden;
	border: 1px solid var(--hqd-line);
	border-right: 0;
	border-radius: var(--hqd-radius) 0 0 var(--hqd-radius);
	background: var(--hqd-line);
	box-shadow: 0 6px 20px rgba(20, 35, 60, 0.14);
}

.hq-demo-cta__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 13px 8px;
	background: var(--hqd-bg);
	color: var(--hqd-text);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	transition: background 0.18s ease, color 0.18s ease;
}

.hq-demo-cta__item:hover {
	background: #f1f5fa;
	color: var(--hqd-accent);
}

.hq-demo-cta__item.is-primary {
	background: var(--hqd-accent);
	color: #fff;
}

.hq-demo-cta__item.is-primary:hover {
	background: var(--hqd-accent-hover);
	color: #fff;
}

/* ---------- мобильные ---------- */

@media (max-width: 782px) {
	.hq-demo-topbar {
		gap: 10px;
		padding: 0 10px;
		font-size: 12px;
	}

	.hq-demo-topbar__text,
	.hq-demo-topbar__price,
	.hq-demo-topbar__link {
		display: none;
	}

	.hq-demo-topbar__btn {
		padding: 7px 13px;
	}

	/* Кнопки остаются по бокам, как на десктопе, но без подписей —
	   внизу у темы своя мобильная панель, туда лезть нельзя. */
	.hq-demo__toggle {
		width: 46px;
		padding: 12px 0;
		border-radius: 0 10px 10px 0;
	}

	.hq-demo__toggle span {
		display: none;
	}

	.hq-demo-cta {
		width: 46px;
		border-radius: 10px 0 0 10px;
	}

	.hq-demo-cta__item {
		padding: 13px 0;
	}

	.hq-demo-cta__item span {
		display: none;
	}

	.hq-demo svg,
	.hq-demo-cta svg {
		width: 22px;
		height: 22px;
	}
}

@media (max-width: 400px) {
	.hq-demo__toggle,
	.hq-demo-cta {
		width: 40px;
	}

	.hq-demo-cta__item {
		padding: 11px 0;
	}

	.hq-demo svg,
	.hq-demo-cta svg {
		width: 20px;
		height: 20px;
	}
}

@media print {
	.hq-demo,
	.hq-demo__toggle,
	.hq-demo__panel,
	.hq-demo__overlay,
	.hq-demo-cta,
	.hq-demo-topbar {
		display: none !important;
	}

	html.hq-demo-has-topbar {
		margin-top: 0 !important;
	}
}
