/* Цвета и шрифты Ai travel — меняются только здесь (см. DESIGN.md) */
:root {
	--at-primary: #1B75BC;
	--at-primary-hover: #155E97;
	--at-accent: #FDB913;
	--at-secondary: #29ABE2;
	--at-bg: #FFFBF3;
	--at-surface: #FFFFFF;
	--at-text: #1F2A37;
	--at-text-muted: #6B7280;
	--at-border: #E8E2D6;
	--at-success: #1E8E3E;
	--at-error: #D93025;
	--at-neutral: #9CA3AF;

	--at-font-heading: 'Nunito', system-ui, sans-serif;
	--at-font-body: 'Golos Text', system-ui, sans-serif;

	--at-radius-btn: 12px;
	--at-radius-bubble: 18px;
	--at-radius-card: 16px;
	--at-shadow: 0 6px 24px rgba(31, 42, 55, 0.12);
}

/* Кнопка чата в правом нижнем углу */
.at-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 20px 12px 12px;
	border: 0;
	border-radius: 999px;
	background: var(--at-primary);
	color: #fff;
	font-family: var(--at-font-body);
	font-size: 16px;
	font-weight: 500;
	box-shadow: var(--at-shadow);
	cursor: pointer;
	transition: background 0.15s ease;
}

.at-launcher:hover,
.at-launcher:focus-visible {
	background: var(--at-primary-hover);
}

.at-launcher img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #fff;
}

.at-launcher[hidden],
.at-panel[hidden] {
	display: none;
}

/* Окно чата: на компьютере — в правом нижнем углу */
.at-panel {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	width: 380px;
	height: min(640px, calc(100vh - 40px));
	overflow: hidden;
	border-radius: var(--at-radius-card);
	background: var(--at-bg);
	box-shadow: var(--at-shadow);
	color: var(--at-text);
	font-family: var(--at-font-body);
	font-size: 16px;
	line-height: 1.45;
}

.at-panel *,
.at-panel *::before,
.at-panel *::after {
	box-sizing: border-box;
}

.at-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 12px 14px 16px;
	background: var(--at-primary);
	color: #fff;
}

.at-header-logo {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	flex: none;
}

.at-header-titles {
	flex: 1;
	min-width: 0;
}

.at-header-title {
	font-family: var(--at-font-heading);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
}

.at-header-sub {
	font-size: 13px;
	opacity: 0.85;
}

.at-close {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.at-close:hover,
.at-close:focus-visible {
	background: rgba(255, 255, 255, 0.15);
}

.at-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.at-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: var(--at-radius-bubble);
	white-space: pre-line;
	overflow-wrap: anywhere;
}

.at-msg-assistant {
	align-self: flex-start;
	background: var(--at-surface);
	border: 1px solid var(--at-border);
	border-bottom-left-radius: 6px;
}

.at-msg-user {
	align-self: flex-end;
	background: var(--at-primary);
	color: #fff;
	border-bottom-right-radius: 6px;
}

.at-msg-error {
	border-color: var(--at-error);
	color: var(--at-error);
}

.at-msg-error .at-btn-small {
	display: block;
	margin-top: 8px;
}

/* Быстрые кнопки */
.at-quick {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.at-chip {
	padding: 8px 14px;
	border: 1px solid var(--at-primary);
	border-radius: 999px;
	background: var(--at-surface);
	color: var(--at-primary);
	font: inherit;
	font-size: 15px;
	cursor: pointer;
}

.at-chip:hover,
.at-chip:focus-visible {
	background: var(--at-primary);
	color: #fff;
}

/* «Помощник печатает…» */
.at-typing {
	display: flex;
	gap: 5px;
	padding: 14px 16px;
}

.at-typing span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--at-text-muted);
	animation: at-blink 1.2s infinite ease-in-out;
}

.at-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.at-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

.at-typing-caption {
	margin-top: -6px;
	font-size: 13px;
	color: var(--at-text-muted);
}

@keyframes at-blink {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
	.at-typing span {
		animation: none;
	}
}

/* Поле ввода */
.at-input {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--at-border);
	background: var(--at-surface);
}

.at-input-field {
	flex: 1;
	min-height: 44px;
	max-height: 120px;
	padding: 10px 12px;
	border: 1px solid var(--at-border);
	border-radius: var(--at-radius-btn);
	background: var(--at-bg);
	color: var(--at-text);
	font: inherit;
	font-size: 16px;
	resize: none;
}

.at-input-field:focus,
.at-field input:focus {
	outline: 2px solid var(--at-primary);
	outline-offset: 0;
	border-color: transparent;
}

.at-send {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	flex: none;
	border: 0;
	border-radius: var(--at-radius-btn);
	background: var(--at-primary);
	color: #fff;
	cursor: pointer;
}

.at-send:hover,
.at-send:focus-visible {
	background: var(--at-primary-hover);
}

.at-send:disabled {
	opacity: 0.5;
	cursor: default;
}

/* Карточка заявки */
.at-card {
	align-self: stretch;
	padding: 16px;
	border: 1px solid var(--at-border);
	border-radius: var(--at-radius-card);
	background: var(--at-surface);
}

.at-card-title {
	margin-bottom: 12px;
	font-family: var(--at-font-heading);
	font-size: 18px;
	font-weight: 700;
	color: var(--at-primary);
}

.at-field {
	margin-bottom: 12px;
}

.at-field label {
	display: block;
	margin-bottom: 4px;
	font-size: 14px;
	font-weight: 500;
}

.at-field input[type="text"],
.at-field input[type="tel"] {
	width: 100%;
	height: 44px;
	padding: 0 12px;
	border: 1px solid var(--at-border);
	border-radius: var(--at-radius-btn);
	background: var(--at-bg);
	color: var(--at-text);
	font: inherit;
	font-size: 16px;
}

.at-consent label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
	line-height: 1.35;
}

.at-consent input {
	width: 20px;
	height: 20px;
	margin: 0;
	flex: none;
	accent-color: var(--at-primary);
}

.at-consent a {
	color: var(--at-primary);
}

.at-field-error,
.at-card-error {
	margin-top: 4px;
	font-size: 13px;
	color: var(--at-error);
}

.at-field-error:empty,
.at-card-error:empty {
	display: none;
}

.at-trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.at-btn {
	width: 100%;
	height: 48px;
	border: 0;
	border-radius: var(--at-radius-btn);
	background: var(--at-primary);
	color: #fff;
	font: inherit;
	font-weight: 500;
	cursor: pointer;
}

.at-btn:hover,
.at-btn:focus-visible {
	background: var(--at-primary-hover);
}

.at-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

.at-btn-small {
	width: auto;
	height: 36px;
	padding: 0 16px;
	font-size: 14px;
}

.at-card-note {
	margin-top: 8px;
	font-size: 13px;
	color: var(--at-text-muted);
	text-align: center;
}

/* Памятка туриста */
.at-memo-section {
	border-top: 1px solid var(--at-border);
	padding: 10px 0;
}

.at-memo-section summary {
	font-weight: 500;
	color: var(--at-primary);
	cursor: pointer;
}

.at-memo-section p {
	margin: 8px 0 0;
	font-size: 15px;
	white-space: pre-line;
}

/* Телефон: чат на весь экран */
@media (max-width: 640px) {
	.at-launcher {
		right: 16px;
		bottom: 16px;
	}

	.at-panel {
		inset: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		border-radius: 0;
	}

	html.at-chat-open,
	html.at-chat-open body {
		overflow: hidden;
	}
}
