/**
 * HostWebo AI Assistant Chatbot Styles
 *
 * @package HostWebo_AI_Assistant
 * @since 1.0.0
 */

/* ========================================
   Variables and Root Styles
   ======================================== */

:root {
	--hwai-primary-color: #5143D9;
	--hwai-primary-dark: #3d32a8;
	--hwai-primary-light: #818CF8;
	--hwai-dark-bg: #0f1027;
	--hwai-dark-bg-alt: #111235;
	--hwai-text-light: #ffffff;
	--hwai-text-muted: #a0a0a0;
	--hwai-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	--hwai-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
	--hwai-radius: 12px;
	--hwai-radius-sm: 8px;
	--hwai-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Chatbot Container
   ======================================== */

.hwai-chatbot {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.hwai-chatbot * {
	box-sizing: border-box;
}

/* Positioning */
.hwai-position-bottom-right {
	bottom: 20px;
	right: 20px;
}

.hwai-position-bottom-left {
	bottom: 20px;
	left: 20px;
}

/* ========================================
   Toggle Button
   ======================================== */

.hwai-chat-toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--hwai-primary-color) 0%, var(--hwai-primary-light) 100%);
	border: none;
	color: var(--hwai-text-light);
	cursor: pointer;
	box-shadow: var(--hwai-shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: var(--hwai-transition);
}

.hwai-chat-toggle:hover {
	transform: scale(1.1);
	box-shadow: var(--hwai-shadow-lg);
}

.hwai-chat-toggle:active {
	transform: scale(0.95);
}

.hwai-chat-toggle .hwai-chat-icon,
.hwai-chat-toggle .hwai-close-icon {
	transition: var(--hwai-transition);
}

.hwai-chat-toggle .hwai-close-icon {
	display: none;
}

.hwai-chat-toggle.hwai-open .hwai-chat-icon {
	display: none;
}

.hwai-chat-toggle.hwai-open .hwai-close-icon {
	display: block;
}

/* Unread Badge */
.hwai-unread-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: #ff4444;
	color: white;
	border-radius: 50%;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	border: 2px solid var(--hwai-dark-bg);
}

/* ========================================
   Chat Window
   ======================================== */

.hwai-chat-window {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 400px;
	max-width: calc(100vw - 40px);
	height: 600px;
	max-height: calc(100vh - 120px);
	background: var(--hwai-dark-bg-alt);
	border-radius: var(--hwai-radius);
	box-shadow: var(--hwai-shadow-lg);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px);
	transition: var(--hwai-transition);
	pointer-events: none;
}

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

/* Mobile Styles */
@media (max-width: 480px) {
	.hwai-chat-window {
		width: calc(100vw - 20px);
		height: calc(100vh - 100px);
		bottom: 70px;
	}

	.hwai-position-bottom-left .hwai-chat-window {
		left: 0;
	}
}

/* ========================================
   Chat Header
   ======================================== */

.hwai-chat-header {
	background: linear-gradient(135deg, var(--hwai-primary-color) 0%, var(--hwai-primary-light) 100%);
	color: var(--hwai-text-light);
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-radius: var(--hwai-radius) var(--hwai-radius) 0 0;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.hwai-avatar {
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
}

.hwai-header-text h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.hwai-status {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	opacity: 0.9;
}

.hwai-status-dot {
	width: 8px;
	height: 8px;
	background: #4ade80;
	border-radius: 50%;
	animation: hwai-pulse 2s infinite;
}

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

.hwai-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-direction: row;
}

.hwai-header-btn {
	background: rgba(255, 255, 255, 0.2);
	border: none;
	color: white;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: var(--hwai-transition);
	flex-shrink: 0;
}

.hwai-header-btn:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   Chat Body
   ======================================== */

.hwai-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	background: var(--hwai-dark-bg);
	scrollbar-width: thin;
	scrollbar-color: var(--hwai-primary-color) transparent;
}

.hwai-chat-body::-webkit-scrollbar {
	width: 6px;
}

.hwai-chat-body::-webkit-scrollbar-track {
	background: transparent;
}

.hwai-chat-body::-webkit-scrollbar-thumb {
	background: var(--hwai-primary-color);
	border-radius: 3px;
}

/* ========================================
   Authentication Forms
   ======================================== */

.hwai-auth-container {
	max-width: 100%;
}

.hwai-auth-form {
	animation: hwai-fadeInUp 0.3s ease-out;
}

@keyframes hwai-fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.hwai-auth-header {
	text-align: center;
	margin-bottom: 24px;
}

.hwai-auth-header h3 {
	color: var(--hwai-text-light);
	margin: 0 0 8px 0;
	font-size: 20px;
}

.hwai-auth-header p {
	color: var(--hwai-text-muted);
	margin: 0;
	font-size: 14px;
}

.hwai-form-group {
	margin-bottom: 16px;
}

