/* PN Sharing Debugger: admin screen */

.pnsd {
	--pnsd-error: #d63638;
	--pnsd-warning: #dba617;
	--pnsd-info: #2271b1;
	--pnsd-pass: #00a32a;
	--pnsd-border: #dcdcde;
	--pnsd-muted: #646970;
	max-width: 1280px;
}

.pnsd-intro { max-width: 70ch; color: var(--pnsd-muted); }

.pnsd-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 24px; }
.pnsd-form #pnsd-url { flex: 1 1 320px; max-width: 560px; }
.pnsd-fresh { color: var(--pnsd-muted); }

.pnsd-loading { display: flex; align-items: center; gap: 4px; }
.pnsd-loading .spinner { float: none; margin: 0; }

.pnsd-panel,
.pnsd-summary,
.pnsd-previews,
.pnsd-check-group {
	background: #fff;
	border: 1px solid var(--pnsd-border);
	border-radius: 6px;
	padding: 16px 20px;
	margin-bottom: 20px;
}
.pnsd h2 { font-size: 15px; margin: 0 0 12px; }
.pnsd details > summary { cursor: pointer; list-style: none; }
.pnsd details > summary::-webkit-details-marker { display: none; }
.pnsd details > summary h2 { display: inline-block; margin: 0; }
.pnsd details > summary::before { content: "▸"; display: inline-block; width: 1.2em; color: var(--pnsd-muted); }
.pnsd details[open] > summary::before { content: "▾"; }
.pnsd details[open] > summary { margin-bottom: 12px; }

