/* =============================================
   English Conversation Widget — Front-end styles
   ============================================= */

.ecw-conversation {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 24px;
	background: #f8f9fa;
	border-radius: 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	max-width: 720px;
	margin: 24px auto;
}

/* ---------- Row ---------- */
.ecw-bubble-row {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	animation: ecwFadeIn 0.3s ease both;
}

.ecw-bubble-row.ecw-side-right {
	flex-direction: row-reverse;
}

/* ---------- Avatar ---------- */
.ecw-avatar-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
	width: 56px;
}

.ecw-avatar {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	object-fit: cover;
	border: 3px solid #fff;
	box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.ecw-avatar-initials {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	color: #fff;
	font-size: 22px;
	font-weight: 700;
	border: 3px solid #fff;
	box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.ecw-char-name {
	font-size: 11px;
	color: #666;
	text-align: center;
	line-height: 1.2;
	max-width: 56px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* ---------- Bubble ---------- */
.ecw-bubble {
	position: relative;
	border-radius: 18px;
	padding: 12px 48px 12px 16px;
	color: #fff;
	max-width: calc(100% - 80px);
	box-shadow: 0 2px 10px rgba(0,0,0,.12);
	word-break: break-word;
	line-height: 1.6;
}

/* Tail — left side */
.ecw-side-left .ecw-bubble::before {
	content: '';
	position: absolute;
	left: -10px;
	bottom: 16px;
	border: 8px solid transparent;
	border-right-color: inherit;
	border-left: 0;
	border-right-width: 10px;
}

/* Tail — right side */
.ecw-side-right .ecw-bubble::before {
	content: '';
	position: absolute;
	right: -10px;
	bottom: 16px;
	border: 8px solid transparent;
	border-left-color: inherit;
	border-right: 0;
	border-left-width: 10px;
}

.ecw-bubble-text {
	font-size: 15px;
}

/* ---------- TTS Button ---------- */
.ecw-tts-btn {
	position: absolute;
	right: 10px;
	bottom: 10px;
	background: rgba(255,255,255,.25);
	border: none;
	border-radius: 50%;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #fff;
	padding: 0;
	transition: background 0.2s, transform 0.15s;
	flex-shrink: 0;
}

.ecw-tts-btn:hover {
	background: rgba(255,255,255,.45);
	transform: scale(1.12);
}

.ecw-tts-btn.ecw-speaking {
	background: rgba(255,255,255,.6);
	animation: ecwPulse 0.9s ease infinite;
}

.ecw-tts-btn svg {
	pointer-events: none;
}

/* ---------- Animation ---------- */
@keyframes ecwFadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes ecwPulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.6); }
	50%       { box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
	.ecw-conversation {
		padding: 16px;
		gap: 14px;
	}
	.ecw-bubble {
		font-size: 14px;
		padding: 10px 40px 10px 12px;
	}
	.ecw-avatar,
	.ecw-avatar-initials {
		width: 40px;
		height: 40px;
		font-size: 17px;
	}
	.ecw-avatar-wrap {
		width: 44px;
	}
}
