/* WpSocialManager frontend portal — Cloudflare-dashboard aesthetic:
   zinc/slate neutrals, 1px borders, dense, square corners.
   Every class here is prefixed kcd_wp-social-manager_ and defined only
   in this file — this plugin owns its own dense-table/badge/drawer/tab
   primitives rather than depending on the shared kcdev-framework's
   assets/kcdev-admin.css classes, so this plugin's console/DataGrid
   markup (shared between the frontend portal and the wp-admin Members
   Console — see assets/wpsm.js) always looks the same and never goes
   unstyled if that other stylesheet isn't loaded. This is loaded
   alongside the active theme's own CSS, not instead of it — an earlier
   version tried to dequeue every other stylesheet on the page to force
   a theme-independent look and broke the surrounding page layout
   instead (the theme's header/nav/wrapper markup is still there; only
   the .kcd_wp-social-manager subtree below is this plugin's). Scoping
   through unique, plugin-prefixed class names is what actually keeps
   this markup safe from the theme, not fighting over the style queue. */

.kcd_wp-social-manager {
	--wpsm-bg: #fafafa;
	--wpsm-surface: #ffffff;
	--wpsm-border: #e4e4e7;
	--wpsm-text: #18181b;
	--wpsm-muted: #71717a;
	--wpsm-accent: #2563eb;
	--wpsm-accent-dark: #1d4ed8;
	--wpsm-danger: #dc2626;
	color: var(--wpsm-text);
	font-size: 14px;
}

/* Centered, app-screen width on the frontend portal only — wp-admin's
   Members Console reuses this same wrapper (for the --wpsm-* custom
   properties above) but keeps this plugin's site-wide dense,
   full-width admin panel convention instead (see CLAUDE.md). */
body:not(.wp-admin) .kcd_wp-social-manager {
	max-width: 960px;
	margin: 0 auto;
}

.kcd_wp-social-manager * {
	box-sizing: border-box;
}

.kcd_wp-social-manager [hidden] {
	display: none !important;
}

/* Base link color — without this, an active theme's own bare `a { }`
   rule (e.g. the KC-Dev theme's) is the only thing that ever matches
   an unclassed <a> this plugin renders (the "Resend verification
   email" link, CSV/Excel export links, ...), since a plain element
   selector loses to nothing here otherwise. Every other reusable
   component in this file is its own class already; a link is the one
   element plain enough that plugins conventionally style it this way
   instead of classing every occurrence. */
.kcd_wp-social-manager a {
	color: var(--wpsm-accent);
}
.kcd_wp-social-manager a:hover {
	color: var(--wpsm-accent-dark);
}

.kcd_wp-social-manager_card {
	background: var(--wpsm-surface);
	border: 1px solid var(--wpsm-border);
	padding: 16px;
	margin-bottom: 12px;
}

.kcd_wp-social-manager_notice {
	padding: 8px 12px;
	border: 1px solid var(--wpsm-border);
	background: #eff6ff;
	color: #1e3a8a;
	font-size: 13px;
	margin-bottom: 12px;
}
.kcd_wp-social-manager_notice.is-error {
	background: #fef2f2;
	color: #991b1b;
	border-color: #fecaca;
}
.kcd_wp-social-manager_notice.is-success {
	background: #f0fdf4;
	color: #166534;
	border-color: #bbf7d0;
}

/* Auth forms */
.kcd_wp-social-manager_auth-tabs {
	display: flex;
	gap: 0;
	margin-bottom: 12px;
	border: 1px solid var(--wpsm-border);
	width: fit-content;
}
.kcd_wp-social-manager_auth-tabs button {
	background: var(--wpsm-surface);
	border: none;
	padding: 7px 16px;
	font-size: 13px;
	font-weight: 600;
	color: var(--wpsm-muted);
	cursor: pointer;
	border-right: 1px solid var(--wpsm-border);
}
.kcd_wp-social-manager_auth-tabs button:last-child {
	border-right: none;
}
.kcd_wp-social-manager_auth-tabs button.is-active {
	background: var(--wpsm-accent);
	color: #fff;
}

