/**
 * EasyOrder Live Chat - Ultra-Modern Glassmorphism Widget
 */

:root {
	--eo-primary: #10B981;
	--eo-primary-dark: #059669;
	--eo-bg-chat: #FFFFFF;
	--eo-text-main: #0F172A;
	--eo-text-muted: #64748B;
	--eo-user-bubble: #10B981;
	--eo-bot-bubble: #F1F5F9;
	--eo-border: #E2E8F0;
	--eo-radius: 18px;
}

#easyorder-chat-root {
	position: fixed;
	bottom: 24px;
	left: 24px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	direction: rtl;
	text-align: right;
}

/* Floating Trigger Button */
#easyorder-chat-trigger {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	background: var(--eo-primary);
	color: #FFFFFF;
	border: none;
	box-shadow: 0 8px 28px rgba(16, 185, 129, 0.4);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease;
	outline: none;
}

#easyorder-chat-trigger:hover {
	transform: scale(1.08);
	box-shadow: 0 12px 32px rgba(16, 185, 129, 0.5);
}

.eo-badge-pulse {
	position: absolute;
	top: 3px;
	right: 3px;
	width: 13px;
	height: 13px;
	background: #22C55E;
	border: 2px solid #FFFFFF;
	border-radius: 50%;
	box-shadow: 0 0 0 rgba(34, 197, 94, 0.7);
	animation: eo-pulse 2s infinite;
}

@keyframes eo-pulse {
	0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
	70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
	100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Chat Window */
#easyorder-chat-window {
	position: absolute;
	bottom: 80px;
	left: 0;
	width: 375px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 120px);
	background: var(--eo-bg-chat);
	border-radius: var(--eo-radius);
	box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.05);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: eo-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes eo-slide-up {
	from { opacity: 0; transform: translateY(16px) scale(0.96); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.eo-chat-header {
	background: linear-gradient(135deg, var(--eo-primary) 0%, var(--eo-primary-dark) 100%);
	color: #FFFFFF;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.eo-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.eo-avatar-wrap {
	position: relative;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #FFFFFF;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: visible;
}

.eo-avatar-wrap img {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
}

.eo-avatar-placeholder {
	font-size: 22px;
}

.eo-status-dot {
	position: absolute;
	bottom: 1px;
	right: 1px;
	width: 11px;
	height: 11px;
	background: #22C55E;
	border: 2px solid #FFFFFF;
	border-radius: 50%;
}

.eo-store-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: #FFFFFF;
}

.eo-persona-status {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.88);
}

.eo-header-close {
	background: none;
	border: none;
	color: #FFFFFF;
	font-size: 18px;
	cursor: pointer;
	padding: 6px;
	opacity: 0.85;
	transition: opacity 0.2s;
}

.eo-header-close:hover {
	opacity: 1;
}

/* Body */
.eo-chat-body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 16px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #F8FAFC;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.eo-msg-bubble {
	max-width: 82%;
	padding: 11px 15px;
	border-radius: 16px;
	font-size: 13.5px;
	line-height: 1.55;
	word-break: break-word;
	position: relative;
}

.eo-msg-bot {
	align-self: flex-start;
	background: #FFFFFF;
	color: var(--eo-text-main);
	border: 1px solid var(--eo-border);
	border-bottom-right-radius: 4px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.eo-msg-user {
	align-self: flex-end;
	background: var(--eo-primary);
	color: #FFFFFF;
	border-bottom-left-radius: 4px;
	box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.eo-msg-time {
	font-size: 10px;
	opacity: 0.7;
	display: block;
	margin-top: 4px;
	text-align: left;
}

/* Product Cards Carousel in Chat */
.eo-products-container {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 8px;
}

.eo-product-card {
	background: #FFFFFF;
	border: 1px solid var(--eo-border);
	border-radius: 12px;
	padding: 10px;
	display: flex;
	gap: 10px;
	align-items: center;
	transition: transform 0.2s, box-shadow 0.2s;
}

.eo-product-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.eo-product-img {
	width: 54px;
	height: 54px;
	border-radius: 8px;
	object-fit: cover;
	flex-shrink: 0;
	background: #F1F5F9;
}

.eo-product-details {
	flex: 1;
	min-width: 0;
}

.eo-product-title {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--eo-text-main);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin: 0 0 4px;
}

.eo-product-price {
	font-size: 12px;
	color: var(--eo-primary);
	font-weight: bold;
}

.eo-product-btn {
	background: var(--eo-primary);
	color: #FFFFFF !important;
	text-decoration: none;
	font-size: 11px;
	font-weight: bold;
	padding: 5px 10px;
	border-radius: 6px;
	white-space: nowrap;
	transition: opacity 0.2s;
}

.eo-product-btn:hover {
	opacity: 0.9;
}

/* Typing Indicator */
.eo-typing-indicator {
	padding: 8px 16px;
	background: #F1F5F9;
	border-radius: 14px;
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-bottom: 8px;
}

.eo-typing-indicator span {
	width: 6px;
	height: 6px;
	background: #94A3B8;
	border-radius: 50%;
	animation: eo-typing-bounce 1.4s infinite ease-in-out both;
}

.eo-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.eo-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes eo-typing-bounce {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

/* Footer / Input Form */
.eo-chat-footer {
	padding: 10px 14px 6px;
	background: #FFFFFF;
	border-top: 1px solid var(--eo-border);
	display: flex;
	gap: 8px;
	align-items: center;
	flex-shrink: 0;
	box-sizing: border-box;
}

.eo-chat-footer input {
	flex: 1;
	min-width: 0;
	border: 1px solid var(--eo-border);
	background: #F8FAFC;
	padding: 10px 16px;
	border-radius: 24px;
	font-size: 14px;
	line-height: 20px;
	height: 42px;
	color: var(--eo-text-main);
	outline: none;
	box-sizing: border-box;
	transition: border-color 0.2s, background 0.2s;
	-webkit-appearance: none;
}

.eo-chat-footer input:focus {
	border-color: var(--eo-primary);
	background: #FFFFFF;
}

.eo-chat-footer button {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: var(--eo-primary);
	color: #FFFFFF;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.2s;
	flex-shrink: 0;
	padding: 0;
}

.eo-chat-footer button:hover {
	transform: scale(1.05);
}

/* Branding footer */
.eo-chat-brand {
	background: #FFFFFF;
	text-align: center;
	padding: 2px 10px 8px;
	font-size: 11px;
	flex-shrink: 0;
	box-sizing: border-box;
}

.eo-chat-brand a {
	color: #94A3B8;
	text-decoration: none;
	transition: color 0.2s;
}

.eo-chat-brand a:hover {
	color: #64748B;
}

.eo-chat-brand strong {
	color: #0F172A;
}

/* Mobile Responsive */
@media (max-width: 600px) {
	#easyorder-chat-root {
		bottom: 16px;
		left: 16px;
	}
	#easyorder-chat-window {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100vw;
		max-width: 100vw;
		height: 100%;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
		z-index: 10000000;
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		overflow: hidden;
	}
	.eo-chat-header {
		padding-top: max(14px, env(safe-area-inset-top, 14px));
		flex-shrink: 0;
	}
	.eo-chat-body {
		flex: 1 1 auto;
		min-height: 0;
	}
	.eo-chat-footer {
		flex-shrink: 0;
		padding: 10px 14px 6px;
		background: #FFFFFF;
	}
	.eo-chat-brand {
		flex-shrink: 0;
		padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
		background: #FFFFFF;
	}
}
