/**
 * Pill-блок AI Gen под меню Astra.
 */

:root {
	--ai-header-content-max: 1200px;
	--ai-header-content-gutter: 24px;
}

.ai-gen-header-bar-wrap,
.ai-gen-header-bar-wrap .ai-gen-header-bar,
.ai-gen-header-bar-wrap .ast-primary-header-bar,
.ai-gen-header-bar-wrap .main-header-bar,
.ai-gen-header-bar-wrap .site-primary-header-wrap {
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border: none !important;
	box-shadow: none !important;
}

@media (min-width: 922px) {
	#masthead .ai-gen-header-bar-wrap .site-primary-header-wrap.ast-container {
		max-width: var(--ai-header-content-max) !important;
		width: min(var(--ai-header-content-max), calc(100% - var(--ai-header-content-gutter) * 2)) !important;
		margin-left: auto !important;
		margin-right: auto !important;
		padding-left: 18px !important;
		padding-right: 18px !important;
		box-sizing: border-box;
	}

	/* Прозрачная шапка (/generation/, /creative/): меню в одной колонке с контентом */
	body.ast-theme-transparent-header #masthead .site-primary-header-wrap.ast-container,
	body.ast-theme-transparent-header #masthead .ast-builder-grid-row-container.site-primary-header-wrap {
		max-width: var(--ai-header-content-max) !important;
		width: min(var(--ai-header-content-max), calc(100% - var(--ai-header-content-gutter) * 2)) !important;
		margin-left: auto !important;
		margin-right: auto !important;
		padding-left: 18px !important;
		padding-right: 18px !important;
		box-sizing: border-box;
	}

	body.ast-theme-transparent-header #masthead .ast-builder-grid-row {
		width: 100% !important;
		max-width: 100% !important;
		justify-content: space-between !important;
		gap: 16px;
	}
}

.ai-gen-header-bar-wrap .site-primary-header-wrap {
	padding-top: 0;
	padding-bottom: 0;
}

.ai-gen-header-bar-inner {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 32px;
	padding: 2px 0 6px;
	text-align: center;
}

/* Hero-страницы: pill по центру колонки контента */
body.ast-theme-transparent-header .ai-gen-header-bar-inner {
	justify-content: center !important;
}

/* Внутри аккаунта pill справа */
body.ast-theme-transparent-header .ai-gen-header-bar-inner:has(.ai-gen-header-pill:not(.ai-gen-header-pill--guest)) {
	justify-content: flex-end !important;
}

@media (min-width: 922px) {
	body.ast-theme-transparent-header .ai-gen-header-bar-inner {
		padding-bottom: 8px;
	}
}

@media (max-width: 921px) {
	.ai-gen-header-bar--desktop-context {
		display: none !important;
	}

	.ai-gen-header-bar-inner {
		padding: 4px 0 6px;
		justify-content: flex-end !important;
		min-height: 0;
	}
}

@media (min-width: 922px) {
	.ai-gen-header-bar--mobile-context {
		display: none !important;
	}
}

/* Pill-контейнер — фон задаётся inline из админки (opacity). */
.ai-gen-header-pill {
	display: inline-flex;
	align-items: stretch;
	flex-wrap: nowrap;
	max-width: 100%;
	border: 1px solid rgba(255, 255, 255, 0.38);
	border-radius: 999px;
	overflow: hidden;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	color: #fff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.ai-gen-header-pill-seg {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	margin: 0;
	border: none;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	cursor: default;
	-webkit-appearance: none;
	appearance: none;
	text-transform: none;
	text-shadow: none;
	box-shadow: none;
	transition: background 0.15s ease, color 0.15s ease;
}

button.ai-gen-header-pill-seg {
	cursor: pointer;
}

button.ai-gen-header-pill-seg:hover {
	background: rgba(255, 255, 255, 0.08);
}

button.ai-gen-header-pill-seg:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.65);
	outline-offset: -2px;
}

.ai-gen-header-pill-divider {
	flex: 0 0 1px;
	align-self: stretch;
	width: 1px;
	background: rgba(255, 255, 255, 0.28);
}

.ai-gen-header-pill-icon {
	flex: 0 0 auto;
	display: block;
}

.ai-gen-header-pill-icon--wallet {
	color: #38bdf8;
}

.ai-gen-header-pill-icon--logout {
	color: rgba(255, 255, 255, 0.72);
}

.ai-gen-header-pill-icon--login {
	color: rgba(255, 255, 255, 0.88);
}

.ai-gen-header-pill-icon--register {
	color: #38bdf8;
}

.ai-gen-header-pill-balance .ai-gen-balance-label {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.01em;
	color: #fff;
}

.ai-gen-header-pill-email {
	min-width: 0;
	max-width: 220px;
	padding-left: 12px;
	padding-right: 12px;
}

.ai-gen-header-pill-email .ai-gen-auth-email {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	font-size: 13px;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.88);
}

.ai-gen-header-pill-logout {
	color: rgba(255, 255, 255, 0.82);
	font-weight: 500;
}

