/**
 * ConvoType Frontend Widget Styles
 * Modern, Professional UI/UX Design
 *
 * @package ConvoType
 */

/* ============================================
   CSS VARIABLES - Extended Color System
   ============================================ */
:root {
	/* Primary Gradient System */
	--convotype-primary: #7c3aed;
	--convotype-primary-light: #8b5cf6;
	--convotype-primary-dark: #6d28d9;
	--convotype-primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
	--convotype-primary-hover: #6d28d9;

	/* Background Colors */
	--convotype-bg: #ffffff;
	--convotype-bg-subtle: #fafafa;
	--convotype-bg-muted: #f1f5f9;
	--convotype-bg-card: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);

	/* Text Colors */
	--convotype-text: #1e293b;
	--convotype-text-muted: #64748b;
	--convotype-text-subtle: #94a3b8;

	/* Border Colors */
	--convotype-border: rgba(0, 0, 0, 0.06);
	--convotype-border-strong: rgba(0, 0, 0, 0.1);
	--convotype-border-focus: rgba(124, 58, 237, 0.3);

	/* Message Colors */
	--convotype-bot-bg: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
	--convotype-bot-bg-solid: #f3f4f6;
	--convotype-user-bg: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
	--convotype-user-text: #ffffff;

	/* Input Colors */
	--convotype-input-bg: #f8fafc;
	--convotype-input-text: #1e293b;

	/* Status Colors */
	--convotype-error: #ef4444;
	--convotype-success: #10b981;
	--convotype-warning: #f59e0b;

	/* Shadows - Layered System */
	--convotype-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
	--convotype-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
	--convotype-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
	--convotype-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
	--convotype-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.06);
	--convotype-shadow-primary: 0 4px 14px rgba(124, 58, 237, 0.25);
	--convotype-shadow-primary-lg: 0 8px 24px rgba(124, 58, 237, 0.3);

	/* Border Radius */
	--convotype-radius-sm: 8px;
	--convotype-radius-md: 12px;
	--convotype-radius-lg: 16px;
	--convotype-radius-xl: 20px;
	--convotype-radius-full: 9999px;
	--convotype-radius: var(--convotype-radius-lg);

	/* Typography */
	--convotype-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--convotype-font-weight: 400;
	--convotype-font-size: 16px;

	/* Transitions */
	--convotype-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
	--convotype-transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
	--convotype-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   TOOLTIP (CSS-only, data-tooltip attribute)
   ============================================ */
.convotype-tooltip {
	position: relative;
}

.convotype-tooltip::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%) scale(0.9);
	padding: 4px 8px;
	border-radius: 6px;
	background: var(--convotype-text);
	color: var(--convotype-bg);
	font-size: 11px;
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 150ms, transform 150ms;
}

.convotype-tooltip:hover::after {
	opacity: 1;
	transform: translateX(-50%) scale(1);
}

/* ============================================
   WIDGET CONTAINER
   ============================================ */
.convotype-widget {
	font-family: var(--convotype-font-sans);
	font-size: 14px;
	line-height: 1.6;
	color: var(--convotype-text);
	background: var(--convotype-bg);
	border-radius: var(--convotype-radius-xl);
	box-shadow: none;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: none;
}

.convotype-mode-embed {
	max-width: 100%;
	height: 600px;
}

.convotype-mode-popup {
	width: 400px;
	height: 580px;
}

/* ============================================
   HEADER - Gradient with Glassmorphism
   ============================================ */
