/**
 * Floating AI Chat Widget Stylesheet - Commercial Premium Theme
 *
 * @package AIAssistant
 */

:root {
	--ai-primary: #4F46E5;
	--ai-secondary: #06B6D4;
	--ai-bg: #FFFFFF;
	--ai-text: #1F2937;
	--ai-user-bubble: #4F46E5;
	--ai-assistant-bubble: #F3F4F6;
	--ai-radius: 16px;
	--ai-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--ai-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ROOT CONTAINER */
#ai-assistant-root {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 999999;
	font-family: var(--ai-font);
	box-sizing: border-box;
}

#ai-assistant-root *,
#ai-assistant-root *:before,
#ai-assistant-root *:after {
	box-sizing: border-box;
}

/* FLOATING LAUNCHER */
#ai-assistant-launcher {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--ai-primary) 0%, var(--ai-secondary) 100%);
	color: #ffffff;
	border: none;
	cursor: pointer;
	box-shadow: 0 10px 20px rgba(79, 70, 229, 0.35);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
	position: relative;
}

#ai-assistant-launcher:hover {
	transform: scale(1.08);
	box-shadow: 0 14px 28px rgba(79, 70, 229, 0.45);
}

.ai-assistant-launcher-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.ai-assistant-launcher-icon.close-icon {
	display: none;
}

.ai-assistant-open .ai-assistant-launcher-icon.open-icon { display: none; }
.ai-assistant-open .ai-assistant-launcher-icon.close-icon { display: flex; }

.ai-assistant-unread-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	background: #EF4444;
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #ffffff;
}

/* EXPANDABLE CHAT WINDOW */
#ai-assistant-window {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 400px;
	height: 600px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 100px);
	background: var(--ai-bg);
	border-radius: var(--ai-radius);
	box-shadow: var(--ai-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px) scale(0.95);
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	border: 1px solid rgba(229, 231, 235, 0.8);
}

.ai-assistant-open #ai-assistant-window {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: all;
}

/* HEADER */
.ai-assistant-header {
	background: linear-gradient(135deg, var(--ai-primary) 0%, var(--ai-secondary) 100%);
	color: #ffffff;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

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

.ai-assistant-avatar-wrapper {
	position: relative;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
}

.ai-assistant-avatar {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
}

.ai-assistant-status-dot {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 10px;
	height: 10px;
	background: #10B981;
	border: 2px solid #ffffff;
	border-radius: 50%;
}

.ai-assistant-header-text h4 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #ffffff;
}

.ai-assistant-status-text {
	font-size: 11px;
	opacity: 0.85;
}

.ai-assistant-header-actions {
	display: flex;
	gap: 6px;
}

.header-action-btn {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #ffffff;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
}

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

/* WELCOME SCREEN OVERLAY */
.ai-assistant-welcome-screen {
	position: absolute;
	top: 72px;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--ai-bg);
	z-index: 10;
	padding: 32px 24px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
}

.welcome-content {
	max-width: 320px;
}

.welcome-badge {
	background: #EEF2FF;
	color: var(--ai-primary);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1px;
	padding: 4px 12px;
	border-radius: 9999px;
	display: inline-block;
	margin-bottom: 12px;
}

.welcome-content h2 {
	margin: 0 0 12px 0;
	font-size: 24px;
	color: var(--ai-text);
	font-weight: 700;
}

.welcome-content p {
	font-size: 14px;
	color: #6B7280;
	line-height: 1.5;
	margin-bottom: 24px;
}

.ai-assistant-cta-button {
	display: block;
	width: 100%;
	background: linear-gradient(135deg, var(--ai-primary) 0%, var(--ai-secondary) 100%);
	color: #ffffff !important;
	text-decoration: none !important;
	padding: 14px 20px;
	border-radius: 12px;
	font-weight: 600;
	font-size: 14px;
	box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
	transition: transform 0.2s ease;
}

.ai-assistant-cta-button:hover {
	transform: translateY(-2px);
}

.welcome-footer-text {
	margin-top: 16px;
	font-size: 12px;
	color: #9CA3AF;
}

