/* =========================================================
   AI Asistent (chatbot) - lebdeći widget
   ========================================================= */

.boshelp-ai-widget {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.boshelp-ai-bubble {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--boshelp-primary, #fc1951);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 14px 20px;
	font-weight: 700;
	font-size: 0.95rem;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	transition: transform .15s ease;
}
.boshelp-ai-bubble:hover {
	transform: translateY(-2px);
}
.boshelp-ai-bubble-icon svg {
	display: block;
}

.boshelp-ai-panel {
	position: absolute;
	right: 0;
	bottom: 70px;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 480px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity .15s ease, transform .15s ease;
	/* Dok panel nije otvoren, ne smije hvatati klikove (inače nevidljiv
	   panel može blokirati klikove na ostatak sajta ispod sebe). */
	pointer-events: none;
}
/* Osigurava da se panel STVARNO sakrije kad ima "hidden" atribut - bez ove
   linije, ".boshelp-ai-panel { display: flex }" gore poništava podrazumijevani
   [hidden] { display: none } iz preglednika. */
.boshelp-ai-panel[hidden] {
	display: none !important;
}
.boshelp-ai-panel.is-open {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.boshelp-ai-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--boshelp-dark, #17171a);
	color: #fff;
	padding: 14px 18px;
	font-weight: 700;
	font-size: 0.95rem;
	flex-shrink: 0;
}
.boshelp-ai-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}

.boshelp-ai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f5f6fb;
}

.boshelp-ai-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 0.9rem;
	line-height: 1.5;
	white-space: pre-wrap;
}
.boshelp-ai-msg-bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e3e6ee;
	color: #1c2333;
	border-bottom-left-radius: 4px;
}
.boshelp-ai-msg-user {
	align-self: flex-end;
	background: var(--boshelp-primary, #fc1951);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.boshelp-ai-sources {
	align-self: flex-start;
	max-width: 85%;
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 0.8rem;
	padding: 0 4px;
}
.boshelp-ai-sources-label {
	font-weight: 700;
	color: #5b6478;
}
.boshelp-ai-sources a {
	color: var(--boshelp-primary, #fc1951);
}

.boshelp-ai-typing span {
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #999;
	margin-right: 3px;
	animation: boshelp-ai-blink 1.2s infinite;
}
.boshelp-ai-typing span:nth-child(2) { animation-delay: .2s; }
.boshelp-ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes boshelp-ai-blink {
	0%, 80%, 100% { opacity: .3; }
	40% { opacity: 1; }
}

.boshelp-ai-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #e3e6ee;
	background: #fff;
	flex-shrink: 0;
}
.boshelp-ai-form input {
	flex: 1;
	border: 1px solid #e3e6ee;
	border-radius: 999px;
	padding: 10px 16px;
	font-size: 0.9rem;
	font-family: inherit;
	outline: none;
}
.boshelp-ai-form input:focus {
	border-color: var(--boshelp-primary, #fc1951);
}
.boshelp-ai-form button {
	background: var(--boshelp-primary, #fc1951);
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
}
.boshelp-ai-form button:hover {
	background: var(--boshelp-primary-dark, #c4133f);
}

@media (max-width: 480px) {
	.boshelp-ai-widget {
		right: 12px;
		bottom: 12px;
	}
	/* Na mobilnom panel postaje puni ekran (fiksiran za viewport, ne za
	   widget) - visina/pozicija se dodatno precizno podešavaju iz JS-a
	   (chatbot.js) preko window.visualViewport, da tastatura ne bi
	   prekrila polje za unos poruke. */
	.boshelp-ai-panel {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: none;
		border-radius: 0;
	}
	.boshelp-ai-bubble-label {
		display: none;
	}
	.boshelp-ai-bubble {
		padding: 14px;
	}
}