/**
 * mLive — Real-time live forum updates
 * @copyright (c) 2026 dmzx, https://www.dmzx-web.net
 * @license GNU General Public License, version 2 (GPL-2.0)
 */

#mlive-dbg {
	position: fixed;
	bottom: 20px;
	left: 16px;
	z-index: 99999;
	width: 340px;
	background: rgba(10, 10, 18, 0.96);
	border: 1px solid #333;
	border-radius: 8px;
	font-family: monospace;
	font-size: 11px;
	box-shadow: 0 4px 20px rgba(0,0,0,.6);
	overflow: hidden;
}

#mlive-dbg-hdr {
	padding: 6px 10px;
	background: rgba(255,255,255,0.05);
	color: #ccc;
	font-size: 11px;
	border-bottom: 1px solid #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#mlive-dbg-status { font-weight: bold; }

#mlive-dbg-log {
	max-height: 260px;
	overflow-y: auto;
	padding: 4px 10px;
}

@keyframes mlive-row-flash-anim {
	0%   { box-shadow: inset 0 0 0 3px rgba(255, 200, 0, 0.85); }
	60%  { box-shadow: inset 0 0 0 3px rgba(255, 200, 0, 0.40); }
	100% { box-shadow: inset 0 0 0 3px rgba(255, 200, 0, 0); }
}

.mlive-row-flash {
	animation: mlive-row-flash-anim var(--mlive-flash-ms, 2500ms) ease;
}

/* Topic row fades + lifts just before being moved to the top */
.mlive-row-leaving {
	opacity: 0.15;
	transform: translateY(-6px);
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.mlive-new-topic {
	outline: 2px solid rgba(255, 200, 0, 0.50);
	outline-offset: -2px;
}

.mlive-new-badge {
	display: inline-block;
	background: #e74c3c;
	color: #fff;
	font-size: 9px;
	font-weight: bold;
	padding: 1px 4px;
	border-radius: 3px;
	vertical-align: middle;
	letter-spacing: .5px;
	margin-left: 4px;
}

.mlive-live-post-wrapper { margin: 2px 0; }

.mlive-live-post {
	padding: 10px 14px;
	border-left: 3px solid #1D9E75;
	background: rgba(29, 158, 117, 0.06);
	border-radius: 0 4px 4px 0;
	animation: mlive-post-in 0.35s ease;
}

@keyframes mlive-post-in {
	from { opacity: 0; transform: translateX(-6px); }
	to   { opacity: 1; transform: translateX(0); }
}

.mlive-live-post-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
	font-size: 0.82em;
	color: #888;
	flex-wrap: wrap;
}

.mlive-live-post-author { font-weight: bold; }
.mlive-live-post-date   { color: #999; }
.mlive-live-post-subject { font-weight: bold; margin-bottom: 4px; font-size: 0.92em; }

.mlive-live-post-text {
	font-size: 0.95em;
	line-height: 1.55;
	word-break: break-word;
}

.mlive-live-post-link {
	margin-left: auto;
	color: #4fc3f7;
	text-decoration: none;
	font-size: 0.85em;
	padding: 1px 5px;
	border-radius: 3px;
	border: 1px solid rgba(79,195,247,.35);
}
.mlive-live-post-link:hover { background: rgba(79,195,247,.1); }

.mlive-toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background: #1a1a2e;
	color: #eee;
	border-radius: 8px;
	border: 1px solid #2a2a4e;
	box-shadow: 0 4px 14px rgba(0,0,0,.45);
	font-size: 13px;
	max-width: 340px;
	animation: mlive-in .22s ease;
}

.mlive-banner {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: #16213e;
	color: #eee;
	border-radius: 6px;
	border: 1px solid #1e3a6e;
	margin-bottom: 10px;
	font-size: 13px;
}

.mlive-badge {
	background: #e74c3c;
	color: #fff;
	font-size: 10px;
	font-weight: bold;
	padding: 2px 5px;
	border-radius: 3px;
	letter-spacing: .6px;
	flex-shrink: 0;
}

