/**
 * Awesome Support AI Agent - Smart Chat Widget Styles
 * Modern Black & White Theme
 */

/* Chat Button */
.wpas-ai-chat-widget {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 9999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.wpas-ai-chat-button {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	border: 2px solid rgba(255, 255, 255, 0.1);
}

.wpas-ai-chat-button:hover {
	background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
	transform: scale(1.08);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.25);
}

.wpas-ai-chat-button.active {
	display: none;
}

.wpas-ai-chat-button svg {
	width: 28px;
	height: 28px;
}

/* Chat Window */
.wpas-ai-chat-window {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 400px;
	max-width: calc(100vw - 40px);
	height: 650px;
	max-height: calc(110vh - 120px);
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 0, 0, 0.1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid rgba(0, 0, 0, 0.08);
	transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
	            height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded Chat Window */
.wpas-ai-chat-window.expanded {
	width: 600px;
	height: 780px;
}

@media (min-width: 768px) {
	.wpas-ai-chat-window.expanded {
		width: 540px;
		height: 780px;
	}
}

/* Header */
.wpas-ai-chat-header {
	background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
	color: #fff;
	padding: 24px 20px;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	position: relative;
}

.wpas-ai-chat-header::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.wpas-ai-chat-header-content h3 {
	margin: 0 0 6px 0;
	font-size: 19px;
	font-weight: 600;
	letter-spacing: -0.3px;
	color: white!Important;
}

.wpas-ai-chat-header-content p {
	margin: 0;
	font-size: 13px;
	opacity: 0.85;
	font-weight: 400;
}

.wpas-ai-chat-header-buttons {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-left: 12px;
}

.wpas-ai-chat-resize {
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 0;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	flex-shrink: 0;
	position: relative;
}

.wpas-ai-chat-resize:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: scale(1.05);
}

.wpas-ai-chat-resize:active {
	transform: scale(0.95);
}

.wpas-ai-chat-resize svg {
	width: 16px;
	height: 16px;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wpas-ai-chat-window.expanded .wpas-ai-chat-resize {
	background: rgba(255, 255, 255, 0.15);
}

.wpas-ai-chat-window.expanded .wpas-ai-chat-resize svg {
	transform: rotate(180deg);
}

.wpas-ai-chat-close {
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 0;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	flex-shrink: 0;
}

.wpas-ai-chat-close:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: rotate(90deg);
}

.wpas-ai-chat-close svg {
	width: 18px;
	height: 18px;
}

/* Messages Area */
.wpas-ai-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 24px 20px;
	background: #f8f9fa;
	background-image: 
		linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
		linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
	background-size: 20px 20px;
}

.wpas-ai-chat-message {
	margin-bottom: 20px;
	display: flex;
	flex-direction: column;
	animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.wpas-ai-message-content {
	padding: 14px 18px;
	border-radius: 14px;
	max-width: 85%;
	word-wrap: break-word;
	line-height: 1.5;
	font-size: 14.5px;
	position: relative;
}

/* Links in messages */
.wpas-ai-message-content a {
	color: #2b92ff;
	text-decoration: none;
	font-weight: 500;
	border-bottom: 1px solid rgba(43, 146, 255, 0.3);
	transition: all 0.2s ease;
}

.wpas-ai-message-content a:hover {
	color: #1a7de8;
	border-bottom-color: #1a7de8;
}

.wpas-ai-message-content a:active {
	color: #0d5cb8;
}

.wpas-ai-bot-message .wpas-ai-message-content {
	background: #ffffff;
	color: #1a1a1a;
	border-bottom-left-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
	border: 1px solid rgba(0, 0, 0, 0.06);
	align-self: flex-start;
}

.wpas-ai-user-message {
	align-items: flex-end;
}

.wpas-ai-user-message .wpas-ai-message-content {
	background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
	color: #ffffff;
	border-bottom-right-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
	align-self: flex-end;
}

/* Message Timestamps */
.wpas-ai-message-timestamp {
	font-size: 11px;
	color: #999;
	margin-top: 6px;
	padding: 0 4px;
	font-weight: 400;
}

.wpas-ai-bot-message .wpas-ai-message-timestamp {
	align-self: flex-start;
}

.wpas-ai-user-message .wpas-ai-message-timestamp {
	align-self: flex-end;
	text-align: right;
}

/* Typing Indicator */
.wpas-ai-typing-indicator {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 0;
}

.wpas-ai-typing-indicator span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #666;
	animation: typing-pulse 1.4s infinite;
}

