/* Evie Chatbot — front-end widget styles
   Colours are driven by CSS variables set inline per instance. */

.evie-root {
	--evie-primary: #16a34a;
	--evie-launcher: #16a34a;
	--evie-user: #16a34a;
	--evie-header-bg: #0f3d2e;
	--evie-header-text: #ffffff;
	--evie-bot-bubble: #f1f3f5;
	--evie-bot-text: #1f2733;
	--evie-panel-bg: #ffffff;
	--evie-radius: 18px;
	--evie-shadow: 0 18px 50px -12px rgba(15, 23, 42, .35), 0 4px 12px -4px rgba(15, 23, 42, .18);
	--evie-font: inherit;
	box-sizing: border-box;
}
.evie-root *,
.evie-root *::before,
.evie-root *::after { box-sizing: border-box; }

/* ---------- Launcher (floating mode) ---------- */
.evie-launcher {
	position: fixed;
	bottom: 22px;
	z-index: 999990;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px 12px 14px;
	border: 0;
	cursor: pointer;
	border-radius: 999px;
	color: #fff;
	background: var(--evie-launcher);
	font: 600 15px/1 var(--evie-font, inherit);
	box-shadow: 0 10px 28px -8px color-mix(in srgb, var(--evie-launcher) 60%, transparent), 0 2px 6px rgba(0,0,0,.2);
	transition: transform .25s cubic-bezier(.2,.9,.3,1.2), box-shadow .25s, opacity .2s;
	-webkit-tap-highlight-color: transparent;
}
.evie-pos-bottom-right .evie-launcher { right: 22px; }
.evie-pos-bottom-left  .evie-launcher { left: 22px; }
.evie-launcher:hover { transform: translateY(-2px) scale(1.02); }
.evie-launcher:active { transform: translateY(0) scale(.98); }
.evie-launcher .evie-launcher-ico {
	width: 30px; height: 30px; flex: 0 0 30px;
	display: grid; place-items: center;
	background: rgba(255,255,255,.18);
	border-radius: 50%;
}
.evie-launcher .evie-launcher-ico svg { width: 18px; height: 18px; }
.evie-launcher::after {
	content: "";
	position: absolute; inset: 0;
	border-radius: inherit;
	box-shadow: 0 0 0 0 color-mix(in srgb, var(--evie-launcher) 55%, transparent);
	animation: evie-pulse 2.6s infinite;
	pointer-events: none;
}
@keyframes evie-pulse {
	0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--evie-launcher) 45%, transparent); }
	70%  { box-shadow: 0 0 0 16px rgba(0,0,0,0); }
	100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}
.evie-root.is-open .evie-launcher { opacity: 0; pointer-events: none; transform: scale(.6); }

/* ---------- Panel ---------- */
.evie-panel {
	display: flex;
	flex-direction: column;
	background: var(--evie-panel-bg);
	overflow: hidden;
	color: var(--evie-bot-text);
	font: 400 15px/1.5 var(--evie-font, inherit);
}
.evie-mode-floating .evie-panel {
	position: fixed;
	bottom: 22px;
	width: 388px;
	max-width: calc(100vw - 32px);
	height: min(640px, calc(100vh - 110px));
	border-radius: var(--evie-radius);
	box-shadow: var(--evie-shadow);
	z-index: 999991;
	transform-origin: bottom right;
	opacity: 0;
	transform: translateY(16px) scale(.96);
	pointer-events: none;
	transition: opacity .22s ease, transform .26s cubic-bezier(.2,.9,.3,1.1);
}
.evie-pos-bottom-right .evie-panel { right: 22px; }
.evie-pos-bottom-left  .evie-panel { left: 22px; transform-origin: bottom left; }
.evie-root.is-open .evie-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.evie-mode-inline .evie-panel {
	position: relative;
	width: 100%;
	height: var(--evie-inline-height, 560px);
	border-radius: var(--evie-radius);
	box-shadow: 0 1px 3px rgba(15,23,42,.12), 0 0 0 1px rgba(15,23,42,.06);
	margin: 12px 0;
}

