/* Asystent AI Omnitel — okienko czatu. Kolory i fonty z motywu (z wartościami zapasowymi). */
.omn-chat {
	--c-yellow: var(--yellow, #f8c311);
	--c-ink: var(--ink, #111);
	--c-paper: var(--paper, #f7f5ef);
	--c-muted: var(--muted, #5f5b52);
	--c-line: rgba(17, 17, 17, 0.1);
	--c-font: var(--font-display, inherit);
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 95;
	font-size: 15px;
	line-height: 1.5;
}
.omn-chat *, .omn-chat *::before, .omn-chat *::after { box-sizing: border-box; }
/* Otwarta rozmowa ponad nagłówkiem strony (z-index 100) i paskiem postępu (200) */
.omn-chat.is-open { z-index: 300; }
/* Przy otwartym menu mobilnym przycisk czatu nie może na nie wchodzić */
.menu-open .omn-chat:not(.is-open) { opacity: 0; visibility: hidden; }
/* Pasek „Kup licencję” na stronie aplikacji — podnosimy okienko nad niego */
body:has(.sticky-buy.is-visible) .omn-chat { bottom: 96px; }

.omn-chat__launcher {
	display: inline-flex; align-items: center; gap: 10px;
	height: 56px; padding: 0 22px 0 8px;
	border: 0; border-radius: 999px;
	background: var(--c-ink); color: #fff;
	font-family: var(--c-font); font-weight: 600; font-size: 15px;
	box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.55);
	cursor: pointer;
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
}
.omn-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.6); }
.omn-chat__launcher:focus-visible, .omn-chat button:focus-visible, .omn-chat a:focus-visible, .omn-chat textarea:focus-visible, .omn-chat input:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 2px; }
.omn-chat__launcher-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #fff; }
.omn-chat__launcher-icon .omn-bulb { width: 34px; height: 34px; }

