/**
 * AdeptWiz V Chat - Frontend Stylesheet & Themes (With Auth & Account Links)
 */

:root {
	--adeptwiz-accent: #4f46e5;
	--adeptwiz-fade-from: #fef08a;
	--adeptwiz-fade-to: #ffffff;
	--adeptwiz-fade-text: #0f172a;
	--adeptwiz-popup-width: 450px;
	--adeptwiz-popup-max-height: 420px;
	--adeptwiz-popup-btn-bg: #4f46e5;
	--adeptwiz-popup-btn-color: #ffffff;
}

/* Reset Box Sizing */
.adeptwiz-chat-container,
.adeptwiz-chat-container *,
.adeptwiz-popup-wrapper,
.adeptwiz-popup-wrapper * {
	box-sizing: border-box !important;
}

/* Auth Restricted & Helper Bar */
.adeptwiz-chat-restricted {
	background: #fffbeb;
	border: 1px solid #fde68a;
	color: #92400e;
	padding: 16px 20px;
	border-radius: 10px;
	font-size: 14px;
	margin: 15px 0;
}

.adeptwiz-btn-login-link,
.adeptwiz-btn-reg-link {
	font-weight: 700;
	color: var(--adeptwiz-accent);
	text-decoration: underline;
	margin: 0 4px;
}

