/**
 * Front-end styles for the AI Conversational Forms widget.
 *
 * Scoped under .afb-aicf-widget to avoid clashing with theme styles.
 */

.afb-aicf-widget {
	--afb-aicf-accent: #228be6;
	--afb-aicf-bg: #ffffff;
	--afb-aicf-assistant-bg: #f1f3f5;
	--afb-aicf-user-bg: #228be6;
	--afb-aicf-user-color: #ffffff;
	--afb-aicf-border: #e2e6ea;

	max-width: 560px;
	margin: 0 auto;
	border: 1px solid var(--afb-aicf-border);
	border-radius: 14px;
	background: var(--afb-aicf-bg);
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.08 );
	overflow: hidden;
	font-family: inherit;
	box-sizing: border-box;
}

.afb-aicf-widget * {
	box-sizing: border-box;
}

.afb-aicf-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	border-bottom: 1px solid var(--afb-aicf-border);
	background: linear-gradient( 135deg, rgba( 34, 139, 230, 0.08 ), rgba( 34, 139, 230, 0.02 ) );
}

.afb-aicf-avatar {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--afb-aicf-accent);
	flex: 0 0 auto;
}

.afb-aicf-title {
	font-weight: 600;
	font-size: 15px;
	color: #1d2327;
}

.afb-aicf-messages {
	padding: 18px;
	height: 380px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.afb-aicf-row {
	display: flex;
}

.afb-aicf-row-user {
	justify-content: flex-end;
}

.afb-aicf-bubble {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.afb-aicf-bubble-assistant {
	background: var(--afb-aicf-assistant-bg);
	color: #1d2327;
	border-bottom-left-radius: 4px;
}

.afb-aicf-bubble-ooc .afb-aicf-ooc-msg {
	margin: 0 0 10px;
	font-weight: 600;
}

.afb-aicf-bubble-ooc .afb-aicf-ooc-buy {
	display: inline-block;
	text-decoration: none;
}

.afb-aicf-bubble-user {
	background: var(--afb-aicf-user-bg);
	color: var(--afb-aicf-user-color);
	border-bottom-right-radius: 4px;
}

.afb-aicf-dot {
	display: inline-block;
	width: 6px;
	height: 6px;
	margin: 0 2px;
	border-radius: 50%;
	background: #adb5bd;
	animation: afb-aicf-blink 1.4s infinite both;
}

.afb-aicf-dot:nth-child( 2 ) {
	animation-delay: 0.2s;
}

.afb-aicf-dot:nth-child( 3 ) {
	animation-delay: 0.4s;
}

@keyframes afb-aicf-blink {
	0%, 80%, 100% {
		opacity: 0.3;
	}
	40% {
		opacity: 1;
	}
}

.afb-aicf-input-bar {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--afb-aicf-border);
}

.afb-aicf-input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid var(--afb-aicf-border);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
	max-height: 120px;
	color: #1d2327;
	background: #fff;
}

.afb-aicf-input:focus {
	outline: none;
	border-color: var(--afb-aicf-accent);
	box-shadow: 0 0 0 2px rgba( 34, 139, 230, 0.2 );
}

.afb-aicf-input:disabled {
	background: #f8f9fa;
}

.afb-aicf-send {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 10px;
	background: var(--afb-aicf-accent);
	cursor: pointer;
	position: relative;
	transition: background 0.15s ease;
}

.afb-aicf-send::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 16px;
	transform: translate( -55%, -50% );
	background: #fff;
	clip-path: polygon( 0 0, 100% 50%, 0 100%, 30% 50% );
}

.afb-aicf-send:hover {
	background: #1c7ed6;
}

.afb-aicf-send:disabled {
	background: #adb5bd;
	cursor: default;
}

.afb-aicf-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.afb-aicf-restart {
	margin-left: auto;
	border: 1px solid rgba(255, 255, 255, 0.5);
	background: transparent;
	color: inherit;
	font-size: 12px;
	padding: 3px 10px;
	border-radius: 999px;
	cursor: pointer;
}

.afb-aicf-progress {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	font-size: 12px;
}

.afb-aicf-progress-bar {
	flex: 1;
	height: 6px;
	border-radius: 999px;
	background: #e6e6ec;
	overflow: hidden;
}

.afb-aicf-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: #2563eb;
	transition: width 0.3s ease;
}

.afb-aicf-progress-label {
	white-space: nowrap;
	color: #555;
}

.afb-aicf-summary {
	max-width: 90%;
	padding: 12px 14px;
	border: 1px solid #d6d6e0;
	border-radius: 12px;
	background: #fbfbfd;
}

.afb-aicf-summary-title {
	margin: 0 0 8px;
	font-weight: 600;
}

.afb-aicf-summary-list {
	margin: 0 0 12px;
}

.afb-aicf-summary-list dt {
	font-weight: 600;
	margin-top: 6px;
}

.afb-aicf-summary-list dd {
	margin: 0 0 4px;
	word-break: break-word;
}

.afb-aicf-summary-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.afb-aicf-summary-confirm,
.afb-aicf-summary-edit {
	padding: 8px 14px;
	border-radius: 8px;
	border: 1px solid transparent;
	cursor: pointer;
	font-size: 14px;
}

.afb-aicf-summary-confirm {
	background: #2563eb;
	color: #fff;
}

.afb-aicf-summary-edit {
	background: transparent;
	border-color: #c2c2cf;
	color: #333;
}

.afb-aicf-error {
	color: #b32d2e;
	font-weight: 600;
}

.afb-aicf-success {
	max-width: 560px;
	margin: 0 auto;
	padding: 16px 20px;
	border: 1px solid #c3e6cb;
	border-radius: 12px;
	background: #d4edda;
	color: #155724;
	font-weight: 500;
}

.afb-aicf-consent {
	max-width: 560px;
	padding: 16px 18px;
	border: 1px solid #d6d6e0;
	border-radius: 12px;
	background: #f7f7fb;
}

.afb-aicf-consent-text {
	margin: 0 0 12px;
	color: #333;
}

.afb-aicf-consent-label {
	display: block;
	margin-bottom: 12px;
	cursor: pointer;
}

.afb-aicf-consent-start[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}
