/**
 * bbPress User Profile Styles
 *
 * Styles for bbPress user profile pages including header, navigation,
 * content sections, favorites, subscriptions, and edit profile form.
 *
 * @package AgenticWP
 */

/* ==========================================================================
   USER PROFILE
   Styles for bbPress user profile pages including header, navigation, and content.
   ========================================================================== */

/* User Profile Wrapper
   Contains avatar sidebar and main content */
#bbp-user-wrapper {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 40px;
	padding: 40px 0 80px;
}

/* Single User Details Sidebar
   Contains avatar and navigation */
#bbp-single-user-details {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* ==========================================================================
   USER AVATAR
   Large avatar display for profile pages.
   ========================================================================== */

#bbp-user-avatar {
	text-align: center;
}

#bbp-user-avatar .vcard {
	display: block;
}

#bbp-user-avatar .vcard a {
	display: block;
}

#bbp-user-avatar img.avatar {
	width: 150px;
	height: 150px;
	border-radius: 50%;
	object-fit: cover;
	border: 4px solid var(--bg);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#bbp-user-avatar img.avatar:hover {
	transform: scale(1.02);
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   USER NAVIGATION TABS
   Horizontal/vertical navigation for profile sections.
   ========================================================================== */

#bbp-user-navigation {
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 12px;
	overflow: hidden;
}

#bbp-user-navigation ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
}

#bbp-user-navigation li {
	border-bottom: 1px solid var(--line);
}

#bbp-user-navigation li:last-child {
	border-bottom: none;
}

#bbp-user-navigation li a {
	display: block;
	padding: 12px 16px;
	font-size: 14px;
	font-weight: 500;
	color: var(--ink);
	text-decoration: none;
	transition: all 0.2s ease;
}

#bbp-user-navigation li a:hover {
	background: var(--subtle-bg);
	color: var(--accent);
}

/* Active Tab State */
#bbp-user-navigation li.current a,
#bbp-user-navigation li.current span a {
	background: var(--accent);
	color: var(--bg);
}

#bbp-user-navigation li.current a:hover,
#bbp-user-navigation li.current span a:hover {
	background: #0a1a4d;
	color: var(--bg);
}

/* Navigation spans (bbPress wraps links in spans) */
#bbp-user-navigation li span {
	display: block;
}

/* ==========================================================================
   USER PROFILE BODY
   Main content area for profile information.
   ========================================================================== */

#bbp-user-body {
	min-width: 0;
}

/* Profile Card Container */
#bbp-user-profile,
.bbp-user-profile {
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 32px;
}

/* Username Title (@username) */
#bbp-user-profile h2.entry-title,
#bbp-user-profile .entry-title {
	font-size: clamp(24px, 4vw, 32px);
	font-weight: 700;
	color: var(--ink);
	margin: 0 0 24px;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

/* Profile Section Container */
.bbp-user-section {
	margin: 0;
}

/* Section Headings (Profile, Forums) */
.bbp-user-section h3 {
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted);
	margin: 0 0 16px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
}

/* Profile Info Paragraphs */
.bbp-user-section p {
	font-size: 15px;
	color: var(--ink);
	line-height: 1.6;
	margin: 0 0 12px;
}

.bbp-user-section p:last-child {
	margin-bottom: 0;
}

/* Muted Info Labels */
.bbp-user-forum-role,
.bbp-user-last-activity,
.bbp-user-topic-count,
.bbp-user-reply-count,
.bbp-user-website {
	font-size: 14px;
	color: var(--muted);
}

/* Links in Profile */
.bbp-user-section a {
	color: var(--accent);
	text-decoration: none;
	transition: color 0.2s ease;
}

.bbp-user-section a:hover {
	color: #0a1a4d;
	text-decoration: underline;
}

/* Horizontal Rule Separator */
.bbp-user-section hr {
	border: none;
	border-top: 1px solid var(--line);
	margin: 24px 0;
}

/* ==========================================================================
   USER ROLE BADGE
   Pill-style badge for forum role display.
   ========================================================================== */

/* Role Badge - Extract from "Forum Role: Keymaster" text via CSS */
.bbp-user-section p.bbp-user-forum-role:last-child {
	margin-top: 16px;
}