/* --- Żarówka Omnitel: tarcza „świeci”, żarówka co chwilę się chwieje; przy szukaniu odpowiedzi błyska --- */
.omn-bulb { display: block; overflow: visible; }
.omn-bulb__glow { fill: var(--c-yellow); transform-box: fill-box; transform-origin: center; animation: omn-bulb-glow 3.2s ease-in-out infinite; }
.omn-bulb__body, .omn-bulb__filament { transform-box: view-box; transform-origin: 23px 44px; }
.omn-chat__launcher .omn-bulb__body, .omn-chat__launcher .omn-bulb__filament { animation: omn-bulb-wiggle 7s ease-in-out infinite; }
.omn-chat__launcher:hover .omn-bulb__glow { animation-duration: 0.9s; }
.omn-chat__launcher:hover .omn-bulb__body, .omn-chat__launcher:hover .omn-bulb__filament { animation: omn-bulb-wiggle-now 0.9s ease-in-out; }
.omn-chat.is-thinking .omn-bulb__glow { animation: omn-bulb-think 0.7s ease-in-out infinite; }
.omn-chat.is-thinking .omn-bulb__filament { fill: #b88a00; }
@keyframes omn-bulb-glow { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1); opacity: 0.82; } }
@keyframes omn-bulb-think { 0%, 100% { transform: scale(0.92); opacity: 0.55; } 50% { transform: scale(1.14); opacity: 1; } }
@keyframes omn-bulb-wiggle { 0%, 84%, 100% { transform: rotate(0); } 87% { transform: rotate(-10deg); } 91% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
@keyframes omn-bulb-wiggle-now { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 55% { transform: rotate(8deg); } 80% { transform: rotate(-3deg); } }
.omn-chat.is-open .omn-chat__launcher { display: none; }

.omn-chat__panel {
	display: flex; flex-direction: column;
	width: min(400px, calc(100vw - 32px));
	height: min(640px, calc(100vh - 48px));
	border-radius: 18px; overflow: hidden;
	background: #fff; color: var(--c-ink);
	box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--c-line);
	transform-origin: 100% 100%;
	animation: omn-chat-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.omn-chat__panel[hidden] { display: none; }
@keyframes omn-chat-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

.omn-chat__head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; background: var(--c-ink); color: #fff; }
.omn-chat__avatar { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #fff; }
.omn-chat__avatar .omn-bulb { width: 34px; height: 34px; }
.omn-chat__title { flex: 1; min-width: 0; }
.omn-chat__title strong { display: block; font-family: var(--c-font); font-size: 16px; }
.omn-chat__title small { display: flex; align-items: center; gap: 6px; color: #cfccc4; font-size: 12.5px; }
.omn-chat__title small::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3ecf6e; }
.omn-chat__icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; }
.omn-chat__icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.omn-chat__icon-btn svg { width: 18px; height: 18px; }

.omn-chat__log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: var(--c-paper); overscroll-behavior: contain; }
.omn-chat__msg { display: flex; margin: 0 0 10px; }
.omn-chat__msg p { margin: 0 0 6px; }
.omn-chat__msg p:last-child { margin-bottom: 0; }
.omn-chat__bubble { max-width: 86%; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.omn-chat__msg--bot .omn-chat__bubble { background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 0 0 1px var(--c-line); }
.omn-chat__msg--user { justify-content: flex-end; }
.omn-chat__msg--user .omn-chat__bubble { background: var(--c-yellow); border-bottom-right-radius: 4px; }
.omn-chat__bubble a { color: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: var(--c-yellow); text-decoration-thickness: 2px; text-underline-offset: 2px; }
.omn-chat__msg--user .omn-chat__bubble a { text-decoration-color: var(--c-ink); }

.omn-chat__typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.omn-chat__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-muted); animation: omn-chat-dot 1.2s infinite; }
.omn-chat__typing i:nth-child(2) { animation-delay: 0.15s; }
.omn-chat__typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes omn-chat-dot { 0%, 60%, 100% { opacity: 0.25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.omn-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.omn-chat__chip { padding: 8px 12px; border: 0; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--c-line); color: var(--c-ink); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.omn-chat__chip:hover { box-shadow: inset 0 0 0 1.5px var(--c-ink); }

/* Karta kontaktu po pytaniu, na które bot nie zna odpowiedzi */
.omn-chat__contact { margin: 0 0 12px; padding: 14px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px var(--c-line); }
.omn-chat__contact-title { margin: 0 0 10px; font-family: var(--c-font); font-weight: 600; font-size: 14px; }
.omn-chat__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.omn-chat__action { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--c-paper); color: var(--c-ink); font: inherit; font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
.omn-chat__action--main { background: var(--c-yellow); }
.omn-chat__action svg { width: 15px; height: 15px; }
.omn-chat__lead { display: grid; gap: 8px; margin-top: 12px; }
.omn-chat__lead[hidden] { display: none; }
.omn-chat__lead input[type="text"] { width: 100%; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 10px; background: var(--c-paper); color: var(--c-ink); font: inherit; font-size: 14px; }
.omn-chat__lead label { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--c-muted); }
.omn-chat__lead label input { margin-top: 3px; }
.omn-chat__lead-status { margin: 0; font-size: 13px; }

.omn-chat__form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 12px 8px; border-top: 1px solid var(--c-line); background: #fff; }
.omn-chat__input { flex: 1; min-height: 44px; max-height: 120px; padding: 11px 14px; border: 0; border-radius: 14px; background: var(--c-paper); color: var(--c-ink); font: inherit; font-size: 15px; resize: none; }
.omn-chat__send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--c-ink); color: var(--c-yellow); cursor: pointer; }
.omn-chat__send:disabled { opacity: 0.4; cursor: default; }
.omn-chat__send svg { width: 18px; height: 18px; }
.omn-chat__note { margin: 0; padding: 0 14px 10px; background: #fff; color: var(--c-muted); font-size: 11.5px; line-height: 1.4; }
.omn-chat__note a { color: inherit; }

@media (max-width: 720px) {
	/* Nad dolnym paskiem „Zadzwoń / Wycena” motywu */
	.omn-chat { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
	.omn-chat__launcher { width: 56px; padding: 0; justify-content: center; }
	.omn-chat__launcher-label { display: none; }
	/* Pełny ekran = dokładnie widoczny obszar (bez klawiatury); wartości ustawia chat.js z visualViewport */
	.omn-chat.is-open { inset: auto; top: var(--omn-vv-top, 0); left: 0; right: 0; bottom: auto; height: var(--omn-vv-h, 100dvh); overscroll-behavior: contain; }
	.omn-chat__panel { width: 100%; height: 100%; border-radius: 0; animation: none; }
	.omn-chat__head { padding-top: max(16px, env(safe-area-inset-top)); }
	.omn-chat__note { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
	/* iPhone powiększa stronę przy polach z czcionką mniejszą niż 16 px — stąd „pływanie” */
	.omn-chat__input, .omn-chat__lead input[type="text"] { font-size: 16px; }
}
/* Strona pod otwartym czatem stoi w miejscu (pozycję przewinięcia przywraca chat.js) */
html.omn-chat-lock, html.omn-chat-lock body { overflow: hidden; overscroll-behavior: none; }
html.omn-chat-lock body { position: fixed; left: 0; right: 0; width: 100%; }
@media (prefers-reduced-motion: reduce) {
	.omn-chat__panel, .omn-chat__typing i, .omn-bulb__glow, .omn-bulb__body, .omn-bulb__filament { animation: none !important; }
}
