/* Academic Chatbot widget styles. Classes are prefixed with acbt- to avoid
   clashing with theme / Elementor styles. */

.acbt-widget {
	--acbt-primary: #1a4d8f;
	--acbt-primary-dark: #123a6b;
	--acbt-bg: #ffffff;
	--acbt-border: #e0e4e9;
	--acbt-text: #1f2933;
	--acbt-muted: #6b7280;
	--acbt-user-bubble: #1a4d8f;
	--acbt-assistant-bubble: #f2f4f7;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
}

.acbt-widget *,
.acbt-widget *::before,
.acbt-widget *::after {
	box-sizing: inherit;
}

/* ---------- Inline (shortcode) mode ---------- */

.acbt-mode-inline .acbt-panel {
	position: static;
	width: 100%;
	max-width: 640px;
	height: 520px;
	display: flex;
	box-shadow: 0 1px 4px rgba(16, 24, 40, 0.08);
	border: 1px solid var(--acbt-border);
	border-radius: 12px;
	overflow: hidden;
}

/* ---------- Floating mode ---------- */

.acbt-mode-floating {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
}

.acbt-mode-floating .acbt-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 140px);
	display: flex;
	background: var(--acbt-bg);
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(16, 24, 40, 0.22);
	border: 1px solid var(--acbt-border);
	overflow: hidden;
}

.acbt-mode-floating .acbt-panel.acbt-hidden {
	display: none;
}

.acbt-toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: var(--acbt-primary);
	color: #fff;
	font-size: 26px;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(16, 24, 40, 0.28);
	display: flex;
	align-items: center;
	justify-content: center;
	float: right;
}

.acbt-toggle:hover {
	background: var(--acbt-primary-dark);
}

/* ---------- Shared panel internals ---------- */

.acbt-panel {
	flex-direction: column;
	background: var(--acbt-bg);
	color: var(--acbt-text);
}

.acbt-header {
	background: var(--acbt-primary);
	color: #fff;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex: 0 0 auto;
}

.acbt-header-title {
	font-weight: 600;
	font-size: 15px;
}

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

.acbt-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafbfc;
}

.acbt-message {
	max-width: 88%;
	padding: 9px 12px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.45;
	word-wrap: break-word;
}

.acbt-message-assistant {
	align-self: flex-start;
	background: var(--acbt-assistant-bubble);
	color: var(--acbt-text);
	border-bottom-left-radius: 4px;
}

.acbt-message-user {
	align-self: flex-end;
	background: var(--acbt-user-bubble);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.acbt-message.acbt-placeholder {
	opacity: 0.7;
	font-style: italic;
}

.acbt-citations {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	font-size: 12px;
}

.acbt-message-user .acbt-citations {
	border-top-color: rgba(255, 255, 255, 0.25);
}

.acbt-citations-label {
	font-weight: 600;
	color: var(--acbt-muted);
	display: block;
	margin-bottom: 4px;
}

.acbt-citations ol {
	margin: 0;
	padding-left: 18px;
}

.acbt-citations a {
	color: var(--acbt-primary);
	text-decoration: underline;
}

.acbt-message-user .acbt-citations a {
	color: #dbe8ff;
}

.acbt-form {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid var(--acbt-border);
	background: var(--acbt-bg);
}

.acbt-input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid var(--acbt-border);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 14px;
	font-family: inherit;
	max-height: 90px;
}

.acbt-input:focus {
	outline: none;
	border-color: var(--acbt-primary);
}

.acbt-send {
	background: var(--acbt-primary);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 0 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.acbt-send:hover {
	background: var(--acbt-primary-dark);
}

.acbt-send:disabled,
.acbt-input:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

@media (max-width: 480px) {
	.acbt-mode-floating .acbt-panel {
		right: -12px;
		width: calc(100vw - 24px);
	}
}