.ai-gen-header-pill-logout:hover {
	color: #fff;
}

.ai-gen-header-pill-logout:hover .ai-gen-header-pill-icon--logout {
	color: #fff;
}

/* Гость */
.ai-gen-header-pill--guest .ai-gen-header-pill-login {
	color: rgba(255, 255, 255, 0.92);
}

.ai-gen-header-pill--guest .ai-gen-header-pill-login:hover .ai-gen-header-pill-icon--login {
	color: #fff;
}

.ai-gen-header-pill--guest .ai-gen-header-pill-register {
	font-weight: 600;
	color: #fff;
}

.ai-gen-header-pill--guest .ai-gen-header-pill-register:hover .ai-gen-header-pill-icon--register {
	color: #7dd3fc;
}

/* Главная и /generation/: светлая шапка — auth справа в колонке контента */
@media (min-width: 922px) {
	body.ai-gen-light-header .ai-gen-header-bar-wrap {
		width: 100%;
	}

	body.ai-gen-light-header .ai-gen-header-bar-inner {
		justify-content: flex-end !important;
		text-align: right;
		min-height: 0;
		padding: 0 0 6px;
	}

	body.ai-gen-light-header .ai-gen-header-pill {
		border-color: #e2e8f0;
		background: #fff !important;
		color: #0f172a;
		box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}

	body.ai-gen-light-header .ai-gen-header-pill-divider {
		background: #e2e8f0;
	}

	body.ai-gen-light-header .ai-gen-header-pill--guest .ai-gen-header-pill-login {
		color: #475569;
	}

	body.ai-gen-light-header .ai-gen-header-pill--guest .ai-gen-header-pill-register {
		color: #fff;
		background: #2563eb;
		font-weight: 600;
	}

	body.ai-gen-light-header .ai-gen-header-pill--guest .ai-gen-header-pill-register:hover {
		background: #1d4ed8;
	}

	body.ai-gen-light-header button.ai-gen-header-pill-seg:hover {
		background: #f8fafc;
	}

	body.ai-gen-light-header .ai-gen-header-pill-icon--login {
		color: #64748b;
	}

	body.ai-gen-light-header .ai-gen-header-pill-icon--register {
		color: #fff;
	}

	/* Авторизованный пользователь на светлой шапке */
	body.ai-gen-light-header .ai-gen-header-pill-balance .ai-gen-balance-label {
		color: #0f172a;
	}

	body.ai-gen-light-header .ai-gen-header-pill-icon--wallet {
		color: #0284c7;
	}

	body.ai-gen-light-header .ai-gen-header-pill-email .ai-gen-auth-email {
		color: #475569;
	}

	body.ai-gen-light-header .ai-gen-header-pill-logout {
		color: #475569;
	}

	body.ai-gen-light-header .ai-gen-header-pill-icon--logout {
		color: #64748b;
	}

	body.ai-gen-light-header .ai-gen-header-pill-logout:hover,
	body.ai-gen-light-header .ai-gen-header-pill-logout:hover .ai-gen-header-pill-icon--logout {
		color: #0f172a;
	}
}

@media (max-width: 921px) {
	body.ai-gen-light-header .ai-gen-header-bar-wrap {
		position: static;
		width: 100%;
	}

	body.ai-gen-light-header .ai-gen-header-bar--mobile-context .site-primary-header-wrap {
		padding: 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		border-radius: 0;
	}

	body.ai-gen-light-header .ai-gen-header-bar-inner {
		padding: 0 0 4px;
		justify-content: flex-end !important;
		text-align: right;
	}

	body.ai-gen-light-header .ai-gen-header-pill {
		border-color: #e2e8f0;
		background: #fff !important;
		color: #0f172a;
		box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
	}

	body.ai-gen-light-header .ai-gen-header-pill-balance .ai-gen-balance-label {
		color: #0f172a;
	}

	body.ai-gen-light-header .ai-gen-header-pill-icon--wallet {
		color: #0284c7;
	}

	body.ai-gen-light-header .ai-gen-header-pill-email .ai-gen-auth-email {
		color: #475569;
	}

	body.ai-gen-light-header .ai-gen-header-pill-logout {
		color: #475569;
	}

	body.ai-gen-light-header .ai-gen-header-pill-icon--logout {
		color: #64748b;
	}

	body.ai-gen-light-header #masthead .ai-gen-auth-toolbar {
		display: none !important;
	}
}

@media (max-width: 921px) {
	.ai-gen-header-pill-email,
	.ai-gen-header-pill-divider--before-logout {
		display: none;
	}

	.ai-gen-header-pill-balance {
		padding-left: 12px;
	}

	.ai-gen-header-pill-logout {
		padding-right: 12px;
	}
}

@media (max-width: 420px) {
	.ai-gen-header-pill-seg {
		padding: 7px 11px;
		font-size: 12px;
		gap: 6px;
	}

	.ai-gen-header-pill-balance .ai-gen-balance-label {
		font-size: 13px;
	}
}