/* When role is displayed as a badge element */
.bbp-user-role-badge,
span.bbp-user-role {
	display: inline-block;
	padding: 6px 14px;
	background: var(--accent-weak);
	color: var(--accent);
	font-size: 12px;
	font-weight: 600;
	text-transform: capitalize;
	border-radius: 20px;
	margin-top: 8px;
}

/* Keymaster Role */
.bbp-user-role-badge.keymaster,
span.bbp-user-role.keymaster {
	background: var(--accent);
	color: var(--bg);
}

/* Moderator Role */
.bbp-user-role-badge.moderator,
span.bbp-user-role.moderator {
	background: #dbeafe;
	color: #1e40af;
}

/* ==========================================================================
   USER TOPICS & REPLIES LISTS
   Reuses topic list styling for user's content listings.
   ========================================================================== */

/* Topics Started / Replies Created Pages */
#bbp-user-topics-started,
#bbp-user-replies-created,
#bbp-user-engagements {
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 32px;
}

#bbp-user-topics-started h2,
#bbp-user-replies-created h2,
#bbp-user-engagements h2 {
	font-size: clamp(20px, 3vw, 24px);
	font-weight: 700;
	color: var(--ink);
	margin: 0 0 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--line);
}

/* Topics/Replies List within User Profile */
#bbp-user-topics-started ul.bbp-topics,
#bbp-user-replies-created .bbp-replies,
#bbp-user-engagements ul.bbp-topics {
	padding: 0;
}

/* No Topics/Replies Notice */
#bbp-user-topics-started .bbp-template-notice,
#bbp-user-replies-created .bbp-template-notice,
#bbp-user-engagements .bbp-template-notice {
	margin: 0;
}

/* ==========================================================================
   FAVORITES & SUBSCRIPTIONS
   Card-style list items with quick action buttons.
   ========================================================================== */

#bbp-user-favorites,
#bbp-user-subscriptions {
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 32px;
}

#bbp-user-favorites h2,
#bbp-user-subscriptions h2 {
	font-size: clamp(20px, 3vw, 24px);
	font-weight: 700;
	color: var(--ink);
	margin: 0 0 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--line);
}

/* Favorites/Subscriptions Topic List */
#bbp-user-favorites ul.bbp-topics,
#bbp-user-subscriptions ul.bbp-topics,
#bbp-user-subscriptions ul.bbp-forums {
	padding: 0;
}

/* Row Actions Container (Unfavorite/Unsubscribe) */
#bbp-user-favorites .bbp-row-actions,
#bbp-user-subscriptions .bbp-row-actions {
	display: inline-flex;
	margin-right: 12px;
}

/* Quick Action Buttons */
#bbp-user-favorites .bbp-row-actions a,
#bbp-user-subscriptions .bbp-row-actions a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--error-bg);
	color: var(--error-text);
	text-decoration: none;
	font-size: 12px;
	transition: all 0.2s ease;
}

#bbp-user-favorites .bbp-row-actions a:hover,
#bbp-user-subscriptions .bbp-row-actions a:hover {
	background: var(--error-text);
	color: var(--bg);
	transform: scale(1.1);
}

/* No Favorites/Subscriptions Notice */
#bbp-user-favorites .bbp-template-notice,
#bbp-user-subscriptions .bbp-template-notice {
	margin: 0;
}

/* ==========================================================================
   EDIT PROFILE FORM
   Styles for the user profile edit form.
   ========================================================================== */

/* Edit Profile Form Container */
#bbp-your-profile {
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 32px;
}

/* Section Headings (Name, Contact Info, etc.) */
#bbp-your-profile h2.entry-title {
	font-size: 18px;
	font-weight: 700;
	color: var(--ink);
	margin: 0 0 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--line);
}

/* First section heading - no top margin */
#bbp-your-profile h2.entry-title:first-child {
	margin-top: 0;
}

/* Subsequent section headings - add spacing */
#bbp-your-profile fieldset.bbp-form + h2.entry-title {
	margin-top: 32px;
}