.kcd_wp-social-manager_form {
	display: grid;
	gap: 10px;
	max-width: 420px;
}
.kcd_wp-social-manager_form.is-wide {
	max-width: 640px;
	grid-template-columns: 1fr 1fr;
}
.kcd_wp-social-manager_form.is-wide .kcd_wp-social-manager_field.is-full {
	grid-column: 1 / -1;
}
.kcd_wp-social-manager_field label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--wpsm-muted);
	margin-bottom: 3px;
}
.kcd_wp-social-manager_field input,
.kcd_wp-social-manager_field select,
.kcd_wp-social-manager_field textarea {
	width: 100%;
	border: 1px solid var(--wpsm-border);
	padding: 6px 8px;
	font-size: 13px;
	background: #fff;
	color: var(--wpsm-text);
}
.kcd_wp-social-manager_field textarea {
	min-height: 60px;
}
.kcd_wp-social-manager_phone-group {
	display: flex;
	gap: 6px;
}
.kcd_wp-social-manager_phone-group select {
	flex: 0 0 auto;
	width: 128px;
}
.kcd_wp-social-manager_phone-group input {
	flex: 1 1 auto;
	min-width: 0;
}
.kcd_wp-social-manager_field input:focus,
.kcd_wp-social-manager_field select:focus,
.kcd_wp-social-manager_field textarea:focus {
	outline: 2px solid var(--wpsm-accent);
	outline-offset: -1px;
}

.kcd_wp-social-manager_btn {
	display: inline-block;
	background: var(--wpsm-accent);
	color: #fff;
	border: 1px solid var(--wpsm-accent);
	padding: 7px 16px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.kcd_wp-social-manager_btn:hover {
	background: var(--wpsm-accent-dark);
	border-color: var(--wpsm-accent-dark);
}
.kcd_wp-social-manager_btn.is-secondary {
	background: #fff;
	color: var(--wpsm-text);
	border-color: var(--wpsm-border);
}
.kcd_wp-social-manager_btn.is-danger {
	background: #fff;
	color: var(--wpsm-danger);
	border-color: #fecaca;
}
.kcd_wp-social-manager_btn:disabled {
	opacity: 0.5;
	cursor: default;
}
.kcd_wp-social-manager_btn.is-small {
	padding: 3px 9px;
	font-size: 12px;
}

/* Admin "view as member" switcher */
.kcd_wp-social-manager_switcher {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	margin-bottom: 12px;
	background: #18181b;
	color: #fafafa;
	font-size: 12px;
}
.kcd_wp-social-manager_switcher strong {
	color: #fde047;
}
.kcd_wp-social-manager_switcher button {
	margin-left: auto;
	background: #27272a;
	color: #fff;
	border: 1px solid #3f3f46;
	padding: 4px 10px;
	font-size: 12px;
	cursor: pointer;
}
.kcd_wp-social-manager_switcher button:hover {
	background: #3f3f46;
}

/* Dashboard shell */
.kcd_wp-social-manager_dash-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 4px;
}
.kcd_wp-social-manager_dash-head h2 {
	margin: 0;
	font-size: 16px;
}
.kcd_wp-social-manager_dash-head .kcd_wp-social-manager_badge-pill {
	text-transform: capitalize;
}

