/**
 * Chat Convert AI — Front-End Widget Stylesheet
 */

:root {
	--cc-widget-primary: #2563eb;
	--cc-widget-primary-hover: #1d4ed8;
	--cc-widget-bg: #ffffff;
	--cc-widget-surface: #f8fafc;
	--cc-widget-text: #0f172a;
	--cc-widget-text-muted: #64748b;
	--cc-widget-border: #e2e8f0;
	--cc-widget-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
	--cc-widget-radius: 16px;
	--cc-widget-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#chat-convert-ai-root {
	font-family: var(--cc-widget-font);
	position: fixed;
	bottom: 24px;
	z-index: 999999;
	line-height: 1.5;
	box-sizing: border-box;
}

#chat-convert-ai-root * {
	box-sizing: border-box;
}

#chat-convert-ai-root.pos-bottom-right {
	right: 24px;
}

#chat-convert-ai-root.pos-bottom-left {
	left: 24px;
}

/* Floating Launcher Button */
.cc-launcher-btn {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--cc-widget-primary);
	color: #ffffff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	outline: none;
}

.cc-launcher-btn:hover {
	transform: scale(1.06);
	background: var(--cc-widget-primary-hover);
	box-shadow: 0 14px 28px rgba(37, 99, 235, 0.45);
}

.cc-launcher-btn svg {
	width: 28px;
	height: 28px;
	transition: transform 0.3s ease;
}

.cc-launcher-btn.is-open svg.icon-chat {
	display: none;
}

.cc-launcher-btn.is-open svg.icon-close {
	display: block;
}

.cc-launcher-btn:not(.is-open) svg.icon-close {
	display: none;
}

/* Chat Window Modal */
.cc-chat-window {
	position: absolute;
	bottom: 76px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 580px;
	max-height: calc(100vh - 120px);
	background: var(--cc-widget-bg);
	border: 1px solid var(--cc-widget-border);
	border-radius: var(--cc-widget-radius);
	box-shadow: var(--cc-widget-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px) scale(0.95);
	pointer-events: none;
	transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#chat-convert-ai-root.pos-bottom-right .cc-chat-window {
	right: 0;
}

#chat-convert-ai-root.pos-bottom-left .cc-chat-window {
	left: 0;
}

.cc-chat-window.is-active {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Window Header */
.cc-chat-header {
	background: linear-gradient(135deg, var(--cc-widget-primary) 0%, #1e40af 100%);
	color: #ffffff;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.cc-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.cc-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	backdrop-filter: blur(4px);
}

.cc-header-titles h3 {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
}

.cc-header-titles span {
	font-size: 11px;
	color: rgba(255, 255, 255, 0.8);
	display: flex;
	align-items: center;
	gap: 4px;
}

.cc-online-dot {
	width: 7px;
	height: 7px;
	background: #10b981;
	border-radius: 50%;
	display: inline-block;
}

.cc-header-actions button {
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.8);
	cursor: pointer;
	padding: 6px;
	border-radius: 6px;
	transition: background 0.15s ease;
}

.cc-header-actions button:hover {
	background: rgba(255, 255, 255, 0.15);
	color: #ffffff;
}

/* Message Area */
.cc-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: #fdfdfd;
}

.cc-msg-row {
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-width: 90%;
}

.cc-msg-row.bot {
	align-self: flex-start;
}

.cc-msg-row.user {
	align-self: flex-end;
}

.cc-msg-bubble-wrap {
	display: flex;
	align-items: flex-end;
	gap: 6px;
}

.cc-msg-bubble {
	padding: 11px 15px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.5;
	word-break: break-word;
}

.cc-msg-row.bot .cc-msg-bubble {
	background: #f1f5f9;
	color: var(--cc-widget-text);
	border-top-left-radius: 4px;
}

.cc-msg-row.user .cc-msg-bubble {
	background: var(--cc-widget-primary);
	color: #ffffff;
	border-top-right-radius: 4px;
}

.cc-msg-time {
	font-size: 10px;
	color: var(--cc-widget-text-muted);
	margin-top: 4px;
	display: block;
}

.cc-msg-row.user .cc-msg-time {
	text-align: right;
	color: rgba(255, 255, 255, 0.75);
}

/* Voice TTS Speaker Button */
.cc-speaker-btn {
	background: none;
	border: none;
	color: #94a3b8;
	cursor: pointer;
	padding: 4px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
}

.cc-speaker-btn:hover {
	color: var(--cc-widget-primary);
	background: #f1f5f9;
}