.wpas-ai-typing-indicator span:nth-child(2) {
	animation-delay: 0.2s;
}

.wpas-ai-typing-indicator span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typing-pulse {
	0%, 60%, 100% {
		opacity: 0.3;
		transform: scale(0.8);
	}
	30% {
		opacity: 1;
		transform: scale(1);
	}
}

/* Input Area */
.wpas-ai-chat-input-area {
	background: #ffffff;
	border-top: 1px solid #e8e8e8;
	padding: 18px 20px;
	box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
}

.wpas-ai-chat-form {
	display: flex;
	gap: 12px;
	align-items: flex-end;
	margin: 0;
}

.wpas-ai-chat-input {
	flex: 1;
	border: 2px solid #e8e8e8;
	border-radius: 24px;
	padding: 12px 18px;
	font-size: 14.5px;
	resize: none;
	max-height: 120px;
	font-family: inherit;
	outline: none;
	transition: all 0.2s;
	background: #f8f9fa;
	color: #1a1a1a;
}

.wpas-ai-chat-input:focus {
	border-color: #1a1a1a;
	background: #ffffff;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.wpas-ai-chat-input::placeholder {
	color: #999;
}

.wpas-ai-chat-send {
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	border-radius: 50%;
	background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	flex-shrink: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	padding: 0;
	overflow: visible;
	margin: auto;
}

.wpas-ai-chat-send:hover:not(:disabled) {
	background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
	transform: scale(1.05);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	color: white;
}

.wpas-ai-chat-send:active:not(:disabled) {
	transform: scale(0.95);
}

.wpas-ai-chat-send:disabled {
	background: #e8e8e8;
	cursor: not-allowed;
	opacity: 0.6;
	box-shadow: none;
}

.wpas-ai-chat-send svg {
	width: 20px !important;
	height: 20px !important;
	min-width: 20px;
	min-height: 20px;
	display: block;
	flex-shrink: 0;
}

/* Action Buttons */
.wpas-ai-action-button {
	display: inline-block;
	background: #1a1a1a;
	color: #fff;
	padding: 10px 18px;
	border-radius: 8px;
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	margin-top: 10px;
	transition: all 0.2s;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.wpas-ai-action-button:hover {
	background: #2d2d2d;
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Mobile Responsive */
@media (max-width: 480px) {
	.wpas-ai-chat-window {
		width: calc(100vw - 20px);
		height: calc(80vh - 80px);
		bottom: 10px;
		right: 10px;
		border-radius: 12px;
	}
	
	/* Disable expansion on mobile - already full screen */
	.wpas-ai-chat-window.expanded {
		width: calc(100vw - 20px);
		height: calc(100vh - 80px);
	}
	
	.wpas-ai-chat-resize {
		display: none; /* Hide resize button on mobile */
	}

	.wpas-ai-chat-button {
		bottom: 10px;
		right: 10px;
		width: 58px;
		height: 58px;
	}
	
	.wpas-ai-chat-messages {
		padding: 20px 16px;
	}
	
	.wpas-ai-chat-input-area {
		padding: 16px;
	}
}

/* Animations */
@keyframes slideInUp {
	from {
		opacity: 0;
		transform: translateY(30px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.wpas-ai-chat-window.active {
	animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrollbar Styles */
.wpas-ai-chat-messages::-webkit-scrollbar {
	width: 8px;
}

.wpas-ai-chat-messages::-webkit-scrollbar-track {
	background: transparent;
	margin: 8px 0;
}

.wpas-ai-chat-messages::-webkit-scrollbar-thumb {
	background: #d0d0d0;
	border-radius: 4px;
	transition: background 0.2s;
}

.wpas-ai-chat-messages::-webkit-scrollbar-thumb:hover {
	background: #b0b0b0;
}

/* Firefox Scrollbar */
.wpas-ai-chat-messages {
	scrollbar-width: thin;
	scrollbar-color: #d0d0d0 transparent;
}

/* Welcome Message Styling */
.wpas-ai-bot-message:first-child .wpas-ai-message-content {
	background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
	border: 2px solid #1a1a1a;
	font-weight: 500;
}

/* Loading State */
.wpas-ai-chat-send.loading {
	pointer-events: none;
}

.wpas-ai-chat-send.loading::after {
	content: '';
	position: absolute;
	width: 20px;
	height: 20px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}