/* Family cards */
.kcd_wp-social-manager_family-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 8px;
	margin-bottom: 12px;
}
.kcd_wp-social-manager_family-card {
	border: 1px solid var(--wpsm-border);
	padding: 10px 12px;
	position: relative;
}
.kcd_wp-social-manager_family-card h4 {
	margin: 0 0 2px;
	font-size: 13px;
}
.kcd_wp-social-manager_family-card p {
	margin: 0;
	font-size: 12px;
	color: var(--wpsm-muted);
}
.kcd_wp-social-manager_family-card .kcd_wp-social-manager_family-actions {
	position: absolute;
	top: 8px;
	right: 8px;
	display: flex;
	gap: 4px;
}
.kcd_wp-social-manager_family-actions button {
	/* Explicit background + color (not "background:none" relying on
	   inherited text color) — buttons don't reliably inherit color from
	   their ancestors across browsers, which was leaving the ✎/× glyphs
	   effectively invisible against the card. */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #f4f4f5;
	color: var(--wpsm-text);
	border: 1px solid var(--wpsm-border);
	width: 22px;
	height: 22px;
	line-height: 1;
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
}
.kcd_wp-social-manager_family-actions button.kcd_wp-social-manager_btn-edit:hover {
	background: #e4e4e7;
}
/* Selector matches ".kcd_wp-social-manager_family-actions button" in
   specificity (0,1,1 vs 0,1,1) but wins on source order — bumped to two
   classes so it isn't fragile to that rule being reordered later. */
.kcd_wp-social-manager_family-actions button.kcd_wp-social-manager_btn-delete {
	color: var(--wpsm-danger);
}
.kcd_wp-social-manager_family-actions button.kcd_wp-social-manager_btn-delete:hover {
	background: #fef2f2;
	border-color: #fecaca;
}

.kcd_wp-social-manager_muted {
	color: var(--wpsm-muted);
	font-size: 12px;
}

/* Activity group assignment checkboxes (registration/profile/family forms) */
.kcd_wp-social-manager_group-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
}
/* Specificity note: ".kcd_wp-social-manager_field label" (0,1,1) would
   otherwise beat a bare ".kcd_wp-social-manager_group-check" (0,1,0)
   and force this back to display:block — these checkboxes live inside
   a .kcd_wp-social-manager_field wrapper, so that ambient field-label
   rule really does match them too. Qualified with the parent class to
   safely outrank it. */
.kcd_wp-social-manager_group-checks .kcd_wp-social-manager_group-check {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: normal;
	font-size: 13px;
}
.kcd_wp-social-manager_group-check img {
	width: 20px;
	height: 20px;
	object-fit: cover;
	border: 1px solid var(--wpsm-border);
}

/* ---------------------------------------------------------------------
   Console/DataGrid components: toolbar, stat tiles, table, badges,
   pagination, tabs, drawer. Rendered by assets/wpsm.js in both the
   frontend portal (Members/Reports/Fields/Groups tabs, for an admin or
   moderator) and the wp-admin Members Console — this plugin's own
   class set, not the shared kcdev-framework one (see file header).
   ------------------------------------------------------------------ */

.kcd_wp-social-manager_toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding: 8px 0;
}
.kcd_wp-social-manager_toolbar input[type="search"],
.kcd_wp-social-manager_toolbar select {
	box-sizing: border-box;
	height: 30px;
	border: 1px solid var(--wpsm-border);
	font-size: 12px;
	padding: 4px 8px;
	line-height: 1.4;
}
.kcd_wp-social-manager_toolbar select {
	min-width: 150px;
}
.kcd_wp-social-manager_spacer {
	margin-left: auto;
}

.kcd_wp-social-manager_stat-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 8px;
	margin-bottom: 10px;
}
.kcd_wp-social-manager_stat-tile {
	padding: 10px 12px;
	background: #f8fafc;
	border: 1px solid var(--wpsm-border);
}
.kcd_wp-social-manager_stat-label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: var(--wpsm-muted);
	margin-bottom: 3px;
}
.kcd_wp-social-manager_stat-value {
	font-size: 20px;
	font-weight: 700;
	color: var(--wpsm-text);
	font-variant-numeric: tabular-nums;
}

