/* =========================================================
   StasWeb — profile_popup.tpl v3.0
   Не блокирует штатные close() и draggable() DLE
   ========================================================= */

.ui-dialog[aria-describedby="dleprofilepopup"],
.ui-dialog.sw-dle-dialog--profile {
	width: min(620px, calc(100vw - 28px)) !important;
	max-width: calc(100vw - 28px) !important;
}

/*
Не задаём окну display, position, top, left и transform.
Этими свойствами управляет jQuery UI, поэтому окно закрывается
и перетаскивается стандартными средствами DLE.
*/

#dleprofilepopup,
.ui-dialog[aria-describedby="dleprofilepopup"] .ui-dialog-content,
.ui-dialog.sw-dle-dialog--profile .ui-dialog-content {
	padding: 0 !important;
	background: #090d15 !important;
}

.sw-profile-popup {
	--sw-pp-panel: rgba(255, 255, 255, .035);
	--sw-pp-line: rgba(255, 255, 255, .085);
	--sw-pp-text: #f4f7ff;
	--sw-pp-soft: #c7cfdf;
	--sw-pp-muted: #8994aa;
	--sw-pp-blue: #67d8ff;
	--sw-pp-green: #79efc7;
	position: relative;
	isolation: isolate;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 20px;
	overflow: hidden;
	color: var(--sw-pp-text);
	background:
		radial-gradient(circle at 92% 0%, rgba(103, 216, 255, .11), transparent 32%),
		radial-gradient(circle at 0% 100%, rgba(155, 140, 255, .08), transparent 38%),
		linear-gradient(150deg, #101521, #090c14 68%);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.55;
	animation: sw-profile-popup-in .22s cubic-bezier(.2, .75, .25, 1) both;
}

.sw-profile-popup *,
.sw-profile-popup *::before,
.sw-profile-popup *::after {
	box-sizing: border-box;
}

.sw-profile-popup a {
	color: inherit;
	text-decoration: none;
}

.sw-profile-popup::before {
	content: "";
	position: absolute;
	z-index: -1;
	top: -110px;
	right: -90px;
	width: 250px;
	height: 250px;
	border: 1px solid rgba(103, 216, 255, .07);
	border-radius: 50%;
	box-shadow:
		0 0 0 36px rgba(103, 216, 255, .022),
		0 0 0 76px rgba(155, 140, 255, .015);
	pointer-events: none;
}

.sw-profile-popup__header {
	display: grid;
	grid-template-columns: 82px minmax(0, 1fr);
	align-items: center;
	gap: 17px;
}

.sw-profile-popup__avatar {
	position: relative;
	display: block;
	width: 82px;
	height: 82px;
	padding: 4px;
	border: 1px solid rgba(103, 216, 255, .2);
	border-radius: 23px;
	background: linear-gradient(145deg, rgba(103, 216, 255, .13), rgba(155, 140, 255, .05));
	box-shadow: 0 17px 38px rgba(0, 0, 0, .32);
}

.sw-profile-popup__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 18px;
	background: #0e1320;
}

.sw-profile-popup__presence {
	position: absolute;
	right: -8px;
	bottom: -6px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 8px;
	border: 1px solid var(--sw-pp-line);
	border-radius: 999px;
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	box-shadow: 0 10px 24px rgba(0, 0, 0, .34);
}

.sw-profile-popup__presence::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	box-shadow: 0 0 10px currentColor;
}

.sw-profile-popup__presence--online {
	color: var(--sw-pp-green);
	background: rgba(13, 38, 34, .98);
}

.sw-profile-popup__presence--offline {
	color: #a5aec0;
	background: rgba(15, 18, 28, .98);
}

.sw-profile-popup__identity {
	min-width: 0;
}

.sw-profile-popup__topline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 7px;
	margin-bottom: 7px;
}

.sw-profile-popup__group,
.sw-profile-popup__id {
	display: inline-flex;
	align-items: center;
	min-height: 24px;
	padding: 5px 8px;
	border: 1px solid rgba(103, 216, 255, .13);
	border-radius: 999px;
	font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.sw-profile-popup__group {
	color: #a8eaff;
	background: rgba(65, 194, 255, .06);
}

.sw-profile-popup__id {
	color: var(--sw-pp-muted);
	border-color: var(--sw-pp-line);
	background: rgba(255, 255, 255, .025);
}

.sw-profile-popup__identity h3 {
	margin: 0;
	color: var(--sw-pp-text);
	font-size: clamp(27px, 5vw, 36px);
	font-weight: 750;
	line-height: 1.04;
	letter-spacing: -.045em;
	overflow-wrap: anywhere;
}

.sw-profile-popup__identity h3 a:hover {
	color: var(--sw-pp-blue);
}

.sw-profile-popup__fullname {
	margin: 7px 0 0;
	color: var(--sw-pp-soft);
	font-size: 13px;
	line-height: 1.4;
}

.sw-profile-popup__stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	margin-top: 18px;
}

