/**
 * Iepirkšanās asistenta logs.
 *
 * Zīmola krāsu ievada PHP kā --helpa-ai-accent; šeit ir tikai rezerves vērtība,
 * lai logs izskatītos pieņemami arī tad, ja iestatījums nav saglabāts.
 */

.helpa-ai-chat {
	--helpa-ai-accent: #1f6f5c;
	--helpa-ai-radius: 12px;

	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
}

/* Poga */

.helpa-ai-chat__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	padding: 0;
	background: var(--helpa-ai-accent);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	color: #fff;
	cursor: pointer;
	transition: transform 0.15s ease;
}

.helpa-ai-chat__toggle:hover {
	transform: scale(1.05);
}

.helpa-ai-chat__toggle-icon {
	font-size: 24px;
	line-height: 1;
}

.helpa-ai-chat[data-open="true"] .helpa-ai-chat__toggle {
	display: none;
}

/* Panelis */

.helpa-ai-chat__panel {
	display: flex;
	flex-direction: column;
	width: 370px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 100px);
	overflow: hidden;
	background: #fff;
	border-radius: var(--helpa-ai-radius);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}

.helpa-ai-chat__panel[hidden] {
	display: none;
}

.helpa-ai-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--helpa-ai-accent);
	color: #fff;
}

.helpa-ai-chat__title {
	font-weight: 600;
}

.helpa-ai-chat__close {
	padding: 0 4px;
	background: none;
	border: 0;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.85;
}

.helpa-ai-chat__close:hover {
	opacity: 1;
}

/* Sarunas žurnāls */

.helpa-ai-chat__log {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f7f7f8;
}

.helpa-ai-msg {
	max-width: 85%;
	margin-bottom: 10px;
	padding: 10px 13px;
	border-radius: var(--helpa-ai-radius);
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.helpa-ai-msg--bot {
	background: #fff;
	border-bottom-left-radius: 3px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.helpa-ai-msg--user {
	margin-left: auto;
	background: var(--helpa-ai-accent);
	border-bottom-right-radius: 3px;
	color: #fff;
}

.helpa-ai-msg--error {
	background: #fdecec;
	color: #a02c2c;
}

.helpa-ai-msg--typing {
	color: #6b7280;
	font-style: italic;
}

.helpa-ai-msg--action {
	max-width: 100%;
	padding: 0;
	background: none;
	box-shadow: none;
}

.helpa-ai-cart-link {
	display: inline-block;
	padding: 8px 14px;
	background: var(--helpa-ai-accent);
	border-radius: 999px;
	color: #fff;
	font-size: 14px;
	text-decoration: none;
}

.helpa-ai-cart-link:hover {
	opacity: 0.9;
	color: #fff;
}

/* Ievade */

.helpa-ai-chat__form {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	padding: 12px;
	background: #fff;
	border-top: 1px solid #e5e7eb;
}

.helpa-ai-chat__form textarea {
	flex: 1;
	max-height: 120px;
	min-height: 40px;
	padding: 9px 12px;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.4;
	resize: none;
}

.helpa-ai-chat__form textarea:focus {
	border-color: var(--helpa-ai-accent);
	outline: 2px solid transparent;
	outline-offset: 2px;
}

.helpa-ai-chat__send {
	padding: 10px 16px;
	background: var(--helpa-ai-accent);
	border: 0;
	border-radius: 20px;
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	cursor: pointer;
}

.helpa-ai-chat__send:disabled {
	opacity: 0.6;
	cursor: default;
}

.helpa-ai-chat__consent {
	margin: 0;
	padding: 0 14px 12px;
	background: #fff;
	color: #6b7280;
	font-size: 11px;
	line-height: 1.4;
}

/* Mobilajās ierīcēs logs aizņem gandrīz visu ekrānu. */

@media (max-width: 480px) {
	.helpa-ai-chat {
		right: 12px;
		bottom: 12px;
	}

	.helpa-ai-chat__panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 90px);
	}
}

/* Ekrānlasītājiem paredzētais teksts, ja tēma to nedefinē. */

.helpa-ai-chat .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip: rect(0, 0, 0, 0);
	word-wrap: normal !important;
}

@media (prefers-reduced-motion: reduce) {
	.helpa-ai-chat__toggle {
		transition: none;
	}
}
