/**
 * WebXtrm Inbox Preview Widget Styles
 * Pure CSS animations: stagger, pulse, float.
 */

.wx-ib-wrap {
	width: 100%;
	display: flex;
	justify-content: center;
	box-sizing: border-box;
	padding: 10px 0;
}

.wx-ib-wrap * {
	box-sizing: border-box;
}

/* ===== CARD ===== */
.wx-ib-card {
	width: 100%;
	max-width: 480px;
	background: #0d1117;
	border: 1px solid rgba(0, 201, 240, 0.15);
	border-radius: 18px;
	padding: 20px;
	box-shadow: 0 20px 60px rgba(0, 201, 240, 0.08);
	position: relative;
	overflow: hidden;
}

/* Decorative top gradient line */
.wx-ib-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(0, 201, 240, 0.6), transparent);
	pointer-events: none;
}

/* ===== HEADER ===== */
.wx-ib-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.wx-ib-header-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.wx-ib-header-label {
	font-family: 'Inter', sans-serif;
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
	line-height: 1.2;
}

.wx-ib-header-sublabel {
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 400;
	color: #9aacbd;
	line-height: 1.3;
}

.wx-ib-header-meta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.wx-ib-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 22px;
	padding: 0 7px;
	background: rgba(0, 201, 240, 0.12);
	border: 1px solid rgba(0, 201, 240, 0.3);
	border-radius: 999px;
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 700;
	color: #00c9f0;
	line-height: 1;
}

.wx-ib-live {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 8px;
	background: rgba(34, 197, 94, 0.08);
	border: 1px solid rgba(34, 197, 94, 0.3);
	border-radius: 999px;
}

.wx-ib-live-dot {
	width: 6px;
	height: 6px;
	background: #22c55e;
	border-radius: 50%;
	flex-shrink: 0;
}

.wx-ib-live-text {
	font-family: 'Inter', sans-serif;
	font-size: 10px;
	font-weight: 700;
	color: #22c55e;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	line-height: 1;
}

/* ===== MESSAGES ===== */
.wx-ib-msgs {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 14px;
}

.wx-ib-msg {
	display: grid;
	grid-template-columns: auto 1fr auto;
	column-gap: 12px;
	align-items: center;
	padding: 11px 12px;
	background: rgba(0, 201, 240, 0.03);
	border: 1px solid transparent;
	border-radius: 10px;
	transition: background 0.25s ease, border-color 0.25s ease;
}

.wx-ib-msg:hover {
	background: rgba(0, 201, 240, 0.07);
	border-color: rgba(0, 201, 240, 0.15);
}

/* ===== AVATAR ===== */
.wx-ib-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: #00c9f0;
	color: #ffffff;
	font-family: 'Inter', sans-serif;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.3px;
	line-height: 1;
	flex-shrink: 0;
	text-transform: uppercase;
}

/* ===== MESSAGE BODY ===== */
.wx-ib-msg-body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wx-ib-msg-name {
	font-family: 'Inter', sans-serif;
	font-size: 13px;
	font-weight: 700;
	color: #ffffff;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wx-ib-msg-text {
	font-family: 'Inter', sans-serif;
	font-size: 12px;
	font-weight: 400;
	color: #9aacbd;
	line-height: 1.35;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ===== MESSAGE META (time + status) ===== */
.wx-ib-msg-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 5px;
	flex-shrink: 0;
}

.wx-ib-msg-time {
	font-family: 'Inter', sans-serif;
	font-size: 10px;
	font-weight: 500;
	color: #4a6070;
	line-height: 1;
	white-space: nowrap;
}

/* ===== STATUS BADGE ===== */
.wx-ib-status {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 7px;
	border-radius: 999px;
	font-family: 'Inter', sans-serif;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	line-height: 1;
	position: relative;
}

.wx-ib-status-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	flex-shrink: 0;
}

/* Status variants */
.wx-ib-status--replied {
	background: rgba(0, 201, 240, 0.12);
	color: #00c9f0;
	border: 1px solid rgba(0, 201, 240, 0.25);
}
.wx-ib-status--replied .wx-ib-status-dot {
	background: #00c9f0;
}

.wx-ib-status--active {
	background: rgba(249, 115, 22, 0.12);
	color: #f97316;
	border: 1px solid rgba(249, 115, 22, 0.3);
}
.wx-ib-status--active .wx-ib-status-dot {
	background: #f97316;
}

