/**
 * WooSeller AI Chat Widget Styles
 *
 * All dynamic values use CSS custom properties (--wsai-*)
 * injected by injectAppearanceStyles() in chat-widget.js.
 * Fallback values match the default appearance config.
 */

/* Widget Container */
.wsai-chat-widget {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 350px;
	max-width: calc(100vw - 40px);
	background: #fff;
	border-radius: 10px;
	box-shadow: var(--wsai-shadow, 0 5px 40px rgba(0, 0, 0, 0.16));
	font-family: var(--wsai-font, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif);
	font-size: var(--wsai-font-size, 14px);
	z-index: 99999;
	display: flex;
	flex-direction: column;
	max-height: 600px;
	transition: all 0.3s ease;
}

/* Widget Hidden State (bubble mode — chat panel is hidden) */
.wsai-chat-widget.wsai-hidden {
	display: none !important;
}

/* Widget Minimized State */
.wsai-chat-widget.wsai-minimized {
	height: auto;
	max-height: none;
}

.wsai-chat-widget.wsai-minimized .wsai-chat-messages,
.wsai-chat-widget.wsai-minimized .wsai-chat-input-area {
	display: none;
}

/* Chat Header */
.wsai-chat-header {
	background: var(--wsai-primary, linear-gradient(135deg, #4ade80 0%, #22c55e 100%));
	color: var(--wsai-header-text, #fff);
	padding: 15px 20px;
	border-radius: 10px 10px 0 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: relative;
}

.wsai-chat-title-group {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.wsai-chat-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--wsai-header-text, #fff);
	line-height: 1.2;
}

.wsai-online-status {
	font-size: 11px;
	color: var(--wsai-header-text, #fff);
	opacity: 0.75;
	line-height: 1.2;
	display: flex;
	align-items: center;
	gap: 4px;
}

.wsai-online-status::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	background: #4ade80;
	border-radius: 50%;
	flex-shrink: 0;
}

.wsai-chat-minimize {
	background: rgba(255, 255, 255, 0.2);
	border: none;
	color: var(--wsai-header-text, #fff);
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	font-size: 20px;
	line-height: 1;
	padding: 0;
}

.wsai-chat-minimize:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* Expanded mode removed — bubble only */

/* Notification Badge */
.wsai-notification-badge {
	position: absolute;
	top: -8px;
	right: -8px;
	background: #ff4757;
	color: #fff;
	border-radius: 12px;
	min-width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 600;
	padding: 0 6px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Notification card (appears above widget button when minimized) */
.wsai-notification-card {
	position: fixed;
	bottom: 90px;
	right: 20px;
	width: var(--wsai-bubble-width, 280px);
	background: var(--wsai-bubble-bg, #ffffff);
	border-radius: var(--wsai-bubble-radius, 12px);
	box-shadow: var(--wsai-bubble-shadow, 0 4px 24px rgba(0, 0, 0, 0.15));
	padding: 12px 36px 12px 16px;
	cursor: pointer;
	z-index: 100000;
	animation: wsaiSlideUp 0.3s ease forwards;
	font-family: var(--wsai-font, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif);
}

.wsai-notification-card.wsai-card-hiding {
	animation: wsaiSlideDown 0.25s ease forwards;
}

.wsai-notification-sender {
	font-size: 13px;
	font-weight: 600;
	color: var(--wsai-bubble-text, #111111);
	margin-bottom: 4px;
	line-height: 1.3;
}

.wsai-notification-text {
	font-size: var(--wsai-font-size, 14px);
	color: var(--wsai-bubble-text, #444444);
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wsai-notification-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 20px;
	height: 20px;
	cursor: pointer;
	color: #999999;
	font-size: 18px;
	line-height: 20px;
	text-align: center;
	background: none;
	border: none;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: color 0.15s, background 0.15s;
}

.wsai-notification-close:hover {
	color: #333333;
	background: rgba(0, 0, 0, 0.06);
}

@keyframes wsaiSlideUp {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes wsaiSlideDown {
	from { opacity: 1; transform: translateY(0); }
	to   { opacity: 0; transform: translateY(10px); }
}

/* Messages Container */
.wsai-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	background: var(--wsai-bg, #f8faf5);
	max-height: 400px;
	min-height: 300px;
}

.wsai-chat-messages::-webkit-scrollbar { width: 6px; }
.wsai-chat-messages::-webkit-scrollbar-track { background: #f1f1f1; }
.wsai-chat-messages::-webkit-scrollbar-thumb { background: #888; border-radius: 3px; }
.wsai-chat-messages::-webkit-scrollbar-thumb:hover { background: #555; }

/* Pinned Greeting Slot */
.wsai-greeting-slot { padding: 0 0 10px 0; }
.wsai-history-slot { /* Inherits normal message styles */ }
.wsai-greeting-slot + .wsai-history-slot { margin-top: 0; }

/* Chat Messages */
.wsai-chat-message {
	margin-bottom: 15px;
	display: flex;
	flex-direction: column;
	animation: slideIn 0.3s ease;
}

/* AI messages — row layout so avatar sits beside the bubble */
.wsai-message-ai {
	flex-direction: row;
	align-items: flex-end;
	gap: 8px;
}

/* Avatar circle next to AI messages */
.wsai-ai-avatar-circle {
	width: 28px;
	height: 28px;
	min-width: 28px;
	border-radius: 50%;
	background: var(--wsai-primary, #22c55e);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	font-weight: 700;
	color: #fff;
	overflow: hidden;
	flex-shrink: 0;
	align-self: flex-end;
}

/* Avatar circle for human operator messages */
.wsai-admin-avatar-circle {
	width: 28px;
	height: 28px;
	min-width: 28px;
	border-radius: 50%;
	background: #fde68a;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
	align-self: flex-end;
}

/* Operator sender label inside bubble */
.wsai-admin-sender-label {
	font-weight: 700;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-right: 4px;
	opacity: 0.75;
}

@keyframes slideIn {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

.wsai-message-content {
	padding: 12px 16px;
	border-radius: var(--wsai-radius, 18px);
	max-width: 80%;
	word-wrap: break-word;
	line-height: 1.4;
	font-size: var(--wsai-font-size, 14px);
	font-weight: 400;
}

/* AI Messages */
.wsai-message-ai .wsai-message-content {
	background: var(--wsai-ai-bubble, #fff);
	color: var(--wsai-ai-text, #333);
	border: 1px solid rgba(0,0,0,0.06);
	border-bottom-left-radius: 4px;
}

.wsai-typing-indicator .wsai-message-content {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 54px;
}

.wsai-typing-indicator .wsai-message-content span {
	width: 8px; height: 8px; border-radius: 50%;
	background: #94a3b8;
	animation: wsaiTypingPulse 1.2s infinite ease-in-out;
}
.wsai-typing-indicator .wsai-message-content span:nth-child(2) { animation-delay: 0.15s; }
.wsai-typing-indicator .wsai-message-content span:nth-child(3) { animation-delay: 0.3s; }

@keyframes wsaiTypingPulse {
	0%, 80%, 100% { opacity: 0.35; transform: scale(0.9); }
	40% { opacity: 1; transform: scale(1); }
}

/* User Messages */
.wsai-message-user { align-items: flex-end; }

.wsai-message-user .wsai-message-content {
	background: var(--wsai-visitor-bubble, linear-gradient(135deg, #4ade80 0%, #22c55e 100%));
	color: var(--wsai-visitor-text, #fff);
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

/* Input Area */
.wsai-chat-input-area {
	padding: 15px 20px;
	background: #fff;
	border-top: 1px solid var(--wsai-input-border, #e1e8ed);
	border-radius: 0 0 10px 10px;
}

.wsai-chat-input-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

.wsai-chat-input {
	flex: 1;
	width: 100%;
	padding: 10px 45px 10px 15px;
	border: 1px solid var(--wsai-input-border, #e1e8ed);
	border-radius: 20px;
	font-size: var(--wsai-font-size, 14px);
	font-family: inherit;
	outline: none;
	transition: border-color 0.2s;
	font-weight: 500;
	box-sizing: border-box;
}

.wsai-chat-input:focus {
	border-color: var(--wsai-primary, #4ade80);
}

.wsai-chat-input::placeholder {
	color: #999;
	font-weight: 400;
}

.wsai-chat-input:disabled {
	opacity: 0.6;
	background: #f5f5f5;
	cursor: not-allowed;
}

.wsai-send-button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.wsai-send-button {
	position: absolute;
	right: 5px;
	background: transparent;
	border: none;
	color: var(--wsai-primary, #4ade80);
	font-size: 18px;
	cursor: pointer;
	padding: 5px 10px;
	border-radius: 15px;
	transition: background-color 0.2s;
	outline: none;
}

.wsai-send-button:hover {
	background-color: #f0fdf4;
}

.wsai-send-icon { display: block; }

/* Hidden elements */
.wsai-hidden { display: none !important; }

/* Responsive Design */
@media (max-width: 480px) {
	.wsai-notification-card {
		right: 10px;
		bottom: 70px;
		width: calc(100vw - 20px);
		max-width: var(--wsai-bubble-width, 280px);
	}

	.wsai-chat-widget {
		bottom: 0; right: 0; left: 0;
		width: 100%; max-width: 100%;
		border-radius: 0; max-height: 100vh;
	}
	.wsai-chat-header { border-radius: 0; }
	.wsai-chat-input-area { border-radius: 0; }
	.wsai-chat-messages { max-height: calc(100vh - 130px); }
	.wsai-chat-input { padding: 10px 40px 10px 15px; }
}

/* ─────────────────────────────────────────────
   FAB Bubble Launcher
───────────────────────────────────────────── */
.wsai-bubble-launcher {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: var(--wsai-widget-size, 60px);
	height: var(--wsai-widget-size, 60px);
	border-radius: var(--wsai-widget-radius, 50px);
	background: var(--wsai-primary, #22c55e);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--wsai-shadow, 0 5px 40px rgba(0,0,0,0.16));
	z-index: 99999;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wsai-bubble-launcher:hover {
	transform: scale(1.08);
	box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

/* Launcher yashirilganda */
.wsai-bubble-launcher.wsai-launcher-hidden {
	display: none !important;
}

/* Expanded mode launcher rule removed */

/* Position: bottom-left */
.wsai-pos-left .wsai-bubble-launcher {
	right: auto;
	left: 20px;
}

@media (max-width: 480px) {
	.wsai-bubble-launcher {
		bottom: 16px;
		right: 16px;
	}
}