/* Fieldset Reset */
#bbp-your-profile fieldset.bbp-form {
	border: none;
	padding: 0;
	margin: 0 0 8px;
}

/* Hide duplicate legend (already have h2) */
#bbp-your-profile fieldset.bbp-form legend {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

/* Field Wrapper */
#bbp-your-profile fieldset.bbp-form > div {
	margin-bottom: 16px;
}

#bbp-your-profile fieldset.bbp-form > div:last-child {
	margin-bottom: 0;
}

/* Form Labels */
#bbp-your-profile label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
	margin-bottom: 6px;
}

/* Text Inputs */
#bbp-your-profile input[type="text"],
#bbp-your-profile input[type="email"],
#bbp-your-profile input[type="url"],
#bbp-your-profile input[type="password"],
#bbp-your-profile input.regular-text {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 12px 16px;
	border: 1px solid var(--line);
	border-radius: 14px;
	font-family: inherit;
	font-size: 15px;
	color: var(--ink);
	background: var(--bg);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	box-sizing: border-box;
}

#bbp-your-profile input[type="text"]:focus,
#bbp-your-profile input[type="email"]:focus,
#bbp-your-profile input[type="url"]:focus,
#bbp-your-profile input[type="password"]:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(5, 14, 57, 0.1);
}

/* Disabled Inputs */
#bbp-your-profile input:disabled {
	background: var(--subtle-bg);
	color: var(--muted);
	cursor: not-allowed;
}

/* Textareas */
#bbp-your-profile textarea {
	display: block;
	width: 100%;
	padding: 12px 16px;
	border: 1px solid var(--line);
	border-radius: 14px;
	font-family: inherit;
	font-size: 15px;
	color: var(--ink);
	background: var(--bg);
	resize: vertical;
	min-height: 120px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	box-sizing: border-box;
}

#bbp-your-profile textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(5, 14, 57, 0.1);
}

/* Select Dropdowns */
#bbp-your-profile select {
	display: block;
	width: 100%;
	padding: 12px 16px;
	padding-right: 40px;
	border: 1px solid var(--line);
	border-radius: 14px;
	font-family: inherit;
	font-size: 15px;
	color: var(--ink);
	background-color: var(--bg);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.825L1.175 4l.825-.825L6 7.175 10 3.175l.825.825z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	background-size: 12px;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
}

#bbp-your-profile select:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(5, 14, 57, 0.1);
}

/* Password Field Section */
#bbp-your-profile #password {
	margin-bottom: 16px;
}

#bbp-your-profile .wp-generate-pw {
	padding: 8px 16px;
	background: var(--accent);
	color: var(--bg);
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
}

#bbp-your-profile .wp-generate-pw:hover {
	background: #0a1a4d;
}

/* Password Input Wrapper */
#bbp-your-profile .password-input-wrapper {
	display: block;
	margin-top: 12px;
}

#bbp-your-profile .password-button-wrapper {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}

#bbp-your-profile .password-button-wrapper button {
	padding: 6px 12px;
	background: var(--subtle-bg);
	color: var(--muted);
	border: 1px solid var(--line);
	border-radius: 6px;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s ease;
}

#bbp-your-profile .password-button-wrapper button:hover {
	background: var(--line);
	color: var(--ink);
}

/* Password Strength Indicator */
#bbp-your-profile #pass-strength-result {
	margin-top: 8px;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
}

/* Checkbox Fields */
#bbp-your-profile input[type="checkbox"] {
	width: 18px;
	height: 18px;
	margin-right: 8px;
	cursor: pointer;
	accent-color: var(--accent);
}

/* Helper Text / Hints */
#bbp-your-profile p.description,
#bbp-your-profile .description {
	font-size: 13px;
	color: var(--muted);
	margin-top: 6px;
	line-height: 1.5;
}

/* Submit Button Fieldset */
#bbp-your-profile fieldset.submit {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--line);
}

/* Hide legend for submit */
#bbp-your-profile fieldset.submit legend {
	display: none;
}

/* Submit Button */
#bbp-your-profile button[type="submit"],
#bbp-your-profile input[type="submit"],
#bbp-your-profile #bbp_user_edit_submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 14px 28px;
	background: var(--btn-primary);
	color: #fff;
	border: none;
	border-radius: 14px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

