/* Grafton Czat */
#gczat {
	--gczat-accent: #FEB90A;
	--gczat-dark: #111111;
	--gczat-text: #1b1b1f;
	--gczat-muted: #6b6f7a;
	--gczat-line: #e6e6ea;
	--gczat-bg: #ffffff;
	--gczat-soft: #f3f3f5;
	position: fixed;
	right: max(18px, env(safe-area-inset-right));
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	z-index: 99990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--gczat-text);
	-webkit-font-smoothing: antialiased;
}
#gczat *, #gczat *::before, #gczat *::after { box-sizing: border-box; }
#gczat [hidden] { display: none !important; }
#gczat button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	border: 0;
	box-shadow: none;
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1;
	cursor: pointer;
	min-height: 0;
	min-width: 0;
}
#gczat .gczat-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Przycisk otwierający */
#gczat .gczat-launcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	height: 52px;
	padding: 0 20px 0 16px;
	border-radius: 26px;
	background: var(--gczat-dark);
	color: #fff;
	font-weight: 600;
	font-size: 15px;
	box-shadow: 0 8px 26px rgba(0, 0, 0, .22);
	transition: transform .15s ease, box-shadow .15s ease;
}
#gczat .gczat-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, .28); background: var(--gczat-dark); color: #fff; }
#gczat .gczat-launcher:focus-visible,
#gczat button:focus-visible,
#gczat input:focus-visible,
#gczat textarea:focus-visible,
#gczat a:focus-visible { outline: 3px solid var(--gczat-accent); outline-offset: 2px; }
#gczat .gczat-ico-chat { color: var(--gczat-accent); flex: 0 0 auto; }
#gczat .gczat-badge {
	position: absolute;
	top: -6px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 11px;
	background: #e5372b;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
	box-shadow: 0 0 0 2px #fff;
}
#gczat[data-open="1"] .gczat-launcher { display: none; }

/* Panel */
#gczat .gczat-panel {
	position: absolute;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: 370px;
	max-width: calc(100vw - 36px);
	height: min(580px, calc(100vh - 40px));
	height: min(580px, calc(100dvh - 40px));
	overflow: hidden;
	border-radius: 18px;
	background: var(--gczat-bg);
	box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
	animation: gczat-in .2s ease-out;
}
@keyframes gczat-in {
	from { opacity: 0; transform: translateY(14px) scale(.98); }
	to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
	#gczat .gczat-panel { animation: none; }
	#gczat .gczat-launcher { transition: none; }
}

#gczat .gczat-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 14px 14px 16px;
	background: var(--gczat-dark);
	color: #fff;
	flex: 0 0 auto;
}
#gczat .gczat-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #fff; flex: 0 0 auto; }
#gczat .gczat-head-text { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
#gczat .gczat-head-text strong { font-size: 16px; font-weight: 700; color: #fff; line-height: 1.25; }
#gczat .gczat-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: rgba(255, 255, 255, .78); }
#gczat .gczat-status i { width: 8px; height: 8px; border-radius: 50%; background: #3ccf6e; box-shadow: 0 0 0 3px rgba(60, 207, 110, .25); }
#gczat.gczat--offline .gczat-status i { background: #9a9aa3; box-shadow: none; }
#gczat .gczat-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	flex: 0 0 auto;
}
#gczat .gczat-close:hover { background: rgba(255, 255, 255, .22); color: #fff; }

/* Wiadomości */
#gczat .gczat-log {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 14px 8px;
	background: var(--gczat-soft);
	display: flex;
	flex-direction: column;
	gap: 10px;
}
#gczat .gczat-msg { display: flex; flex-direction: column; max-width: 84%; }
#gczat .gczat-msg--staff { align-self: flex-start; align-items: flex-start; }
#gczat .gczat-msg--customer { align-self: flex-end; align-items: flex-end; }
#gczat .gczat-msg--system { align-self: center; max-width: 92%; }
#gczat .gczat-bubble {
	padding: 10px 13px;
	border-radius: 16px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	font-size: 15px;
	line-height: 1.45;
}
#gczat .gczat-msg--staff .gczat-bubble { background: #fff; color: var(--gczat-text); border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
#gczat .gczat-msg--customer .gczat-bubble { background: var(--gczat-accent); color: #1b1b1f; border-bottom-right-radius: 5px; }
#gczat .gczat-msg--system .gczat-bubble { background: transparent; color: var(--gczat-muted); font-size: 13px; text-align: center; padding: 4px 8px; }
#gczat .gczat-msg--pending { opacity: .6; }
#gczat .gczat-who { font-size: 12px; font-weight: 600; color: var(--gczat-muted); margin: 0 0 3px 4px; }
#gczat .gczat-time { font-size: 11px; color: var(--gczat-muted); margin: 3px 4px 0; }