.kcd_wp-social-manager_table-wrap {
	overflow-x: auto;
	border: 1px solid var(--wpsm-border);
}
table.kcd_wp-social-manager_table {
	width: 100%;
	border-collapse: collapse;
	font-size: 12px;
}
table.kcd_wp-social-manager_table th,
table.kcd_wp-social-manager_table td {
	padding: 6px 8px;
	text-align: left;
	border-bottom: 1px solid var(--wpsm-border);
	white-space: nowrap;
}
table.kcd_wp-social-manager_table thead th {
	background: #f8fafc;
	font-weight: 600;
	color: var(--wpsm-text);
	position: sticky;
	top: 0;
	cursor: pointer;
	user-select: none;
}
table.kcd_wp-social-manager_table thead th.is-sorted::after {
	content: " \2193";
}
table.kcd_wp-social-manager_table thead th.is-sorted[data-order="asc"]::after {
	content: " \2191";
}
table.kcd_wp-social-manager_table tbody tr:hover {
	background: #f8fafc;
}
table.kcd_wp-social-manager_table td.kcd_wp-social-manager_col-wrap {
	white-space: normal;
}

.kcd_wp-social-manager_badge-pill {
	display: inline-block;
	padding: 1px 8px;
	font-size: 11px;
	font-weight: 600;
	border: 1px solid transparent;
	line-height: 1.6;
}
.kcd_wp-social-manager_badge-active { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.kcd_wp-social-manager_badge-pending_verification, .kcd_wp-social-manager_badge-pending { background: #fef9c3; color: #854d0e; border-color: #fef08a; }
.kcd_wp-social-manager_badge-suspended { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.kcd_wp-social-manager_badge-admin { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.kcd_wp-social-manager_badge-moderator { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.kcd_wp-social-manager_badge-member { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.kcd_wp-social-manager_badge-regular { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.kcd_wp-social-manager_badge-event { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }

.kcd_wp-social-manager_pagination {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 0 0;
	font-size: 12px;
	color: var(--wpsm-muted);
}
.kcd_wp-social-manager_pagination button {
	border: 1px solid var(--wpsm-border);
	background: #fff;
	padding: 2px 8px;
	cursor: pointer;
}
.kcd_wp-social-manager_pagination button:disabled {
	opacity: 0.4;
	cursor: default;
}

.kcd_wp-social-manager_tabs {
	display: flex;
	gap: 2px;
	border-bottom: 1px solid var(--wpsm-border);
	margin-bottom: 10px;
}
.kcd_wp-social-manager_tabs button {
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 8px 12px;
	font-size: 13px;
	font-weight: 600;
	color: var(--wpsm-muted);
	cursor: pointer;
}
.kcd_wp-social-manager_tabs button.is-active {
	color: var(--wpsm-accent);
	border-bottom-color: var(--wpsm-accent);
}
.kcd_wp-social-manager_tab-panel[hidden] {
	display: none;
}

.kcd_wp-social-manager_drawer-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.4);
	z-index: 100000;
}
.kcd_wp-social-manager_drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(420px, 92vw);
	background: var(--wpsm-surface);
	box-shadow: -2px 0 8px rgba(15, 23, 42, 0.15);
	z-index: 100001;
	display: flex;
	flex-direction: column;
}
.kcd_wp-social-manager_drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: #18181b;
	color: #fafafa;
}
.kcd_wp-social-manager_drawer-header h2 {
	margin: 0;
	font-size: 14px;
	color: #fafafa;
}
.kcd_wp-social-manager_drawer-close {
	background: none;
	border: none;
	color: #fafafa;
	font-size: 18px;
	cursor: pointer;
	line-height: 1;
}
.kcd_wp-social-manager_drawer-body {
	padding: 12px 16px;
	overflow-y: auto;
	flex: 1;
}
.kcd_wp-social-manager_drawer-body dl {
	display: grid;
	grid-template-columns: 110px 1fr;
	gap: 6px 10px;
	margin: 0 0 12px;
	font-size: 12px;
}
.kcd_wp-social-manager_drawer-body dt {
	color: var(--wpsm-muted);
	font-weight: 600;
}
.kcd_wp-social-manager_drawer-body dd {
	margin: 0;
	color: var(--wpsm-text);
}