.mlive-link { color: #4fc3f7; text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.mlive-link:hover { text-decoration: underline; }

.mlive-close {
	background: none; border: none; color: #aaa;
	cursor: pointer; padding: 0 2px; font-size: 15px;
	flex-shrink: 0; margin-left: auto;
}
.mlive-close:hover { color: #fff; }

.mlive-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes mlive-in {
	from { transform: translateX(110%); opacity: 0; }
	to   { transform: translateX(0);    opacity: 1; }
}

.mlive-typing-line {
	display: none;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	color: #888;
	margin: 0 0 6px;
}

.mlive-typing-line.mlive-typing-visible { display: flex; }

.mlive-typing-dot {
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #57d9a3;
	flex-shrink: 0;
	animation: mlive-typing-pulse 1.2s ease-in-out infinite;
}

@keyframes mlive-typing-pulse {
	0%, 100% { opacity: 0.4; }
	50%      { opacity: 1; }
}

.mlive-row-typing {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11.5px;
	color: #57d9a3;
	margin-top: 3px;
	width: 100%;
	clear: both;
}

.mlive-pm-toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 10000;
	width: 320px;
	background: #1a1a2e;
	border: 1px solid #2a2a4e;
	border-left: 3px solid #4fc3f7;
	border-radius: 8px;
	box-shadow: 0 4px 14px rgba(0,0,0,.45);
	overflow: hidden;
	animation: mlive-in .22s ease;
}

.mlive-pm-toast-bar {
	height: 3px;
	width: 100%;
	background: #4fc3f7;
	animation: mlive-pm-bar-shrink var(--mlive-pm-toast-ms, 10000ms) linear forwards;
	transform-origin: left;
}

@keyframes mlive-pm-bar-shrink {
	from { transform: scaleX(1); }
	to   { transform: scaleX(0); }
}

.mlive-pm-toast-body {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px 12px;
}

.mlive-pm-toast-icon {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(79, 195, 247, 0.15);
	color: #4fc3f7;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 16px;
}

.mlive-pm-toast-text { flex: 1; min-width: 0; }

.mlive-pm-toast-title {
	font-size: 13.5px;
	font-weight: bold;
	color: #eee;
}

.mlive-pm-toast-subject {
	font-size: 12.5px;
	color: #aaa;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mlive-pm-toast-time {
	font-size: 11px;
	color: #777;
	margin-top: 4px;
}

.mlive-pm-toast-close {
	background: none;
	border: none;
	color: #888;
	cursor: pointer;
	padding: 2px;
	font-size: 13px;
	flex-shrink: 0;
}
.mlive-pm-toast-close:hover { color: #fff; }

.mlive-pm-toast-link {
	position: absolute;
	inset: 0;
	z-index: -1;
}

.mlive-activity-panel {
	position: fixed;
	top: 70px;
	right: 20px;
	z-index: 9998; /* below the toasts (9999/10000) so a fresh one is never hidden behind it */
	width: 300px;
	max-width: calc(100vw - 40px);
	background: #1a1a2e;
	border: 1px solid #2a2a4e;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0,0,0,.45);
	font-size: 12.5px;
	color: #eee;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.mlive-activity-panel--expand-up {
	flex-direction: column-reverse;
}

.mlive-activity-header {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 9px 12px;
	cursor: grab;
	user-select: none;
	border-bottom: 1px solid #2a2a4e;
}
.mlive-activity-header:active { cursor: grabbing; }

.mlive-activity-drag-handle {
	color: #666;
	font-size: 12px;
	line-height: 1;
	letter-spacing: -1px;
	flex-shrink: 0;
}

.mlive-activity-header h3 {
	margin: 0;
	font-size: 12.5px;
	font-weight: bold;
	color: #eee;
}

.mlive-activity-count {
	font-size: 10.5px;
	color: #999;
	background: rgba(255,255,255,0.07);
	border-radius: 99px;
	padding: 1px 6px;
	font-weight: bold;
}

.mlive-activity-live-dot {
	width: 6px; height: 6px; border-radius: 50%;
	background: #57d9a3;
	margin-left: auto;
	flex-shrink: 0;
	animation: mlive-typing-pulse 2s infinite;
}

.mlive-activity-collapse-btn {
	background: transparent;
	border: 1px solid #2a2a4e;
	border-radius: 5px;
	color: #999;
	width: 18px; height: 18px;
	display: inline-flex; align-items: center; justify-content: center;
	font-size: 9px;
	flex-shrink: 0;
	cursor: pointer;
}
.mlive-activity-collapse-btn:hover { color: #fff; border-color: rgba(255,255,255,0.25); }

.mlive-activity-body {
	display: flex;
	flex-direction: column;
	max-height: 260px;
	overflow-y: auto;
}
.mlive-activity-panel--expand-up .mlive-activity-body {
	flex-direction: column-reverse;
}
.mlive-activity-body.mlive-activity-collapsed { display: none; }

.mlive-activity-item {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	padding: 8px 12px;
	border-bottom: 1px solid rgba(255,255,255,0.05);
	line-height: 1.4;
}
.mlive-activity-item:last-child { border-bottom: none; }

.mlive-activity-dot {
	display: inline-block;
	width: 6px; height: 6px; border-radius: 50%;
	margin-top: 5px;
	flex-shrink: 0;
}
.mlive-activity-dot--typing     { background: #57d9a3; }
.mlive-activity-dot--editing    { background: #fbbf24; }
.mlive-activity-dot--new_post,
.mlive-activity-dot--new_topic  { background: #4fc3f7; }
.mlive-activity-dot--poll_vote  { background: #b197fc; }

.mlive-activity-item-body { flex: 1; min-width: 0; }

.mlive-activity-item b { color: #fff; }

.mlive-activity-verb--typing     { color: #57d9a3; }
.mlive-activity-verb--editing    { color: #fbbf24; }
.mlive-activity-verb--new_post,
.mlive-activity-verb--new_topic  { color: #4fc3f7; }
.mlive-activity-verb--poll_vote  { color: #b197fc; }

/*
 * Flex row, NOT a single nowrap+ellipsis span — forum name and time are
 * flex-shrink:0 siblings of the topic-title link, which gets its OWN
 * ellipsis via flex:1/min-width:0. A long title now truncates itself
 * instead of the single shared ellipsis swallowing the trailing time/
 * forum name. Same pattern as .mlive-text/.mlive-close in the toast
 * component above.
 */
.mlive-activity-item-where {
	display: flex;
	align-items: center;
	gap: 4px;
	color: #999;
	font-size: 11px;
	min-width: 0;
}
.mlive-activity-item-where a {
	color: inherit;
	text-decoration: none;
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mlive-activity-item-where a:hover { color: #4fc3f7; text-decoration: underline; }

.mlive-activity-forum {
	color: #ccc;
	font-weight: 600;
	flex-shrink: 1;
	min-width: 0;
	max-width: 40%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mlive-activity-sep { color: #666; flex-shrink: 0; }
.mlive-activity-time { flex-shrink: 0; }

.mlive-activity-empty {
	padding: 20px 12px;
	text-align: center;
	color: #999;
	font-size: 11.5px;
}

@media (max-width: 600px) {
	.mlive-activity-panel { display: none; }
}
