/* =========================================================
   Claude Chat Widget — "claude.ai" inspired chat surface
   ========================================================= */

.claude-chat-widget {
	--claude-chat-accent: #c96442;
	--claude-chat-accent-hover: #b3552f;
	--claude-chat-bg: #faf9f6;
	--claude-chat-panel: #ffffff;
	--claude-chat-border: #e7e3da;
	--claude-chat-text: #3d3929;
	--claude-chat-text-muted: #83786a;
	--claude-chat-user-bubble: #f0eee6;

	max-width: 480px;
	margin: 20px 0;
	border: 1px solid var(--claude-chat-border);
	border-radius: 16px;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	box-shadow: 0 8px 24px rgba(61, 57, 41, 0.08);
	background: var(--claude-chat-bg);
	display: flex;
	flex-direction: column;
}

.claude-chat-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--claude-chat-bg);
	color: var(--claude-chat-text);
	border-bottom: 1px solid var(--claude-chat-border);
}

.claude-chat-header-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--claude-chat-accent);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
}

.claude-chat-header-title {
	font-weight: 600;
	font-size: 14.5px;
	flex: 1;
	letter-spacing: -0.01em;
}

.claude-chat-close-btn {
	background: transparent;
	border: none;
	color: var(--claude-chat-text-muted);
	font-size: 16px;
	cursor: pointer;
	line-height: 1;
	padding: 4px;
	border-radius: 6px;
}

.claude-chat-close-btn:hover {
	background: var(--claude-chat-user-bubble);
	color: var(--claude-chat-text);
}

.claude-chat-toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	border-bottom: 1px solid var(--claude-chat-border);
	background: var(--claude-chat-bg);
}

.claude-chat-model-label {
	font-size: 12px;
	color: var(--claude-chat-text-muted);
}

.claude-chat-model-select {
	font-size: 12.5px;
	padding: 5px 10px;
	border: 1px solid var(--claude-chat-border);
	border-radius: 20px;
	background: var(--claude-chat-panel);
	color: var(--claude-chat-text);
	flex: 1;
	min-width: 0;
}

.claude-chat-clear-btn {
	border: none;
	background: transparent;
	cursor: pointer;
	font-size: 13px;
	color: var(--claude-chat-text-muted);
	padding: 5px 8px;
	border-radius: 6px;
}

.claude-chat-clear-btn:hover {
	background: var(--claude-chat-user-bubble);
	color: var(--claude-chat-text);
}

.claude-chat-messages {
	height: 380px;
	overflow-y: auto;
	padding: 18px 16px;
	background: var(--claude-chat-panel);
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.claude-chat-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.claude-chat-row-user {
	justify-content: flex-end;
}

.claude-chat-row-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--claude-chat-accent);
	color: #fff;
	font-size: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	margin-top: 2px;
}

.claude-chat-msg {
	max-width: 82%;
	line-height: 1.55;
	font-size: 14.5px;
	word-wrap: break-word;
	color: var(--claude-chat-text);
}

/* Assistant replies: plain text, no bubble — matches claude.ai's reading pane */
.claude-chat-msg-bot {
	background: transparent;
	padding: 0;
}

.claude-chat-msg-user {
	background: var(--claude-chat-user-bubble);
	padding: 9px 14px;
	border-radius: 18px;
	border-bottom-right-radius: 4px;
}

.claude-chat-msg-error {
	background: #fbe9e7;
	color: #9a3324;
	padding: 9px 14px;
	border-radius: 14px;
}

.claude-chat-msg-typing {
	background: transparent;
	color: var(--claude-chat-text-muted);
	padding: 0;
}

.claude-chat-typing-dots span {
	display: inline-block;
	width: 5px;
	height: 5px;
	margin-right: 3px;
	border-radius: 50%;
	background: var(--claude-chat-text-muted);
	animation: claude-chat-dot-bounce 1.2s infinite ease-in-out;
}

.claude-chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.claude-chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes claude-chat-dot-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-3px); opacity: 1; }
}

.claude-chat-typing-cursor::after {
	content: '▋';
	animation: claude-chat-blink 1s step-start infinite;
	margin-left: 1px;
	color: var(--claude-chat-accent);
}

@keyframes claude-chat-blink {
	50% { opacity: 0; }
}

.claude-chat-code-block {
	background: #2b2820;
	color: #f0eee6;
	padding: 12px 14px;
	border-radius: 10px;
	overflow-x: auto;
	font-size: 12.5px;
	margin: 8px 0;
}

