/* Pomoćnik – AI agent za WooCommerce v1.2.3 */
#pmai-root {
	--pmai-color: #c8102e;
	--pmai-offset: 20px;
	--pmai-text: #1d2327;
	--pmai-muted: #6b7280;
	--pmai-bg: #ffffff;
	--pmai-soft: #f3f4f6;
	position: fixed;
	bottom: var(--pmai-offset);
	z-index: 999990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--pmai-text);
	text-align: left;
}
#pmai-root.pmai--right { right: 20px; }
#pmai-root.pmai--left { left: 20px; }
#pmai-root *, #pmai-root *::before, #pmai-root *::after { box-sizing: border-box; }
#pmai-root [hidden] { display: none !important; }

/* Reset tema (Astra, Elementor…) za gumbe i polja */
#pmai-root button,
#pmai-root textarea {
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	margin: 0;
	box-shadow: none;
	min-height: 0;
	line-height: inherit;
}
#pmai-root button { cursor: pointer; border: 0; background: none; padding: 0; color: inherit; }
#pmai-root a { text-decoration: none; }

/* Gumb za otvaranje */
#pmai-root .pmai-launcher {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: var(--pmai-color);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
	transition: transform .15s ease;
	margin-left: auto;
}
#pmai-root.pmai--left .pmai-launcher { margin-left: 0; }
#pmai-root .pmai-launcher:hover { transform: scale(1.06); background: var(--pmai-color); color: #fff; }
#pmai-root .pmai-launcher:focus-visible { outline: 3px solid rgba(0, 0, 0, .35); outline-offset: 2px; }

/* Prozor */
#pmai-root .pmai-panel {
	position: absolute;
	bottom: 72px;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: 600px;
	max-height: calc(100vh - var(--pmai-offset) - 100px);
	background: var(--pmai-bg);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: pmai-in .18s ease-out;
}
#pmai-root.pmai--right .pmai-panel { right: 0; }
#pmai-root.pmai--left .pmai-panel { left: 0; }
@keyframes pmai-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#pmai-root .pmai-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 12px 12px 16px;
	background: var(--pmai-color);
	color: #fff;
}
#pmai-root .pmai-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .22);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	flex: none;
}
#pmai-root .pmai-title { flex: 1; min-width: 0; }
#pmai-root .pmai-title strong { display: block; font-size: 15px; color: #fff; }
#pmai-root .pmai-title > span { display: block; font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pmai-root .pmai-badge { display: inline-block; width: auto; line-height: 16px; font-weight: 700; font-size: 10px; background: #fff; color: var(--pmai-color); border-radius: 4px; padding: 0 5px; margin-left: 4px; vertical-align: 2px; }
#pmai-root .pmai-icon {
	width: 34px;
	height: 34px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	opacity: .9;
}
#pmai-root .pmai-icon:hover { background: rgba(255, 255, 255, .18); opacity: 1; color: #fff; }

/* Poruke */
#pmai-root .pmai-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px 8px;
	background: #fafafa;
	overscroll-behavior: contain;
}
#pmai-root .pmai-row { display: flex; margin-bottom: 10px; }
#pmai-root .pmai-row--user { justify-content: flex-end; }
#pmai-root .pmai-bubble {
	max-width: 85%;
	padding: 9px 13px;
	border-radius: 14px;
	background: var(--pmai-bg);
	border: 1px solid #e5e7eb;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
#pmai-root .pmai-row--bot .pmai-bubble { border-bottom-left-radius: 4px; }
#pmai-root .pmai-row--user .pmai-bubble {
	background: var(--pmai-color);
	border-color: var(--pmai-color);
	color: #fff;
	border-bottom-right-radius: 4px;
}
#pmai-root .pmai-bubble.is-error { background: #fff5f5; border-color: #fecaca; }
#pmai-root .pmai-bubble a { color: var(--pmai-color); text-decoration: underline; }
#pmai-root .pmai-bubble strong { font-weight: 600; }
#pmai-root .pmai-li { display: block; padding-left: 14px; position: relative; }
#pmai-root .pmai-li::before { content: "•"; position: absolute; left: 2px; }

