/* ============================================================
   SOGO Bot – Frontend Styles
   ============================================================ */

/* --- Wrapper (fixed anchor, bottom-right) --- */
.sogo-bot-wrapper {
	position: fixed !important;
	bottom: 24px !important;
	right: 24px !important;
	left: auto !important;
	top: auto !important;
	z-index: 2147483647 !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	transform: none !important;
	margin: 0 !important;
	padding: 0 !important;
	width: auto !important;
	height: auto !important;
	float: none !important;
	overflow: visible !important;
	pointer-events: auto !important;
}

/* --- Button wrapper (badge anchor) --- */
.sogo-bot-btn-wrap {
	position: relative !important;
	display: inline-block !important;
	width: 64px !important;
	height: 64px !important;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
}

/* --- Circle button --- */
.sogo-bot-circle {
	width: 64px !important;
	height: 64px !important;
	border-radius: 50% !important;
	border: 3px solid #2E7D32 !important;
	background: #2E7D32 !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18) !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	overflow: hidden !important;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	position: relative !important;
	line-height: 1 !important;
	text-decoration: none !important;
}

/* --- Fallback icon (shown when avatar fails to load) --- */
.sogo-bot-icon-fallback {
	display: block;
	color: #fff;
	width: 32px;
	height: 32px;
	flex-shrink: 0;
}

.sogo-bot-circle:hover {
	transform: scale(1.07);
	box-shadow: 0 6px 22px rgba(0, 0, 0, 0.24);
}

.sogo-bot-circle:focus-visible {
	outline: 3px solid #2E7D32;
	outline-offset: 3px;
}

/* --- Avatar inside circle --- */
.sogo-bot-avatar {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

/* --- Red notification badge --- */
.sogo-bot-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	width: 20px;
	height: 20px;
	background: #e53935;
	color: #fff;
	border-radius: 50%;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	border: 2px solid #fff;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.sogo-bot-badge.sogo-badge-hidden {
	opacity: 0;
	transform: scale(0);
}

/* --- Chat window --- */
.sogo-chat-window {
	position: fixed !important;
	bottom: 100px !important;
	right: 24px !important;
	left: auto !important;
	top: auto !important;
	width: 340px !important;
	max-height: 520px !important;
	background: #fff !important;
	border-radius: 16px !important;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18) !important;
	display: flex !important;
	flex-direction: column !important;
	overflow: hidden !important;
	transform: translateY(12px) !important;
	opacity: 0 !important;
	transition: transform 0.25s ease, opacity 0.25s ease !important;
	pointer-events: none !important;
	z-index: 2147483646 !important;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
}

.sogo-chat-window.sogo-chat-open {
	transform: translateY(0) !important;
	opacity: 1 !important;
	pointer-events: all !important;
}

/* --- Chat header --- */
.sogo-chat-header {
	background: #2E7D32;
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.sogo-chat-title {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.sogo-chat-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	opacity: 0.85;
	transition: opacity 0.15s;
}

.sogo-chat-close:hover {
	opacity: 1;
}

/* --- Messages area --- */
.sogo-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
}

/* Scrollbar */
.sogo-chat-messages::-webkit-scrollbar { width: 4px; }
.sogo-chat-messages::-webkit-scrollbar-track { background: transparent; }
.sogo-chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* --- Message bubbles --- */
.sogo-msg {
	max-width: 82%;
	padding: 9px 13px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.5;
	word-break: break-word;
}

.sogo-msg-bot {
	background: #f1f3f4;
	color: #1a1a1a;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

.sogo-msg-user {
	background: #2E7D32;
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

.sogo-msg-error {
	background: #fdecea;
	color: #c62828;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
	font-size: 13px;
}

/* --- Typing indicator --- */
.sogo-typing {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 9px 13px;
	background: #f1f3f4;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	align-self: flex-start;
}

.sogo-typing span {
	width: 7px;
	height: 7px;
	background: #888;
	border-radius: 50%;
	display: inline-block;
	animation: sogo-bounce 1.2s infinite ease-in-out;
}

.sogo-typing span:nth-child(2) { animation-delay: 0.2s; }
.sogo-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sogo-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30%            { transform: translateY(-5px); }
}

/* --- Input area --- */
.sogo-chat-input-area {
	border-top: 1px solid #e8e8e8;
	padding: 10px 12px 8px;
	flex-shrink: 0;
	background: #fff;
}

.sogo-chat-input {
	width: 100%;
	border: 1px solid #ddd;
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	line-height: 1.4;
	resize: none;
	outline: none;
	box-sizing: border-box;
	transition: border-color 0.15s;
	font-family: inherit;
	max-height: 100px;
	overflow-y: auto;
}

.sogo-chat-input:focus {
	border-color: #2E7D32;
}

.sogo-chat-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 6px;
}

.sogo-char-counter {
	font-size: 11px;
	color: #aaa;
	transition: color 0.2s;
}

.sogo-char-counter.sogo-over-limit {
	color: #e53935;
	font-weight: 600;
}

.sogo-chat-send {
	background: #2E7D32;
	border: none;
	border-radius: 50%;
	width: 34px;
	height: 34px;
	cursor: pointer;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.15s, transform 0.1s;
	flex-shrink: 0;
}

.sogo-chat-send:hover {
	background: #388E3C;
}

.sogo-chat-send:active {
	transform: scale(0.92);
}

.sogo-chat-send:disabled {
	background: #ccc;
	cursor: not-allowed;
}

/* --- Mobile responsive --- */
@media (max-width: 400px) {
	.sogo-chat-window {
		width: calc(100vw - 16px);
		right: 8px;
		bottom: 90px;
	}
	.sogo-bot-wrapper {
		bottom: 16px;
		right: 16px;
	}
}
