.wa-mailbot-chat {
	/* Farebnosť webu (Automatic.css), s pôvodnými farbami ako fallback,
	keby --primary z nejakého dôvodu nebolo dostupné. */
	--wa-mailbot-accent: var(--primary, #1e293b);
	--wa-mailbot-accent-hover: var(--primary-hover, #334155);
	position: fixed;
	bottom: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
}

/* Bez tohto by `display:flex` na paneli/formulári prebilo atribút [hidden]. */
.wa-mailbot-chat [hidden] {
	display: none !important;
}

.wa-mailbot-chat__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.wa-mailbot-chat button:focus-visible,
.wa-mailbot-chat input:focus-visible {
	outline: 2px solid var(--wa-mailbot-accent);
	outline-offset: 2px;
}

.wa-mailbot-chat--right {
	right: 20px;
}

.wa-mailbot-chat--left {
	left: 20px;
}

.wa-mailbot-chat__launcher {
	background: var(--wa-mailbot-accent);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 12px 20px;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.wa-mailbot-chat__panel {
	position: absolute;
	bottom: 60px;
	right: 0;
	width: 320px;
	max-width: calc(100vw - 40px);
	height: 420px;
	max-height: 70vh;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.wa-mailbot-chat--left .wa-mailbot-chat__panel {
	right: auto;
	left: 0;
}

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

.wa-mailbot-chat__close {
	background: none;
	border: none;
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.wa-mailbot-chat__header-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wa-mailbot-chat__new {
	background: none;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 4px;
	color: #fff;
	font-size: 12px;
	line-height: 1;
	padding: 4px 8px;
	cursor: pointer;
}

.wa-mailbot-chat__new-inline {
	align-self: center;
	background: var(--wa-mailbot-accent);
	color: #fff;
	border: none;
	border-radius: 6px;
	padding: 8px 14px;
	cursor: pointer;
}

.wa-mailbot-chat__messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wa-mailbot-chat__msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 10px;
	word-break: break-word;
}

.wa-mailbot-chat__msg--user {
	align-self: flex-end;
	background: var(--wa-mailbot-accent);
	color: #fff;
	/* Vlastný text návštevníka (vložený cez textContent) nemá <p>/<br> —
	   riadky drží pohromade len surový znak nového riadku. */
	white-space: pre-wrap;
}

.wa-mailbot-chat__msg--bot {
	align-self: flex-start;
	background: #f1f5f9;
	color: #0f172a;
}

/* Odpoveď bota je teraz skutočné HTML z wpautop() (<p>, <br>) — bez
   pre-wrap, inak by sa surové \n medzi značkami spočítali s okrajmi
   odstavcov a odpoveď by mala zbytočné medzery navyše. */
.wa-mailbot-chat__msg--bot p {
	margin: 0 0 8px;
}

.wa-mailbot-chat__msg--bot p:last-child {
	margin-bottom: 0;
}

.wa-mailbot-chat__msg--bot .wa-mailbot-product {
	margin-top: 8px;
	padding: 8px;
	background: #fff;
	border-radius: 8px;
	border: 1px solid #e2e8f0;
}

.wa-mailbot-chat__msg--bot .wa-mailbot-product img {
	border-radius: 6px;
}

.wa-mailbot-chat__msg--bot a {
	color: var(--wa-mailbot-accent);
}

.wa-mailbot-chat__consent {
	background: #f1f5f9;
	border-radius: 10px;
	padding: 10px 12px;
	text-align: center;
}

.wa-mailbot-chat__consent p {
	margin: 0 0 8px;
	color: #334155;
}

.wa-mailbot-chat__consent-accept {
	background: var(--wa-mailbot-accent);
	color: #fff;
	border: none;
	border-radius: 6px;
	padding: 6px 12px;
	cursor: pointer;
}

.wa-mailbot-chat__msg--system {
	align-self: center;
	color: #94a3b8;
	font-style: italic;
	white-space: pre-wrap;
	background: none;
	padding: 2px;
}

.wa-mailbot-chat__form {
	display: flex;
	background: var(--wp--preset--color--pale-pink, #f78da7);
	border-top: 1px solid #e2e8f0;
}

.wa-mailbot-chat__input {
	flex: 1;
	border: none;
	padding: 10px 12px;
	outline: none;
}

.wa-mailbot-chat__send {
	background: var(--wa-mailbot-accent);
	color: #fff;
	border: none;
	padding: 0 14px;
	cursor: pointer;
}

.wa-mailbot-chat__send:disabled,
.wa-mailbot-chat__email-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.wa-mailbot-chat__email {
	align-self: stretch;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	background: #f1f5f9;
	border-radius: 10px;
	padding: 10px 12px;
}

.wa-mailbot-chat__email-input {
	flex: 1 1 140px;
	min-width: 0;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	padding: 8px;
	font-size: 16px; /* pod 16px iOS pri fokuse približuje stránku */
}

.wa-mailbot-chat__email-send {
	background: var(--wa-mailbot-accent);
	color: #fff;
	border: none;
	border-radius: 6px;
	padding: 8px 12px;
	cursor: pointer;
}

.wa-mailbot-chat__email-error {
	flex-basis: 100%;
	color: #b91c1c;
	font-size: 13px;
}

.wa-mailbot-chat__email-error:empty {
	display: none;
}

.wa-mailbot-chat__input {
	font-size: 16px;
}

/* Mobil: panel cez celú šírku a takmer celú výšku, nech sa dá písať pri klávesnici. */
@media (max-width: 480px) {
	.wa-mailbot-chat {
		bottom: 12px;
	}

	.wa-mailbot-chat--right {
		right: 12px;
	}

	.wa-mailbot-chat--left {
		left: 12px;
	}

	.wa-mailbot-chat__panel {
		position: fixed;
		inset: 0;
		width: auto;
		max-width: none;
		height: auto;
		max-height: none;
		border-radius: 0;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.wa-mailbot-chat__launcher {
		transition: transform 0.15s ease;
	}
}

@media (hover: hover) {
	.wa-mailbot-chat__launcher:hover,
	.wa-mailbot-chat__send:not(:disabled):hover,
	.wa-mailbot-chat__new-inline:hover,
	.wa-mailbot-chat__consent-accept:hover,
	.wa-mailbot-chat__email-send:not(:disabled):hover {
		background: var(--wa-mailbot-accent-hover);
	}
}

@media (prefers-color-scheme: dark) {
	.wa-mailbot-chat__email,
	.wa-mailbot-chat__consent {
		background: #1e293b;
	}

	.wa-mailbot-chat__consent p {
		color: #e2e8f0;
	}

	.wa-mailbot-chat__email-input {
		background: #0f172a;
		color: #e2e8f0;
		border-color: #475569;
	}

	.wa-mailbot-chat__email-error {
		color: #fca5a5;
	}

	.wa-mailbot-chat__panel {
		background: #0f172a;
	}

	.wa-mailbot-chat__msg--bot {
		background: #1e293b;
		color: #e2e8f0;
	}

	.wa-mailbot-chat__input {
		background: #0f172a;
		color: #e2e8f0;
	}
}