#pmai-root .pmai-typing { display: flex; gap: 4px; padding: 13px 14px; }
#pmai-root .pmai-typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9ca3af;
	animation: pmai-dot 1s infinite ease-in-out;
}
#pmai-root .pmai-typing i:nth-child(2) { animation-delay: .15s; }
#pmai-root .pmai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pmai-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Kartice proizvoda */
#pmai-root .pmai-products {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding: 2px 2px 10px;
	margin-bottom: 6px;
	scroll-snap-type: x mandatory;
}
#pmai-root .pmai-card {
	position: relative;
	display: flex;
	flex-direction: column;
	flex: 0 0 150px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	overflow: hidden;
	color: var(--pmai-text);
	scroll-snap-align: start;
	transition: box-shadow .15s ease, border-color .15s ease;
}
#pmai-root .pmai-card:hover { border-color: var(--pmai-color); box-shadow: 0 4px 14px rgba(0, 0, 0, .1); }
#pmai-root .pmai-card img { display: block; width: 100%; height: 130px; object-fit: cover; background: var(--pmai-soft); margin: 0; border-radius: 0; }
#pmai-root .pmai-card-link { display: block; color: var(--pmai-text); flex: 1; }
#pmai-root .pmai-card-body { padding: 8px 10px 8px; }
#pmai-root .pmai-add {
	display: block;
	margin: 0 10px 10px;
	padding: 7px 8px;
	border-radius: 8px;
	background: var(--pmai-color);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
}
#pmai-root .pmai-add:hover { filter: brightness(1.08); color: #fff; background: var(--pmai-color); }
#pmai-root .pmai-add:disabled { opacity: .85; cursor: default; }
#pmai-root .pmai-card-name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 34px;
}
#pmai-root .pmai-card-price { font-size: 13px; font-weight: 700; color: var(--pmai-color); margin-top: 4px; }
#pmai-root .pmai-card-stock { font-size: 11px; color: #15803d; margin-top: 2px; }
#pmai-root .pmai-card-stock.is-out { color: #b91c1c; }
#pmai-root .pmai-sale {
	position: absolute;
	top: 8px;
	left: 8px;
	background: var(--pmai-color);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 20px;
}

/* Kontakt gumbi */
#pmai-root .pmai-contact { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
#pmai-root .pmai-btn {
	display: inline-block;
	padding: 7px 12px;
	border-radius: 20px;
	border: 1px solid var(--pmai-color);
	color: var(--pmai-color);
	background: #fff;
	font-size: 13px;
	font-weight: 600;
}
#pmai-root .pmai-btn:hover { background: var(--pmai-color); color: #fff; }

/* Prijedlozi */
#pmai-root .pmai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 4px; background: #fafafa; }
#pmai-root .pmai-chip {
	padding: 6px 11px;
	border-radius: 20px;
	border: 1px solid #d1d5db;
	background: #fff;
	color: var(--pmai-text);
	font-size: 13px;
}
#pmai-root .pmai-chip:hover { border-color: var(--pmai-color); color: var(--pmai-color); background: #fff; }

/* Unos */
#pmai-root .pmai-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
}
#pmai-root .pmai-input {
	flex: 1;
	resize: none;
	border: 1px solid #d1d5db;
	border-radius: 12px;
	padding: 9px 12px;
	font-size: 15px;
	max-height: 110px;
	background: #fff;
	color: var(--pmai-text);
	outline: none;
	width: auto;
	height: auto;
	overflow-y: hidden;
	-webkit-appearance: none;
	appearance: none;
}
#pmai-root .pmai-input:focus { border-color: var(--pmai-color); }
#pmai-root .pmai-send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--pmai-color);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}
#pmai-root .pmai-send:hover { background: var(--pmai-color); color: #fff; filter: brightness(1.08); }
#pmai-root .pmai-send:disabled { opacity: .5; cursor: default; }
#pmai-root .pmai-mic {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--pmai-soft);
	color: var(--pmai-text);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}
#pmai-root .pmai-mic:hover { background: #e5e7eb; color: var(--pmai-text); }
#pmai-root .pmai-mic.is-on { background: #dc2626; color: #fff; animation: pmai-pulse 1.2s infinite; }
@keyframes pmai-pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .5); } 70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
#pmai-root .pmai-speak { opacity: .55; }
#pmai-root .pmai-speak.is-on { opacity: 1; background: rgba(255, 255, 255, .22); }

#pmai-root .pmai-foot {
	font-size: 11px;
	color: var(--pmai-muted);
	text-align: center;
	padding: 0 12px 8px;
	background: #fff;
}
#pmai-root .pmai-foot a { color: var(--pmai-muted); text-decoration: underline; }

/* Mobitel: cijeli zaslon */
@media (max-width: 480px) {
	#pmai-root.pmai--right { right: 14px; }
	#pmai-root.pmai--left { left: 14px; }
	#pmai-root .pmai-panel {
		position: fixed;
		inset: 0;
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		border-radius: 0;
	}
	#pmai-root.is-open .pmai-launcher { display: none; }
	#pmai-root .pmai-input { font-size: 16px; } /* iOS bez zumiranja */
}
