/**
 * BGE AI Assistant - Proactive Messages Styles
 *
 * Styles for proactive message display components.
 *
 * @package NELSONS_Membership
 * @subpackage AI_Assistant
 * @since 2.3.0
 */

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

#nd-ai-proactive-container {
	position: fixed;
	z-index: 999998;
	pointer-events: none;
}

#nd-ai-proactive-container > * {
	pointer-events: auto;
}

/* ==========================================================================
   Base Message Styles
   ========================================================================== */

.nd-proactive-message {
	position: fixed;
	max-width: 380px;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
	opacity: 0;
	transform: translateY(20px) scale(0.95);
	transition: opacity 0.3s ease, transform 0.3s ease;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #1a1a1a;
}

.nd-proactive-message--visible {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.nd-proactive-message--hiding {
	opacity: 0;
	transform: translateY(-10px) scale(0.95);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ==========================================================================
   Close Button
   ========================================================================== */

.nd-proactive-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 28px;
	height: 28px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #666;
	transition: background-color 0.2s, color 0.2s;
	z-index: 10;
}

.nd-proactive-close:hover {
	background: rgba(0, 0, 0, 0.08);
	color: #333;
}

.nd-proactive-close:focus {
	outline: 2px solid #4F46E5;
	outline-offset: 2px;
}

.nd-proactive-close svg {
	width: 14px;
	height: 14px;
}

/* ==========================================================================
   Content
   ========================================================================== */

.nd-proactive-content {
	padding: 16px 40px 16px 16px;
}

.nd-proactive-text {
	color: #333;
	word-wrap: break-word;
}

.nd-proactive-text p {
	margin: 0 0 8px;
}

.nd-proactive-text p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   Position Variants
   ========================================================================== */

/* Bottom Right (Default) */
.nd-proactive-position--bottom-right {
	bottom: 24px;
	right: 24px;
}

/* Bottom Left */
.nd-proactive-position--bottom-left {
	bottom: 24px;
	left: 24px;
}

/* Top Right */
.nd-proactive-position--top-right {
	top: 24px;
	right: 24px;
}

.nd-proactive-position--top-right.nd-proactive-message {
	transform: translateY(-20px) scale(0.95);
}

.nd-proactive-position--top-right.nd-proactive-message--visible {
	transform: translateY(0) scale(1);
}

/* Top Left */
.nd-proactive-position--top-left {
	top: 24px;
	left: 24px;
}

.nd-proactive-position--top-left.nd-proactive-message {
	transform: translateY(-20px) scale(0.95);
}

.nd-proactive-position--top-left.nd-proactive-message--visible {
	transform: translateY(0) scale(1);
}

/* Center */
.nd-proactive-position--center {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.95);
}

.nd-proactive-position--center.nd-proactive-message--visible {
	transform: translate(-50%, -50%) scale(1);
}

/* ==========================================================================
   Toast Style
   ========================================================================== */

.nd-proactive-message--toast {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #fff;
	padding: 0;
}

.nd-proactive-message--toast .nd-proactive-content {
	padding: 14px 44px 14px 16px;
}

.nd-proactive-message--toast .nd-proactive-text {
	color: #fff;
}

.nd-proactive-message--toast .nd-proactive-close {
	color: rgba(255, 255, 255, 0.8);
}

.nd-proactive-message--toast .nd-proactive-close:hover {
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
}

/* ==========================================================================
   Chat Bubble Style
   ========================================================================== */

.nd-proactive-message--chat_bubble {
	max-width: 320px;
	cursor: pointer;
	transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.2s ease;
}

.nd-proactive-message--chat_bubble:hover {
	box-shadow: 0 6px 32px rgba(0, 0, 0, 0.18), 0 3px 12px rgba(0, 0, 0, 0.12);
}

.nd-proactive-message--chat_bubble .nd-proactive-content {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 40px 14px 14px;
}

.nd-proactive-avatar {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
}

.nd-proactive-avatar svg {
	width: 20px;
	height: 20px;
}

.nd-proactive-message--chat_bubble .nd-proactive-text {
	flex: 1;
	padding-top: 2px;
}

/* Speech bubble tail */
.nd-proactive-message--chat_bubble::after {
	content: '';
	position: absolute;
	bottom: -8px;
	right: 24px;
	width: 16px;
	height: 16px;
	background: #fff;
	transform: rotate(45deg);
	box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.08);
	border-radius: 2px;
}

/* Tail position for left-positioned bubbles */
.nd-proactive-message--chat_bubble.nd-proactive-position--bottom-left::after,
.nd-proactive-message--chat_bubble.nd-proactive-position--top-left::after {
	right: auto;
	left: 24px;
}

/* Tail at top for top-positioned bubbles */
.nd-proactive-message--chat_bubble.nd-proactive-position--top-right::after,
.nd-proactive-message--chat_bubble.nd-proactive-position--top-left::after {
	bottom: auto;
	top: -8px;
	box-shadow: -2px -2px 8px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Modal Style
   ========================================================================== */

.nd-proactive-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	opacity: 0;
	animation: nd-fade-in 0.3s ease forwards;
}

@keyframes nd-fade-in {
	to { opacity: 1; }
}

.nd-proactive-message--modal {
	position: relative;
	max-width: 480px;
	width: calc(100% - 48px);
	transform: scale(0.9);
	border-radius: 16px;
}