/* Summary */
.pnsd-summary { display: grid; grid-template-columns: auto 1fr; gap: 16px 32px; align-items: center; }
.pnsd-scores { display: flex; gap: 16px; grid-row: span 2; }
.pnsd-score {
	--c: var(--pnsd-pass);
	width: 84px; height: 84px; border-radius: 50%;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	background:
		radial-gradient(closest-side, #fff 78%, transparent 80% 100%),
		conic-gradient(var(--c) calc(var(--v) * 1%), #f0f0f1 0);
}
.pnsd-score.is-ok { --c: var(--pnsd-warning); }
.pnsd-score.is-bad { --c: var(--pnsd-error); }
.pnsd-score-value { font-size: 22px; font-weight: 600; line-height: 1; }
.pnsd-score-label { font-size: 11px; color: var(--pnsd-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.pnsd-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.pnsd-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; font-size: 12px; }
.pnsd-facts dt { color: var(--pnsd-muted); }
.pnsd-facts dd { margin: 0; word-break: break-all; }
.pnsd-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }

.pnsd-badge {
	display: inline-block; padding: 2px 8px; border-radius: 999px;
	font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap;
	background: #f0f0f1; color: #1d2327;
}
.pnsd-badge.is-error { background: #fcf0f1; color: #8a2424; }
.pnsd-badge.is-warning { background: #fcf9e8; color: #614a00; }
.pnsd-badge.is-info { background: #f0f6fc; color: #0a4b78; }
.pnsd-badge.is-pass { background: #edfaef; color: #005c12; }
.pnsd-badge.is-fact { background: #f6f7f7; color: #50575e; }

/* Tabs and preview grid */
.pnsd-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--pnsd-border); }
.pnsd-tab {
	border: 0; background: none; cursor: pointer; padding: 8px 12px; margin-bottom: -1px;
	border-bottom: 2px solid transparent; color: var(--pnsd-muted); font-size: 13px;
}
.pnsd-tab:hover { color: #1d2327; }
.pnsd-tab.is-active { color: #1d2327; border-bottom-color: var(--pnsd-info); font-weight: 600; }
.pnsd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; align-items: start; }
.pnsd-grid.is-single { grid-template-columns: minmax(0, 520px); }
.pnsd-preview { margin: 0; }
.pnsd-preview figcaption { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--pnsd-muted); margin-bottom: 8px; }

.pv { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow: hidden; }
.pv img.is-broken { display: none; }
.pv-img { display: block; width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; background: #e5e5e5; }
.pv-title, .pv-desc { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
.pv-title { -webkit-line-clamp: 2; font-weight: 600; }
.pv-desc { -webkit-line-clamp: 2; }

/* Small-image layouts: thumbnail next to the text */
.pv.is-small:not(.pv-x),
.pv-card.is-small { display: grid; grid-template-columns: 96px 1fr; align-items: stretch; }
.pv.is-small:not(.pv-x) .pv-img,
.pv-card.is-small .pv-img { aspect-ratio: 1; height: 100%; }
.pv-img.is-small { width: 96px; aspect-ratio: 1; }

/* WhatsApp */
.pv-whatsapp { background: #efeae2; padding: 12px; border-radius: 8px; }
.pv-whatsapp .pv-bubble { background: #d9fdd3; border-radius: 8px; padding: 4px; max-width: 360px; margin-left: auto; }
.pv-whatsapp .pv-card { background: #cfe9c7; border-radius: 6px; overflow: hidden; }
.pv-whatsapp .pv-body { padding: 8px 10px; font-size: 13px; color: #111b21; }
.pv-whatsapp .pv-desc { color: #54656f; font-size: 12px; margin-top: 2px; }
.pv-whatsapp .pv-domain { color: #667781; font-size: 12px; margin-top: 4px; }
.pv-whatsapp .pv-link { color: #027eb5; font-size: 13px; padding: 6px 6px 2px; word-break: break-all; }

/* Facebook */
.pv-facebook { border: 1px solid #dadde1; background: #f0f2f5; }
.pv-facebook .pv-body { padding: 10px 12px; }
.pv-facebook .pv-domain { font-size: 12px; color: #65676b; }
.pv-facebook .pv-title { font-size: 16px; color: #050505; margin-top: 2px; -webkit-line-clamp: 2; }
.pv-facebook .pv-desc { font-size: 14px; color: #65676b; -webkit-line-clamp: 1; margin-top: 2px; }

/* Google */
.pv-google { font-family: Arial, sans-serif; max-width: 600px; }
.pv-google .pv-site { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.pv-google .pv-fav { width: 26px; height: 26px; border-radius: 50%; background: #f1f3f4; border: 1px solid #dadce0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pv-google .pv-favimg { width: 18px; height: 18px; object-fit: contain; }
.pv-google .pv-site > span:last-child { display: flex; flex-direction: column; }
.pv-google .pv-sitename { font-size: 14px; color: #202124; }
.pv-google .pv-crumbs { font-size: 12px; color: #4d5156; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 480px; }
.pv-google .pv-title { color: #1a0dab; font-size: 20px; font-weight: 400; line-height: 1.3; -webkit-line-clamp: 1; }
.pv-google .pv-desc { color: #4d5156; font-size: 14px; line-height: 1.58; margin-top: 4px; }

/* Telegram */
.pv-telegram { background: #effdde; border-radius: 12px; padding: 8px 10px; font-size: 14px; }
.pv-telegram .pv-link { color: #168acd; word-break: break-all; margin-bottom: 6px; }
.pv-telegram .pv-card { border-left: 3px solid #4fae4e; padding-left: 8px; }
.pv-telegram .pv-sitename { color: #4fae4e; font-weight: 600; }
.pv-telegram .pv-title { -webkit-line-clamp: 3; margin-top: 2px; }
.pv-telegram .pv-desc { -webkit-line-clamp: 4; margin: 2px 0 6px; }
.pv-telegram .pv-img { border-radius: 6px; }

/* LinkedIn */
.pv-linkedin { border: 1px solid #e0e0e0; border-radius: 8px; background: #fff; }
.pv-linkedin .pv-body { padding: 10px 12px; background: #eef3f8; }
.pv-linkedin.is-small .pv-body { background: #fff; display: flex; flex-direction: column; justify-content: center; }
.pv-linkedin .pv-title { font-size: 14px; color: rgba(0,0,0,.9); }
.pv-linkedin .pv-domain { font-size: 12px; color: rgba(0,0,0,.6); margin-top: 4px; }

/* X */
.pv-x { font-size: 15px; color: #0f1419; }
.pv-x .pv-media { position: relative; border: 1px solid #cfd9de; border-radius: 16px; overflow: hidden; }
.pv-x .pv-overlay {
	position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px);
	background: rgba(0,0,0,.77); color: #fff; font-size: 13px; padding: 0 6px; border-radius: 4px;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 20px;
}
.pv-x .pv-from { color: #536471; font-size: 13px; margin-top: 4px; }
.pv-x.is-small { display: grid; grid-template-columns: 130px 1fr; border: 1px solid #cfd9de; border-radius: 16px; }
.pv-x.is-small .pv-thumb { background: #f7f9f9; border-right: 1px solid #cfd9de; }
.pv-x.is-small .pv-img { aspect-ratio: 1; height: 100%; }
.pv-x.is-small .pv-body { padding: 12px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.pv-x .pv-domain, .pv-x .pv-desc { color: #536471; }
.pv-x .pv-title { font-weight: 400; -webkit-line-clamp: 1; }

/* Discord */
.pv-discord {
	background: #2b2d31; color: #dbdee1; border-left: 4px solid #1e1f22; border-radius: 4px;
	padding: 8px 16px 16px 12px; max-width: 432px; font-size: 14px;
}
.pv-discord .pv-sitename { font-size: 12px; color: #b5bac1; margin-top: 8px; }
.pv-discord .pv-title { color: #00a8fc; font-size: 16px; margin-top: 8px; -webkit-line-clamp: 3; }
.pv-discord .pv-desc { -webkit-line-clamp: 6; margin-top: 8px; font-size: 14px; }
.pv-discord .pv-img { border-radius: 4px; margin-top: 16px; }
.pv-discord .pv-img.is-small { width: 80px; }

/* Slack */
.pv-slack { border-left: 4px solid #dddddd; padding: 2px 0 2px 12px; font-size: 15px; color: #1d1c1d; max-width: 520px; }
.pv-slack .pv-site { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; }
.pv-slack .pv-favimg { width: 16px; height: 16px; object-fit: contain; }
.pv-slack .pv-title { color: #1264a3; margin-top: 2px; -webkit-line-clamp: 1; }
.pv-slack .pv-desc { -webkit-line-clamp: 3; margin-top: 2px; }
.pv-slack .pv-img { border-radius: 8px; margin-top: 8px; max-width: 360px; }

/* Checks */
.pnsd-columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.pnsd-check-group ul { margin: 0; }
.pnsd-check { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 10px 0; margin: 0; border-top: 1px solid #f0f0f1; }
.pnsd-check:first-child { border-top: 0; }
.pnsd-check .pnsd-badge { justify-self: start; align-self: start; }
.pnsd-passed { margin-top: 8px; }
.pnsd-passed > summary { color: var(--pnsd-muted); padding: 6px 0; }
.pnsd-fixes { position: sticky; top: 52px; }
.pnsd-check-body p { margin: 2px 0 4px; color: #3c434a; }
.pnsd-value { display: block; font-size: 12px; white-space: pre-wrap; word-break: break-word; background: #f6f7f7; padding: 4px 6px; }

.pnsd-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.pnsd-panel-head h2 { margin: 0; }
.pnsd-code {
	background: #1d2327; color: #f0f0f1; padding: 12px; border-radius: 4px;
	font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
	max-height: 420px; overflow: auto; margin: 0;
}

/* Data table */
.pnsd-data table td, .pnsd-data table th { vertical-align: top; word-break: break-word; }
.pnsd-data thead th:first-child { width: 140px; }
.pnsd-data thead th:last-child { width: 170px; }
.pnsd-alt { margin-top: 6px; font-size: 12px; color: var(--pnsd-muted); }

@media (max-width: 960px) {
	.pnsd-columns { grid-template-columns: 1fr; }
	.pnsd-fixes { position: static; }
	.pnsd-summary { grid-template-columns: 1fr; }
	.pnsd-scores { grid-row: auto; }
}
@media (max-width: 480px) {
	.pnsd-grid { grid-template-columns: 1fr; }
	.pnsd-score { width: 68px; height: 68px; }
}
@media (max-width: 640px) {
	/* Metadata table: one stacked card per field. */
	.pnsd .pnsd-data table,
	.pnsd .pnsd-data tbody,
	.pnsd .pnsd-data tr,
	.pnsd .pnsd-data tbody td { display: block; width: auto; }
	.pnsd .pnsd-data thead { display: none; }
	.pnsd .pnsd-data tr { padding: 8px 0; border-top: 1px solid var(--pnsd-border); }
	.pnsd .pnsd-data tbody td { padding: 2px 0; border: 0; }
	.pnsd .pnsd-data tbody td:first-child { font-weight: 600; }
	.pnsd .pnsd-data tbody td:last-child:empty { display: none; }
}
