/* BridgeChat AI Widget */
.bridgechat-root,
.bridgechat-root * {
	box-sizing: border-box;
}

.bridgechat-root {
	--bc-accent: #111827;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: #111827;
}

.bridgechat-pos-right {
	right: 20px;
	left: auto;
	transform: none;
}

.bridgechat-pos-left {
	left: 20px;
	right: auto;
	transform: none;
}

.bridgechat-pos-center {
	left: 50%;
	right: auto;
	transform: translateX(-50%);
}

.bridgechat-launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	border: none;
	border-radius: 9999px;
	background: var(--bc-accent);
	color: #ffffff;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
	transition: transform 0.15s ease, opacity 0.15s ease;
}

.bridgechat-launcher:hover {
	transform: translateY(-1px);
}

.bridgechat-launcher[hidden] {
	display: none;
}

.bridgechat-panel {
	width: 400px;
	max-width: calc(100vw - 24px);
	height: 560px;
	max-height: calc(100vh - 36px);
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.bridgechat-panel[hidden] {
	display: none;
}

.bridgechat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 14px;
	background: var(--bc-accent);
	color: #ffffff;
}

.bridgechat-header-title {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.bridgechat-header-title strong {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bridgechat-status {
	font-size: 11px;
	opacity: 0.85;
}

.bridgechat-header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.bridgechat-handoff-btn {
	border: 1px solid rgba(255, 255, 255, 0.45);
	background: rgba(255, 255, 255, 0.14);
	color: #ffffff;
	font-size: 11px;
	font-weight: 600;
	padding: 5px 9px;
	border-radius: 9999px;
	cursor: pointer;
}

.bridgechat-handoff-btn:hover {
	background: rgba(255, 255, 255, 0.26);
}

.bridgechat-handoff-btn[hidden] {
	display: none;
}

.bridgechat-close-btn {
	border: none;
	background: transparent;
	color: #ffffff;
	font-size: 20px;
	line-height: 1;
	padding: 2px 6px;
	cursor: pointer;
}

.bridgechat-messages {
	position: relative;
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #f8fafc;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.bridgechat-msg {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: 14px;
	word-break: break-word;
	overflow-wrap: anywhere;
	font-size: 13.5px;
	line-height: 1.55;
}

.bridgechat-msg-body {
	min-width: 0;
}

.bridgechat-msg-visitor {
	align-self: flex-end;
	background: var(--bc-accent);
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

.bridgechat-msg-visitor .bridgechat-msg-body,
.bridgechat-msg-system .bridgechat-msg-body {
	white-space: pre-wrap;
}

.bridgechat-msg-ai,
.bridgechat-msg-human {
	max-width: 92%;
	align-self: flex-start;
	background: #ffffff;
	color: #111827;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.bridgechat-msg-ai .bridgechat-msg-body,
.bridgechat-msg-human .bridgechat-msg-body {
	white-space: normal;
}

.bridgechat-md-p {
	margin: 0 0 8px;
}

.bridgechat-md-p:last-child {
	margin-bottom: 0;
}

.bridgechat-md-heading {
	margin: 12px 0 6px;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.35;
}

.bridgechat-md-heading:first-child {
	margin-top: 0;
}

.bridgechat-md-heading:last-child {
	margin-bottom: 0;
}

.bridgechat-md-h1 {
	font-size: 15.5px;
}

.bridgechat-md-h2 {
	font-size: 14.5px;
}

.bridgechat-md-h3,
.bridgechat-md-h4 {
	font-size: 13.5px;
}

ul.bridgechat-md-list,
ol.bridgechat-md-list {
	margin: 4px 0 8px;
	padding-left: 18px;
}

ul.bridgechat-md-list {
	list-style: disc;
}

ul.bridgechat-md-list ul.bridgechat-md-list {
	list-style: circle;
	margin: 4px 0 2px;
}

ol.bridgechat-md-list {
	list-style: decimal;
}

ol.bridgechat-md-list ol.bridgechat-md-list {
	margin: 4px 0 2px;
}

.bridgechat-md-list:last-child {
	margin-bottom: 0;
}

.bridgechat-md-list li {
	margin: 0 0 4px;
	padding-left: 2px;
}

.bridgechat-md-list li:last-child {
	margin-bottom: 0;
}

.bridgechat-md-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 12px;
	background: #f1f5f9;
	color: #0f172a;
	border: 1px solid #e2e8f0;
	border-radius: 4px;
	padding: 1px 5px;
}

.bridgechat-md-pre {
	margin: 8px 0;
	padding: 10px 12px;
	background: #f8fafc;
	color: #0f172a;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow-x: auto;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 12px;
	line-height: 1.45;
	white-space: pre;
}

.bridgechat-md-pre:first-child {
	margin-top: 0;
}

.bridgechat-md-pre:last-child {
	margin-bottom: 0;
}

.bridgechat-md-pre code {
	background: none;
	border: none;
	padding: 0;
	font-size: inherit;
	color: inherit;
}

.bridgechat-md-quote {
	margin: 8px 0;
	padding: 4px 0 4px 10px;
	border-left: 3px solid #cbd5e1;
	color: #475569;
}

.bridgechat-md-quote:first-child {
	margin-top: 0;
}

.bridgechat-md-quote:last-child {
	margin-bottom: 0;
}

.bridgechat-md-hr {
	border: none;
	border-top: 1px solid #e5e7eb;
	margin: 10px 0;
}

.bridgechat-md-table-wrap {
	margin: 8px 0;
	overflow-x: auto;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
}

.bridgechat-md-table-wrap:first-child {
	margin-top: 0;
}

.bridgechat-md-table-wrap:last-child {
	margin-bottom: 0;
}

.bridgechat-md-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 12.5px;
	line-height: 1.4;
}

.bridgechat-md-table th,
.bridgechat-md-table td {
	padding: 6px 8px;
	border-bottom: 1px solid #e5e7eb;
	border-right: 1px solid #f1f5f9;
	text-align: left;
	vertical-align: top;
}

.bridgechat-md-table th:last-child,
.bridgechat-md-table td:last-child {
	border-right: none;
}

.bridgechat-md-table tbody tr:last-child td {
	border-bottom: none;
}

.bridgechat-md-table th {
	background: #f8fafc;
	font-weight: 600;
	color: #0f172a;
	white-space: nowrap;
}

.bridgechat-msg-label {
	display: block;
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #6b7280;
	margin-bottom: 4px;
}

.bridgechat-msg-system {
	align-self: center;
	max-width: 94%;
	background: #eef2ff;
	color: #3730a3;
	font-size: 12px;
	padding: 6px 10px;
	border-radius: 8px;
	text-align: center;
}

.bridgechat-citations {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid #f1f5f9;
}

.bridgechat-citations-label {
	font-size: 11px;
	font-weight: 600;
	color: #6b7280;
	margin-right: 2px;
}

.bridgechat-citation {
	display: inline-block;
	font-size: 11px;
	padding: 3px 9px;
	border-radius: 9999px;
	background: #f3f4f6;
	color: #1f2937;
	text-decoration: none;
	border: 1px solid #e5e7eb;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.bridgechat-citation:hover {
	background: #e5e7eb;
	border-color: #d1d5db;
}

.bridgechat-starters {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 12px 0;
	background: #f8fafc;
}

.bridgechat-starters[hidden] {
	display: none;
}

.bridgechat-starter-btn {
	border: 1px solid #d1d5db;
	background: #ffffff;
	color: #374151;
	border-radius: 9999px;
	padding: 5px 10px;
	font-size: 12px;
	cursor: pointer;
}

.bridgechat-starter-btn:hover {
	background: #f3f4f6;
}

.bridgechat-form {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	background: #ffffff;
	border-top: 1px solid #e5e7eb;
}

.bridgechat-form[hidden] {
	display: none;
}

.bridgechat-input {
	flex: 1;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 13.5px;
	line-height: 1.4;
	font-family: inherit;
	color: #111827;
	background: #ffffff;
	resize: none;
	min-height: 38px;
	max-height: 96px;
}

.bridgechat-input:focus {
	outline: none;
	border-color: var(--bc-accent);
	box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.12);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--bc-accent) 18%, transparent);
}

.bridgechat-send-btn {
	border: none;
	border-radius: 8px;
	padding: 0 14px;
	background: var(--bc-accent);
	color: #ffffff;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
}

.bridgechat-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.bridgechat-thinking {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: #6b7280;
}

.bridgechat-thinking-label {
	font-size: 12.5px;
	font-style: italic;
}

.bridgechat-typing-dots {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.bridgechat-typing-dots span {
	width: 6px;
	height: 6px;
	border-radius: 9999px;
	background: #9ca3af;
	animation: bridgechat-dot-bounce 1.2s infinite ease-in-out both;
}

.bridgechat-typing-dots span:nth-child(2) {
	animation-delay: 0.16s;
}

.bridgechat-typing-dots span:nth-child(3) {
	animation-delay: 0.32s;
}

@keyframes bridgechat-dot-bounce {
	0%, 80%, 100% {
		opacity: 0.35;
		transform: translateY(0);
	}
	40% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.bridgechat-typing-dots span {
		animation: none;
		opacity: 0.65;
	}
}

.bridgechat-inline-link {
	color: #2563eb;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.bridgechat-msg-visitor .bridgechat-inline-link {
	color: #ffffff;
}