/* Formularz */
#gczat .gczat-form {
	flex: 0 0 auto;
	margin: 0;
	padding: 12px 14px 10px;
	border-top: 1px solid var(--gczat-line);
	background: #fff;
}
#gczat .gczat-email-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
#gczat .gczat-email-row label { font-size: 13px; font-weight: 600; color: var(--gczat-text); margin: 0; }
#gczat .gczat-form input[type="email"],
#gczat .gczat-form textarea {
	display: block;
	width: 100%;
	margin: 0;
	border: 1px solid #c9cad1;
	border-radius: 12px;
	background: #fff;
	color: var(--gczat-text);
	font: inherit;
	font-size: 16px;
	line-height: 1.4;
	box-shadow: none;
	outline: none;
}
#gczat .gczat-form input[type="email"] { height: 44px; padding: 0 12px; }
#gczat .gczat-form input[type="email"]:focus,
#gczat .gczat-form textarea:focus { border-color: var(--gczat-dark); }
#gczat .gczat-compose { display: flex; align-items: flex-end; gap: 8px; }
#gczat .gczat-form textarea {
	flex: 1 1 auto;
	min-height: 44px;
	max-height: 140px;
	padding: 10px 12px;
	resize: none;
	overflow-y: auto;
}
#gczat .gczat-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 50%;
	background: var(--gczat-accent);
	color: var(--gczat-dark);
	flex: 0 0 auto;
	transition: filter .15s ease;
}
#gczat .gczat-send:hover { filter: brightness(.95); background: var(--gczat-accent); color: var(--gczat-dark); }
#gczat .gczat-send:disabled { opacity: .55; cursor: wait; }
#gczat .gczat-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#gczat .gczat-error { margin: 8px 2px 0; color: #c62828; font-size: 13px; line-height: 1.4; }
#gczat .gczat-rodo { margin: 8px 2px 0; color: var(--gczat-muted); font-size: 11.5px; line-height: 1.4; }
#gczat .gczat-rodo a { color: var(--gczat-muted); text-decoration: underline; }

/* Telefon: panel na cały ekran, przycisk w formie kółka */
@media (max-width: 560px) {
	#gczat { right: max(14px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
	#gczat .gczat-launcher { width: 56px; height: 56px; padding: 0; justify-content: center; border-radius: 50%; }
	#gczat .gczat-launcher-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	#gczat .gczat-ico-chat { width: 26px; height: 26px; }
	#gczat .gczat-panel {
		position: fixed;
		inset: 0;
		width: 100%;
		max-width: none;
		height: 100%;
		border-radius: 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
}


/* Zakładka przy prawej krawędzi strony */
#gczat.gczat--tab {
	top: 0;
	right: 0;
	bottom: auto;
	width: 0;
	height: 0;
}
#gczat.gczat--tab .gczat-launcher {
	flex-direction: column;
	gap: 10px;
	width: 46px;
	height: auto;
	padding: 16px 0 18px;
	border-radius: 14px 0 0 14px;
	box-shadow: -4px 4px 22px rgba(0, 0, 0, .22);
	position: fixed;
	top: 50%;
	right: 0;
	transform: translate(4px, -50%);
	transition: transform .2s ease, width .2s ease, box-shadow .2s ease;
	border-left: 3px solid var(--gczat-accent);
}
#gczat.gczat--tab .gczat-launcher:hover,
#gczat.gczat--tab .gczat-launcher:focus-visible {
	transform: translate(0, -50%);
	width: 54px;
	box-shadow: -6px 6px 28px rgba(0, 0, 0, .3);
}
#gczat.gczat--tab .gczat-launcher-label {
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	white-space: nowrap;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .3px;
	line-height: 1;
}
#gczat.gczat--tab .gczat-badge { top: -8px; right: auto; left: -8px; }
#gczat.gczat--tab .gczat-panel {
	position: fixed;
	top: auto;
	right: max(18px, env(safe-area-inset-right));
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	animation-name: gczat-in-side;
}
@keyframes gczat-in-side {
	from { opacity: 0; transform: translateX(30px); }
	to { opacity: 1; transform: none; }
}
/* Delikatne zwrócenie uwagi kilka sekund po wejściu na stronę */
#gczat.gczat--tab.gczat--nudge .gczat-launcher { animation: gczat-nudge 1.2s ease 2; }
@keyframes gczat-nudge {
	0%, 100% { transform: translate(4px, -50%); }
	30% { transform: translate(-6px, -50%); }
	60% { transform: translate(2px, -50%); }
}
@media (prefers-reduced-motion: reduce) {
	#gczat.gczat--tab .gczat-launcher { transition: none; }
	#gczat.gczat--tab.gczat--nudge .gczat-launcher { animation: none; }
}
@media (max-width: 560px) {
	#gczat.gczat--tab { top: 0; right: 0; bottom: auto; }
	#gczat.gczat--tab .gczat-launcher { width: 40px; height: auto; padding: 12px 0 14px; border-radius: 12px 0 0 12px; justify-content: flex-start; }
	#gczat.gczat--tab .gczat-launcher:hover { width: 40px; }
	#gczat.gczat--tab .gczat-launcher-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: 13px; }
	#gczat.gczat--tab .gczat-ico-chat { width: 20px; height: 20px; }
	#gczat.gczat--tab .gczat-panel { right: 0; bottom: 0; }
}

@media print { #gczat { display: none !important; } }
