/*!
 * Czat Czajka — styles.
 * Kolory pobierane są ze zmiennych motywu, z fallbackiem na paletę Czajka ZUK.
 */

.czajka-chat {
	--cz-ink: #123f73;
	--cz-ink-dark: #0d2f57;
	--cz-accent: #ff6417;
	--cz-accent-dark: #e2540c;
	--cz-bg: #ffffff;
	--cz-bg-soft: #f5f8fc;
	--cz-border: #dde5f0;
	--cz-text: #1d2939;
	--cz-muted: #64748b;
	--cz-radius: 18px;
	--cz-shadow: 0 18px 50px rgba(13, 47, 87, 0.22);

	position: fixed;
	inset: auto 0 0 auto;
	z-index: 99990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--cz-text);
}

.czajka-chat--nojs .czajka-chat__panel,
.czajka-chat--nojs .czajka-chat__teaser {
	display: none;
}

.czajka-chat [hidden] {
	display: none !important;
}

.czajka-chat *,
.czajka-chat *::before,
.czajka-chat *::after {
	box-sizing: border-box;
}

.czajka-chat__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* -------------------------------------------------- launcher */

.czajka-chat__launcher {
	position: fixed;
	right: 22px;
	bottom: 22px;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 56px;
	padding: 0 20px 0 16px;
	border: 0;
	border-radius: 999px;
	background: var(--cz-ink);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 10px 26px rgba(13, 47, 87, 0.32);
	transition: transform 0.18s ease, background-color 0.18s ease;
}

.czajka-chat__launcher:hover {
	transform: translateY(-2px);
	background: var(--cz-ink-dark);
}

.czajka-chat__launcher-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
}

.czajka-chat__launcher-label {
	white-space: nowrap;
}

.czajka-chat__badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--cz-accent);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.czajka-chat[data-open="1"] .czajka-chat__launcher-icon {
	background: rgba(255, 255, 255, 0.22);
}

/* Gdy panel jest otwarty, launcher i podpowiedź znikają — inaczej nachodzą
   na dolną krawędź panelu (i na pasek cookie). */
