/**
 * BGE AI Assistant - Chat Widget Styles
 *
 * Styles for the public chat widget and floating launcher.
 * Designed to match Nelsons Dashboard dashboard CSS variables.
 *
 * @package NELSONS_Membership
 * @subpackage AI_Assistant
 * @since 1.0.0
 */

/* ==========================================================================
   Enhanced Widget Header with Gradient & Avatar
   ========================================================================== */

.nd-ai-widget__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 20px;
	/* Custom gradient: Gold (#c08411) to Black (#000000) */
	background: linear-gradient(90deg, #c08411 0%, #000000 100%);
	color: #fff;
	flex-shrink: 0;
	min-height: 70px;
}

/* Avatar Circle */
.nd-ai-widget__avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nd-ai-widget__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nd-ai-widget__avatar svg {
	width: 28px;
	height: 28px;
	color: #c08411;
}

/* Header Content */
.nd-ai-widget__header-content {
	flex: 1;
	min-width: 0;
}

.nd-ai-widget__title {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 2px 0;
	color: #fff;
	opacity: 0.9;
	display: block;
}

.nd-ai-widget__subtitle {
	font-size: 16px;
	font-weight: 700;
	margin: 0;
	color: #fff;
	display: block;
}

/* Hide old title icon */
.nd-ai-widget__title-icon {
	display: none;
}

/* Controls - update for better visibility on dark gradient */
.nd-ai-widget__controls {
	display: flex;
	gap: 4px;
	margin-left: auto;
}

