/* AI Chat Support — widget CSS (skeleton v0.1.0) */
.aic {
	--aic-color: #2563eb;
	position: fixed;
	bottom: 20px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}

.aic--right { right: 20px; }
.aic--left  { left: 20px; }

/* Кнопка-бабл */
.aic__bubble {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border: 0;
	border-radius: 50%;
	background: var(--aic-color);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.aic__bubble:hover {
	transform: scale(1.06);
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.aic__icon--close { display: none; }
.aic--open .aic__icon--chat  { display: none; }
.aic--open .aic__icon--close { display: block; }

/* Вікно чату */
/* Поважати HTML-атрибут hidden: базовий display:flex нижче інакше перебиває його,
   і вікно лишалося б відкритим на старті. !important — страховка від стилів теми. */
.aic__window[hidden] {
	display: none !important;
}

.aic__window {
	position: absolute;
	bottom: 70px;
	width: 340px;
	max-width: calc(100vw - 40px);
	height: 460px;
	max-height: calc(100vh - 120px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	overflow: hidden;
}

.aic--right .aic__window { right: 0; }
.aic--left  .aic__window { left: 0; }

/* Шапка */
.aic__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--aic-color);
	color: #fff;
}

.aic__title {
	font-weight: 600;
	font-size: 15px;
}

.aic__header-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.aic__close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.85;
	padding: 0 2px;
}

.aic__close:hover { opacity: 1; }

.aic__handoff {
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	cursor: pointer;
	opacity: 0.9;
}

.aic__handoff:hover    { opacity: 1; background: rgba(255, 255, 255, 0.28); }
.aic__handoff:disabled { opacity: 0.5; cursor: default; }

/* Стрічка повідомлень */
.aic__messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #f6f7f9;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.aic__msg {
	max-width: 82%;
	padding: 9px 12px;
	border-radius: 12px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.aic__msg--user {
	align-self: flex-end;
	background: var(--aic-color);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.aic__msg--assistant {
	align-self: flex-start;
	background: #fff;
	color: #1f2937;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 4px;
}

.aic__msg--typing {
	align-self: flex-start;
	background: #fff;
	color: #6b7280;
	border: 1px dashed #d1d5db;
	font-style: italic;
	animation: aic-pulse 1.2s ease-in-out infinite;
}

.aic__msg--error {
	align-self: center;
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
	font-size: 13px;
}

@keyframes aic-pulse {
	0%, 100% { opacity: 1; }
	50%      { opacity: 0.55; }
}

/* Форма вводу */
.aic__form {
	display: flex;
	gap: 8px;
	padding: 10px;
	background: #fff;
	border-top: 1px solid #e5e7eb;
}

.aic__input {
	flex: 1;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	outline: none;
}

.aic__input:focus { border-color: var(--aic-color); }

.aic__send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	border: 0;
	border-radius: 10px;
	background: var(--aic-color);
	color: #fff;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.aic__send:hover    { opacity: 0.9; }
.aic__send:disabled { opacity: 0.5; cursor: default; }

/* Мобільні екрани */
@media (max-width: 480px) {
	.aic--right, .aic--left { bottom: 14px; }
	.aic--right { right: 14px; }
	.aic--left  { left: 14px; }

	.aic__window {
		width: calc(100vw - 28px);
		height: 70vh;
	}
}