.wx-ib-status--new {
	background: rgba(34, 197, 94, 0.12);
	color: #22c55e;
	border: 1px solid rgba(34, 197, 94, 0.3);
}
.wx-ib-status--new .wx-ib-status-dot {
	background: #22c55e;
}

.wx-ib-status--pending {
	background: rgba(154, 172, 189, 0.08);
	color: #9aacbd;
	border: 1px solid rgba(154, 172, 189, 0.25);
}
.wx-ib-status--pending .wx-ib-status-dot {
	background: #9aacbd;
}

/* ===== FOOTER STATS ===== */
.wx-ib-footer {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
	gap: 10px;
	padding-top: 14px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.wx-ib-stat {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.wx-ib-stat-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #00c9f0;
	flex-shrink: 0;
}

.wx-ib-stat-icon svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
	display: block;
}

.wx-ib-stat-icon svg path,
.wx-ib-stat-icon svg circle,
.wx-ib-stat-icon svg polygon,
.wx-ib-stat-icon svg rect {
	fill: currentColor;
}

.wx-ib-stat-icon i {
	font-size: 14px;
	color: inherit;
	line-height: 1;
}

.wx-ib-stat-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wx-ib-stat-value {
	font-family: 'Inter', sans-serif;
	font-size: 12px;
	font-weight: 700;
	color: #ffffff;
	line-height: 1.1;
	white-space: nowrap;
}

.wx-ib-stat-label {
	font-family: 'Inter', sans-serif;
	font-size: 9px;
	font-weight: 500;
	color: #9aacbd;
	line-height: 1.2;
	letter-spacing: 0.3px;
}

/* ============================================ */
/* ===== ANIMATIONS ========================== */
/* ============================================ */

/* 1. Messages stagger in on load */
@keyframes wx-ib-msg-in {
	from {
		opacity: 0;
		transform: translateX(-10px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

.wx-ib-anim-stagger .wx-ib-msg {
	opacity: 0;
	animation: wx-ib-msg-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
	animation-delay: calc(var(--wx-i, 0) * 0.1s + 0.15s);
}

/* 2. Live dot pulse */
@keyframes wx-ib-live-pulse {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
	}
	50% {
		box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
	}
}

.wx-ib-anim-live-pulse .wx-ib-live-dot {
	animation: wx-ib-live-pulse 2s ease-out infinite;
}

/* 3. "New" status pulse — expanding ring */
@keyframes wx-ib-new-pulse {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
	}
	50% {
		box-shadow: 0 0 0 5px rgba(34, 197, 94, 0);
	}
}

.wx-ib-anim-new-pulse .wx-ib-status--new .wx-ib-status-dot {
	animation: wx-ib-new-pulse 1.8s ease-out infinite;
}

/* 4. Card float */
@keyframes wx-ib-float {
	0%, 100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-6px);
	}
}

.wx-ib-anim-float {
	animation: wx-ib-float 5s ease-in-out infinite;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.wx-ib-anim-stagger .wx-ib-msg,
	.wx-ib-anim-live-pulse .wx-ib-live-dot,
	.wx-ib-anim-new-pulse .wx-ib-status--new .wx-ib-status-dot,
	.wx-ib-anim-float {
		animation: none !important;
		opacity: 1 !important;
		transform: none !important;
	}
}

/* ===== RESPONSIVE SAFETY FALLBACKS ===== */
@media (max-width: 540px) {
	.wx-ib-card {
		padding: 16px 14px;
		border-radius: 14px;
	}
	.wx-ib-header-label {
		font-size: 13px;
	}
	.wx-ib-header-sublabel {
		font-size: 10px;
	}
	.wx-ib-msg {
		padding: 10px;
		column-gap: 10px;
	}
	.wx-ib-avatar {
		width: 34px;
		height: 34px;
		font-size: 12px;
	}
	.wx-ib-msg-name {
		font-size: 12px;
	}
	.wx-ib-msg-text {
		font-size: 11px;
	}
	.wx-ib-msg-time {
		font-size: 9px;
	}
	.wx-ib-status {
		font-size: 8px;
		padding: 2px 6px;
	}
	.wx-ib-stat-value {
		font-size: 11px;
	}
	.wx-ib-stat-label {
		font-size: 8.5px;
	}
}

@media (max-width: 380px) {
	.wx-ib-msg-meta {
		gap: 3px;
	}
	.wx-ib-status-text {
		display: none; /* show only dot on tiny screens */
	}
	.wx-ib-status {
		padding: 4px;
	}
}
