/**
 * Claude Chatbot widget styles.
 */

.ccb-root {
	--ccb-accent: #2f6feb;
	--ccb-bg: #ffffff;
	--ccb-fg: #1c1e21;
	--ccb-muted: #6b7280;
	--ccb-border: #e3e6ea;
	--ccb-user-bg: var(--ccb-accent);
	--ccb-user-fg: #ffffff;
	--ccb-bot-bg: #f3f4f6;
	--ccb-radius: 14px;
	--ccb-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--ccb-fg);
	box-sizing: border-box;
}

.ccb-root *,
.ccb-root *::before,
.ccb-root *::after {
	box-sizing: inherit;
}

.ccb-floating {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
}

.ccb-inline {
	position: relative;
	max-width: 720px;
	margin: 24px auto;
}

/* Launcher ---------------------------------------------------------------- */

.ccb-launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--ccb-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: var(--ccb-shadow);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ccb-launcher:hover,
.ccb-launcher:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 22px 54px rgba(15, 23, 42, 0.24);
}

.ccb-launcher-icon {
	display: inline-flex;
}

.ccb-floating.is-open .ccb-launcher {
	display: none;
}

/* Panel ------------------------------------------------------------------- */

.ccb-panel {
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 120px);
	background: var(--ccb-bg);
	border: 1px solid var(--ccb-border);
	border-radius: var(--ccb-radius);
	box-shadow: var(--ccb-shadow);
	overflow: hidden;
}

.ccb-inline .ccb-panel {
	width: 100%;
	height: 480px;
	max-height: none;
}

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

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

.ccb-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	color: inherit;
}

.ccb-header-actions {
	display: flex;
	gap: 4px;
}

.ccb-header button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}

.ccb-header button:hover,
.ccb-header button:focus-visible {
	background: rgba(255, 255, 255, 0.3);
}

/* Log --------------------------------------------------------------------- */

.ccb-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fbfbfc;
	overscroll-behavior: contain;
}

.ccb-msg {
	display: flex;
	max-width: 100%;
}

.ccb-msg-user {
	justify-content: flex-end;
}

.ccb-bubble {
	max-width: 85%;
	padding: 10px 13px;
	border-radius: 14px;
	background: var(--ccb-bot-bg);
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.ccb-msg-user .ccb-bubble {
	background: var(--ccb-user-bg);
	color: var(--ccb-user-fg);
	border-bottom-right-radius: 4px;
	white-space: pre-wrap;
}

.ccb-msg-bot .ccb-bubble {
	border-bottom-left-radius: 4px;
}

.ccb-bubble p {
	margin: 0 0 8px;
}

.ccb-bubble p:last-child {
	margin-bottom: 0;
}

.ccb-bubble ul,
.ccb-bubble ol {
	margin: 0 0 8px;
	padding-left: 20px;
}

.ccb-bubble li {
	margin: 2px 0;
}

.ccb-bubble code {
	padding: 1px 5px;
	border-radius: 5px;
	background: rgba(15, 23, 42, 0.08);
	font-size: 0.9em;
}

.ccb-bubble pre {
	margin: 0 0 8px;
	padding: 10px;
	border-radius: 8px;
	background: #1f2430;
	color: #e6e8ec;
	overflow-x: auto;
}

.ccb-bubble pre code {
	background: none;
	padding: 0;
	color: inherit;
}

.ccb-bubble a {
	color: inherit;
	text-decoration: underline;
}

.ccb-msg.ccb-error .ccb-bubble {
	background: #fdecec;
	color: #8a1c1c;
}

/* Typing indicator -------------------------------------------------------- */

.ccb-typing .ccb-bubble {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 14px 14px;
}

.ccb-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--ccb-muted);
	animation: ccb-blink 1.2s infinite ease-in-out;
}

.ccb-typing span:nth-child(2) {
	animation-delay: 0.18s;
}

.ccb-typing span:nth-child(3) {
	animation-delay: 0.36s;
}

@keyframes ccb-blink {
	0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
	.ccb-typing span {
		animation: none;
		opacity: 0.5;
	}

	.ccb-launcher {
		transition: none;
	}
}

/* Notice and form --------------------------------------------------------- */

.ccb-notice {
	margin: 0;
	padding: 8px 16px;
	font-size: 12px;
	color: var(--ccb-muted);
	background: #fff;
	border-top: 1px solid var(--ccb-border);
}

.ccb-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--ccb-border);
	background: #fff;
}

.ccb-input {
	flex: 1 1 auto;
	min-height: 40px;
	max-height: 140px;
	padding: 10px 12px;
	border: 1px solid var(--ccb-border);
	border-radius: 10px;
	font: inherit;
	color: inherit;
	background: #fff;
	resize: none;
}

.ccb-input:focus {
	outline: 2px solid var(--ccb-accent);
	outline-offset: 1px;
	border-color: var(--ccb-accent);
}

.ccb-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex: 0 0 auto;
	border: 0;
	border-radius: 10px;
	background: var(--ccb-accent);
	color: #fff;
	cursor: pointer;
}

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

.ccb-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 480px) {
	.ccb-floating {
		bottom: 12px;
		left: 12px !important;
		right: 12px !important;
		align-items: stretch;
	}

	.ccb-panel {
		width: 100%;
		height: min(70vh, 520px);
	}

	.ccb-launcher {
		align-self: flex-end;
	}
}

@media (prefers-color-scheme: dark) {
	.ccb-root {
		--ccb-bg: #16181d;
		--ccb-fg: #e9eaee;
		--ccb-muted: #9aa1ac;
		--ccb-border: #2a2e37;
		--ccb-bot-bg: #23262e;
	}

	.ccb-log {
		background: #1a1d23;
	}

	.ccb-notice,
	.ccb-form,
	.ccb-input {
		background: var(--ccb-bg);
	}

	.ccb-bubble code {
		background: rgba(255, 255, 255, 0.12);
	}

	.ccb-msg.ccb-error .ccb-bubble {
		background: #3a1f1f;
		color: #ffb4b4;
	}
}
