/**
 * Jetonomy — BuddyPress integration styles.
 * Only loaded when BuddyPress is active.
 *
 * Colors route through the --jt-* token cascade so this integration adopts the
 * active theme's palette and dark mode (the tokens are reassigned in
 * .jt-dark .jt-app in jetonomy.css). The hex after each var() is the original
 * value, kept as a fallback so appearance is identical when no theme token is
 * present. The two `#fff` on accent buttons are intentional on-accent contrast.
 *
 * @package Jetonomy
 */

/* ── Token definitions ──
 * jetonomy.css (which defines the --jt-* tokens on :root) is NOT enqueued on
 * BuddyPress pages — only this file is. So define the tokens this integration
 * uses here, scoped to its own containers, inheriting from the active theme's
 * brand tokens (BuddyX / Reign / BuddyNext / Astra / Kadence / Blocksy /
 * GeneratePress) with a hex fallback. Mirrors the chain in jetonomy.css so the
 * BP surfaces adopt the theme's colors instead of the raw fallbacks. */
.jt-bp-forum,
.jt-bp-profile,
.jt-bp-forum-settings,
.jt-bp-back-banner {
	--jt-accent: var(--bx-color-accent, var(--reign-colors-theme, var(--brand, var(--wp--preset--color--primary, var(--ast-global-color-0, var(--global-palette1, var(--theme-palette-color-1, var(--wp--preset--color--accent, #3B82F6))))))));
	--jt-accent-hover: #2563EB;
	--jt-accent-hover: color-mix(in srgb, var(--jt-accent) 85%, black);
	--jt-text: var(--bx-color-fg, var(--text-1, var(--wp--preset--color--contrast, #1a1a1a)));
	--jt-text-secondary: #4B5563;
	--jt-text-secondary: color-mix(in srgb, var(--jt-text) 70%, transparent);
	--jt-text-tertiary: #6B7280;
	--jt-text-tertiary: color-mix(in srgb, var(--jt-text) 65%, transparent);
	--jt-bg: var(--bx-color-bg-elevated, var(--bg, var(--wp--preset--color--base, #ffffff)));
	--jt-bg-subtle: #F9FAFB;
	--jt-bg-subtle: color-mix(in srgb, var(--jt-text) 3%, var(--jt-bg));
	--jt-bg-muted: #F3F4F6;
	--jt-bg-muted: color-mix(in srgb, var(--jt-text) 6%, var(--jt-bg));
	--jt-border: rgba(0, 0, 0, 0.1);
	--jt-border: var(--bx-color-border, color-mix(in srgb, var(--jt-text) 10%, transparent));
}

/* ── Group Forum Tab ── */
.jt-bp-forum { padding: 0; }

.jt-bp-forum-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--jt-border, #e5e7eb);
}
.jt-bp-forum-head strong {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--jt-text, #1e293b);
}
.jt-bp-forum-head .bp-primary-action {
	background: var(--jt-accent, #3b82f6);
	color: #fff; /* on-accent contrast */
	border: none;
	border-radius: 6px;
	padding: 8px 18px;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s;
}
.jt-bp-forum-head .bp-primary-action:hover {
	background: var(--jt-accent-hover, #2563eb);
	color: #fff; /* on-accent contrast */
}

.jt-bp-empty {
	text-align: center;
	color: var(--jt-text-tertiary, #94a3b8);
	font-size: 0.9375rem;
	padding: 48px 20px;
	background: var(--jt-bg-subtle, #f8fafc);
	border-radius: 8px;
	border: 1px dashed var(--jt-border, #e2e8f0);
}

/* Topic list */
.jt-bp-topics {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
}
.jt-bp-topics th {
	text-align: left;
	font-size: 0.6875rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-weight: 600;
	color: var(--jt-text-tertiary, #94a3b8);
	padding: 10px 16px;
	border-bottom: 2px solid var(--jt-border, #e2e8f0);
	background: var(--jt-bg-subtle, #f8fafc);
}
.jt-bp-topics th:first-child { border-radius: 8px 0 0 0; }
.jt-bp-topics th:last-child { border-radius: 0 8px 0 0; }

.jt-bp-topics td {
	padding: 14px 16px;
	border-bottom: 1px solid var(--jt-border, #f1f5f9);
	font-size: 0.9375rem;
	vertical-align: middle;
}
.jt-bp-topics tr:last-child td { border-bottom: none; }
.jt-bp-topics tr:hover td { background: var(--jt-bg-subtle, #f8fafc); }

.jt-bp-topics td a {
	text-decoration: none;
	font-weight: 600;
	color: var(--jt-text, #1e293b);
	font-size: 0.9375rem;
}
.jt-bp-topics td a:hover { color: var(--jt-accent, #3b82f6); }

.jt-bp-topics td small {
	display: block;
	color: var(--jt-text-tertiary, #94a3b8);
	font-size: 0.8125rem;
	margin-top: 2px;
	font-weight: 400;
}
.jt-bp-topics .jt-bp-replies,
.jt-bp-topics .jt-bp-activity {
	color: var(--jt-text-secondary, #64748b);
	font-size: 0.875rem;
	white-space: nowrap;
}

/* Topic row (group forum list) */
.jt-bp-topic-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jt-bp-topic-meta { font-size: 0.8125rem; color: var(--jt-text-tertiary, #94a3b8); margin-top: 2px; }

.jt-bp-view-all {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--jt-border, #e2e8f0);
	font-size: 0.875rem;
	text-align: center;
}
.jt-bp-view-all a {
	font-weight: 600;
	text-decoration: none;
	color: var(--jt-accent, #3b82f6);
}
.jt-bp-view-all a:hover { text-decoration: underline; }

/* ── Member Profile Forum Tab ── */
.jt-bp-profile { padding: 0; }

.jt-bp-stats {
	display: flex;
	gap: 0;
	padding: 0;
	margin-bottom: 24px;
	border: 1px solid var(--jt-border, #e2e8f0);
	border-radius: 8px;
	overflow: hidden;
}
.jt-bp-stat {
	flex: 1;
	text-align: center;
	padding: 16px 12px;
	border-right: 1px solid var(--jt-border, #e2e8f0);
	background: var(--jt-bg-subtle, #f8fafc);
}
.jt-bp-stat:last-child { border-right: none; }
.jt-bp-stat strong {
	display: block;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--jt-text, #1e293b);
	line-height: 1.2;
}
.jt-bp-stat span,
.jt-bp-stat {
	font-size: 0.75rem;
	color: var(--jt-text-tertiary, #94a3b8);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.jt-bp-profile h4 {
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--jt-text-secondary, #64748b);
	margin: 0 0 12px;
}

.jt-bp-recent {
	list-style: none;
	padding: 0;
	margin: 0 0 20px;
}
.jt-bp-recent li {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid var(--jt-border, #f1f5f9);
}
.jt-bp-recent li:last-child { border-bottom: none; }
.jt-bp-recent a {
	text-decoration: none;
	font-weight: 500;
	color: var(--jt-text, #1e293b);
	font-size: 0.9375rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.jt-bp-recent a:hover { color: var(--jt-accent, #3b82f6); }
.jt-bp-time {
	color: var(--jt-text-tertiary, #94a3b8);
	font-size: 0.8125rem;
	white-space: nowrap;
	text-align: right;
}
.jt-bp-space-tag {
	display: inline-block;
	font-size: 0.75rem;
	color: var(--jt-text-secondary, #64748b);
	background: var(--jt-bg-muted, #f1f5f9);
	padding: 1px 8px;
	border-radius: 4px;
	margin-left: 6px;
	vertical-align: middle;
}

/* ── Back to Group Link ── */
.jt-bp-back-banner {
	font-size: 0.8125rem;
	margin-bottom: 12px;
}
.jt-bp-back-banner a {
	text-decoration: none;
	color: var(--jt-text-secondary, #64748b);
}
.jt-bp-back-banner a:hover {
	color: var(--jt-accent, #3b82f6);
}

/* ── Profile Link ── */
.jt-bp-profile-link { margin-top: 20px; }

/* ── Group Create/Manage Forum Settings ── */
.jt-bp-forum-settings {
	margin-top: 20px;
	padding: 20px;
	border: 1px solid var(--jt-border, #e2e8f0);
	border-radius: 8px;
	background: var(--jt-bg-subtle, #f8fafc);
}
.jt-bp-forum-settings h4 {
	margin: 0 0 4px;
	font-size: 1rem;
	font-weight: 700;
	color: var(--jt-text, #1e293b);
}
.jt-bp-forum-settings .description {
	color: var(--jt-text-secondary, #64748b);
	font-size: 0.875rem;
	margin: 0 0 14px;
}
.jt-bp-forum-settings label {
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--jt-text, #374151);
	display: block;
	margin-bottom: 6px;
}
.jt-bp-forum-settings select {
	width: 100%;
	max-width: 400px;
	padding: 8px 12px;
	border: 1px solid var(--jt-border, #d1d5db);
	border-radius: 6px;
	font-size: 0.9375rem;
	background: var(--jt-bg, #fff);
}
