/**
 * AI Chat Assistant styles — uses plugin --qb-accent variables.
 */

.qb-chat-root.qb-chat-floating {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99990;
	font-family: inherit;
}

.qb-chat-root.qb-chat-inline {
	position: relative;
	max-width: 400px;
	margin: 20px 0;
}

.qb-chat-toggle {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: none;
	background: var(--qb-accent, #f5c518);
	color: var(--qb-accent-text, #111);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	font-size: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	position: relative;
	pointer-events: auto;
}

.qb-chat-inline .qb-chat-toggle {
	display: none;
}

.qb-chat-panel {
	width: 340px;
	max-width: calc(100vw - 32px);
	background: var(--qb-panel-bg, rgba(15, 15, 15, 0.95));
	color: var(--qb-text, #fff);
	border-radius: var(--qb-radius, 12px);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
	overflow: hidden;
	display: none;
	flex-direction: column;
	max-height: 480px;
}

/*
 * Critical: themes often force .qb-chat-panel { display:flex }, which
 * overrides HTML [hidden] and makes close look broken. Inline styles
 * from JS + these rules must win.
 */
.qb-chat-panel[hidden],
.qb-chat-root:not(.qb-chat-open) .qb-chat-panel,
body .qb-chat-floating:not(.qb-chat-open) .qb-chat-panel {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

.qb-chat-root.qb-chat-open .qb-chat-panel,
body .qb-chat-floating.qb-chat-open .qb-chat-panel {
	display: flex !important;
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
}

.qb-chat-inline .qb-chat-panel {
	width: 100%;
}

.qb-chat-floating .qb-chat-panel {
	position: absolute;
	bottom: 68px;
	right: 0;
}

.qb-chat-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 14px;
	background: rgba(0, 0, 0, 0.2);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.qb-chat-close {
	background: none;
	border: none;
	color: inherit;
	font-size: 22px;
	cursor: pointer;
	line-height: 1;
	padding: 4px 8px;
	z-index: 2;
	position: relative;
	pointer-events: auto;
}

.qb-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 200px;
	max-height: 320px;
}

.qb-chat-msg {
	padding: 10px 12px;
	border-radius: 10px;
	font-size: 14px;
	line-height: 1.45;
	max-width: 88%;
	word-break: break-word;
}

.qb-chat-msg-user {
	align-self: flex-end;
	background: var(--qb-accent, #f5c518);
	color: var(--qb-accent-text, #111);
}

.qb-chat-msg-bot {
	align-self: flex-start;
	background: var(--qb-input-bg, rgba(255, 255, 255, 0.08));
	color: var(--qb-text, #fff);
}

.qb-chat-typing {
	padding: 0 14px 8px;
	font-size: 12px;
	opacity: 0.7;
}

.qb-chat-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.qb-chat-input {
	flex: 1;
	padding: 10px 12px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: var(--qb-input-bg, rgba(255, 255, 255, 0.06));
	color: var(--qb-input-text, #fff);
	font-size: 14px;
}

.qb-chat-send {
	padding: 10px 14px;
	border: none;
	border-radius: 8px;
	background: var(--qb-accent, #f5c518);
	color: var(--qb-accent-text, #111);
	font-weight: 700;
	cursor: pointer;
}

.qb-chat-upgrade {
	padding: 16px;
	border-radius: var(--qb-radius, 12px);
}

@media (max-width: 480px) {
	.qb-chat-floating .qb-chat-panel {
		width: calc(100vw - 24px);
		right: -8px;
	}
}
