/**
 * 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)
 */

/* ==========================================================================
   Debug panel (visible when localStorage.mlive_debug === '1')
   ========================================================================== */

#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;
}

/* ==========================================================================
   Row flash animation

   Duration is driven by --mlive-flash-ms, injected from the ACP setting
   via an inline <style> in overall_footer_body_after.html. Default fallback
   is 2500ms in case the variable is not set.

   Uses box-shadow (inset) instead of background-color so phpBB theme
   row backgrounds (bg1/bg2) are never touched. JS removes the class after
   the animation ends so no CSS residue remains.
   ========================================================================== */

@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;
}

/* ==========================================================================
   New topic row (live injected on viewforum)
   ========================================================================== */

.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;
}

/* ==========================================================================
   Live injected post (viewtopic)
   ========================================================================== */

.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); }

/* ==========================================================================
   Toast + banner
   ========================================================================== */

.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; }
}
