.ccb-chatbot {
	--ccb-brand: #3b461e;
	--ccb-brand-dark: #2d3516;
	--ccb-surface: #ffffff;
	--ccb-bubble: #f2f3f5;
	--ccb-ink: #1a1a1a;
	--ccb-muted: #7c7c7c;
	--ccb-line: #e6e6e6;
	--ccb-danger: #c0392b;

	max-width: 420px;
	margin: 0 auto;
	direction: rtl;
	font-family: 'cocaro', Tahoma, sans-serif;
	color: var(--ccb-ink);
}

.ccb-chatbot *,
.ccb-chatbot *::before,
.ccb-chatbot *::after {
	box-sizing: border-box;
}

.ccb-chatbot [hidden] {
	display: none !important;
}

.ccb-chat {
	display: flex;
	flex-direction: column;
	background: var(--ccb-surface);
	border-radius: 16px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
	padding: 14px;
}

.ccb-thread {
	display: flex;
	flex-direction: column;
	gap: 10px;
	height: 360px;
	overflow-y: auto;
	padding: 4px;
	margin-bottom: 12px;
	overscroll-behavior: contain;
}

.ccb-msg {
	max-width: 85%;
	padding: 11px 15px;
	border-radius: 18px;
	font-size: 14px;
	line-height: 1.75;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.ccb-msg--user {
	align-self: flex-end;
	background: var(--ccb-brand);
	color: #fff;
	border-bottom-left-radius: 6px;
}

.ccb-msg--assistant {
	align-self: flex-start;
	background: var(--ccb-bubble);
	color: var(--ccb-ink);
	border-bottom-right-radius: 6px;
}

.ccb-msg--error {
	align-self: flex-start;
	background: #fdecea;
	color: var(--ccb-danger);
	border-bottom-right-radius: 6px;
}

/* نشانگر در حال نوشتن */

.ccb-typing {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	height: 10px;
}

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

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

@keyframes ccb-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
	30%           { transform: translateY(-4px); opacity: 1; }
}

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

/* فیلدها و دکمه‌ها */

.ccb-input {
	width: 100%;
	padding: 13px 16px;
	border: 1.5px solid var(--ccb-line);
	border-radius: 12px;
	background: #f9f9f9;
	color: var(--ccb-ink);
	font: inherit;
	font-size: 16px;
	outline: none;
	transition: border-color 0.2s, background 0.2s;
}

.ccb-input:focus-visible {
	border-color: var(--ccb-brand);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(59, 70, 30, 0.15);
}

.ccb-input--bad {
	border-color: var(--ccb-danger);
}

.ccb-btn {
	display: block;
	padding: 13px 16px;
	border: none;
	border-radius: 12px;
	background: var(--ccb-brand);
	color: #fff;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, opacity 0.2s;
}

.ccb-btn:hover:not(:disabled) { background: var(--ccb-brand-dark); }
.ccb-btn:focus-visible { outline: 2px solid var(--ccb-brand); outline-offset: 2px; }
.ccb-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.ccb-btn--send {
	width: auto;
	flex-shrink: 0;
	padding: 13px 20px;
}

/* ردیف شماره درون چت */

.ccb-phone {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px;
	margin-bottom: 10px;
	border: 1px dashed var(--ccb-line);
	border-radius: 12px;
	background: #fafaf7;
}

.ccb-phone__field {
	flex: 1;
	min-width: 0;
	padding: 10px 14px;
	font-size: 15px;
}

.ccb-skip {
	flex-shrink: 0;
	padding: 8px 10px;
	border: none;
	background: none;
	color: var(--ccb-muted);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.ccb-skip:hover { color: var(--ccb-ink); }

/* نوار نوشتن */

.ccb-compose {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.ccb-compose__field {
	flex: 1;
	min-height: 48px;
	max-height: 140px;
	resize: none;
	line-height: 1.6;
	overflow-y: auto;
}

@media (max-width: 480px) {
	.ccb-thread { height: 300px; }
	.ccb-phone { flex-wrap: wrap; }
	.ccb-phone__field { flex: 1 1 100%; }
}