/* ---------- Header ---------- */
.evie-header {
	display: flex; align-items: center; gap: 12px;
	padding: 14px 16px;
	color: var(--evie-header-text);
	background:
		radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--evie-primary) 55%, var(--evie-header-bg)) 0%, var(--evie-header-bg) 60%);
	flex: 0 0 auto;
}
.evie-avatar {
	width: 38px; height: 38px; flex: 0 0 38px;
	border-radius: 50%;
	background: rgba(255,255,255,.16);
	display: grid; place-items: center;
	overflow: hidden;
	font-weight: 700; font-size: 16px;
}
.evie-avatar img { width: 100%; height: 100%; object-fit: cover; }
.evie-htitle { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.evie-hsub { font-size: 12px; opacity: .82; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.evie-hsub::before { content:""; width:7px; height:7px; border-radius:50%; background:#34d399; box-shadow:0 0 0 3px rgba(52,211,153,.25); }
.evie-header .evie-spacer { flex: 1; }
.evie-close {
	background: rgba(255,255,255,.14); border: 0; color: inherit;
	width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
	display: grid; place-items: center; transition: background .2s;
}
.evie-close:hover { background: rgba(255,255,255,.28); }
.evie-mode-inline .evie-close { display: none; }

/* ---------- Messages ---------- */
.evie-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px 16px 8px;
	display: flex; flex-direction: column; gap: 12px;
	background:
		linear-gradient(var(--evie-panel-bg), var(--evie-panel-bg)) padding-box,
		radial-gradient(60% 30% at 50% 0%, color-mix(in srgb, var(--evie-primary) 6%, transparent), transparent);
	scrollbar-width: thin;
}
.evie-messages::-webkit-scrollbar { width: 7px; }
.evie-messages::-webkit-scrollbar-thumb { background: rgba(15,23,42,.18); border-radius: 4px; }

.evie-msg {
	max-width: 86%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14.5px;
	line-height: 1.5;
	word-wrap: break-word;
	animation: evie-rise .28s ease both;
}
@keyframes evie-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.evie-msg.bot {
	align-self: flex-start;
	background: var(--evie-bot-bubble);
	color: var(--evie-bot-text);
	border-bottom-left-radius: 5px;
}
.evie-msg.user {
	align-self: flex-end;
	background: var(--evie-user);
	color: #fff;
	border-bottom-right-radius: 5px;
}
.evie-msg p { margin: 0 0 8px; }
.evie-msg p:last-child { margin-bottom: 0; }
.evie-msg ul, .evie-msg ol { margin: 6px 0; padding-left: 20px; }
.evie-msg li { margin: 2px 0; }
.evie-msg a { color: inherit; text-decoration: underline; }
.evie-msg.bot a { color: var(--evie-primary); }
.evie-msg strong { font-weight: 700; }
.evie-msg code { background: rgba(15,23,42,.08); padding: 1px 5px; border-radius: 5px; font-size: .9em; }

.evie-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.evie-typing span {
	width: 7px; height: 7px; border-radius: 50%;
	background: color-mix(in srgb, var(--evie-bot-text) 45%, transparent);
	animation: evie-bounce 1.1s infinite;
}
.evie-typing span:nth-child(2) { animation-delay: .15s; }
.evie-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes evie-bounce { 0%,60%,100% { transform: translateY(0); opacity:.5;} 30% { transform: translateY(-5px); opacity:1;} }

/* ---------- Suggestions ---------- */
.evie-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 10px; }
.evie-chip {
	border: 1px solid color-mix(in srgb, var(--evie-primary) 35%, #e2e8f0);
	background: color-mix(in srgb, var(--evie-primary) 6%, #fff);
	color: color-mix(in srgb, var(--evie-primary) 75%, #1f2733);
	padding: 8px 12px; border-radius: 999px; font-size: 13px;
	cursor: pointer; transition: transform .15s, background .15s, border-color .15s;
}
.evie-chip:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--evie-primary) 12%, #fff); }

/* ---------- Composer ---------- */
.evie-composer {
	flex: 0 0 auto;
	display: flex; align-items: flex-end; gap: 8px;
	padding: 12px; border-top: 1px solid rgba(15,23,42,.08);
	background: var(--evie-panel-bg);
}
.evie-input {
	flex: 1; resize: none; border: 1px solid rgba(15,23,42,.14);
	border-radius: 14px; padding: 10px 12px; font: inherit; font-size: 14.5px;
	max-height: 120px; line-height: 1.45; color: var(--evie-bot-text);
	background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.evie-input:focus { border-color: var(--evie-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--evie-primary) 18%, transparent); }
.evie-send {
	flex: 0 0 auto; width: 42px; height: 42px; border: 0; border-radius: 12px;
	background: var(--evie-primary); color: #fff; cursor: pointer;
	display: grid; place-items: center; transition: transform .15s, filter .15s, opacity .15s;
}
.evie-send:hover { filter: brightness(1.06); transform: translateY(-1px); }
.evie-send:disabled { opacity: .5; cursor: default; transform: none; }
.evie-send svg { width: 19px; height: 19px; }

.evie-foot { text-align: center; font-size: 10.5px; padding: 0 0 8px; color: rgba(15,23,42,.4); background: var(--evie-panel-bg); }
.evie-foot b { color: rgba(15,23,42,.55); font-weight: 600; }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
	.evie-mode-floating .evie-panel {
		inset: 0; width: 100%; max-width: 100%; height: 100%;
		border-radius: 0;
	}
	.evie-launcher { bottom: 16px; }
	.evie-pos-bottom-right .evie-launcher { right: 16px; }
	.evie-pos-bottom-left  .evie-launcher { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.evie-launcher::after { animation: none; }
	.evie-msg, .evie-panel { animation: none !important; transition: none !important; }
}