.convotype-header {
	padding: 20px 24px;
	background: var(--convotype-header-bg, #ffffff);
	color: var(--convotype-header-text, #1f2937);
	position: relative;
	overflow: hidden;
	border-bottom: none;
}

/* Subtle pattern overlay */
.convotype-header::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: none;
	pointer-events: none;
}

.convotype-header h3 {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.02em;
	position: relative;
	text-shadow: none;
}

.convotype-subtitle {
	margin: 6px 0 0;
	font-size: 13px;
	opacity: 0.9;
	font-weight: 400;
	position: relative;
}

.convotype-close-btn {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	border: none;
	background: rgba(0, 0, 0, 0.06);
	backdrop-filter: blur(4px);
	color: var(--convotype-header-text, #6b7280);
	border-radius: var(--convotype-radius-sm);
	cursor: pointer;
	font-size: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--convotype-transition-fast);
}

.convotype-close-btn:hover {
	background: rgba(255, 255, 255, 0.25);
	transform: scale(1.05);
}

.convotype-close-btn:active {
	transform: scale(0.95);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.convotype-progress-container {
	padding: 10px 24px;
	background: var(--convotype-bg);
	border-bottom: 1px solid var(--convotype-border);
	display: flex;
	align-items: center;
	gap: 12px;
}

.convotype-progress-bar {
	flex: 1;
	height: 4px;
	background: var(--convotype-bg-muted);
	border-radius: var(--convotype-radius-full);
	overflow: hidden;
}

.convotype-progress-fill {
	height: 100%;
	background: var(--convotype-progress-color, var(--convotype-primary));
	border-radius: var(--convotype-radius-full);
	transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.convotype-progress-text {
	font-size: 11px;
	font-weight: 500;
	color: var(--convotype-text-muted);
	white-space: nowrap;
}

/* Minimal variant: flush thin line, no padding/border, no track bg */
.convotype-progress-bar.convotype-progress-bar--minimal {
	height: 3px;
	border-radius: 0;
	flex: none;
	width: 100%;
	background: transparent;
}

.convotype-progress-bar--minimal .convotype-progress-fill {
	border-radius: 0;
}

/* ============================================
   MESSAGES CONTAINER
   ============================================ */
.convotype-messages {
	flex: 1;
	overflow-y: auto;
	padding: 24px;
	padding-bottom: 28px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	scroll-behavior: smooth;
}

/* Custom Scrollbar */
.convotype-messages::-webkit-scrollbar {
	width: 6px;
}

.convotype-messages::-webkit-scrollbar-track {
	background: transparent;
}

.convotype-messages::-webkit-scrollbar-thumb {
	background: var(--convotype-border-strong);
	border-radius: var(--convotype-radius-full);
}

.convotype-messages::-webkit-scrollbar-thumb:hover {
	background: var(--convotype-text-subtle);
}

/* ============================================
   MESSAGE BUBBLES - Modern Design
   ============================================ */
.convotype-message {
	display: flex;
	flex-direction: column;
	animation: messageSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlideIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.convotype-message-bot {
	align-items: flex-start;
}

.convotype-message-user {
	align-items: flex-end;
}

.convotype-message-bubble {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	max-width: 85%;
}

.convotype-message-user .convotype-message-bubble {
	flex-direction: row-reverse;
}

/* Inline restart button on user messages */
.convotype-msg-restart-btn {
	width: 24px;
	height: 24px;
	border: none;
	border-radius: var(--convotype-radius-sm);
	background: var(--convotype-bg);
	color: var(--convotype-text-subtle);
	opacity: 0;
	transition: opacity 150ms, color 150ms;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	padding: 0;
	align-self: center;
}

.convotype-message-user:hover .convotype-msg-restart-btn {
	opacity: 1;
}

.convotype-msg-restart-btn:hover {
	color: var(--convotype-text);
}

/* Avatar Styling */
.convotype-avatar {
	width: 36px;
	height: 36px;
	border-radius: var(--convotype-radius-full);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
	box-shadow: var(--convotype-shadow-sm);
}

.convotype-avatar--square {
	border-radius: 6px;
}

.convotype-avatar--none {
	background: none !important;
	box-shadow: none;
	overflow: visible;
}

.convotype-avatar-svg {
	width: 100%;
	height: 100%;
}

.convotype-avatar-img {
	width: 100%;
	height: 100%;
	-o-object-fit: cover;
	   object-fit: cover;
}

/* Dashicon avatar */
.convotype-avatar .dashicons {
	font-size: 22px;
	width: 22px;
	height: 22px;
	line-height: 22px;
	color: inherit;
}

/* Message Content Styling */
.convotype-message-content {
	padding: 12px 16px;
	border-radius: var(--convotype-radius-xl);
	word-wrap: break-word;
	font-size: var(--convotype-font-size, 16px);
	line-height: 1.5;
	font-weight: var(--convotype-font-weight, 400);
}

.convotype-message-bot .convotype-message-content {
	background: var(--convotype-bot-bg);
	color: var(--convotype-text);
	border: 1px solid var(--convotype-border);
	border-bottom-left-radius: 6px;
	box-shadow: var(--convotype-shadow-xs);
}

.convotype-message-user .convotype-message-content {
	background: var(--convotype-user-bg);
	color: var(--convotype-user-text);
	border-bottom-right-radius: 6px;
	box-shadow: var(--convotype-shadow-primary);
}

.convotype-message-time {
	font-size: 11px;
	color: var(--convotype-text-subtle);
	margin-top: 4px;
	padding: 0 46px;
	font-weight: 400;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.convotype-typing-indicator {
	margin-bottom: 4px;
}

.convotype-typing-dots {
	display: flex;
	gap: 5px;
	padding: 12px 16px;
	background: var(--convotype-bot-bg);
	border: 1px solid var(--convotype-border);
	border-radius: var(--convotype-radius-xl);
	border-bottom-left-radius: 6px;
}

.convotype-typing-dots span {
	width: 8px;
	height: 8px;
	background: var(--convotype-primary);
	border-radius: var(--convotype-radius-full);
	animation: typingPulse 1.4s ease-in-out infinite;
}

.convotype-typing-dots span:nth-child(2) {
	animation-delay: 0.2s;
}

.convotype-typing-dots span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typingPulse {
	0%, 60%, 100% {
		transform: translateY(0) scale(1);
		opacity: 0.4;
	}
	30% {
		transform: translateY(-6px) scale(1.1);
		opacity: 1;
	}
}

/* ============================================
   INPUT AREA
   ============================================ */
.convotype-input-area {
	padding: 16px 24px;
	border-top: 1px solid var(--convotype-border);
	background: var(--convotype-bg);
}

.convotype-input-form {
	width: 100%;
}

.convotype-input-wrapper {
	display: flex;
	gap: 12px;
	align-items: flex-end;
}

.convotype-input {
	flex: 1;
	padding: 12px 16px;
	min-height: 44px;
	border: 1px solid var(--convotype-border-strong);
	border-radius: var(--convotype-radius-md);
	font-size: 14px;
	font-family: inherit;
	background: var(--convotype-input-bg);
	color: var(--convotype-input-text);
	outline: none;
	transition: var(--convotype-transition-fast);
	box-sizing: border-box;
}

.convotype-input::-moz-placeholder {
	color: var(--convotype-text-muted);
}

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

.convotype-input:focus {
	border-color: rgba(0, 0, 0, 0.15);
	background: var(--convotype-bg);
}

.convotype-input-error {
	border-color: var(--convotype-error);
}

.convotype-input-error:focus {
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

button.convotype-send-btn {
	width: 44px;
	height: 44px;
	border: none;
	background: var(--convotype-primary);
	background-color: var(--convotype-primary);
	color: white;
	border-radius: var(--convotype-radius-sm);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--convotype-transition-fast);
	flex-shrink: 0;
	box-sizing: border-box;
	padding: 0;
}

button.convotype-send-btn svg {
	width: 18px;
	height: 18px;
	color: white;
	fill: none;
	stroke: currentColor;
}

/* Send button style variants */
button.convotype-send-btn--text {
	width: auto;
	min-width: 44px;
	padding: 0 16px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
}

button.convotype-send-btn--icon-text {
	width: auto;
	min-width: 44px;
	padding: 0 14px;
	gap: 6px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
}

button.convotype-send-btn:hover:not(:disabled) {
	background: var(--convotype-primary-dark);
	background-color: var(--convotype-primary-dark);
}

button.convotype-send-btn:active:not(:disabled) {
	transform: scale(0.95);
}

button.convotype-send-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.convotype-input-error-message {
	margin-top: 8px;
	font-size: 12px;
	color: var(--convotype-error);
	padding-left: 4px;
}

/* ============================================
   BUTTON CHOICES - Glass Effect
   ============================================ */
.convotype-button-choices {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.convotype-choices-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.convotype-widget .convotype-choice-btn {
	padding: 11px 18px;
	background: var(--convotype-bg, #ffffff) !important;
	border: 1px solid var(--convotype-primary, #7c3aed) !important;
	border-radius: var(--convotype-radius-md);
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	font-family: inherit;
	color: var(--convotype-primary, #7c3aed) !important;
	transition: var(--convotype-transition-fast);
	display: flex;
	align-items: center;
	gap: 8px;
	box-shadow: var(--convotype-shadow-xs);
}

.convotype-widget .convotype-choice-btn:hover:not(:disabled) {
	transform: translateY(-2px);
	border-color: var(--convotype-primary, #7c3aed) !important;
	box-shadow: var(--convotype-shadow-md);
	opacity: 0.85;
}

.convotype-choice-btn:active:not(:disabled) {
	transform: translateY(0) scale(0.98);
}

.convotype-widget .convotype-choice-btn.selected {
	background: var(--convotype-primary, #7c3aed) !important;
	border-color: transparent !important;
	color: var(--convotype-btn-text, #ffffff) !important;
	box-shadow: var(--convotype-shadow-primary);
}

.convotype-widget .convotype-choice-btn.selected:hover:not(:disabled) {
	box-shadow: var(--convotype-shadow-primary-lg);
}

.convotype-choice-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.convotype-checkbox {
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-radius: 5px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	transition: var(--convotype-transition-fast);
}

.convotype-choice-btn.selected .convotype-checkbox {
	background: rgba(255, 255, 255, 0.2);
}

.convotype-submit-choices {
	padding: 12px 24px;
	border: none;
	background: var(--convotype-primary);
	color: var(--convotype-btn-text, #ffffff);
	border-radius: var(--convotype-radius-md);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	transition: var(--convotype-transition-fast);
	box-shadow: var(--convotype-shadow-primary);
	align-self: flex-start;
}

.convotype-submit-choices:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: var(--convotype-shadow-primary-lg);
}

.convotype-submit-choices:active:not(:disabled) {
	transform: translateY(0) scale(0.98);
}

.convotype-submit-choices:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ============================================
   INLINE INPUT BLOCK - Modern Card Design
   ============================================ */
.convotype-inline-input-block {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 4px 0;
	width: 100%;
}

.convotype-inline-input-active {
	flex-direction: column;
	gap: 12px;
}

.convotype-inline-input-completed {
	flex-direction: row;
	max-width: 85%;
	margin-bottom: -10px;
}

.convotype-inline-input-block .convotype-avatar {
	flex-shrink: 0;
}

.convotype-inline-input-active .convotype-inline-content {
	flex: 1;
	min-width: 0;
}

/* Two-row layout: Question row (left-aligned) */
.convotype-inline-question-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	max-width: 85%;
}

/* Question bubble matching bot message styling */
.convotype-inline-question-bubble {
	padding: 12px 16px;
	background: var(--convotype-bot-bg);
	border: 1px solid var(--convotype-border);
	border-radius: var(--convotype-radius-xl);
	border-bottom-left-radius: 6px;
	box-shadow: var(--convotype-shadow-xs);
	font-size: var(--convotype-font-size, 16px);
	line-height: 1.5;
	font-weight: var(--convotype-font-weight, 400);
	color: var(--convotype-text);
}

/* Two-row layout: Input row (right-aligned) */
.convotype-inline-input-row {
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: flex-end;
	align-self: flex-end;
	max-width: 85%;
}

/* Back icon button (appears on hover of input row) */
.convotype-back-icon-btn {
	width: 32px;
	height: 32px;
	border: none;
	border-radius: var(--convotype-radius-sm);
	background: var(--convotype-bg);
	color: var(--convotype-text-subtle);
	opacity: 0;
	transition: opacity 150ms, color 150ms;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	padding: 0;
}

.convotype-inline-input-row:hover .convotype-back-icon-btn,
.convotype-back-icon-btn:focus-visible {
	opacity: 1;
}

.convotype-back-icon-btn:hover {
	color: var(--convotype-text);
}

/* Input card styling — transparent pass-through */
.convotype-inline-input-card {
	min-width: 240px;
}

.convotype-inline-input-completed .convotype-inline-content {
	background: var(--convotype-bot-bg);
	padding: 12px 16px;
	border-radius: var(--convotype-radius-xl);
	border-bottom-left-radius: 6px;
	border: 1px solid var(--convotype-border);
}

.convotype-inline-question {
	font-size: var(--convotype-font-size, 16px);
	color: var(--convotype-text);
	line-height: 1.5;
	font-weight: var(--convotype-font-weight, 400);
}

.convotype-inline-input-completed .convotype-inline-question {
	margin-bottom: 0;
	font-size: var(--convotype-font-size, 16px);
	font-weight: var(--convotype-font-weight, 400);
}

.convotype-inline-input {
	margin-bottom: 0;
}

/* Inline mode styles for inputs */
.convotype-input-form.convotype-inline-mode {
	width: 100%;
}

.convotype-inline-mode .convotype-input-wrapper {
	border: none;
}

.convotype-inline-mode .convotype-input {
	border: 1px solid var(--convotype-border-strong);
	border-radius: var(--convotype-radius-sm);
	padding: 10px 16px;
	height: 44px;
	background: var(--convotype-input-bg);
}

.convotype-inline-mode .convotype-textarea {
	height: auto;
	min-height: calc(1.5em * 4 + 20px);
	resize: none;
}

.convotype-inline-mode .convotype-input:focus {
	border-color: var(--convotype-primary) !important;
	box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
	background: var(--convotype-bg);
	outline: none;
}

.convotype-inline-mode .convotype-send-btn {
	width: 44px;
	height: 44px;
}

.convotype-inline-mode .convotype-send-btn--text {
	width: auto;
	padding: 0 18px;
}

.convotype-inline-mode .convotype-send-btn--icon-text {
	width: auto;
	padding: 0 16px;
}

.convotype-inline-mode .convotype-send-btn span {
	font-size: 18px;
}

/* Inline mode styles for buttons */
.convotype-button-choices.convotype-inline-mode {
	padding: 0;
}

.convotype-button-choices.convotype-inline-mode .convotype-choices-grid {
	gap: 8px;
}

.convotype-button-choices.convotype-inline-mode .convotype-choice-btn {
	padding: 10px 16px;
	font-size: 13px;
	border-radius: var(--convotype-radius-sm);
}

/* ============================================
   END NODE
   ============================================ */
.convotype-end {
	text-align: center;
	padding: 24px;
}

.convotype-end p {
	font-size: 16px;
	color: var(--convotype-text);
	margin: 0 0 16px;
}

.convotype-redirect-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	background: var(--convotype-primary);
	color: var(--convotype-btn-text, #ffffff);
	text-decoration: none;
	border-radius: var(--convotype-radius-md);
	font-weight: 600;
	transition: var(--convotype-transition-fast);
	box-shadow: var(--convotype-shadow-primary);
}

.convotype-redirect-btn:hover {
	transform: translateY(-2px);
	box-shadow: var(--convotype-shadow-primary-lg);
	color: var(--convotype-btn-text, #ffffff);
}

/* ============================================
   FOOTER - Refined Branding
   ============================================ */
.convotype-footer {
	padding: 12px 24px;
	text-align: center;
	background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.01) 100%);
	border-top: none;
}

.convotype-branding {
	font-size: 11px;
	color: var(--convotype-text-subtle);
	display: inline-flex;
	align-items: center;
	gap: 4px;
	opacity: 0.7;
	transition: var(--convotype-transition-fast);
}

.convotype-branding:hover {
	opacity: 1;
	color: var(--convotype-text-muted);
}

/* ============================================
   POPUP MODE
   ============================================ */
.convotype-popup-trigger {
	border: none;
	border-radius: var(--convotype-radius-md);
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 10px;
	box-shadow: var(--convotype-shadow-lg);
	z-index: 9998;
	font-family: var(--convotype-font-sans);
	font-weight: 600;
	transition: var(--convotype-transition-fast);
}

.convotype-popup-trigger:hover {
	transform: translateY(-2px) scale(1.02);
	box-shadow: var(--convotype-shadow-xl);
}

.convotype-popup-trigger:active {
	transform: translateY(0) scale(0.98);
}

.convotype-trigger-icon {
	font-size: 1.2em;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.convotype-trigger-icon svg {
	width: 1.2em;
	height: 1.2em;
	flex-shrink: 0;
}

.convotype-trigger-text {
	white-space: nowrap;
}

.convotype-popup-trigger--open {
	padding: 12px !important;
	border-radius: var(--convotype-radius-full) !important;
}

.convotype-popup-trigger--open .convotype-trigger-icon {
	font-size: 1.5em;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

.convotype-popup-container {
	z-index: 9999;
}

/* ============================================
   LOADING STATE - SKELETON LOADER
   ============================================ */
@keyframes convotype-shimmer {
	0% {
		background-position: -200% 0;
	}
	100% {
		background-position: 200% 0;
	}
}

.convotype-loading {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}

.convotype-skeleton-header {
	background: var(--convotype-primary-gradient);
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.convotype-skeleton-messages {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 16px;
	overflow: hidden;
}

.convotype-skeleton-message {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.convotype-skeleton-message-bot {
	flex-direction: row;
}

.convotype-skeleton-message-user {
	flex-direction: row-reverse;
}

.convotype-skeleton-avatar {
	width: 36px;
	height: 36px;
	border-radius: var(--convotype-radius-full);
	background: var(--convotype-bg-muted);
	flex-shrink: 0;
}

.convotype-skeleton-bubble {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 16px;
	border-radius: var(--convotype-radius-lg);
	border-top-left-radius: 4px;
	background: var(--convotype-bg-muted);
	max-width: 70%;
	min-width: 120px;
}

.convotype-skeleton-bubble-user {
	border-radius: var(--convotype-radius-lg);
	border-top-right-radius: 4px;
	border-top-left-radius: var(--convotype-radius-lg);
	background: var(--convotype-primary-gradient);
	opacity: 0.7;
}

.convotype-skeleton-line {
	height: 12px;
	border-radius: 6px;
	background: linear-gradient(
		90deg,
		var(--convotype-border) 25%,
		var(--convotype-bg-muted) 50%,
		var(--convotype-border) 75%
	);
	background-size: 200% 100%;
	animation: convotype-shimmer 1.5s ease-in-out infinite;
}

.convotype-skeleton-message:nth-child(1) .convotype-skeleton-line {
	animation-delay: 0s;
}

.convotype-skeleton-message:nth-child(2) .convotype-skeleton-line {
	animation-delay: 0.15s;
}

.convotype-skeleton-message:nth-child(3) .convotype-skeleton-line {
	animation-delay: 0.3s;
}

.convotype-skeleton-message:nth-child(4) .convotype-skeleton-line {
	animation-delay: 0.45s;
}

.convotype-skeleton-input-area {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-top: 1px solid var(--convotype-border);
}

.convotype-skeleton-input {
	flex: 1;
	height: 44px;
	border-radius: var(--convotype-radius-lg);
	background: var(--convotype-bg-muted);
}

.convotype-skeleton-send-btn {
	width: 44px;
	height: 44px;
	border-radius: var(--convotype-radius-full);
	background: var(--convotype-bg-muted);
	flex-shrink: 0;
}

.convotype-spinner-small {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: white;
	border-radius: var(--convotype-radius-full);
	animation: spin 0.6s linear infinite;
	display: inline-block;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* ============================================
   ERROR STATE
   ============================================ */
.convotype-error {
	text-align: center;
	padding: 48px 24px;
}

.convotype-error p {
	color: var(--convotype-error);
	margin-bottom: 20px;
	font-size: 14px;
}

.convotype-error button {
	padding: 12px 24px;
	border: none;
	background: var(--convotype-primary);
	color: var(--convotype-btn-text, #ffffff);
	border-radius: var(--convotype-radius-md);
	cursor: pointer;
	font-weight: 600;
	font-family: inherit;
	transition: var(--convotype-transition-fast);
	box-shadow: var(--convotype-shadow-primary);
}

.convotype-error button:hover {
	transform: translateY(-2px);
	box-shadow: var(--convotype-shadow-primary-lg);
}

/* ============================================
   RATING INPUT
   ============================================ */
.convotype-rating-input {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.convotype-rating-stars {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.convotype-rating-star {
	background: none;
	border: none;
	padding: 2px;
	cursor: pointer;
	transition: var(--convotype-transition-fast);
}

.convotype-rating-star:hover {
	transform: scale(1.2);
}

.convotype-rating-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.convotype-rating-number {
	width: 38px;
	height: 38px;
	border: 2px solid var(--convotype-border-strong);
	background: var(--convotype-bg);
	border-radius: var(--convotype-radius-full);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	color: var(--convotype-text);
	transition: var(--convotype-transition-fast);
	display: flex;
	align-items: center;
	justify-content: center;
}

.convotype-rating-number:hover {
	border-color: var(--convotype-primary);
	transform: translateY(-2px);
}

.convotype-rating-number.selected {
	background: var(--convotype-primary);
	border-color: transparent;
	color: var(--convotype-btn-text, #ffffff);
	box-shadow: var(--convotype-shadow-primary);
}

.convotype-rating-emojis {
	display: flex;
	gap: 12px;
}

.convotype-rating-emoji {
	font-size: 28px;
	background: none;
	border: 2px solid transparent;
	padding: 6px;
	border-radius: var(--convotype-radius-md);
	cursor: pointer;
	transition: var(--convotype-transition-fast);
	opacity: 0.5;
}

.convotype-rating-emoji:hover {
	opacity: 1;
	transform: scale(1.15);
}

.convotype-rating-emoji.selected {
	opacity: 1;
	border-color: var(--convotype-primary);
	background: rgba(124, 58, 237, 0.08);
}

.convotype-rating-submit {
	padding: 12px 20px;
	border: none;
	background: var(--convotype-primary);
	color: var(--convotype-btn-text, #ffffff);
	border-radius: var(--convotype-radius-md);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	transition: var(--convotype-transition-fast);
	align-self: flex-start;
	box-shadow: var(--convotype-shadow-primary);
}

.convotype-rating-submit:hover {
	transform: translateY(-2px);
	box-shadow: var(--convotype-shadow-primary-lg);
}

/* Rating submit size variants */
.convotype-rating-submit--small { padding: 10px 16px; font-size: 13px; }
.convotype-rating-submit--medium { padding: 12px 20px; font-size: 14px; }
.convotype-rating-submit--large { padding: 14px 24px; font-size: 15px; }

/* Rating display in user message bubble */
.convotype-rating-bubble-stars { display: inline-flex; gap: 2px; align-items: center; }
.convotype-rating-bubble-emoji { font-size: 20px; line-height: 1; }
.convotype-rating-bubble-number { font-weight: 600; font-size: 14px; }

/* ============================================
   FILE UPLOAD
   ============================================ */
.convotype-file-upload {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.convotype-file-dropzone {
	border: 2px dashed var(--convotype-border-strong);
	border-radius: var(--convotype-radius-lg);
	padding: 28px;
	text-align: center;
	cursor: pointer;
	transition: var(--convotype-transition-fast);
	background: var(--convotype-bg);
}

.convotype-file-dropzone:hover {
	border-color: var(--convotype-primary);
	background: rgba(124, 58, 237, 0.02);
}

.convotype-file-dropzone-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.convotype-file-icon {
	font-size: 32px;
}

.convotype-file-text {
	font-size: 14px;
	color: var(--convotype-text);
	font-weight: 500;
}

.convotype-file-hint {
	font-size: 12px;
	color: var(--convotype-text-subtle);
}

.convotype-file-input-hidden {
	display: none;
}

.convotype-file-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.convotype-file-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	background: var(--convotype-bg-muted);
	border-radius: var(--convotype-radius-md);
}

.convotype-file-item-icon {
	font-size: 20px;
}

.convotype-file-item-info {
	flex: 1;
	min-width: 0;
}

.convotype-file-item-name {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: var(--convotype-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.convotype-file-item-size {
	font-size: 11px;
	color: var(--convotype-text-subtle);
}

.convotype-file-item-remove {
	width: 28px;
	height: 28px;
	border: none;
	background: transparent;
	color: var(--convotype-text-subtle);
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--convotype-radius-full);
	transition: var(--convotype-transition-fast);
}

.convotype-file-item-remove:hover {
	background: var(--convotype-error);
	color: white;
}

.convotype-file-error {
	font-size: 12px;
	color: var(--convotype-error);
	padding: 10px 14px;
	background: rgba(239, 68, 68, 0.08);
	border-radius: var(--convotype-radius-md);
}

.convotype-file-progress {
	position: relative;
	height: 24px;
	background: var(--convotype-bg-muted);
	border-radius: var(--convotype-radius-full);
	overflow: hidden;
}

.convotype-file-progress-bar {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background: var(--convotype-primary);
	transition: width 0.3s ease-out;
}

.convotype-file-progress-text {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 11px;
	font-weight: 600;
	color: var(--convotype-text);
}

.convotype-file-submit {
	padding: 12px 20px;
	border: none;
	background: var(--convotype-primary);
	color: var(--convotype-btn-text, #ffffff);
	border-radius: var(--convotype-radius-md);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	transition: var(--convotype-transition-fast);
	align-self: flex-start;
	box-shadow: var(--convotype-shadow-primary);
}

.convotype-file-submit:hover {
	transform: translateY(-2px);
	box-shadow: var(--convotype-shadow-primary-lg);
}

/* ============================================
   EMBED, VIDEO, AUDIO, IMAGE CONTENT
   ============================================ */
.convotype-message-embed {
	max-width: 100%;
}

.convotype-message-embed iframe {
	max-width: 100%;
	border-radius: var(--convotype-radius-md);
	display: block;
}

.convotype-message-embed .convotype-message-caption,
.convotype-message-video .convotype-message-caption,
.convotype-message-audio .convotype-message-caption {
	margin-top: 10px;
	font-size: 13px;
	color: var(--convotype-text-muted);
}

.convotype-message-video {
	max-width: 100%;
}

.convotype-video-player {
	max-width: 100%;
	border-radius: var(--convotype-radius-md);
	display: block;
}

.convotype-message-audio {
	max-width: 100%;
}

.convotype-audio-player {
	width: 100%;
	border-radius: var(--convotype-radius-md);
}

.convotype-message-image img {
	max-width: 100%;
	border-radius: var(--convotype-radius-md);
	display: block;
}

.convotype-message-caption {
	margin-top: 10px;
	font-size: 13px;
	color: var(--convotype-text-muted);
}

/* ============================================
   PRODUCT CARD
   ============================================ */
.convotype-product-card {
	background: var(--convotype-bg);
	border: 1px solid var(--convotype-border-strong);
	border-radius: var(--convotype-radius-lg);
	overflow: hidden;
	max-width: 280px;
	box-shadow: var(--convotype-shadow-sm);
}

.convotype-product-message {
	padding: 14px 14px 0;
	font-size: 14px;
	color: var(--convotype-text);
}

.convotype-product-image {
	width: 100%;
	height: auto;
	display: block;
}

.convotype-product-info {
	padding: 14px;
}

.convotype-product-name {
	font-weight: 600;
	color: var(--convotype-text);
	margin-bottom: 6px;
}

.convotype-product-price {
	font-size: 18px;
	font-weight: 700;
	color: var(--convotype-primary);
	margin-bottom: 10px;
}

.convotype-product-description {
	font-size: 13px;
	color: var(--convotype-text-muted);
	margin-bottom: 14px;
	line-height: 1.5;
}

.convotype-product-link {
	display: inline-flex;
	align-items: center;
	padding: 10px 18px;
	background: var(--convotype-primary);
	color: var(--convotype-btn-text, #ffffff);
	text-decoration: none;
	border-radius: var(--convotype-radius-sm);
	font-size: 13px;
	font-weight: 600;
	transition: var(--convotype-transition-fast);
	box-shadow: var(--convotype-shadow-primary);
}

.convotype-product-link:hover {
	transform: translateY(-1px);
	box-shadow: var(--convotype-shadow-primary-lg);
	color: var(--convotype-btn-text, #ffffff);
}

/* ============================================
   ACCESSIBILITY & ANIMATIONS
   ============================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
	.convotype-widget *,
	.convotype-widget *::before,
	.convotype-widget *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* Enhanced focus states for keyboard navigation */
.convotype-input:focus-visible {
	outline: none;
}

.convotype-choice-btn:focus-visible,
.convotype-send-btn:focus-visible,
.convotype-submit-choices:focus-visible,
.convotype-rating-submit:focus-visible,
.convotype-file-submit:focus-visible,
.convotype-close-btn:focus-visible {
	outline: 2px solid rgba(0, 0, 0, 0.15);
	outline-offset: 2px;
}

/* SVG Checkmark with draw animation */
.convotype-checkbox-svg {
	width: 16px;
	height: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.convotype-checkbox-svg svg {
	width: 12px;
	height: 12px;
}

.convotype-checkbox-svg path {
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
	fill: none;
	stroke-dasharray: 16;
	stroke-dashoffset: 16;
}

.convotype-choice-btn.selected .convotype-checkbox-svg path {
	animation: drawCheck 200ms ease forwards;
}

@keyframes drawCheck {
	to {
		stroke-dashoffset: 0;
	}
}

/* ============================================
   CHAT ACTIONS (Back / Restart)
   ============================================ */
.convotype-chat-actions {
	display: flex;
	gap: 16px;
	padding: 4px 46px 2px;
}

.convotype-chat-action-link {
	background: none;
	border: none;
	padding: 0;
	font-family: inherit;
	font-size: 11px;
	font-weight: 400;
	color: var(--convotype-text-subtle);
	cursor: pointer;
	transition: color var(--convotype-transition-fast);
}

.convotype-chat-action-link:hover {
	color: var(--convotype-text-muted);
}

/* Completed state: centered */
.convotype-chat-actions--complete {
	justify-content: center;
	padding: 12px 24px 4px;
}

.convotype-restart-btn {
	padding: 10px 24px;
	background: var(--convotype-bg);
	border: 1px solid var(--convotype-border-strong);
	border-radius: var(--convotype-radius-md);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	color: var(--convotype-text-muted);
	cursor: pointer;
	transition: var(--convotype-transition-fast);
}

.convotype-restart-btn:hover {
	background: var(--convotype-bg-muted);
	color: var(--convotype-text);
	border-color: var(--convotype-text-subtle);
}

.convotype-restart-btn:active {
	transform: scale(0.97);
}

/* Bottom mode: align with bottom input area padding */
.convotype-input-bottom > .convotype-chat-actions {
	padding: 6px 20px 0;
}

.convotype-input-bottom > .convotype-chat-actions--complete {
	padding: 12px 20px 4px;
}

/* ============================================
   BOTTOM INPUT POSITION MODE
   ============================================ */

/* Widget layout adjustments for bottom input */
.convotype-widget.convotype-input-bottom {
	display: flex;
	flex-direction: column;
}

.convotype-input-bottom .convotype-messages {
	flex: 1;
	min-height: 0;
	padding-bottom: 16px;
}

/* Bottom Input Area Container */
.convotype-bottom-input-area {
	border-top: 1px solid var(--convotype-border);
	background: var(--convotype-bg);
	padding: 16px 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex-shrink: 0;
}

/* Input content container */
.convotype-bottom-input-content {
	width: 100%;
}

/* Adjust input form in bottom mode */
.convotype-bottom-input-area .convotype-input-form {
	width: 100%;
}

.convotype-bottom-input-area .convotype-input-wrapper {
	background: var(--convotype-bg-subtle);
	border-radius: var(--convotype-radius-md);
	padding: 4px;
}

.convotype-bottom-input-area .convotype-input {
	border: 1px solid var(--convotype-border);
	border-radius: var(--convotype-radius-sm);
	padding: 12px 16px;
	min-height: 44px;
	background: var(--convotype-input-bg);
}

.convotype-bottom-input-area .convotype-input:focus {
	border-color: var(--convotype-primary);
	background: var(--convotype-bg);
}

/* Button choices in bottom mode */
.convotype-bottom-input-area .convotype-button-choices {
	padding: 0;
}

.convotype-bottom-input-area .convotype-choices-grid {
	flex-wrap: wrap;
	justify-content: flex-start;
}

/* Rating in bottom mode */
.convotype-bottom-input-area .convotype-rating-input {
	align-items: flex-start;
}

/* File upload in bottom mode - more compact */
.convotype-bottom-input-area .convotype-file-dropzone {
	padding: 20px;
}

/* Textarea in bottom mode */
.convotype-bottom-input-area .convotype-textarea {
	min-height: 60px;
	max-height: 120px;
	resize: none;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 480px) {
	.convotype-popup-container {
		bottom: 0 !important;
		right: 0 !important;
		left: 0 !important;
		top: auto !important;
		width: 100% !important;
		max-width: 100% !important;
		transform: none !important;
	}

	.convotype-popup-container .convotype-mode-popup {
		width: 100% !important;
		height: 100vh !important;
		max-height: 100vh !important;
		border-radius: 0 !important;
	}

	.convotype-popup-trigger {
		bottom: 16px !important;
		right: 16px !important;
		left: auto !important;
		top: auto !important;
		transform: none !important;
	}

	.convotype-header {
		padding: 18px 20px;
	}

	.convotype-messages {
		padding: 20px;
	}

	.convotype-input-area {
		padding: 14px 20px;
	}

	.convotype-inline-input-completed {
		max-width: 95%;
	}

	.convotype-inline-question-row,
	.convotype-inline-input-row {
		max-width: 95%;
	}

	/* Bottom input responsive */
	.convotype-bottom-input-area {
		padding: 12px 16px;
	}

}

