/* Psyern Player Detail Modal — themed via --psyern-* vars from active theme */

.psyern-pdm,
.psyern-pdm * {
	box-sizing: border-box;
}

.psyern-pdm[hidden] {
	display: none;
}

body.psyern-pdm-open {
	overflow: hidden;
}

/* ─── Backdrop ─── */
.psyern-pdm__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
	z-index: 9990;
	opacity: 0;
	transition: opacity 200ms ease;
}

.psyern-pdm--open .psyern-pdm__backdrop {
	opacity: 1;
}

/* ─── Panel ─── */
.psyern-pdm__panel {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, calc(-50% + 10px));
	width: min(92vw, 920px);
	max-width: 92vw;
	max-height: min(92vh, 720px);
	background: var(--psyern-bg, #1a1a1a);
	color: var(--psyern-fg, #e8e8e8);
	border: 1px solid var(--psyern-border, rgba(255, 255, 255, 0.12));
	border-radius: var(--pf-radius, 12px);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.4);
	z-index: 9991;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transition: opacity 200ms ease, transform 200ms ease;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
}

.psyern-pdm--open .psyern-pdm__panel {
	opacity: 1;
	transform: translate(-50%, -50%);
}

.psyern-pdm__panel:focus {
	outline: none;
}

/* ─── Header ─── */
.psyern-pdm__header {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 16px 20px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	position: sticky;
	top: 0;
	background: inherit;
	z-index: 2;
}

.psyern-pdm__avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.05);
	flex-shrink: 0;
}

.psyern-pdm__identity {
	flex: 1;
	min-width: 0;
}

.psyern-pdm__name {
	margin: 0 0 6px;
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: inherit;
}

.psyern-pdm__sub {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.psyern-pdm__chip {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.12);
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: inherit;
}

.psyern-pdm__chip--faction {
	background: rgba(231, 76, 60, 0.14);
	border-color: rgba(231, 76, 60, 0.3);
}

.psyern-pdm__chip--rep {
	background: rgba(255, 215, 0, 0.10);
	border-color: rgba(255, 215, 0, 0.25);
}

.psyern-pdm__close {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: inherit;
	width: 36px;
	height: 36px;
	border-radius: 6px;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
	flex-shrink: 0;
}

.psyern-pdm__close:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.3);
}

/* ─── Tabs ─── */
.psyern-pdm__tabs {
	display: flex;
	gap: 0;
	padding: 0 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	overflow-x: auto;
	scrollbar-width: thin;
	flex-shrink: 0;
	background: inherit;
}

.psyern-pdm__tab {
	background: transparent;
	border: none;
	color: inherit;
	padding: 12px 16px;
	font: inherit;
	font-weight: 600;
	font-size: 0.85rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
	opacity: 0.6;
	border-bottom: 2px solid transparent;
	transition: opacity 0.15s, border-color 0.15s, color 0.15s;
	white-space: nowrap;
}

.psyern-pdm__tab:hover {
	opacity: 0.9;
}

.psyern-pdm__tab--active,
.psyern-pdm__tab[aria-selected="true"] {
	opacity: 1;
	border-bottom-color: var(--pf-accent, #ffd700);
	color: var(--pf-accent, #ffd700);
}

/* ─── Body / Panes ─── */
.psyern-pdm__body {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	-webkit-overflow-scrolling: touch;
}

.psyern-pdm__pane[hidden] {
	display: none;
}

.psyern-pdm__pane {
	animation: psyern-pdm-fade-in 180ms ease;
}

@keyframes psyern-pdm-fade-in {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ─── KPI Grid ─── */
.psyern-pdm__kpi-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 12px;
}

.psyern-pdm__kpi {
	padding: 12px 14px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.03);
	min-width: 0;
}

.psyern-pdm__kpi-label {
	display: block;
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	opacity: 0.55;
	margin-bottom: 4px;
}

.psyern-pdm__kpi-value {
	display: block;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--pf-accent, #ffd700);
	word-break: break-word;
}

/* ─── Groups (Kills/Deaths) ─── */
.psyern-pdm__groups {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.psyern-pdm__group {
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.03);
	overflow: hidden;
}

.psyern-pdm__group-summary {
	padding: 10px 14px;
	font-weight: 600;
	font-size: 0.85rem;
	cursor: pointer;
	user-select: none;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	list-style: none;
}

.psyern-pdm__group-summary::-webkit-details-marker {
	display: none;
}

.psyern-pdm__group-summary::before {
	content: '\25B8';
	display: inline-block;
	margin-right: 8px;
	transition: transform 0.15s;
	opacity: 0.7;
}

.psyern-pdm__group[open] .psyern-pdm__group-summary::before {
	transform: rotate(90deg);
}

.psyern-pdm__group-title {
	flex: 1;
}

.psyern-pdm__group-total {
	font-weight: 700;
	color: var(--pf-accent, #ffd700);
	font-variant-numeric: tabular-nums;
}

.psyern-pdm__group-list {
	list-style: none;
	margin: 0;
	padding: 0 14px 10px;
}

.psyern-pdm__group-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	padding: 5px 0;
	border-top: 1px solid rgba(255, 255, 255, 0.05);
	font-size: 0.85rem;
}

.psyern-pdm__group-row:first-child {
	border-top: none;
}

.psyern-pdm__group-label {
	opacity: 0.85;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.psyern-pdm__group-count {
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	flex-shrink: 0;
}

/* ─── Footer ─── */
.psyern-pdm__footer {
	padding: 10px 20px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	font-size: 0.75rem;
	opacity: 0.6;
	flex-shrink: 0;
	background: inherit;
}

/* ─── Loading & Error ─── */
.psyern-pdm__loading,
.psyern-pdm__error {
	text-align: center;
	padding: 40px 20px;
	font-size: 0.9rem;
	opacity: 0.7;
}

.psyern-pdm__error {
	color: #e74c3c;
}

/* ─── Focus styles ─── */
.psyern-pdm__tab:focus-visible,
.psyern-pdm__close:focus-visible,
.psyern-pdm__group-summary:focus-visible {
	outline: 2px solid var(--pf-accent, #ffd700);
	outline-offset: 2px;
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
	.psyern-pdm__panel {
		top: 0;
		left: 0;
		transform: none;
		width: 100vw;
		max-width: 100vw;
		max-height: 100vh;
		height: 100vh;
		border-radius: 0;
		border: none;
	}

	.psyern-pdm--open .psyern-pdm__panel {
		transform: none;
	}

	.psyern-pdm__header {
		padding: 12px 14px;
	}

	.psyern-pdm__avatar {
		width: 52px;
		height: 52px;
	}

	.psyern-pdm__name {
		font-size: 1.05rem;
	}

	.psyern-pdm__body {
		padding: 14px;
	}

	.psyern-pdm__kpi-grid {
		grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
		gap: 8px;
	}

	.psyern-pdm__kpi-value {
		font-size: 1.2rem;
	}
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
	.psyern-pdm__backdrop,
	.psyern-pdm__panel,
	.psyern-pdm__pane,
	.psyern-pdm__tab,
	.psyern-pdm__close,
	.psyern-pdm__group-summary::before {
		transition: none !important;
		animation: none !important;
	}
}