/* MESSAGES BODY */
.ai-assistant-messages-body {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.ai-message {
	display: flex;
	flex-direction: column;
	max-width: 82%;
	position: relative;
	animation: aiMessageSlide 0.25s ease-out forwards;
}

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

.ai-message.user {
	align-self: flex-end;
}

.ai-message.assistant {
	align-self: flex-start;
}

.ai-message-bubble {
	padding: 12px 16px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	word-break: break-word;
}

.ai-message.user .ai-message-bubble {
	background: var(--ai-user-bubble);
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

.ai-message.assistant .ai-message-bubble {
	background: var(--ai-assistant-bubble);
	color: var(--ai-text);
	border-bottom-left-radius: 4px;
}

.ai-message-time {
	font-size: 10px;
	color: #9CA3AF;
	margin-top: 4px;
	align-self: flex-end;
}

.ai-copy-btn {
	background: transparent;
	border: none;
	color: #9CA3AF;
	cursor: pointer;
	padding: 2px 4px;
	font-size: 11px;
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin-top: 2px;
}

.ai-copy-btn:hover {
	color: var(--ai-primary);
}

/* SUGGESTED PILLS */
.ai-assistant-suggested-pills {
	padding: 8px 16px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	background: rgba(249, 250, 251, 0.8);
	border-top: 1px solid #F3F4F6;
}

.suggested-pill {
	background: #ffffff;
	border: 1px solid #E5E7EB;
	color: var(--ai-primary);
	font-size: 12px;
	font-weight: 500;
	padding: 6px 12px;
	border-radius: 9999px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.suggested-pill:hover {
	background: #EEF2FF;
	border-color: var(--ai-primary);
}

/* TYPING INDICATOR */
.ai-assistant-typing-indicator {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 16px;
	margin: 0 20px 10px 20px;
	background: var(--ai-assistant-bubble);
	border-radius: 12px;
	width: fit-content;
}

.typing-dot {
	width: 6px;
	height: 6px;
	background: #9CA3AF;
	border-radius: 50%;
	animation: typingBlink 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBlink {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

/* FOOTER INPUT */
.ai-assistant-footer {
	padding: 12px 16px;
	border-top: 1px solid #E5E7EB;
	background: var(--ai-bg);
}

.ai-assistant-footer form {
	display: flex;
	align-items: center;
	gap: 8px;
}

.schedule-icon-btn {
	background: #F3F4F6;
	border: none;
	color: #4B5563;
	width: 38px;
	height: 38px;
	border-radius: 10px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
}

.schedule-icon-btn:hover {
	background: #EEF2FF;
	color: var(--ai-primary);
}

#ai-assistant-input {
	flex: 1;
	border: 1px solid #E5E7EB;
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 14px;
	outline: none;
	background: #F9FAFB;
	color: var(--ai-text);
}

#ai-assistant-input:focus {
	border-color: var(--ai-primary);
	background: #ffffff;
}

#ai-assistant-send-btn {
	background: var(--ai-primary);
	color: #ffffff;
	border: none;
	width: 38px;
	height: 38px;
	border-radius: 10px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
}

#ai-assistant-send-btn:hover {
	background: #4338CA;
}

/* MODAL FOR SCHEDULING */
.ai-assistant-modal {
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.ai-assistant-modal-content {
	background: #ffffff;
	width: 100%;
	border-radius: 16px;
	padding: 20px;
	box-shadow: var(--ai-shadow);
}

.ai-assistant-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
}

.ai-assistant-modal-header h3 { margin: 0; font-size: 16px; }
.modal-close-btn { background: none; border: none; font-size: 20px; cursor: pointer; }

.form-group {
	margin-bottom: 12px;
}

.form-group label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	margin-bottom: 4px;
	color: #374151;
}

.form-group input, .form-group textarea {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #D1D5DB;
	border-radius: 8px;
	font-size: 13px;
}

.ai-assistant-submit-booking-btn {
	width: 100%;
	background: var(--ai-primary);
	color: #ffffff;
	border: none;
	padding: 10px;
	border-radius: 8px;
	font-weight: 600;
	cursor: pointer;
}

/* DARK MODE OVERRIDES */
.ai-dark-mode #ai-assistant-window {
	--ai-bg: #111827;
	--ai-text: #F9FAFB;
	--ai-assistant-bubble: #1F2937;
	border-color: #374151;
}

.ai-dark-mode .ai-assistant-welcome-screen {
	background: #111827;
}

.ai-dark-mode #ai-assistant-input {
	background: #1F2937;
	border-color: #374151;
	color: #ffffff;
}

.ai-dark-mode .ai-assistant-suggested-pills {
	background: #1F2937;
}

.ai-dark-mode .suggested-pill {
	background: #111827;
	border-color: #374151;
	color: #A5B4FC;
}

/* MARKDOWN STYLING */
.ai-message-bubble table {
	border-collapse: collapse;
	width: 100%;
	margin: 8px 0;
	font-size: 12px;
}

.ai-message-bubble th, .ai-message-bubble td {
	border: 1px solid #D1D5DB;
	padding: 4px 8px;
}

.ai-message-bubble pre {
	background: #1E293B;
	color: #F8FAFC;
	padding: 8px 12px;
	border-radius: 8px;
	overflow-x: auto;
	font-size: 12px;
}