#bbp-your-profile button[type="submit"]:hover,
#bbp-your-profile input[type="submit"]:hover {
	background: var(--btn-primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

/* ==========================================================================
   USER PROFILE RESPONSIVE
   Mobile-friendly adjustments for profile pages.
   ========================================================================== */

@media (max-width: 900px) {
	/* Stack sidebar and content */
	#bbp-user-wrapper {
		grid-template-columns: 1fr;
		gap: 24px;
		max-width: 100%;
		overflow-x: hidden;
	}

	/* Center avatar on mobile */
	#bbp-single-user-details {
		flex-direction: column;
		align-items: center;
		text-align: center;
		max-width: 100%;
		overflow-x: hidden;
	}

	/* Horizontal scroll nav on tablet - constrain to viewport */
	#bbp-user-navigation {
		max-width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	#bbp-user-navigation ul {
		flex-direction: row;
		width: max-content;
		min-width: 100%;
	}

	#bbp-user-navigation li {
		border-bottom: none;
		border-right: 1px solid var(--line);
		flex-shrink: 0;
	}

	#bbp-user-navigation li:last-child {
		border-right: none;
	}

	#bbp-user-navigation li a {
		padding: 12px 14px;
		white-space: nowrap;
	}
}

@media (max-width: 640px) {
	/* Reduce avatar size */
	#bbp-user-avatar img.avatar {
		width: 96px;
		height: 96px;
	}

	/* Reduce padding on cards */
	#bbp-user-profile,
	.bbp-user-profile,
	#bbp-user-topics-started,
	#bbp-user-replies-created,
	#bbp-user-engagements,
	#bbp-user-favorites,
	#bbp-user-subscriptions {
		padding: 20px;
	}

	/* Smaller navigation text */
	#bbp-user-navigation li a {
		font-size: 13px;
		padding: 10px 12px;
	}

	/* Profile title sizing */
	#bbp-user-profile h2.entry-title {
		font-size: 22px;
	}

	/* Edit Profile Form Responsive */
	#bbp-your-profile {
		padding: 20px;
	}

	#bbp-your-profile h2.entry-title {
		font-size: 16px;
	}

	#bbp-your-profile button[type="submit"],
	#bbp-your-profile input[type="submit"] {
		width: 100%;
	}
}

/* ==========================================================================
   USER PROFILE ACCESSIBILITY
   ========================================================================== */

/* User navigation links */
#bbp-user-navigation li a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Row action buttons */
#bbp-user-favorites .bbp-row-actions a:focus-visible,
#bbp-user-subscriptions .bbp-row-actions a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	/* User avatar */
	#bbp-user-avatar img.avatar {
		transition: none;
	}

	#bbp-user-avatar img.avatar:hover {
		transform: none;
	}

	/* User navigation */
	#bbp-user-navigation li a {
		transition: none;
	}

	/* User section links */
	.bbp-user-section a {
		transition: none;
	}

	/* Row actions */
	#bbp-user-favorites .bbp-row-actions a,
	#bbp-user-subscriptions .bbp-row-actions a {
		transition: none;
	}

	#bbp-user-favorites .bbp-row-actions a:hover,
	#bbp-user-subscriptions .bbp-row-actions a:hover {
		transform: none;
	}

	/* Form elements */
	#bbp-your-profile input[type="text"],
	#bbp-your-profile input[type="email"],
	#bbp-your-profile input[type="url"],
	#bbp-your-profile input[type="password"],
	#bbp-your-profile textarea,
	#bbp-your-profile select {
		transition: none;
	}

	/* Generate password button */
	#bbp-your-profile .wp-generate-pw,
	#bbp-your-profile .password-button-wrapper button {
		transition: none;
	}

	/* Submit buttons */
	#bbp-your-profile button[type="submit"],
	#bbp-your-profile input[type="submit"] {
		transition: none;
	}

	#bbp-your-profile button[type="submit"]:hover,
	#bbp-your-profile input[type="submit"]:hover {
		transform: none;
	}
}