.hwai-form-group label {
	display: block;
	color: var(--hwai-text-light);
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 500;
}

.hwai-input {
	width: 100%;
	padding: 12px 16px;
	background: var(--hwai-dark-bg-alt);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: var(--hwai-radius-sm);
	color: var(--hwai-text-light);
	font-size: 14px;
	transition: var(--hwai-transition);
}

.hwai-input:focus {
	outline: none;
	border-color: var(--hwai-primary-color);
	box-shadow: 0 0 0 3px rgba(81, 67, 217, 0.1);
}

.hwai-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	cursor: pointer;
	color: var(--hwai-text-light);
	font-size: 13px;
}

.hwai-checkbox-label input[type="checkbox"] {
	margin-top: 2px;
	accent-color: var(--hwai-primary-color);
}

.hwai-btn {
	width: 100%;
	padding: 12px 24px;
	border: none;
	border-radius: var(--hwai-radius-sm);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: var(--hwai-transition);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.hwai-btn-primary {
	background: linear-gradient(135deg, var(--hwai-primary-color) 0%, var(--hwai-primary-light) 100%);
	color: white;
}

.hwai-btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(81, 67, 217, 0.3);
}

.hwai-btn-primary:active {
	transform: translateY(0);
}

.hwai-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none !important;
}

.hwai-auth-footer {
	margin-top: 20px;
	text-align: center;
}

.hwai-auth-footer p {
	color: var(--hwai-text-muted);
	font-size: 13px;
	margin: 0;
}

.hwai-auth-footer a {
	color: var(--hwai-primary-light);
	text-decoration: none;
	font-weight: 600;
}

.hwai-auth-footer a:hover {
	text-decoration: underline;
}

/* ========================================
   Messages
   ======================================== */

.hwai-messages-container {
	height: 100%;
	display: flex;
	flex-direction: column;
}

.hwai-messages {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.hwai-message {
	display: flex;
	gap: 10px;
	animation: hwai-fadeInUp 0.3s ease-out;
}

.hwai-message-user {
	flex-direction: row-reverse;
}

.hwai-message-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--hwai-primary-color);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.hwai-message-user .hwai-message-avatar {
	background: var(--hwai-primary-light);
}

.hwai-message-bubble {
	max-width: 75%;
	padding: 12px 16px;
	border-radius: var(--hwai-radius);
	position: relative;
}

.hwai-message-assistant .hwai-message-bubble {
	background: var(--hwai-dark-bg-alt);
	color: var(--hwai-text-light);
	border: 1px solid rgba(255, 255, 255, 0.05);
}

.hwai-message-user .hwai-message-bubble {
	background: linear-gradient(135deg, var(--hwai-primary-color) 0%, var(--hwai-primary-light) 100%);
	color: white;
}

.hwai-message-content {
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
}

.hwai-message-content p {
	margin: 0 0 8px 0;
}

.hwai-message-content p:last-child {
	margin-bottom: 0;
}

.hwai-message-content strong {
	font-weight: 600;
}

.hwai-message-content a {
	color: var(--hwai-primary-light);
	text-decoration: underline;
}

.hwai-message-content ul,
.hwai-message-content ol {
	margin: 8px 0;
	padding-left: 20px;
}

.hwai-message-content li {
	margin: 4px 0;
}

.hwai-message-time {
	font-size: 11px;
	color: var(--hwai-text-muted);
	margin-top: 4px;
	display: block;
}

/* Typing Indicator */
.hwai-typing-dots {
	display: flex;
	gap: 4px;
	padding: 4px 0;
}

.hwai-typing-dots span {
	width: 8px;
	height: 8px;
	background: var(--hwai-primary-light);
	border-radius: 50%;
	animation: hwai-typing 1.4s infinite;
}

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

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

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

/* ========================================
   Chat Footer / Input
   ======================================== */

.hwai-chat-footer {
	padding: 16px 20px;
	background: var(--hwai-dark-bg-alt);
	border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.hwai-input-container {
	display: flex;
	gap: 10px;
	align-items: flex-end;
}

.hwai-message-input {
	flex: 1;
	padding: 12px 16px;
	background: var(--hwai-dark-bg);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: var(--hwai-radius-sm);
	color: var(--hwai-text-light);
	font-size: 14px;
	font-family: inherit;
	resize: none;
	max-height: 120px;
	transition: var(--hwai-transition);
}

.hwai-message-input:focus {
	outline: none;
	border-color: var(--hwai-primary-color);
	box-shadow: 0 0 0 3px rgba(81, 67, 217, 0.1);
}

.hwai-message-input::placeholder {
	color: var(--hwai-text-muted);
}

.hwai-send-btn {
	width: 44px;
	height: 44px;
	background: linear-gradient(135deg, var(--hwai-primary-color) 0%, var(--hwai-primary-light) 100%);
	border: none;
	border-radius: 50%;
	color: white;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--hwai-transition);
	flex-shrink: 0;
}