.claude-chat-msg code {
	background: rgba(61, 57, 41, 0.08);
	padding: 1px 5px;
	border-radius: 4px;
	font-size: 13px;
}

.claude-chat-msg a {
	color: var(--claude-chat-accent);
	text-decoration: underline;
}

.claude-chat-image-preview {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	background: var(--claude-chat-bg);
}

.claude-chat-image-preview img {
	max-height: 52px;
	max-width: 52px;
	border-radius: 8px;
	object-fit: cover;
}

.claude-chat-image-preview button {
	border: none;
	background: var(--claude-chat-user-bubble);
	color: var(--claude-chat-text);
	border-radius: 50%;
	width: 20px;
	height: 20px;
	line-height: 1;
	cursor: pointer;
	font-size: 11px;
}

.claude-chat-msg-image img {
	max-width: 100%;
	max-height: 220px;
	border-radius: 14px;
	display: block;
}

/* ---------------- Composer (claude.ai-style rounded input) ---------------- */

.claude-chat-input-row {
	display: flex;
	align-items: flex-end;
	border: 1px solid var(--claude-chat-border);
	border-radius: 22px;
	background: var(--claude-chat-panel);
	margin: 12px 14px 6px;
	padding: 8px 8px 8px 12px;
	gap: 6px;
	box-shadow: 0 1px 3px rgba(61, 57, 41, 0.05);
}

.claude-chat-input-row:focus-within {
	border-color: var(--claude-chat-accent);
}

.claude-chat-upload-btn {
	border: none;
	background: transparent;
	font-size: 17px;
	cursor: pointer;
	padding: 6px;
	color: var(--claude-chat-text-muted);
	flex-shrink: 0;
	border-radius: 50%;
}

.claude-chat-upload-btn:hover {
	background: var(--claude-chat-user-bubble);
}

.claude-chat-upload-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.claude-chat-input {
	flex: 1;
	min-width: 0;
	resize: none;
	border: none;
	outline: none;
	background: transparent;
	font-family: inherit;
	font-size: 14.5px;
	line-height: 1.4;
	color: var(--claude-chat-text);
	padding: 6px 2px;
	max-height: 120px;
}

.claude-chat-input::placeholder {
	color: var(--claude-chat-text-muted);
}

.claude-chat-send {
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: var(--claude-chat-accent);
	color: #fff;
	font-size: 15px;
	cursor: pointer;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.12s ease;
}

.claude-chat-send:hover:not(:disabled) {
	background: var(--claude-chat-accent-hover);
}

.claude-chat-send:disabled {
	opacity: 0.4;
	cursor: default;
}

.claude-chat-disclaimer {
	text-align: center;
	font-size: 11px;
	color: var(--claude-chat-text-muted);
	padding: 0 14px 12px;
}

/* ---------------- Floating bubble ---------------- */

.claude-chat-floating-root {
	--claude-chat-accent: #c96442;
	position: fixed;
	z-index: 999999;
	bottom: 24px;
}

.claude-chat-position-bottom-right {
	right: 24px;
}

.claude-chat-position-bottom-left {
	left: 24px;
}

.claude-chat-launcher {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--claude-chat-accent);
	border: none;
	box-shadow: 0 6px 20px rgba(61, 57, 41, 0.25);
	cursor: pointer;
	font-size: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
	color: #fff;
}

.claude-chat-launcher:hover {
	transform: scale(1.06);
}

.claude-chat-launcher-hidden {
	display: none;
}

.claude-chat-widget-floating-panel {
	position: absolute;
	bottom: 70px;
	right: 0;
	width: 380px;
	max-width: calc(100vw - 32px);
	margin: 0;
	display: none;
	flex-direction: column;
}

.claude-chat-position-bottom-left .claude-chat-widget-floating-panel {
	right: auto;
	left: 0;
}

.claude-chat-widget-floating-panel.claude-chat-panel-open {
	display: flex;
	animation: claude-chat-pop-in 0.15s ease;
}

@keyframes claude-chat-pop-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.claude-chat-widget-floating-panel .claude-chat-messages {
	height: 400px;
}

@media (max-width: 480px) {
	.claude-chat-floating-root {
		bottom: 16px;
	}
	.claude-chat-position-bottom-right,
	.claude-chat-position-bottom-left {
		right: 16px;
		left: 16px;
	}
	.claude-chat-widget-floating-panel {
		width: auto;
		left: 0;
		right: 0;
	}
}