.cc-speaker-btn.is-speaking {
	color: #ef4444;
	animation: ccPulseRecord 1.2s infinite ease-in-out;
}

/* Quick Action Suggestion Chips */
.cc-suggestions-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 6px;
}

.cc-chip-btn {
	background: #ffffff;
	color: var(--cc-widget-primary);
	border: 1px solid #bfdbfe;
	font-size: 12px;
	font-weight: 600;
	padding: 6px 12px;
	border-radius: 16px;
	cursor: pointer;
	transition: all 0.15s ease;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.cc-chip-btn:hover {
	background: var(--cc-widget-primary);
	color: #ffffff;
	border-color: var(--cc-widget-primary);
	transform: translateY(-1px);
	box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* --------------------------------------------------- */
/* INLINE LEAD CAPTURE FORM (STAGE 7 & 8)              */
/* --------------------------------------------------- */
.cc-inline-lead-form {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 14px;
	margin-top: 10px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	width: 100%;
}

.cc-lead-form-header {
	font-size: 13px;
	font-weight: 700;
	color: var(--cc-widget-text);
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.cc-lead-form-fields {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cc-lead-input {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font-size: 12.5px;
	outline: none;
	transition: border-color 0.15s ease;
	font-family: inherit;
}

.cc-lead-input:focus {
	border-color: var(--cc-widget-primary);
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.cc-lead-submit-btn {
	background: var(--cc-widget-primary);
	color: #ffffff;
	border: none;
	border-radius: 6px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.15s ease;
	margin-top: 4px;
}

.cc-lead-submit-btn:hover {
	background: var(--cc-widget-primary-hover);
}

.cc-lead-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.cc-lead-success-banner {
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: #065f46;
	padding: 12px 14px;
	border-radius: 8px;
	font-size: 12.5px;
	font-weight: 500;
	text-align: center;
	margin-top: 8px;
}

/* Typing Indicator */
.cc-typing-indicator {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 16px;
	background: #f1f5f9;
	border-radius: 14px;
	border-top-left-radius: 4px;
	width: fit-content;
	align-self: flex-start;
}

.cc-typing-dot {
	width: 6px;
	height: 6px;
	background: #94a3b8;
	border-radius: 50%;
	animation: ccBounce 1.4s infinite ease-in-out both;
}

.cc-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.cc-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ccBounce {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

/* Footer / Input */
.cc-chat-footer {
	padding: 12px 16px;
	background: #ffffff;
	border-top: 1px solid var(--cc-widget-border);
}

.cc-input-wrapper {
	display: flex;
	align-items: center;
	background: var(--cc-widget-surface);
	border: 1px solid var(--cc-widget-border);
	border-radius: 24px;
	padding: 4px 6px 4px 14px;
	transition: border-color 0.2s ease;
	gap: 4px;
}

.cc-input-wrapper:focus-within {
	border-color: var(--cc-widget-primary);
	background: #ffffff;
}

.cc-input-field {
	flex: 1;
	border: none;
	background: transparent;
	padding: 8px 0;
	font-size: 13.5px;
	outline: none;
	color: var(--cc-widget-text);
	font-family: inherit;
}

/* Voice Mic Button */
.cc-mic-btn {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: transparent;
	color: #64748b;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.15s ease;
}

.cc-mic-btn:hover {
	color: var(--cc-widget-primary);
	background: rgba(37, 99, 235, 0.08);
}

.cc-mic-btn.is-recording {
	background: #ef4444;
	color: #ffffff;
	animation: ccPulseRecord 1.2s infinite ease-in-out;
}

@keyframes ccPulseRecord {
	0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
	50% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
	100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.cc-send-btn {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--cc-widget-primary);
	color: #ffffff;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.15s ease;
}

.cc-send-btn:hover {
	background: var(--cc-widget-primary-hover);
	transform: scale(1.05);
}

.cc-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

/* Responsive Mobile Layout */
@media (max-width: 480px) {
	#chat-convert-ai-root {
		bottom: 16px;
	}
	#chat-convert-ai-root.pos-bottom-right {
		right: 16px;
	}
	#chat-convert-ai-root.pos-bottom-left {
		left: 16px;
	}
	.cc-chat-window {
		position: fixed;
		bottom: 0;
		left: 0 !important;
		right: 0 !important;
		width: 100vw;
		max-width: 100vw;
		height: 100vh;
		max-height: 100vh;
		border-radius: 0;
	}
}