.hwai-send-btn:hover {
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(81, 67, 217, 0.3);
}

.hwai-send-btn:active {
	transform: scale(0.95);
}

.hwai-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none !important;
}

.hwai-footer-info {
	margin-top: 8px;
	text-align: center;
}

.hwai-footer-info small {
	color: var(--hwai-text-muted);
	font-size: 11px;
}

/* ========================================
   Utilities
   ======================================== */

.hwai-error-message {
	background: #ef4444;
	color: white;
	padding: 12px 16px;
	border-radius: var(--hwai-radius-sm);
	font-size: 13px;
	margin-bottom: 16px;
	animation: hwai-shake 0.5s;
}

@keyframes hwai-shake {
	0%, 100% { transform: translateX(0); }
	10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
	20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.hwai-success-message {
	background: #10b981;
	color: white;
	padding: 12px 16px;
	border-radius: var(--hwai-radius-sm);
	font-size: 13px;
	margin-bottom: 16px;
}

/* Loading Spinner */
.hwai-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: white;
	border-radius: 50%;
	animation: hwai-spin 0.6s linear infinite;
}

@keyframes hwai-spin {
	to { transform: rotate(360deg); }
}

/* ========================================
   Auth Description
   ======================================== */

.hwai-auth-description {
	background: rgba(81, 67, 217, 0.1);
	border-left: 3px solid var(--hwai-primary-color);
	padding: 15px;
	margin-bottom: 20px;
	border-radius: var(--hwai-radius-sm);
}

.hwai-auth-description p {
	margin: 0 0 10px 0;
	font-size: 13px;
	color: var(--hwai-text-light);
	font-weight: 500;
}

.hwai-auth-description ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.hwai-auth-description li {
	font-size: 12px;
	color: var(--hwai-text-muted);
	margin-bottom: 6px;
	line-height: 1.5;
}

/* ========================================
   Quick Buttons
   ======================================== */

.hwai-quick-buttons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin: 12px 0 16px 0;
	padding: 0;
	animation: hwai-fadeInUp 0.5s ease-out;
}

.hwai-quick-btn {
	background: rgba(81, 67, 217, 0.08);
	border: 1px solid rgba(129, 140, 248, 0.2);
	color: var(--hwai-text-light);
	padding: 10px 12px;
	border-radius: var(--hwai-radius-sm);
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
	font-family: inherit;
	font-weight: 500;
	line-height: 1.3;
	position: relative;
	overflow: hidden;
}

.hwai-quick-btn::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
	transition: left 0.5s;
}

.hwai-quick-btn:hover::before {
	left: 100%;
}

.hwai-quick-btn:hover {
	background: rgba(81, 67, 217, 0.15);
	border-color: var(--hwai-primary-light);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(81, 67, 217, 0.2);
}

.hwai-quick-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(81, 67, 217, 0.2);
}

/* Mobile: stack vertically */
@media (max-width: 400px) {
	.hwai-quick-buttons {
		grid-template-columns: 1fr;
		gap: 6px;
	}
}

/* ========================================
   Session Feedback Widget
   ======================================== */

.hwai-session-feedback {
	background: rgba(17, 18, 53, 0.6);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(129, 140, 248, 0.15);
	border-radius: var(--hwai-radius-sm);
	padding: 10px 14px;
	margin-bottom: 10px;
	animation: hwai-slideInUp 0.4s ease-out;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

.hwai-feedback-content {
	display: flex;
	align-items: center;
	gap: 10px;
	justify-content: space-between;
}

.hwai-feedback-text {
	color: rgba(255, 255, 255, 0.9);
	font-size: 12px;
	font-weight: 500;
	flex: 1;
	line-height: 1.4;
}

.hwai-feedback-buttons {
	display: flex;
	gap: 6px;
	flex-shrink: 0;
}

.hwai-feedback-btn {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: var(--hwai-text-light);
	width: 32px;
	height: 32px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
	padding: 0;
}

.hwai-feedback-btn svg {
	width: 18px;
	height: 18px;
}

.hwai-feedback-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.hwai-feedback-positive:hover {
	background: rgba(16, 185, 129, 0.2);
	border-color: #10b981;
	color: #10b981;
}

.hwai-feedback-negative:hover {
	background: rgba(239, 68, 68, 0.2);
	border-color: #ef4444;
	color: #ef4444;
}

.hwai-feedback-close {
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.4);
	cursor: pointer;
	padding: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	flex-shrink: 0;
	margin-left: 4px;
}

.hwai-feedback-close:hover {
	color: rgba(255, 255, 255, 0.8);
	transform: rotate(90deg);
}

.hwai-feedback-close svg {
	width: 14px;
	height: 14px;
}