.sw-profile-popup__stat {
	min-width: 0;
	padding: 12px;
	border: 1px solid var(--sw-pp-line);
	border-radius: 14px;
	background: var(--sw-pp-panel);
}

.sw-profile-popup__stat span {
	display: block;
	margin-bottom: 6px;
	color: var(--sw-pp-muted);
	font-size: 8px;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
}

.sw-profile-popup__stat strong {
	display: block;
	color: var(--sw-pp-text);
	font-size: 20px;
	font-weight: 730;
	line-height: 1;
	overflow-wrap: anywhere;
}

.sw-profile-popup__details {
	display: grid;
	margin-top: 9px;
	padding: 3px 14px;
	border: 1px solid var(--sw-pp-line);
	border-radius: 16px;
	background: rgba(255, 255, 255, .018);
}

.sw-profile-popup__details > div {
	display: grid;
	grid-template-columns: minmax(115px, .8fr) minmax(0, 1.2fr);
	align-items: center;
	gap: 14px;
	padding: 10px 0;
	border-bottom: 1px solid rgba(255, 255, 255, .055);
}

.sw-profile-popup__details > div:last-child {
	border-bottom: 0;
}

.sw-profile-popup__details span {
	color: var(--sw-pp-muted);
	font-size: 11px;
}

.sw-profile-popup__details strong {
	color: #dce4f2;
	font-size: 11px;
	font-weight: 650;
	text-align: right;
	overflow-wrap: anywhere;
}

.sw-profile-popup__about {
	margin-top: 9px;
	padding: 14px;
	border: 1px solid var(--sw-pp-line);
	border-radius: 16px;
	background: var(--sw-pp-panel);
}

.sw-profile-popup__label {
	display: block;
	margin-bottom: 6px;
	color: var(--sw-pp-blue);
	font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	font-size: 8px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
}

.sw-profile-popup__bio {
	max-height: 94px;
	overflow: auto;
	padding-right: 4px;
	color: #b7c0d1;
	font-size: 12px;
	line-height: 1.6;
	overflow-wrap: anywhere;
	white-space: pre-line;
	scrollbar-width: thin;
}

.sw-profile-popup__bio p {
	margin: 0 0 .75em;
}

.sw-profile-popup__bio p:last-child {
	margin-bottom: 0;
}

.sw-profile-popup__content-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.sw-profile-popup__content-links > span:empty {
	display: none;
}

.sw-profile-popup__content-links a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 8px 12px;
	border: 1px solid var(--sw-pp-line);
	border-radius: 11px;
	color: #d4dceb;
	background: rgba(255, 255, 255, .03);
	font-size: 10px;
	font-weight: 700;
	line-height: 1.2;
}

.sw-profile-popup__content-links a:hover {
	border-color: rgba(103, 216, 255, .26);
	background: rgba(103, 216, 255, .07);
}

/* Системные кнопки DLE выводятся движком отдельно от profile_popup.tpl. */
.ui-dialog[aria-describedby="dleprofilepopup"] .ui-dialog-buttonpane,
.ui-dialog.sw-dle-dialog--profile .ui-dialog-buttonpane {
	display: block;
}

/* Страховка от старого v2, если он остался ниже в кэше или CSS. */
.ui-dialog[aria-describedby="dleprofilepopup"][style*="display: none"],
.ui-dialog.sw-dle-dialog--profile[style*="display: none"] {
	display: none !important;
}

@keyframes sw-profile-popup-in {
	from {
		opacity: 0;
		transform: translateY(7px) scale(.988);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (max-width: 560px) {
	.ui-dialog[aria-describedby="dleprofilepopup"],
	.ui-dialog.sw-dle-dialog--profile {
		width: calc(100vw - 14px) !important;
		max-width: calc(100vw - 14px) !important;
	}

	.sw-profile-popup {
		padding: 16px;
	}

	.sw-profile-popup__header {
		grid-template-columns: 68px minmax(0, 1fr);
		gap: 13px;
	}

	.sw-profile-popup__avatar {
		width: 68px;
		height: 68px;
		border-radius: 19px;
	}

	.sw-profile-popup__avatar img {
		border-radius: 15px;
	}

	.sw-profile-popup__presence {
		right: -6px;
		bottom: -7px;
		padding: 5px 7px;
		font-size: 8px;
	}

	.sw-profile-popup__identity h3 {
		font-size: 25px;
	}

	.sw-profile-popup__stats {
		gap: 6px;
		margin-top: 15px;
	}

	.sw-profile-popup__stat {
		padding: 10px 8px;
	}

	.sw-profile-popup__stat span {
		font-size: 7px;
	}

	.sw-profile-popup__stat strong {
		font-size: 18px;
	}

	.sw-profile-popup__details > div {
		grid-template-columns: 1fr;
		gap: 2px;
	}

	.sw-profile-popup__details strong {
		text-align: left;
	}

	.sw-profile-popup__content-links {
		display: grid;
		grid-template-columns: 1fr;
	}

	.sw-profile-popup__content-links a {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sw-profile-popup {
		animation: none !important;
	}

	.sw-profile-popup * {
		transition: none !important;
	}
}
