/**
 * HALA AI Frontend Widget - Professional Design
 */

:root {
	--hala-primary: #667eea;
	--hala-secondary: #764ba2;
	--hala-dark: #0f0f23;
	--hala-card: #1a1a2e;
	--hala-border: rgba(255, 255, 255, 0.1);
	--hala-text: #ffffff;
	--hala-text-dim: rgba(255, 255, 255, 0.7);
}

.hala-ai-widget {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hala-ai-position-bottom-right {
	bottom: 24px;
	right: 24px;
}

.hala-ai-position-bottom-left {
	bottom: 24px;
	left: 24px;
}

/* Trigger Button */
.hala-ai-trigger {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--hala-primary), var(--hala-secondary));
	border: none;
	cursor: pointer;
	box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	color: #fff;
}

.hala-ai-trigger:hover {
	transform: scale(1.1);
	box-shadow: 0 12px 48px rgba(102, 126, 234, 0.5);
}

.hala-ai-trigger:active {
	transform: scale(0.95);
}

/* Panel */
.hala-ai-panel {
	position: absolute;
	bottom: 80px;
	width: 400px;
	height: 600px;
	background: var(--hala-card);
	border-radius: 20px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: panelSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hala-ai-position-bottom-right .hala-ai-panel {
	right: 0;
}

.hala-ai-position-bottom-left .hala-ai-panel {
	left: 0;
}

@keyframes panelSlideIn {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Header */
.hala-ai-header {
	background: linear-gradient(135deg, var(--hala-primary), var(--hala-secondary));
	padding: 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hala-ai-header-content {
	display: flex;
	align-items: center;
	gap: 12px;
}

.hala-ai-avatar {
	flex-shrink: 0;
}

.hala-ai-header-text h3 {
	margin: 0;
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.3px;
}

.hala-ai-status {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 4px 0 0;
	color: rgba(255, 255, 255, 0.9);
	font-size: 13px;
}

.hala-ai-status-dot {
	width: 6px;
	height: 6px;
	background: #10b981;
	border-radius: 50%;
	animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

.hala-ai-minimize {
	background: rgba(255, 255, 255, 0.2);
	border: none;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	transition: all 0.2s ease;
}

.hala-ai-minimize:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* Messages */
.hala-ai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	background: var(--hala-dark);
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.hala-ai-messages::-webkit-scrollbar {
	width: 6px;
}

.hala-ai-messages::-webkit-scrollbar-track {
	background: transparent;
}

.hala-ai-messages::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 3px;
}

.hala-ai-messages::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.3);
}

.hala-ai-message {
	display: flex;
	animation: messageSlideIn 0.3s ease;
}

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

.hala-ai-message-user {
	justify-content: flex-end;
}

.hala-ai-message-content {
	max-width: 80%;
	padding: 12px 16px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
}

.hala-ai-message-assistant .hala-ai-message-content {
	background: rgba(102, 126, 234, 0.15);
	border: 1px solid rgba(102, 126, 234, 0.2);
	color: var(--hala-text);
	border-bottom-left-radius: 4px;
}

.hala-ai-message-user .hala-ai-message-content {
	background: linear-gradient(135deg, var(--hala-primary), var(--hala-secondary));
	color: #fff;
	border-bottom-right-radius: 4px;
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Typing Indicator */
.hala-ai-typing {
	padding: 0 20px 12px;
	display: flex;
	gap: 6px;
}

.hala-ai-typing span {
	width: 8px;
	height: 8px;
	background: rgba(102, 126, 234, 0.6);
	border-radius: 50%;
	animation: typing 1.4s ease-in-out infinite;
}

.hala-ai-typing span:nth-child(2) {
	animation-delay: 0.2s;
}

.hala-ai-typing span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typing {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.7;
	}
	30% {
		transform: translateY(-10px);
		opacity: 1;
	}
}

/* Input */
.hala-ai-input-wrap {
	padding: 16px 20px;
	background: var(--hala-card);
	border-top: 1px solid var(--hala-border);
}

.hala-ai-form {
	display: flex;
	gap: 12px;
	margin-bottom: 8px;
}

.hala-ai-input {
	flex: 1;
	padding: 12px 16px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--hala-border);
	border-radius: 12px;
	color: var(--hala-text);
	font-size: 14px;
	font-family: inherit;
	transition: all 0.2s ease;
}

.hala-ai-input:focus {
	outline: none;
	border-color: var(--hala-primary);
	background: rgba(255, 255, 255, 0.08);
}

.hala-ai-input::placeholder {
	color: var(--hala-text-dim);
}

.hala-ai-send {
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--hala-primary), var(--hala-secondary));
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.hala-ai-send:hover:not(:disabled) {
	transform: scale(1.05);
	box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.hala-ai-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.hala-ai-powered {
	text-align: center;
	color: var(--hala-text-dim);
	font-size: 12px;
}

.hala-ai-powered strong {
	background: linear-gradient(135deg, var(--hala-primary), var(--hala-secondary));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	font-weight: 600;
}

/* Light Theme */
.hala-ai-theme-light .hala-ai-panel {
	background: #ffffff;
}

.hala-ai-theme-light .hala-ai-messages {
	background: #f9fafb;
}

.hala-ai-theme-light .hala-ai-message-assistant .hala-ai-message-content {
	background: #fff;
	border: 1px solid #e5e7eb;
	color: #111827;
}

.hala-ai-theme-light .hala-ai-input-wrap {
	background: #fff;
	border-top-color: #e5e7eb;
}

.hala-ai-theme-light .hala-ai-input {
	background: #f9fafb;
	border-color: #e5e7eb;
	color: #111827;
}

.hala-ai-theme-light .hala-ai-input::placeholder {
	color: #9ca3af;
}

.hala-ai-theme-light .hala-ai-powered {
	color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
	.hala-ai-widget {
		bottom: 0;
		right: 0;
		left: 0;
	}
	
	.hala-ai-position-bottom-right,
	.hala-ai-position-bottom-left {
		bottom: 0;
		right: 0;
		left: 0;
	}
	
	.hala-ai-panel {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		height: calc(100vh - 80px);
		max-height: none;
		border-radius: 20px 20px 0 0;
	}
	
	.hala-ai-trigger {
		position: fixed;
		bottom: 20px;
		right: 20px;
		width: 60px;
		height: 60px;
	}
}

@media (max-width: 480px) {
	.hala-ai-panel {
		height: calc(100vh - 70px);
	}
	
	.hala-ai-trigger {
		width: 56px;
		height: 56px;
		bottom: 16px;
		right: 16px;
	}
	
	.hala-ai-header {
		padding: 16px;
	}
	
	.hala-ai-messages {
		padding: 16px;
	}
	
	.hala-ai-input-wrap {
		padding: 12px 16px;
	}
}


/* Error state */
.hala-ai-error {
	color: #ef4444;
	padding: 12px 16px;
	background: rgba(239, 68, 68, 0.1);
	border: 1px solid rgba(239, 68, 68, 0.3);
	border-radius: 8px;
	margin: 16px 0;
	font-size: 14px;
}