.nd-proactive-message--modal.nd-proactive-message--visible {
	transform: scale(1);
}

.nd-proactive-message--modal .nd-proactive-content {
	padding: 24px 48px 24px 24px;
}

.nd-proactive-message--modal .nd-proactive-text {
	font-size: 15px;
}

.nd-proactive-message--modal .nd-proactive-close {
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
}

/* ==========================================================================
   Banner Style
   ========================================================================== */

.nd-proactive-message--banner {
	position: fixed;
	left: 0;
	right: 0;
	max-width: none;
	border-radius: 0;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
	transform: translateY(-100%);
}

.nd-proactive-message--banner.nd-proactive-position--top {
	top: 0;
}

.nd-proactive-message--banner.nd-proactive-position--bottom {
	top: auto;
	bottom: 0;
	transform: translateY(100%);
}

.nd-proactive-message--banner.nd-proactive-message--visible {
	transform: translateY(0);
}

.nd-proactive-message--banner .nd-proactive-content {
	max-width: 1200px;
	margin: 0 auto;
	padding: 12px 48px 12px 24px;
	text-align: center;
}

.nd-proactive-message--banner .nd-proactive-close {
	top: 50%;
	right: 16px;
	transform: translateY(-50%);
}

/* Banner color variations */
.nd-proactive-message--banner.nd-proactive-banner--info {
	background: #EFF6FF;
	border-bottom: 1px solid #BFDBFE;
	color: #1E40AF;
}

.nd-proactive-message--banner.nd-proactive-banner--success {
	background: #ECFDF5;
	border-bottom: 1px solid #A7F3D0;
	color: #065F46;
}

.nd-proactive-message--banner.nd-proactive-banner--warning {
	background: #FFFBEB;
	border-bottom: 1px solid #FDE68A;
	color: #92400E;
}

/* ==========================================================================
   Inline Style
   ========================================================================== */

.nd-proactive-message--inline {
	position: relative;
	max-width: none;
	margin: 16px 0;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
	border: 1px solid #E5E7EB;
	transform: none;
	opacity: 1;
}

.nd-proactive-message--inline .nd-proactive-content {
	padding: 16px 44px 16px 16px;
}

/* ==========================================================================
   CTA Button
   ========================================================================== */

.nd-proactive-cta {
	display: inline-block;
	margin-top: 12px;
	padding: 8px 16px;
	background: #4F46E5;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.2s;
}

.nd-proactive-cta:hover {
	background: #4338CA;
	color: #fff;
}

.nd-proactive-message--toast .nd-proactive-cta {
	background: rgba(255, 255, 255, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.4);
}

.nd-proactive-message--toast .nd-proactive-cta:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes nd-proactive-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-4px); }
}

.nd-proactive-message--chat_bubble.nd-proactive-message--visible {
	animation: nd-proactive-bounce 2s ease-in-out 1s 2;
}

/* Pulse animation for attention */
@keyframes nd-proactive-pulse {
	0%, 100% { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1); }
	50% { box-shadow: 0 4px 24px rgba(79, 70, 229, 0.3), 0 2px 8px rgba(79, 70, 229, 0.2); }
}

.nd-proactive-message--attention {
	animation: nd-proactive-pulse 2s ease-in-out infinite;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 480px) {
	.nd-proactive-message {
		max-width: calc(100% - 32px);
		left: 16px !important;
		right: 16px !important;
	}

	.nd-proactive-position--bottom-right,
	.nd-proactive-position--bottom-left {
		bottom: 16px;
	}

	.nd-proactive-position--top-right,
	.nd-proactive-position--top-left {
		top: 16px;
	}

	.nd-proactive-message--chat_bubble {
		max-width: calc(100% - 32px);
	}

	.nd-proactive-message--chat_bubble::after {
		display: none;
	}

	.nd-proactive-message--modal {
		width: calc(100% - 32px);
		max-height: calc(100vh - 48px);
		overflow-y: auto;
	}

	.nd-proactive-message--banner .nd-proactive-content {
		padding: 12px 44px 12px 16px;
		text-align: left;
	}
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	.nd-proactive-message {
		background: #1F2937;
		color: #F9FAFB;
	}

	.nd-proactive-message .nd-proactive-text {
		color: #E5E7EB;
	}

	.nd-proactive-close {
		color: #9CA3AF;
	}

	.nd-proactive-close:hover {
		background: rgba(255, 255, 255, 0.1);
		color: #E5E7EB;
	}

	.nd-proactive-message--chat_bubble::after {
		background: #1F2937;
	}

	.nd-proactive-message--inline {
		border-color: #374151;
	}

	.nd-proactive-overlay {
		background: rgba(0, 0, 0, 0.7);
	}
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.nd-proactive-message,
	.nd-proactive-message--visible,
	.nd-proactive-message--hiding,
	.nd-proactive-overlay,
	.nd-proactive-message--chat_bubble.nd-proactive-message--visible {
		animation: none;
		transition: opacity 0.1s ease;
	}
}

/* Screen reader only */
.nd-proactive-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Focus visible for keyboard navigation */
.nd-proactive-message:focus-within {
	outline: 2px solid #4F46E5;
	outline-offset: 2px;
}