/* =========================================================
   Topic Statistics – Milk_v2 / modern clean theme friendly
   Version: 1.0.5-milk
   ========================================================= */

:root {
	/* Soft neutral backgrounds that blend with Milk light mode */
	--ts-bg: #f7f9fb00;
	--ts-bg-alt: #eef2f600;
	--ts-border: #e1e7ee00;
	--ts-text: #e6e6e6;
	--ts-muted: #838b98;
	--ts-radius: 10px;
	--ts-author-size: 40px;
	--ts-poster-size: 32px;
	--ts-item-w: 60px;
	--ts-gap: 8px;
	--ts-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Main container – card-like, soft */
.topic_stats_main {
	position: relative;
	display: flex;
	align-items: stretch;
	background: var(--ts-bg);
	border: 1px solid var(--ts-border);
	border-radius: var(--ts-radius);
	margin: 0 0 12px 0;
	min-height: 72px;
	overflow: hidden;
	box-shadow: var(--ts-shadow);
	font-size: 12px;
	color: var(--ts-text);
}

/* ---- Author block ---- */
.topic_stats_author {
	background: transparent;
	border-right: 1px solid var(--ts-border);
	padding: 8px 12px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	min-width: 90px;
	max-width: 110px;
}

.author_avatar img {
	width: var(--ts-author-size);
	height: var(--ts-author-size);
	border-radius: 50%;
	object-fit: cover;
	display: block;
	border: 2px solid #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.author_username {
	margin-top: 4px;
	font-size: 11px;
	font-weight: 600;
	text-align: center;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	line-height: 1.2;
	color: var(--ts-text);
}

.author_username a {
	text-decoration: none;
	color: inherit;
}

.author_username a:hover {
	opacity: 0.8;
}

/* ---- Stats numbers block ---- */
.topic_stats_left {
	background: var(--ts-bg-alt);
	padding: 8px 6px;
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	border-right: 1px solid var(--ts-border);
}

.topic_stats_ul {
	display: flex;
	padding: 0 6px;
	margin: 0 !important;
	gap: 2px;
}

.topic_stat_item {
	padding: 0 10px;
	text-align: center;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
}

.topic_stat_value {
	display: block;
	font-weight: 500;
	font-size: 13px;
	line-height: 1.15;
	color: var(--ts-text);
}

.topic_stat_title {
	display: block;
	font-size: 14px;
	font-weight: 500;	
	color: var(--ts-muted);
	white-space: nowrap;
	letter-spacing: 0.2px;
	text-transform: capitalize;
	margin-top: 1px;
}

/* ---- Top posters row ---- */
.topic_stats_middle {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.topic_stats_header {
	font-size: 14px;
	font-weight: 500;
	color: var(--ts-muted);
	text-transform: capitalize;
	letter-spacing: 0.4px;
	margin-bottom: 4px;
	line-height: 1;
}

.topic_stats_ulist {
	display: flex;
	gap: var(--ts-gap);
	overflow: hidden;
	flex-wrap: nowrap;
	align-items: center;
	width: 100%;
}

.stats_user {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 0 0 var(--ts-item-w);
	min-width: 0;
	line-height: 1;
	cursor: default;
}

.ts_avatar img {
	width: var(--ts-poster-size);
	height: var(--ts-poster-size);
	border-radius: 50%;
	object-fit: cover;
	display: block;
	border: 2px solid #fff;
	box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.ts_name {
	margin-top: 3px;
	font-size: 9px;
	max-width: var(--ts-item-w);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-align: center;
	color: var(--ts-muted);
}

.ts_name a {
	text-decoration: none;
	color: inherit;
}

.ts_empty {
	font-size: 11px;
	color: var(--ts-muted);
	margin: 0;
	padding: 4px 0;
}

/* ---- Toggle button (show all) ---- */
.topic_stats_corner {
	display: flex;
	align-items: center;
	padding: 0 10px;
	border-left: 1px solid var(--ts-border);
	background: transparent;
}

.topic_stats_toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.04);
	color: var(--ts-muted);
	transition: background 0.15s, color 0.15s;
	text-decoration: none;
	font-size: 12px;
}

.topic_stats_toggle:hover,
.topic_stats_toggle:focus {
	background: rgba(0, 0, 0, 0.08);
	color: var(--ts-text);
	text-decoration: none;
}
/* =========================================================
   Top Contributors — match PostReaction "who reacted" window
   Targets #phpbb_alert (phpbb.alert), NOT phpbb_confirm
   ========================================================= */
#phpbb_alert:has(.ts-milk-dialog),
.phpbb_alert:has(.ts-milk-dialog) {
	display: block;
	position: fixed !important;
	top: 50% !important;
	left: 50% !important;
	right: auto !important;
	bottom: auto !important;
	transform: translate(-50%, -50%) !important;
	width: min(640px, 94vw) !important;
	max-width: 94vw !important;
	max-height: 80vh !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	border-radius: 12px !important;
	background-color: #FFFFFF !important;
	border: 1px solid #e1e7ee !important;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18) !important;
	color: #2c3e50 !important;
	z-index: 100051 !important;
}

#phpbb_alert:has(.ts-milk-dialog) .alert_title,
.phpbb_alert:has(.ts-milk-dialog) .alert_title,
#phpbb_alert:has(.ts-milk-dialog) h3,
.phpbb_alert:has(.ts-milk-dialog) h3 {
	margin: 16px 48px 10px 16px !important;
	padding: 0 !important;
	border: none !important;
	font-size: 16px !important;
	font-weight: 600 !important;
	color: #28313F !important;
	background: transparent !important;
	line-height: 1.3 !important;
}

#phpbb_alert:has(.ts-milk-dialog) .alert_text,
.phpbb_alert:has(.ts-milk-dialog) .alert_text {
	display: block !important;
	margin: 0 !important;
	padding: 0 16px 12px !important;
	border: none !important;
}

/* Close: kill Milk white fa-times-circle, use × like PostReaction */
#phpbb_alert:has(.ts-milk-dialog) .alert_close,
.phpbb_alert:has(.ts-milk-dialog) .alert_close {
	float: none !important;
	position: absolute !important;
	top: 12px !important;
	right: 12px !important;
	margin: 0 !important;
	width: 32px !important;
	height: 32px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	border-radius: 50% !important;
	background: transparent !important;
	color: #6b7c8f !important;
	text-decoration: none !important;
	z-index: 2;
}
#phpbb_alert:has(.ts-milk-dialog) .alert_close:hover,
.phpbb_alert:has(.ts-milk-dialog) .alert_close:hover {
	background: rgba(0, 0, 0, 0.06) !important;
	color: #28313F !important;
}
#phpbb_alert:has(.ts-milk-dialog) .alert_close .icon,
.phpbb_alert:has(.ts-milk-dialog) .alert_close .icon {
	display: none !important;
}
#phpbb_alert:has(.ts-milk-dialog) .alert_close::after,
.phpbb_alert:has(.ts-milk-dialog) .alert_close::after {
	content: "\00d7";
	font-size: 22px;
	line-height: 1;
	font-weight: 400;
	color: inherit;
}

.ts-milk-dialog { margin: 0; padding: 0; }
.ts-milk-list {
	max-height: min(52vh, 420px);
	overflow-y: auto;
	padding: 4px 2px 8px;
}
.ts-milk-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 6px;
	border-radius: 8px;
}
.ts-milk-row:hover { background: rgba(0, 0, 0, 0.03); }
.ts-milk-avatar img,
.ts-milk-avatar .avatar {
	width: 36px !important;
	height: 36px !important;
	border-radius: 8px !important;
	object-fit: cover;
	display: block;
	border: none !important;
	box-shadow: none !important;
}
.ts-milk-meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1 1 auto;
	gap: 2px;
}
.ts-milk-name {
	font-weight: 600;
	font-size: 13px;
	color: #28313F;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ts-milk-name a { color: inherit; text-decoration: none; }
.ts-milk-count {
	font-size: 11px;
	color: #6b7c8f;
}
.ts-milk-count strong {
	font-weight: 700;
	color: #445566;
}
.ts-milk-empty {
	margin: 12px 6px;
	color: #6b7c8f;
	font-size: 13px;
}

/* Dark — Milk fd_dark palette */
html.fd_dark #phpbb_alert:has(.ts-milk-dialog),
body.fd_dark #phpbb_alert:has(.ts-milk-dialog),
.fd_dark #phpbb_alert:has(.ts-milk-dialog),
html.phpbb-dark-mode #phpbb_alert:has(.ts-milk-dialog),
body.dark-mode #phpbb_alert:has(.ts-milk-dialog),
html.fd_dark .phpbb_alert:has(.ts-milk-dialog),
body.fd_dark .phpbb_alert:has(.ts-milk-dialog),
.fd_dark .phpbb_alert:has(.ts-milk-dialog),
html.phpbb-dark-mode .phpbb_alert:has(.ts-milk-dialog),
body.dark-mode .phpbb_alert:has(.ts-milk-dialog) {
	background-color: #171b24 !important;
	border-color: #353457 !important;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55) !important;
	color: #CCCCCC !important;
}
html.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_title,
body.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_title,
.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_title,
html.phpbb-dark-mode #phpbb_alert:has(.ts-milk-dialog) .alert_title,
body.dark-mode #phpbb_alert:has(.ts-milk-dialog) .alert_title,
html.fd_dark #phpbb_alert:has(.ts-milk-dialog) h3,
body.fd_dark #phpbb_alert:has(.ts-milk-dialog) h3,
.fd_dark #phpbb_alert:has(.ts-milk-dialog) h3,
html.phpbb-dark-mode #phpbb_alert:has(.ts-milk-dialog) h3,
body.dark-mode #phpbb_alert:has(.ts-milk-dialog) h3 {
	color: #CCCCCC !important;
}
html.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_close,
body.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_close,
.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_close,
html.phpbb-dark-mode #phpbb_alert:has(.ts-milk-dialog) .alert_close,
body.dark-mode #phpbb_alert:has(.ts-milk-dialog) .alert_close {
	color: #838b98 !important;
	background: transparent !important;
}
html.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_close:hover,
body.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_close:hover,
.fd_dark #phpbb_alert:has(.ts-milk-dialog) .alert_close:hover,
html.phpbb-dark-mode #phpbb_alert:has(.ts-milk-dialog) .alert_close:hover,
body.dark-mode #phpbb_alert:has(.ts-milk-dialog) .alert_close:hover {
	background: rgba(255, 255, 255, 0.08) !important;
	color: #CCCCCC !important;
}
html.fd_dark .ts-milk-row:hover,
body.fd_dark .ts-milk-row:hover,
.fd_dark .ts-milk-row:hover,
html.phpbb-dark-mode .ts-milk-row:hover,
body.dark-mode .ts-milk-row:hover {
	background: rgba(255, 255, 255, 0.04);
}
html.fd_dark .ts-milk-name,
body.fd_dark .ts-milk-name,
.fd_dark .ts-milk-name,
html.phpbb-dark-mode .ts-milk-name,
body.dark-mode .ts-milk-name {
	color: #CCCCCC;
}
html.fd_dark .ts-milk-count,
body.fd_dark .ts-milk-count,
.fd_dark .ts-milk-count,
html.phpbb-dark-mode .ts-milk-count,
body.dark-mode .ts-milk-count,
html.fd_dark .ts-milk-empty,
body.fd_dark .ts-milk-empty,
.fd_dark .ts-milk-empty,
html.phpbb-dark-mode .ts-milk-empty,
body.dark-mode .ts-milk-empty {
	color: #838b98;
}
html.fd_dark .ts-milk-count strong,
body.fd_dark .ts-milk-count strong,
.fd_dark .ts-milk-count strong,
html.phpbb-dark-mode .ts-milk-count strong,
body.dark-mode .ts-milk-count strong {
	color: #CCCCCC;
}

/* If browser hoists .ts-milk-dialog out of <p.alert_text>, keep padding */
#phpbb_alert:has(.ts-milk-dialog) > .ts-milk-dialog,
.phpbb_alert:has(.ts-milk-dialog) > .ts-milk-dialog {
	padding: 0 16px 12px;
}
