/* AI Virtual Assistant — phase-0 chat widget styles. */

.aivc-widget {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}

.aivc-bubble {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	box-sizing: border-box;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--aivc-color, #2d6cdf);
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* Explicit display + size: theme CSS (e.g. global button/span rules)
   can collapse a bare inline span, squashing the emoji to nothing. */
.aivc-bubble-icon {
	display: block;
	width: 1.25em;
	height: 1.25em;
	font-size: inherit;
	line-height: 1.25;
	text-align: center;
}

/* Owner-uploaded icon (media library). */
.aivc-bubble-icon-img {
	width: 32px;
	height: 32px;
	max-width: 32px;
	object-fit: contain;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.aivc-bubble:hover {
	filter: brightness(0.9);
}

/* Owner-selected position: left (default is right). */
.aivc-widget.aivc-left {
	right: auto;
	left: 20px;
	align-items: flex-start;
}

@media (max-width: 480px) {
	.aivc-widget.aivc-left {
		left: 10px;
	}
}

/* display:flex below would defeat the UA [hidden] rule (author styles
   always win over the UA sheet) — restore hiding explicitly. */
.aivc-panel[hidden] {
	display: none;
}

.aivc-panel {
	width: 340px;
	max-width: calc(100vw - 40px);
	height: 460px;
	max-height: calc(100vh - 110px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}

.aivc-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 14px;
	background: var(--aivc-color, #2d6cdf);
	color: #fff;
}

.aivc-title {
	font-weight: 600;
}

/* Permanent AI disclosure mark — do not hide (EU AI Act / invariant #8). */
.aivc-ai-badge {
	font-size: 12px;
	opacity: 0.9;
}

.aivc-close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.aivc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #f6f7f9;
}

.aivc-msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 10px;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.aivc-msg-user {
	align-self: flex-end;
	background: var(--aivc-color, #2d6cdf);
	color: #fff;
	border-bottom-right-radius: 2px;
}

.aivc-msg-assistant {
	align-self: flex-start;
	background: #fff;
	color: #1e1e1e;
	border: 1px solid #e3e5e8;
	border-bottom-left-radius: 2px;
}

.aivc-msg-error {
	align-self: flex-start;
	background: #fdecea;
	color: #b32d2e;
	border: 1px solid #f5c6c5;
}

.aivc-typing {
	padding: 4px 14px 8px;
	font-size: 12px;
	color: #6b7280;
	background: #f6f7f9;
	font-style: italic;
}

.aivc-form {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #e3e5e8;
	background: #fff;
}

.aivc-input {
	flex: 1;
	resize: none;
	border: 1px solid #cfd3d9;
	border-radius: 8px;
	padding: 8px 10px;
	font: inherit;
	max-height: 90px;
}

.aivc-send {
	border: 0;
	border-radius: 8px;
	background: var(--aivc-color, #2d6cdf);
	color: #fff;
	padding: 0 14px;
	cursor: pointer;
	font: inherit;
}

.aivc-send:disabled {
	opacity: 0.6;
	cursor: default;
}

@media (max-width: 480px) {
	.aivc-widget {
		right: 10px;
		bottom: 10px;
	}

	.aivc-panel {
		width: calc(100vw - 20px);
		height: min(560px, calc(100dvh - 90px));
	}
}

/* Honeypot (§8): off-screen, never visible to humans. */
.aivc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

/* Action buttons under an assistant message (§10.1). */
.aivc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 2px 0 6px;
}

.aivc-action {
	display: inline-block;
	padding: 6px 12px;
	border-radius: 999px;
	border: 1px solid var(--aivc-color, #2d6cdf);
	color: var(--aivc-color, #2d6cdf);
	background: #fff;
	font-size: 13px;
	text-decoration: none;
}

.aivc-action:hover {
	background: var(--aivc-color, #2d6cdf);
	color: #fff;
}

/* Invisible Turnstile host. */
.aivc-turnstile {
	position: absolute;
	left: -9999px;
}

/* Panel footer with the Privacy Policy link (§4.10). */
.aivc-footer {
	padding: 4px 12px 8px;
	text-align: center;
	background: #fff;
}

.aivc-privacy {
	font-size: 11px;
	color: #888;
	text-decoration: underline;
}

/* Links inside assistant messages (safe linkified URLs). */
.aivc-msg-link {
	color: var(--aivc-color, #2d6cdf);
	text-decoration: underline;
	word-break: break-all;
}

.aivc-msg-assistant .aivc-msg-link:hover {
	opacity: 0.8;
}

/* Quick-reply chips (§5.5 step 2): button-styled like link chips. */
.aivc-action-reply {
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}
