.estella-assistant-container {
	position: fixed;
	bottom: 20%; /* Lower medium */
	right: 20px; /* Aligned to the very right edge */
	z-index: 999999;
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	display: flex;
	flex-direction: column;
	align-items: flex-end; /* Align elements inside to the right */
	pointer-events: none; /* Allows clicking through container background */
}

/* Make inner elements clickable */
.estella-fairy, .estella-chat-window {
	pointer-events: auto; 
}

/* Fairy Styling */
.estella-fairy {
	width: 70px;
	height: 70px;
	cursor: pointer;
	position: relative;
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	animation: hover-float 3s ease-in-out infinite;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 2;
}

.estella-fairy:hover {
	transform: scale(1.1) translateY(-10px);
}

.estella-body {
	width: 50px;
	height: 50px;
	background: radial-gradient(circle at 30% 30%, #ffd1e8, #f582ae);
	border-radius: 50%;
	position: relative;
	z-index: 2;
	box-shadow: 0 0 15px rgba(245, 130, 174, 0.6), inset -5px -5px 10px rgba(0,0,0,0.1);
}

.estella-face {
	position: absolute;
	top: 18px;
	left: 10px;
	width: 30px;
	height: 18px;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
}

.eye {
	width: 5px;
	height: 7px;
	background: #333;
	border-radius: 50%;
	animation: blink 4s infinite;
}

.smile {
	width: 14px;
	height: 7px;
	border-bottom: 2px solid #333;
	border-radius: 0 0 10px 10px;
	margin: 3px auto 0;
	transition: height 0.1s;
}

.smile.speaking {
	height: 10px;
	background: #333;
	border-radius: 5px;
	animation: talk 0.2s infinite alternate;
}

.estella-wings {
	position: absolute;
	width: 100%;
	height: 100%;
	z-index: 1;
}

.wing {
	position: absolute;
	width: 35px;
	height: 30px;
	background: rgba(255, 255, 255, 0.7);
	border: 1px solid rgba(255, 218, 238, 0.8);
	border-radius: 50% 50% 0 50%;
	top: -5px;
	box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.left-wing {
	left: -15px;
	transform-origin: bottom right;
	animation: flutter-left 0.15s infinite alternate;
}

.right-wing {
	right: -15px;
	transform: scaleX(-1);
	transform-origin: bottom left;
	animation: flutter-right 0.15s infinite alternate;
}

.sparkles {
	position: absolute;
	top: -15px;
	right: -10px;
	font-size: 20px;
	opacity: 0;
	animation: sparkle-anim 2s infinite;
}

@keyframes hover-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-15px); }
}
@keyframes flutter-left {
	0% { transform: rotate(15deg); }
	100% { transform: rotate(-30deg); }
}
@keyframes flutter-right {
	0% { transform: scaleX(-1) rotate(-15deg); }
	100% { transform: scaleX(-1) rotate(30deg); }
}
@keyframes blink {
	0%, 96%, 98%, 100% { transform: scaleY(1); }
	97%, 99% { transform: scaleY(0.1); }
}
@keyframes talk {
	0% { transform: scaleY(1); }
	100% { transform: scaleY(1.5); }
}
@keyframes sparkle-anim {
	0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
	50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}

/* Chat Window */
.estella-chat-window {
	display: none;
	width: 100vw;
	max-width: 380px;
	height: 60vh;
	max-height: 500px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(245, 130, 174, 0.3);
	flex-direction: column;
	position: absolute;
	bottom: 80px; /* Position above the fairy when open */
	right: 0; /* Align perfectly to the right */
	overflow: hidden;
	border: 2px solid #ffebf5;
	z-index: 1;
}

.estella-chat-window.active {
	display: flex;
	animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
	0% { transform: scale(0.8) translateY(20px); opacity: 0; }
	100% { transform: scale(1) translateY(0); opacity: 1; }
}

.estella-chat-header {
	background: linear-gradient(135deg, #f582ae, #ffb6b9);
	color: #fff;
	padding: 15px;
	font-weight: 600;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

#estella-close-btn-c9e8245a {
	background: none;
	border: none;
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	line-height: 1;
}

.estella-chat-messages {
	flex: 1;
	padding: 15px;
	overflow-y: auto;
	background: #fffafc;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.estella-message {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.4;
	word-wrap: break-word;
}

.estella-message.system-msg {
	background: #ffebf5;
	color: #515150;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

.estella-message.user-msg {
	background: #f582ae;
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

.estella-permission-prompt {
	background: #fff;
	border: 1px solid #f582ae;
	padding: 15px;
	border-radius: 10px;
	text-align: center;
	margin: 10px 0;
	box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.estella-permission-btn {
	background: #f582ae;
	color: white;
	border: none;
	padding: 8px 15px;
	border-radius: 20px;
	margin-top: 10px;
	cursor: pointer;
	font-weight: bold;
	width: 100%;
	max-width: 200px;
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.estella-chat-input-area {
	display: flex;
	padding: 12px;
	background: #fff;
	border-top: 1px solid #ffebf5;
	gap: 8px;
	align-items: center;
}

.estella-chat-input-area input {
	flex: 1;
	border: 1px solid #ffb6b9;
	border-radius: 20px;
	padding: 10px 15px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
	min-width: 0; /* Prevent input overflow on small screens */
}

.estella-chat-input-area input:focus {
	border-color: #f582ae;
}

.estella-mic-btn, .estella-send-btn {
	background: #ffebf5;
	border: none;
	font-size: 18px;
	cursor: pointer;
	color: #f582ae;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, color 0.2s;
	flex-shrink: 0;
}

.estella-mic-btn:hover, .estella-send-btn:hover {
	background: #f582ae;
	color: #fff;
}

.estella-mic-btn.listening {
	background: #e74c3c;
	color: #fff;
	animation: pulse 1.5s infinite;
}

@keyframes pulse {
	0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
	70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
	100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
	.estella-chat-window {
		width: calc(100vw - 60px);
		height: 65vh;
	}
	
	.estella-assistant-container {
		width: auto;
	}
}