/* ====================================================================
   AMIR TECHNOLOGY AGENTS TEAM — Public Floating Chat Widget
   ==================================================================== */

#aat-floating-widget, #aat-floating-widget * {
	box-sizing: border-box;
	font-family: 'Vazirmatn', 'Yekan', 'IRANSans', Tahoma, -apple-system, BlinkMacSystemFont, sans-serif;
}

#aat-floating-widget, .aat-floating-widget {
	--aat-brand: #6C5CE7;
	--aat-widget-offset: 24px;
	position: fixed;
	bottom: var(--aat-widget-offset);
	z-index: 999999;
}
.aat-position-bottom-right { right: 24px; }
.aat-position-bottom-left  { left: 24px; }

/* ---------------------------------------------------------------
   دکمه شناور
   --------------------------------------------------------------- */
.aat-widget-toggle {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: linear-gradient(135deg, var(--aat-brand), color-mix(in srgb, var(--aat-brand) 60%, #00D2D3));
	box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 0 6px rgba(255,255,255,0.04);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	overflow: hidden;
	position: relative;
}
.aat-widget-toggle:hover { transform: scale(1.06); }
.aat-widget-toggle img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.aat-widget-toggle-icon-close { display: none; font-size: 20px; color: #fff; }
.aat-floating-widget.open .aat-widget-toggle-icon-open { display: none; }
.aat-floating-widget.open .aat-widget-toggle-icon-close { display: block; }

/* ---------------------------------------------------------------
   پنل چت
   --------------------------------------------------------------- */
.aat-widget-panel {
	position: absolute;
	bottom: 78px;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: 560px;
	max-height: calc(100vh - 140px);
	background: rgba(16, 18, 30, 0.85);
	backdrop-filter: blur(28px);
	-webkit-backdrop-filter: blur(28px);
	border: 1px solid rgba(255,255,255,0.1);
	border-radius: 26px;
	box-shadow: 0 30px 70px rgba(0,0,0,0.45);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px) scale(0.97);
	pointer-events: none;
	transition: all 0.3s cubic-bezier(.2,.9,.3,1.2);
}
.aat-position-bottom-right .aat-widget-panel { right: 0; }
.aat-position-bottom-left  .aat-widget-panel { left: 0; }

#aat-floating-widget.open .aat-widget-panel,
.aat-floating-widget.open .aat-widget-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: all;
}

/* لایه نور پس‌زمینه داخل پنل برای حس Liquid Glass */
.aat-widget-panel::before {
	content: '';
	position: absolute;
	width: 220px; height: 220px;
	background: radial-gradient(circle, color-mix(in srgb, var(--aat-brand) 40%, transparent), transparent 70%);
	top: -80px; right: -60px;
	border-radius: 50%;
	filter: blur(50px);
	pointer-events: none;
}

/* ---------------------------------------------------------------
   هدر
   --------------------------------------------------------------- */
.aat-widget-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	border-bottom: 1px solid rgba(255,255,255,0.08);
	position: relative;
	z-index: 1;
}
.aat-widget-agent-info { display: flex; align-items: center; gap: 12px; }
.aat-widget-avatar {
	width: 42px; height: 42px;
	border-radius: 14px;
	background: linear-gradient(135deg, var(--aat-brand), transparent);
	background-color: rgba(255,255,255,0.08);
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; color: #fff; font-size: 16px;
	position: relative;
	overflow: hidden;
}
.aat-widget-avatar img { width: 100%; height: 100%; object-fit: cover; }
.aat-widget-online-dot {
	position: absolute;
	width: 10px; height: 10px;
	background: #00C896;
	border: 2px solid rgba(16,18,30,1);
	border-radius: 50%;
	bottom: -2px; left: -2px;
}
.aat-widget-agent-name { font-size: 14px; font-weight: 700; color: #F4F4FA; }
.aat-widget-agent-status { font-size: 11px; color: #00C896; margin-top: 2px; }
.aat-widget-close {
	background: rgba(255,255,255,0.06);
	border: none;
	width: 30px; height: 30px;
	border-radius: 50%;
	color: #A6A8BF;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s ease;
}
.aat-widget-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ---------------------------------------------------------------
   پیام‌ها
   --------------------------------------------------------------- */
.aat-widget-messages {
	flex: 1;
	overflow-y: auto;
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	position: relative;
	z-index: 1;
}
.aat-widget-messages::-webkit-scrollbar { width: 5px; }
.aat-widget-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }

.aat-msg { display: flex; }
.aat-msg-user { justify-content: flex-start; flex-direction: row-reverse; }
.aat-msg-agent { justify-content: flex-start; }

.aat-msg-bubble {
	max-width: 80%;
	padding: 11px 15px;
	border-radius: 18px;
	font-size: 13px;
	line-height: 1.8;
	word-wrap: break-word;
}
.aat-msg-agent .aat-msg-bubble {
	background: rgba(255,255,255,0.07);
	color: #F4F4FA;
	border-bottom-right-radius: 4px;
}
.aat-msg-user .aat-msg-bubble {
	background: linear-gradient(135deg, var(--aat-brand), color-mix(in srgb, var(--aat-brand) 70%, #00D2D3));
	color: #fff;
	border-bottom-left-radius: 4px;
}
.aat-msg-error .aat-msg-bubble {
	background: rgba(255, 92, 124, 0.15);
	color: #FF8FA3;
}

/* تایپینگ */
.aat-widget-typing {
	display: flex;
	gap: 4px;
	padding: 0 18px 10px;
}
.aat-widget-typing span {
	width: 6px; height: 6px;
	border-radius: 50%;
	background: var(--aat-brand);
	animation: aatTypingBounce 1.2s infinite ease-in-out;
}
.aat-widget-typing span:nth-child(2) { animation-delay: 0.15s; }
.aat-widget-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aatTypingBounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------------------------------------------------------------
   نوار ابزار پیوست (تصویر/ویدیو/فایل/لوکیشن/صوت)
   --------------------------------------------------------------- */
.aat-widget-toolbar {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px 14px;
	border-top: 1px solid rgba(255,255,255,0.06);
}
.aat-tool-btn {
	width: 32px; height: 32px;
	border-radius: 50%;
	border: none;
	background: transparent;
	color: #A6A8BF;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}
.aat-tool-btn:hover { background: rgba(255,255,255,0.08); color: #F4F4FA; }
.aat-tool-mic.recording { color: #FF5C7C; }

.aat-attachment-preview {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	font-size: 11.5px;
	color: #A6A8BF;
}
.aat-spinner-dot {
	width: 8px; height: 8px;
	border-radius: 50%;
	background: var(--aat-brand);
	animation: aatPulseDot 1s infinite ease-in-out;
}
@keyframes aatPulseDot {
	0%, 100% { opacity: 0.3; transform: scale(0.8); }
	50% { opacity: 1; transform: scale(1.2); }
}

/* ---------------------------------------------------------------
   ضبط پیام صوتی با اکولایزر زنده
   --------------------------------------------------------------- */
.aat-voice-recorder {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	background: rgba(255,92,124,0.06);
	border-top: 1px solid rgba(255,255,255,0.06);
}
.aat-voice-stop {
	width: 36px; height: 36px;
	border-radius: 50%;
	border: none;
	background: linear-gradient(135deg, #FF5C7C, #FF8FA3);
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	box-shadow: 0 0 0 0 rgba(255,92,124,0.5);
	animation: aatRecordPulse 1.6s infinite;
}
@keyframes aatRecordPulse {
	0% { box-shadow: 0 0 0 0 rgba(255,92,124,0.5); }
	70% { box-shadow: 0 0 0 10px rgba(255,92,124,0); }
	100% { box-shadow: 0 0 0 0 rgba(255,92,124,0); }
}
.aat-voice-stop-dot {
	width: 12px; height: 12px;
	background: #fff;
	border-radius: 3px;
}
.aat-voice-equalizer {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	height: 28px;
}
.aat-voice-equalizer span {
	display: inline-block;
	width: 3px;
	min-height: 15%;
	height: 30%;
	border-radius: 3px;
	background: linear-gradient(180deg, var(--aat-brand), #00D2D3);
	transition: height 0.08s ease;
}
.aat-voice-timer {
	font-size: 12px;
	font-weight: 700;
	color: #F4F4FA;
	min-width: 38px;
	direction: ltr;
}
.aat-voice-cancel {
	width: 26px; height: 26px;
	border-radius: 50%;
	border: none;
	background: rgba(255,255,255,0.08);
	color: #A6A8BF;
	cursor: pointer;
	font-size: 11px;
	flex-shrink: 0;
}
.aat-voice-cancel:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ---------------------------------------------------------------
   نمایش پیوست‌ها درون حباب پیام
   --------------------------------------------------------------- */
.aat-msg-text { margin-top: 6px; }
.aat-msg-bubble:has(.aat-msg-image:only-child),
.aat-msg-bubble:has(.aat-msg-video:only-child) { padding: 5px; }

.aat-msg-image {
	max-width: 220px;
	max-height: 220px;
	border-radius: 14px;
	display: block;
	object-fit: cover;
}
.aat-msg-video {
	max-width: 240px;
	border-radius: 14px;
	display: block;
}
.aat-msg-audio {
	max-width: 230px;
	display: block;
	height: 36px;
}
.aat-msg-file, .aat-msg-location {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: rgba(255,255,255,0.08);
	border-radius: 12px;
	color: inherit;
	text-decoration: none;
	font-size: 12px;
	font-weight: 600;
}
.aat-msg-file:hover, .aat-msg-location:hover { background: rgba(255,255,255,0.14); }

/* ---------------------------------------------------------------
   فرم ورودی
   --------------------------------------------------------------- */
.aat-widget-input-form {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px;
	border-top: 1px solid rgba(255,255,255,0.08);
	position: relative;
	z-index: 1;
}
.aat-widget-input {
	flex: 1;
	background: rgba(255,255,255,0.06);
	border: 1px solid rgba(255,255,255,0.08);
	border-radius: 20px;
	padding: 11px 16px;
	color: #F4F4FA;
	font-size: 13px;
	outline: none;
	transition: border-color 0.2s ease;
}
.aat-widget-input:focus { border-color: var(--aat-brand); }
.aat-widget-input::placeholder { color: #6E7090; }

.aat-widget-send {
	width: 40px; height: 40px;
	border-radius: 50%;
	border: none;
	background: linear-gradient(135deg, var(--aat-brand), color-mix(in srgb, var(--aat-brand) 70%, #00D2D3));
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: transform 0.2s ease;
}
.aat-widget-send:hover { transform: scale(1.08); }
.aat-widget-send svg { transform: scaleX(-1); }

/* ---------------------------------------------------------------
   Embed/Fullscreen Chat (شورت‌کد)
   --------------------------------------------------------------- */
.aat-chat-embed {
	font-family: 'Vazirmatn', 'Yekan', 'IRANSans', Tahoma, sans-serif;
	direction: rtl;
	background: rgba(16,18,30,0.9);
	border: 1px solid rgba(255,255,255,0.1);
	border-radius: 20px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	max-width: 100%;
}
.aat-chat-embed.aat-mode-fullscreen { height: 80vh; }
.aat-chat-header {
	display: flex; align-items: center; gap: 12px;
	padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.aat-chat-header .aat-avatar { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; }
.aat-agent-meta strong { color: #F4F4FA; font-size: 14px; display: block; }
.aat-agent-meta span { color: #A6A8BF; font-size: 11.5px; }
.aat-chat-messages { flex: 1; overflow-y: auto; padding: 16px; }
.aat-chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.aat-chat-input {
	flex: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08);
	border-radius: 18px; padding: 10px 16px; color: #fff; font-size: 13px; outline: none;
}
.aat-chat-send {
	background: linear-gradient(135deg, #6C5CE7, #00D2D3); border: none; color: #fff;
	border-radius: 18px; padding: 10px 20px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}

/* ---------------------------------------------------------------
   Team Grid (شورت‌کد [aat_team])
   --------------------------------------------------------------- */
.aat-team-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 16px;
	direction: rtl;
	font-family: 'Vazirmatn', 'Yekan', 'IRANSans', Tahoma, sans-serif;
}
.aat-team-card {
	background: rgba(16,18,30,0.6);
	border: 1px solid rgba(255,255,255,0.1);
	border-radius: 20px;
	padding: 20px;
	text-align: center;
	transition: transform 0.2s ease;
}
.aat-team-card:hover { transform: translateY(-4px); }
.aat-team-card img, .aat-avatar-placeholder {
	width: 60px; height: 60px;
	border-radius: 18px;
	margin: 0 auto 12px;
	object-fit: cover;
	display: flex; align-items: center; justify-content: center;
	background: linear-gradient(135deg, var(--aat-brand, #6C5CE7), transparent);
	color: #fff; font-weight: 700; font-size: 20px;
}
.aat-team-card h4 { color: #F4F4FA; font-size: 14px; margin: 6px 0; }
.aat-team-card p { color: #A6A8BF; font-size: 12px; line-height: 1.7; margin-bottom: 14px; }
.aat-open-chat {
	background: linear-gradient(135deg, var(--aat-brand, #6C5CE7), #00D2D3);
	border: none; color: #fff; padding: 9px 18px; border-radius: 18px;
	font-size: 12px; font-weight: 700; cursor: pointer;
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 480px) {
	.aat-widget-panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 110px);
		bottom: 74px;
	}
	.aat-position-bottom-right, .aat-position-bottom-left { right: 12px; left: 12px; }
}