.adeptwiz-auth-helper-bar {
	padding: 8px 18px;
	background: rgba(0, 0, 0, 0.04);
	font-size: 12px;
	display: flex;
	align-items: center;
	gap: 8px;
	border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.adeptwiz-auth-link {
	font-weight: 600;
	color: var(--adeptwiz-accent);
	text-decoration: none;
}

.adeptwiz-auth-link:hover {
	text-decoration: underline;
}

/* Base Chat Container */
.adeptwiz-chat-container {
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	margin: 20px 0;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 100%;
}

/* Header */
.adeptwiz-chat-header {
	padding: 14px 18px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.adeptwiz-chat-title {
	display: flex;
	align-items: center;
	gap: 10px;
}

.adeptwiz-chat-title h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.adeptwiz-chat-status-dot {
	width: 10px;
	height: 10px;
	background: #22c55e;
	border-radius: 50%;
	box-shadow: 0 0 8px #22c55e;
}

.adeptwiz-chat-header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

.adeptwiz-btn-sound-toggle {
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 16px;
	padding: 4px;
	border-radius: 6px;
	transition: transform 0.2s;
}

.adeptwiz-btn-sound-toggle:hover {
	transform: scale(1.15);
}

.adeptwiz-online-count {
	font-size: 13px;
	font-weight: 500;
	opacity: 0.9;
}

/* Messages Box */
.adeptwiz-chat-messages {
	min-height: 200px;
	max-height: 420px;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scroll-behavior: smooth;
}

.adeptwiz-message-item {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 10px 14px;
	border-radius: 10px;
	transition: background-color 0.5s ease;
}

/* HIGHLIGHT ANIMATION WITH TEXT COLOR CUSTOMIZATION */
.adeptwiz-msg-new-highlight {
	background-color: var(--adeptwiz-fade-from) !important;
	color: var(--adeptwiz-fade-text, #0f172a) !important;
	animation: adeptwizHighlightFade 1.2s forwards;
}

.adeptwiz-msg-new-highlight .adeptwiz-msg-author,
.adeptwiz-msg-new-highlight .adeptwiz-msg-text,
.adeptwiz-msg-new-highlight .adeptwiz-msg-time {
	color: var(--adeptwiz-fade-text, #0f172a) !important;
}

@keyframes adeptwizHighlightFade {
	0% {
		background-color: var(--adeptwiz-fade-from);
	}
	100% {
		background-color: var(--adeptwiz-fade-to);
	}
}

.adeptwiz-avatar-img {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.adeptwiz-msg-content {
	flex: 1;
	min-width: 0;
}

.adeptwiz-msg-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 4px;
}

.adeptwiz-msg-author {
	font-weight: 600;
	font-size: 14px;
}

.adeptwiz-msg-time {
	font-size: 11px;
	opacity: 0.6;
}

.adeptwiz-msg-text {
	font-size: 14px;
	line-height: 1.45;
	word-break: break-word;
}

/* Form Area */
.adeptwiz-chat-form {
	padding: 14px 18px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	display: flex;
	flex-direction: column;
	gap: 10px;
	position: relative;
	width: 100%;
}

.adeptwiz-form-row {
	display: flex;
	gap: 10px;
	width: 100%;
	align-items: center;
}

.adeptwiz-input-name,
.adeptwiz-input-message {
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
	width: 100% !important;
}

.adeptwiz-input-name:focus,
.adeptwiz-input-message:focus {
	border-color: var(--adeptwiz-accent);
	box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.adeptwiz-input-message {
	flex: 1;
	min-width: 0;
}

.adeptwiz-textarea {
	resize: vertical;
	min-height: 60px;
}

.adeptwiz-btn-send {
	background: var(--adeptwiz-accent);
	color: #ffffff;
	border: none;
	border-radius: 8px;
	padding: 10px 18px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	transition: opacity 0.2s, transform 0.1s;
}

.adeptwiz-btn-send:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.adeptwiz-btn-emoji {
	background: #f1f5f9;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	cursor: pointer;
	padding: 8px 12px;
	font-size: 16px;
	flex-shrink: 0;
}

.adeptwiz-emoji-dropdown {
	position: absolute;
	bottom: 60px;
	right: 80px;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	padding: 8px;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 6px;
	box-shadow: 0 8px 20px rgba(0,0,0,0.15);
	z-index: 100;
}

.adeptwiz-emoji-dropdown span {
	font-size: 18px;
	cursor: pointer;
	padding: 4px;
	text-align: center;
	border-radius: 4px;
}

.adeptwiz-emoji-dropdown span:hover {
	background: #f1f5f9;
}

.hidden {
	display: none !important;
}

/* THEMES */
/* Modern Dark */
.theme-modern_dark {
	background: #0f172a;
	color: #f8fafc;
}
.theme-modern_dark .adeptwiz-chat-header {
	background: #1e293b;
	color: #ffffff;
}
.theme-modern_dark .adeptwiz-message-item {
	background: #1e293b;
}
.theme-modern_dark .adeptwiz-msg-author {
	color: #818cf8;
}
.theme-modern_dark .adeptwiz-chat-form {
	background: #0f172a;
	border-color: #334155;
}
.theme-modern_dark .adeptwiz-input-name,
.theme-modern_dark .adeptwiz-input-message {
	background: #1e293b;
	border-color: #475569;
	color: #ffffff;
}

/* Classic Light */
.theme-classic_light {
	background: #ffffff;
	color: #1e293b;
	border: 1px solid #e2e8f0;
}
.theme-classic_light .adeptwiz-chat-header {
	background: #f8fafc;
	color: #0f172a;
}
.theme-classic_light .adeptwiz-message-item {
	background: #f1f5f9;
}

/* Glassmorphism */
.theme-glassmorphism {
	background: rgba(255, 255, 255, 0.7);
	backdrop-filter: blur(16px);
	border: 1px solid rgba(255, 255, 255, 0.4);
	color: #0f172a;
}
.theme-glassmorphism .adeptwiz-message-item {
	background: rgba(255, 255, 255, 0.5);
}

/* Cyber Neon */
.theme-cyber_neon {
	background: #050515;
	color: #00f0ff;
	border: 2px solid #00f0ff;
	box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}
.theme-cyber_neon .adeptwiz-chat-header {
	background: #0a0a25;
	color: #ff007f;
}
.theme-cyber_neon .adeptwiz-message-item {
	background: #0d0d30;
	border-left: 3px solid #ff007f;
}
.theme-cyber_neon .adeptwiz-btn-send {
	background: #ff007f;
}

/* FLOATING CORNER POPUP WIDGET (STRICT RESIZING & OVERRIDES) */
.adeptwiz-popup-wrapper {
	position: fixed;
	bottom: 24px;
	z-index: 99999;
}

.adeptwiz-popup-wrapper.pos-bottom_right {
	right: 24px;
	left: auto;
}

.adeptwiz-popup-wrapper.pos-bottom_left {
	left: 24px;
	right: auto;
}

.adeptwiz-popup-toggle-btn {
	background: var(--adeptwiz-popup-btn-bg) !important;
	color: var(--adeptwiz-popup-btn-color) !important;
	border: none !important;
	border-radius: 30px !important;
	padding: 12px 24px !important;
	font-size: 15px !important;
	font-weight: 700 !important;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
	display: flex;
	align-items: center;
	gap: 8px;
	transition: transform 0.2s, box-shadow 0.2s;
}

.adeptwiz-popup-toggle-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35) !important;
}

.adeptwiz-popup-content {
	position: absolute;
	bottom: 65px;
	width: var(--adeptwiz-popup-width, 450px) !important;
	min-width: 320px !important;
	max-width: calc(100vw - 32px) !important;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3) !important;
	border-radius: 16px !important;
	overflow: hidden !important;
	background: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.2);
}

.pos-bottom_right .adeptwiz-popup-content {
	right: 0 !important;
	left: auto !important;
}

.pos-bottom_left .adeptwiz-popup-content {
	left: 0 !important;
	right: auto !important;
}

.adeptwiz-popup-content .adeptwiz-chat-container {
	margin: 0 !important;
	border-radius: 0 0 16px 16px !important;
	box-shadow: none !important;
	width: 100% !important;
	min-width: 100% !important;
	max-width: 100% !important;
	border: none !important;
}

.adeptwiz-popup-content .adeptwiz-chat-messages {
	max-height: var(--adeptwiz-popup-max-height, 420px) !important;
	min-height: 250px !important;
}

.adeptwiz-popup-header {
	background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 100%);
	color: #ffffff;
	padding: 12px 18px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 700;
	font-size: 15px;
}

.adeptwiz-popup-close-btn {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #ffffff;
	font-size: 18px;
	cursor: pointer;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.adeptwiz-popup-close-btn:hover {
	background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
	.adeptwiz-popup-wrapper.pos-bottom_right {
		bottom: 16px;
		right: 16px;
	}
	.adeptwiz-popup-wrapper.pos-bottom_left {
		bottom: 16px;
		left: 16px;
	}
	.adeptwiz-popup-content {
		width: calc(100vw - 32px) !important;
		bottom: 60px;
	}
	.adeptwiz-popup-content .adeptwiz-chat-messages {
		max-height: 50vh !important;
	}
}
