/**
 * Daiane AI Chat — frontend styles.
 * Every selector is prefixed with dai-chat- to avoid theme collisions.
 */

.dai-chat-root {
	--dai-chat-teal: #0e9f8a;
	--dai-chat-teal-dark: #0b7f6e;
	--dai-chat-ink: #1f2937;
	--dai-chat-muted: #6b7280;
	--dai-chat-bg: #ffffff;
	--dai-chat-bot-bg: #f1f5f4;
	--dai-chat-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	z-index: 999999;
}

/* Floating bubble */
.dai-chat-bubble {
	position: fixed;
	right: 22px;
	bottom: 22px;
	width: 62px;
	height: 62px;
	border-radius: 50%;
	border: 3px solid #ffffff;
	background: var(--dai-chat-teal);
	box-shadow: var(--dai-chat-shadow);
	cursor: pointer;
	padding: 0;
	overflow: visible;
	transition: transform 0.15s ease;
}

.dai-chat-bubble:hover {
	transform: scale(1.06);
}

.dai-chat-bubble-avatar {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

.dai-chat-bubble-ping {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #22c55e;
	border: 2px solid #ffffff;
}

/* Panel */
.dai-chat-panel {
	position: fixed;
	right: 22px;
	bottom: 96px;
	width: 378px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 130px);
	background: var(--dai-chat-bg);
	border-radius: 18px;
	box-shadow: var(--dai-chat-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.dai-chat-hidden {
	opacity: 0;
	transform: translateY(14px) scale(0.98);
	pointer-events: none;
}

/* Header */
.dai-chat-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 12px;
	background: linear-gradient(135deg, var(--dai-chat-teal) 0%, var(--dai-chat-teal-dark) 100%);
	color: #ffffff;
}

.dai-chat-header-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.85);
	flex: none;
}

.dai-chat-header-text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.dai-chat-header-name {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
}

.dai-chat-header-sub {
	font-size: 12px;
	opacity: 0.92;
	display: flex;
	align-items: center;
	gap: 6px;
}

.dai-chat-online-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
	flex: none;
}

.dai-chat-icon-btn {
	background: transparent;
	border: 0;
	color: #ffffff;
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
	line-height: 0;
}

.dai-chat-icon-btn:hover {
	background: rgba(255, 255, 255, 0.18);
}

/* Messages */
.dai-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafcfb;
}

.dai-chat-msg {
	display: flex;
}

.dai-chat-msg-bot {
	justify-content: flex-start;
}

.dai-chat-msg-user {
	justify-content: flex-end;
}

.dai-chat-bubble-text {
	max-width: 82%;
	padding: 10px 13px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.45;
	color: var(--dai-chat-ink);
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.dai-chat-msg-bot .dai-chat-bubble-text {
	background: var(--dai-chat-bot-bg);
	border-bottom-left-radius: 4px;
}

.dai-chat-msg-user .dai-chat-bubble-text {
	background: var(--dai-chat-teal);
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

/* Typing indicator */
.dai-chat-typing .dai-chat-bubble-text {
	display: flex;
	gap: 5px;
	align-items: center;
	padding: 14px 16px;
}

.dai-chat-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--dai-chat-muted);
	animation: dai-chat-blink 1.2s infinite;
}

.dai-chat-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.dai-chat-dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes dai-chat-blink {
	0%, 60%, 100% {
		opacity: 0.25;
		transform: translateY(0);
	}
	30% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

/* Quick replies */
.dai-chat-quick {
	display: flex;
	gap: 8px;
	padding: 10px 12px 4px;
	overflow-x: auto;
	background: #fafcfb;
	flex: none;
}

.dai-chat-quick button {
	flex: none;
	border: 1px solid var(--dai-chat-teal);
	background: #ffffff;
	color: var(--dai-chat-teal-dark);
	font-size: 13px;
	font-weight: 600;
	border-radius: 999px;
	padding: 7px 13px;
	cursor: pointer;
	white-space: nowrap;
}

.dai-chat-quick button:hover {
	background: var(--dai-chat-teal);
	color: #ffffff;
}

/* Input */
.dai-chat-form {
	display: flex;
	gap: 8px;
	padding: 10px 12px 12px;
	background: #ffffff;
	border-top: 1px solid #eef2f1;
	flex: none;
}

.dai-chat-input {
	flex: 1;
	border: 1px solid #d7e0de;
	border-radius: 999px;
	padding: 10px 15px;
	font-size: 14px;
	outline: none;
	min-width: 0;
}

.dai-chat-input:focus {
	border-color: var(--dai-chat-teal);
}

.dai-chat-send {
	flex: none;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 0;
	background: var(--dai-chat-teal);
	color: #ffffff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dai-chat-send:hover {
	background: var(--dai-chat-teal-dark);
}

/* Mobile: keep the bubble above the sticky Call/Text/Quote bar
   and clear of the hero CTA, on small screens. */
@media (max-width: 480px) {
	.dai-chat-panel {
		right: 12px;
		left: 12px;
		bottom: 162px;
		width: auto;
		max-width: none;
		height: 70vh;
		max-height: none;
	}

	.dai-chat-bubble {
		right: 22px;
		bottom: 86px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dai-chat-panel,
	.dai-chat-bubble,
	.dai-chat-dot {
		transition: none;
		animation: none;
	}
}