.czajka-chat[data-open="1"] .czajka-chat__launcher,
.czajka-chat[data-open="1"] .czajka-chat__teaser {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* Pasek zgody na cookies zasłania dolny róg, w którym stoi launcher —
   podnosimy widget ponad pasek, dopóki ten jest widoczny. */
.czajka-chat[data-lift="1"] .czajka-chat__launcher {
	bottom: var(--cz-lift, 22px);
}

.czajka-chat[data-lift="1"] .czajka-chat__teaser {
	bottom: calc(var(--cz-lift, 22px) + 70px);
}

/* -------------------------------------------------- teaser */

.czajka-chat__teaser {
	position: fixed;
	right: 22px;
	bottom: 92px;
	width: 268px;
	padding: 14px 16px 16px;
	border-radius: 16px;
	background: var(--cz-bg);
	border: 1px solid var(--cz-border);
	box-shadow: var(--cz-shadow);
	animation: czajka-fade-up 0.35s ease both;
}

.czajka-chat__teaser p {
	margin: 0 0 10px;
	font-size: 14px;
	color: var(--cz-text);
}

.czajka-chat__teaser-close {
	position: absolute;
	top: 6px;
	right: 8px;
	border: 0;
	background: transparent;
	color: var(--cz-muted);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.czajka-chat__teaser-cta {
	display: inline-block;
	padding: 8px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--cz-accent);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.czajka-chat__teaser-cta:hover {
	background: var(--cz-accent-dark);
}

@keyframes czajka-fade-up {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* -------------------------------------------------- panel */

.czajka-chat__panel {
	position: fixed;
	right: 22px;
	bottom: 92px;
	display: flex;
	flex-direction: column;
	width: 382px;
	max-width: calc(100vw - 32px);
	height: min(612px, calc(100vh - 130px));
	background: var(--cz-bg);
	border-radius: var(--cz-radius);
	box-shadow: var(--cz-shadow);
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(14px);
	transition: opacity 0.2s ease, transform 0.22s ease, visibility 0.22s;
}

.czajka-chat[data-open="1"] .czajka-chat__panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.czajka-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(135deg, var(--cz-ink) 0%, var(--cz-ink-dark) 100%);
	color: #fff;
}

.czajka-chat__identity {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.czajka-chat__avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: var(--cz-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.5px;
}

.czajka-chat__names {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.czajka-chat__names strong {
	font-size: 16px;
	line-height: 1.25;
}

.czajka-chat__names span {
	font-size: 12.5px;
	opacity: 0.85;
}

.czajka-chat__close {
	border: 0;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	flex: 0 0 auto;
}

.czajka-chat__close:hover {
	background: rgba(255, 255, 255, 0.26);
}

/* -------------------------------------------------- messages */

.czajka-chat__log {
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex: 1 1 auto;
	padding: 16px;
	overflow-y: auto;
	background: var(--cz-bg-soft);
	scrollbar-width: thin;
}

.czajka-chat__msg {
	display: flex;
	max-width: 88%;
}

.czajka-chat__msg--bot {
	align-self: flex-start;
}

.czajka-chat__msg--user {
	align-self: flex-end;
}

.czajka-chat__bubble {
	position: relative;
	padding: 11px 14px;
	border-radius: 14px 14px 14px 4px;
	background: var(--cz-bg);
	border: 1px solid var(--cz-border);
	box-shadow: 0 1px 2px rgba(13, 47, 87, 0.06);
	white-space: pre-line;
	overflow-wrap: anywhere;
}

.czajka-chat__msg--user .czajka-chat__bubble {
	border-radius: 14px 14px 4px 14px;
	background: var(--cz-ink);
	border-color: var(--cz-ink);
	color: #fff;
}

.czajka-chat__bubble a {
	color: var(--cz-accent);
	font-weight: 600;
}

.czajka-chat__msg--user .czajka-chat__bubble a {
	color: #fff;
}

.czajka-chat__typing {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 12px;
}

.czajka-chat__typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--cz-muted);
	opacity: 0.5;
	animation: czajka-blink 1.2s infinite ease-in-out;
}

.czajka-chat__typing i:nth-child(2) {
	animation-delay: 0.18s;
}

.czajka-chat__typing i:nth-child(3) {
	animation-delay: 0.36s;
}

@keyframes czajka-blink {
	0%,
	60%,
	100% {
		opacity: 0.28;
		transform: translateY(0);
	}
	30% {
		opacity: 1;
		transform: translateY(-2px);
	}
}

/* -------------------------------------------------- chips & actions */

.czajka-chat__chips,
.czajka-chat__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 16px 10px;
	background: var(--cz-bg-soft);
}

.czajka-chat__chips:empty,
.czajka-chat__actions:empty {
	display: none;
}

.czajka-chat__chip {
	padding: 8px 13px;
	border: 1px solid var(--cz-border);
	border-radius: 999px;
	background: var(--cz-bg);
	color: var(--cz-ink);
	font: inherit;
	font-size: 13.5px;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.czajka-chat__chip--cancel {
	border-style: dashed;
	color: var(--cz-muted, #5c6b7f);
	background: transparent;
}

.czajka-chat__chip--cancel:hover {
	border-color: var(--cz-muted, #5c6b7f);
}

.czajka-chat__chip:hover {
	border-color: var(--cz-ink);
	background: #eef4fc;
}

.czajka-chat__action {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 15px;
	border: 0;
	border-radius: 12px;
	background: var(--cz-accent);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.czajka-chat__action:hover {
	background: var(--cz-accent-dark);
	color: #fff;
}

.czajka-chat__action--ghost {
	background: var(--cz-bg);
	color: var(--cz-ink);
	border: 1px solid var(--cz-border);
}

.czajka-chat__action--ghost:hover {
	background: #eef4fc;
	color: var(--cz-ink);
}

/* -------------------------------------------------- consent + form */

.czajka-chat__consent {
	padding: 12px 16px;
	background: var(--cz-bg);
	border-top: 1px solid var(--cz-border);
}

.czajka-chat__consent-label {
	display: flex;
	gap: 10px;
	font-size: 12.5px;
	color: var(--cz-muted);
	line-height: 1.45;
}

.czajka-chat__consent-label input {
	margin: 2px 0 0;
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
	accent-color: var(--cz-accent);
}

.czajka-chat__consent-error {
	margin: 8px 0 0;
	color: #b42318;
	font-size: 12.5px;
	font-weight: 600;
}

.czajka-chat__submit {
	width: 100%;
	margin-top: 10px;
	padding: 11px 16px;
	border: 0;
	border-radius: 12px;
	background: var(--cz-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.czajka-chat__submit:hover {
	background: var(--cz-accent-dark);
}

.czajka-chat__submit[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.czajka-chat__form {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: var(--cz-bg);
	border-top: 1px solid var(--cz-border);
}

.czajka-chat__form input[type="text"] {
	flex: 1 1 auto;
	min-width: 0;
	height: 42px;
	padding: 0 13px;
	border: 1px solid var(--cz-border);
	border-radius: 12px;
	background: var(--cz-bg);
	color: var(--cz-text);
	font: inherit;
	font-size: 14.5px;
}

.czajka-chat__form input[type="text"]:focus {
	outline: 2px solid rgba(255, 100, 23, 0.35);
	outline-offset: 1px;
	border-color: var(--cz-accent);
}

.czajka-chat__send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 12px;
	background: var(--cz-ink);
	color: #fff;
	cursor: pointer;
}

.czajka-chat__send:hover {
	background: var(--cz-ink-dark);
}

.czajka-chat__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.czajka-chat__footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 10px;
	padding: 9px 16px 11px;
	background: var(--cz-bg);
	border-top: 1px solid var(--cz-border);
	font-size: 11.5px;
	color: var(--cz-muted);
}

.czajka-chat__footer a {
	color: var(--cz-muted);
	text-decoration: underline;
}

.czajka-chat__footer-links {
	display: inline-flex;
	gap: 10px;
}

/* -------------------------------------------------- mobile */

@media (max-width: 600px) {
	.czajka-chat__launcher {
		right: 14px;
		bottom: 14px;
		height: 52px;
		padding: 0 14px;
	}

	.czajka-chat__launcher-label {
		display: none;
	}

	.czajka-chat__panel {
		right: 0;
		left: 0;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		height: 88vh;
		border-radius: 18px 18px 0 0;
	}

	.czajka-chat__teaser {
		right: 14px;
		bottom: 80px;
		width: min(280px, calc(100vw - 28px));
	}
}

@media (prefers-reduced-motion: reduce) {
	.czajka-chat__panel,
	.czajka-chat__launcher,
	.czajka-chat__teaser {
		transition: none;
		animation: none;
	}
}

@media print {
	.czajka-chat {
		display: none !important;
	}
}
