/* Ивент Бутик — окно ИИ-помощника. Phone-first: на телефоне лист на весь экран, от 768px — окно в правом нижнем углу. */
.eb-chat {
	--c-violet: #5828ec;
	--c-slate: #303841;
	--c-text-2: #59626d;
	--c-panel: #f5f5f7;
	--c-line: rgba(48, 56, 65, .10);
	position: fixed;
	right: 16px;
	bottom: 88px; /* над нижней панелью телефона */
	z-index: 9990;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--c-slate);
}
.eb-chat *, .eb-chat *::before, .eb-chat *::after { box-sizing: border-box; }
.eb-chat button { font: inherit; cursor: pointer; }

.eb-chat__launcher {
	position: relative;
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--c-violet);
	color: #fff;
	box-shadow: 0 8px 24px rgba(88, 40, 236, .38), 0 2px 6px rgba(0, 0, 0, .12);
	transition: transform .2s cubic-bezier(.2, .7, .2, 1), box-shadow .2s ease, background-color .2s ease;
}
.eb-chat__launcher:hover { transform: translateY(-2px) scale(1.04); }
.eb-chat__launcher:active { transform: scale(.96); }
.eb-chat__launcher:focus-visible, .eb-chat__icon:focus-visible, .eb-chat__send:focus-visible, .eb-chat__chip:focus-visible { outline: 3px solid rgba(88, 40, 236, .35); outline-offset: 2px; }
.eb-chat__launcher span { grid-area: 1 / 1; display: grid; place-items: center; transition: opacity .2s ease, transform .25s cubic-bezier(.2, .7, .2, 1); }
.eb-chat__launcher-close { opacity: 0; transform: rotate(-45deg) scale(.6); }
.eb-chat.is-open .eb-chat__launcher { background: var(--c-slate); box-shadow: 0 8px 24px rgba(48, 56, 65, .3); }
.eb-chat.is-open .eb-chat__launcher-open { opacity: 0; transform: rotate(45deg) scale(.6); }
.eb-chat.is-open .eb-chat__launcher-close { opacity: 1; transform: none; }

.eb-chat__panel {
	position: fixed;
	inset: 0;
	display: flex;
	flex-direction: column;
	background: #fff;
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px);
	transition: opacity .22s ease, transform .28s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .28s;
}
.eb-chat.is-open .eb-chat__panel { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.eb-chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--c-line); }
.eb-chat__ava { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: rgba(88, 40, 236, .10); color: var(--c-violet); }
.eb-chat__titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.eb-chat__titles strong { font-size: 16px; font-weight: 600; line-height: 1.25; }
.eb-chat__titles span { font-size: 13px; color: var(--c-text-2); }
.eb-chat__icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--c-text-2); transition: background-color .2s ease, color .2s ease; }
.eb-chat__icon:hover { background: var(--c-panel); color: var(--c-slate); }

.eb-chat__list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.eb-chat__row { display: flex; animation: eb-chat-in .28s cubic-bezier(.2, .7, .2, 1) both; }
.eb-chat__row--user { justify-content: flex-end; }
.eb-chat__bubble { max-width: 86%; padding: 10px 14px; border-radius: 18px; background: var(--c-panel); white-space: pre-wrap; overflow-wrap: anywhere; }
.eb-chat__row--assistant .eb-chat__bubble { border-bottom-left-radius: 6px; }
.eb-chat__row--user .eb-chat__bubble { border-bottom-right-radius: 6px; background: var(--c-violet); color: #fff; }
.eb-chat__row--error .eb-chat__bubble { background: #fff4f6; color: #8a1034; }
.eb-chat__bubble a { color: var(--c-violet); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.eb-chat__row--error .eb-chat__bubble a { color: inherit; }
.eb-chat__row--typing .eb-chat__bubble { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.eb-chat__row--typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa1aa; animation: eb-chat-dot 1.1s ease-in-out infinite; }
.eb-chat__row--typing i:nth-child(2) { animation-delay: .15s; }
.eb-chat__row--typing i:nth-child(3) { animation-delay: .3s; }

.eb-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.eb-chat__chips[hidden] { display: none; }
.eb-chat__chip { padding: 8px 12px; border: 1px solid var(--c-line); border-radius: 12px; background: #fff; color: var(--c-slate); font-size: 14px; line-height: 1.3; text-align: left; transition: border-color .2s ease, background-color .2s ease, color .2s ease; }
.eb-chat__chip:hover { border-color: var(--c-violet); color: var(--c-violet); background: rgba(88, 40, 236, .05); }

.eb-chat__form { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 6px 6px 6px 14px; border-radius: 18px; background: var(--c-panel); transition: box-shadow .2s ease, background-color .2s ease; }
.eb-chat__form:focus-within { background: #fff; box-shadow: 0 0 0 2px var(--c-violet); }
.eb-chat .eb-chat__input { flex: 1; min-width: 0; width: auto; min-height: 40px; max-height: 112px; margin: 0; padding: 9px 0; border: 0 !important; border-radius: 0; background: transparent !important; box-shadow: none !important; color: var(--c-slate); font: inherit; font-size: 16px; line-height: 1.4; resize: none; outline: 0; }
.eb-chat__input::placeholder { color: #8b929b; }
.eb-chat__send { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; background: var(--c-violet); color: #fff; transition: opacity .2s ease, transform .15s ease, background-color .2s ease; }
.eb-chat__send:disabled { background: #c9ccd2; cursor: default; }
.eb-chat__send:not(:disabled):hover { background: #4a1fd6; }
.eb-chat__send:not(:disabled):active { transform: scale(.94); }

.eb-chat__foot { display: flex; justify-content: space-between; gap: 12px; padding: 8px 18px calc(10px + env(safe-area-inset-bottom, 0px)); font-size: 12px; line-height: 1.35; color: #7c838c; }
.eb-chat__count { flex: none; font-variant-numeric: tabular-nums; }

@keyframes eb-chat-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes eb-chat-dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* на телефоне открытый чат закрывает страницу целиком: прячем его кнопку и не даём странице прокручиваться под ним */
@media (max-width: 767.98px) {
	.eb-chat.is-open .eb-chat__launcher { display: none; }
	html.eb-chat-open, html.eb-chat-open body { overflow: hidden; }
}

@media (min-width: 768px) {
	.eb-chat { right: 24px; bottom: 100px; } /* нижняя панель сайта есть до 1200px — кнопка стоит над ней */
	.eb-chat__launcher { width: 60px; height: 60px; }
	.eb-chat__panel {
		inset: auto 24px 176px auto;
		width: 392px;
		height: min(620px, calc(100vh - 272px)); /* не заходит на шапку сайта */
		border-radius: 24px;
		box-shadow: 0 2px 8px rgba(0, 0, 0, .08), 0 24px 64px rgba(48, 56, 65, .22);
		overflow: hidden;
		transform: translateY(12px) scale(.98);
		transform-origin: bottom right;
	}
	.eb-chat__input { font-size: 15px; }
}
@media (min-width: 1200px) {
	.eb-chat { bottom: 24px; }
	.eb-chat__panel { inset: auto 24px 100px auto; height: min(620px, calc(100vh - 196px)); }
}

@media (prefers-reduced-motion: reduce) {
	.eb-chat__launcher, .eb-chat__launcher span, .eb-chat__panel, .eb-chat__row, .eb-chat__row--typing i { transition: none; animation: none; }
}