.nd-ai-widget__control {
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: rgba(255, 255, 255, 0.9);
	cursor: pointer;
	padding: 8px;
	border-radius: 6px;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nd-ai-widget__control:hover {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}

.nd-ai-widget__control svg {
	width: 18px;
	height: 18px;
}

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

.nd-ai-widget__messages {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ==========================================================================
   Welcome Message Bubble
   ========================================================================== */

.nd-ai-welcome-bubble {
	background: #f8f9fa;
	border-radius: 12px;
	padding: 14px 16px;
	margin: 16px;
	font-size: 14px;
	line-height: 1.5;
	color: #1d2327;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	border: 1px solid #e9ecef;
}

.nd-ai-welcome-bubble p {
	margin: 0;
}

/* ==========================================================================
   Enhanced Message Bubbles
   ========================================================================== */

.nd-ai-message {
	max-width: 85%;
	padding: 12px 16px;
	border-radius: 12px;
	line-height: 1.5;
	font-size: 14px;
	animation: nd-ai-message-in 0.3s ease;
}

.nd-ai-message--assistant {
	align-self: flex-start;
	background: #f8f9fa;
	color: #1d2327;
	border: 1px solid #e9ecef;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.nd-ai-message--user {
	align-self: flex-end;
	background: linear-gradient(135deg, #c08411 0%, #a06d0f 100%);
	color: #fff;
	border-bottom-right-radius: 4px;
	box-shadow: 0 1px 3px rgba(192, 132, 17, 0.3);
}

/* ==========================================================================
   Input Area Enhancement
   ========================================================================== */

.nd-ai-widget__input-area {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: #fff;
	border-top: 1px solid #e9ecef;
}

.nd-ai-widget__input-wrapper {
	flex: 1;
	position: relative;
}

.nd-ai-widget__input {
	width: 100%;
	padding: 12px 16px;
	border: 1px solid #e9ecef;
	border-radius: 24px;
	font-size: 14px;
	line-height: 1.4;
	resize: none;
	background: #f8f9fa;
	color: #2c3338;
	transition: all 0.2s ease;
	font-family: inherit;
}

.nd-ai-widget__input:focus {
	outline: none;
	border-color: #c08411;
	background: #fff;
	color: #2c3338;
	box-shadow: 0 0 0 3px rgba(192, 132, 17, 0.1);
}

.nd-ai-widget__input::placeholder {
	color: #8c8f94;
}

/* Send Button */
.nd-ai-widget__send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(135deg, #c08411 0%, #a06d0f 100%);
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(192, 132, 17, 0.2);
}

.nd-ai-widget__send:hover {
	background: linear-gradient(135deg, #a06d0f 0%, #8a5c0d 100%);
	transform: scale(1.05);
	box-shadow: 0 3px 6px rgba(192, 132, 17, 0.3);
}

.nd-ai-widget__send:active {
	transform: scale(0.95);
}

.nd-ai-widget__send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.nd-ai-widget__send svg {
	width: 20px;
	height: 20px;
}

/* File Upload Button (if exists) */
.nd-ai-widget__file-upload {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: transparent;
	border: 1px solid #e9ecef;
	color: #646970;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.nd-ai-widget__file-upload:hover {
	background: #f8f9fa;
	border-color: #c08411;
	color: #c08411;
}

/* ==========================================================================
   Footer Disclaimer
   ========================================================================== */

.nd-ai-widget__footer {
	padding: 8px 16px;
	text-align: center;
	font-size: 11px;
	color: #8c8f94;
	background: #f8f9fa;
	border-top: 1px solid #e9ecef;
}

.nd-ai-widget__footer a {
	color: #c08411;
	text-decoration: none;
}

.nd-ai-widget__footer a:hover {
	text-decoration: underline;
}

/* ==========================================================================
   Launcher Button with Gradient
   ========================================================================== */

.nd-ai-launcher {
	position: fixed;
	z-index: 9999;
	width: 128px;
	height: 128px;
	border-radius: 0;
	background: transparent;
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: none;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	overflow: visible;
}

.nd-ai-launcher:hover {
	background: transparent;
	transform: scale(1.1);
	box-shadow: none;
}

.nd-ai-launcher:active {
	transform: scale(0.95);
}

/* Custom mascot launcher (when using image) */
.nd-ai-launcher--mascot,
.nd-ai-launcher:has(.nd-ai-launcher__icon--custom) {
	background: transparent !important;
	box-shadow: none;
}

.nd-ai-launcher--mascot:hover,
.nd-ai-launcher:has(.nd-ai-launcher__icon--custom):hover {
	background: transparent !important;
	transform: scale(1.05);
	box-shadow: none;
}

/* Custom icon image styling */
.nd-ai-launcher__icon--custom {
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 0;
	display: block;
}

/* Default SVG icon styling */
.nd-ai-launcher__icon:not(.nd-ai-launcher__icon--custom) {
	width: 48px;
	height: 48px;
}

/* Launcher position variants */
.nd-ai-launcher--bottom-right {
	bottom: 20px;
	right: 20px;
}

.nd-ai-launcher--bottom-left {
	bottom: 20px;
	left: 20px;
}

.nd-ai-launcher--top-right {
	top: 20px;
	right: 20px;
}

.nd-ai-launcher--top-left {
	top: 20px;
	left: 20px;
}

/* ==========================================================================
   Typing Indicator
   ========================================================================== */

.nd-ai-typing {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: #f8f9fa;
	border-radius: 12px;
	max-width: 80px;
	margin-left: 16px;
	border: 1px solid #e9ecef;
}

.nd-ai-typing__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #8c8f94;
	animation: nd-ai-typing-bounce 1.4s infinite;
}

.nd-ai-typing__dot:nth-child(2) {
	animation-delay: 0.2s;
}

.nd-ai-typing__dot:nth-child(3) {
	animation-delay: 0.4s;
}

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

/* ==========================================================================
   Quick Actions & Templates Enhancement
   ========================================================================== */

.nd-ai-quick-actions,
.nd-ai-templates {
	padding: 12px 16px;
	background: #fff;
	border-bottom: 1px solid #e9ecef;
}

.nd-ai-template-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.nd-ai-template-tab {
	padding: 6px 12px;
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 16px;
	font-size: 12px;
	font-weight: 500;
	color: #646970;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.2s ease;
}

.nd-ai-template-tab:hover {
	background: #e9ecef;
	color: #1d2327;
}

.nd-ai-template-tab--active {
	background: linear-gradient(135deg, #c08411 0%, #a06d0f 100%);
	color: #fff;
	border-color: #c08411;
}

.nd-ai-template-item,
.nd-ai-quick-action {
	padding: 8px 14px;
	background: #fff;
	border: 1px solid #e9ecef;
	border-radius: 8px;
	font-size: 13px;
	color: #1d2327;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	gap: 8px;
}

.nd-ai-template-item:hover,
.nd-ai-quick-action:hover {
	background: #f8f9fa;
	border-color: #c08411;
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Floating Widget Positioning
   ========================================================================== */

.nd-ai-widget--floating {
	position: fixed;
	z-index: 9998;
	width: 380px;
	max-width: calc(100vw - 40px);
	max-height: 600px;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	display: flex;
	flex-direction: column;
	background: #fff;
	opacity: 0;
	visibility: hidden;
	transform: scale(0.95);
	transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.nd-ai-widget--floating.nd-ai-widget--open {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
}

/* Widget position variants */
.nd-ai-widget--bottom-right {
	bottom: 90px;
	right: 20px;
}

.nd-ai-widget--bottom-left {
	bottom: 90px;
	left: 20px;
}

.nd-ai-widget--top-right {
	top: 90px;
	right: 20px;
}

.nd-ai-widget--top-left {
	top: 90px;
	left: 20px;
}

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

@media (max-width: 768px) {
	.nd-ai-widget__header {
		padding: 12px 16px;
		min-height: 64px;
	}
	
	.nd-ai-widget__avatar {
		width: 40px;
		height: 40px;
	}
	
	.nd-ai-widget__subtitle {
		font-size: 15px;
	}
	
	.nd-ai-widget__title {
		font-size: 13px;
	}
	
	.nd-ai-widget__input {
		font-size: 16px; /* Prevents zoom on iOS */
	}
}

/* ==========================================================================
   Dark Mode Support (Optional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	.nd-ai-widget {
		background: #1e1e1e;
	}
	
	.nd-ai-widget__messages {
		background: #252525;
	}
	
	.nd-ai-message--assistant {
		background: #2d2d2d;
		color: #e9ecef;
		border-color: #3d3d3d;
	}
	
	.nd-ai-widget__input {
		background: #2d2d2d;
		color: #e9ecef;
		border-color: #3d3d3d;
	}
	
	.nd-ai-widget__input:focus {
		background: #353535;
		color: #e9ecef;
		border-color: #c08411;
	}
	
	.nd-ai-widget__footer {
		background: #252525;
		border-color: #3d3d3d;
		color: #8c8f94;
	}
}