/**
 * bbPress Core Styles
 *
 * Core layout and foundational styles for bbPress forums: variables, page wrapper,
 * hero sections, breadcrumbs, container, pagination, notices, and login form.
 *
 * @package AgenticWP
 */

/*
 * CSS VARIABLES
 * Additional color tokens for bbPress (extends base.css palette).
 * These variables enable consistent theming across all forum components.
 */
:root {
	/* Button Colors */
	--btn-primary: #0EA5E9;
	--btn-primary-hover: var(--accent);

	/* Backgrounds */
	--subtle-bg: #f8fafc;

	/* Code Blocks */
	--code-bg: #1e293b;
	--code-text: #e2e8f0;

	/* Status Colors - Error */
	--error-bg: #fef2f2;
	--error-border: #fecaca;
	--error-text: #dc2626;

	/* Status Colors - Success */
	--success-bg: #f0fdf4;
	--success-border: #bbf7d0;
	--success-text: #16a34a;
}

/* ==========================================================================
   BASE LAYOUT
   Styles for forum wrapper, page structure, and hero sections.
   ========================================================================== */

/* Forum Page Wrapper
   Provides consistent spacing below header and above footer */
.bbpress-page-wrapper {
	padding: 100px 0 80px;
}

/* Forum Hero Section
   Hero-style header for forum archive matching blog pattern */
.forum-hero {
	padding: 100px 0 60px;
	background: linear-gradient(
		to bottom,
		#fefcfb 0%,
		var(--bg) 100%
	);
	text-align: center;
}

.forum-hero-content {
	max-width: 600px;
	margin: 0 auto;
	padding: 0 20px;
}

.forum-hero-title {
	font-size: clamp(32px, 5vw, 48px);
	font-weight: 700;
	color: var(--accent);
	line-height: 1.1;
	margin: 0 0 16px;
	letter-spacing: -0.02em;
}

.forum-hero-description {
	font-size: 18px;
	line-height: 1.6;
	color: var(--muted);
	margin: 0;
}

/* Forum Hero Breadcrumb */
.forum-hero-breadcrumb {
	margin-bottom: 12px;
}

.forum-hero-breadcrumb .bbp-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px;
	font-size: 14px;
	color: var(--muted);
	margin: 0;
	padding: 0;
	list-style: none;
}

.forum-hero-breadcrumb .bbp-breadcrumb a {
	color: var(--muted);
	text-decoration: none;
	transition: color 0.2s ease;
}

.forum-hero-breadcrumb .bbp-breadcrumb a:hover {
	color: var(--accent);
}

.forum-hero-breadcrumb .bbp-breadcrumb-sep {
	color: var(--line);
}

.forum-hero-breadcrumb .bbp-breadcrumb-current {
	color: var(--ink);
	font-weight: 500;
}

/* Forum Hero Variants
   --full: Forum archive - large centered hero
   --compact: Single forum - medium hero with breadcrumb
   --minimal: Single topic/search - small header with breadcrumb */

/* Full Hero (forum archive) - default styling, largest */
.forum-hero--full {
	padding: 100px 0 60px;
}

.forum-hero--full .forum-hero-title {
	font-size: clamp(32px, 5vw, 48px);
	margin-bottom: 16px;
}

/* Compact Hero (single forum) - medium size */
.forum-hero--compact {
	padding: 80px 0 40px;
}

.forum-hero--compact .forum-hero-content {
	max-width: 800px;
}

.forum-hero--compact .forum-hero-title {
	font-size: clamp(28px, 4vw, 36px);
	margin-bottom: 12px;
}

.forum-hero--compact .forum-hero-description {
	font-size: 16px;
}

/* Minimal Hero (single topic, search, tags) - small header */
.forum-hero--minimal {
	padding: 70px 0 24px;
	background: linear-gradient(
		to bottom,
		#fefcfb 0%,
		var(--bg) 100%
	);
}

.forum-hero--minimal .forum-hero-content {
	max-width: 900px;
}

.forum-hero--minimal .forum-hero-title {
	font-size: clamp(22px, 3vw, 28px);
	margin-bottom: 0;
	line-height: 1.3;
}

.forum-hero--minimal .forum-hero-breadcrumb {
	margin-bottom: 8px;
}

/* Main bbPress Container
   Constrains forum content to match site container width */
#bbpress-forums {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 16px;
	font-size: 16px;
	line-height: 1.6;
	color: var(--ink);
}

/* Remove default bbPress table styling */
#bbpress-forums .bbp-body,
#bbpress-forums .bbp-header,
#bbpress-forums .bbp-footer {
	background: transparent;
	border: none;
}

/* Breadcrumb Navigation
   Consistent breadcrumb styling for forum navigation */
.bbp-breadcrumb {
	font-size: 14px;
	color: var(--muted);
	margin-bottom: 24px;
	padding: 0;
}

.bbp-breadcrumb a {
	color: var(--accent);
	text-decoration: none;
	transition: color 0.2s ease;
}

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

.bbp-breadcrumb .bbp-breadcrumb-sep {
	margin: 0 8px;
	color: var(--muted);
	opacity: 0.5;
}

.bbp-breadcrumb .bbp-breadcrumb-current {
	color: var(--ink);
	font-weight: 500;
}

/* Hide default content breadcrumb on pages where hero shows breadcrumb.
   This prevents duplicate breadcrumbs - the hero shows one, content shows another.
   Uses body classes added by bbPress for targeting. */
.single-forum .forum-content > #bbpress-forums > .bbp-breadcrumb,
.single-topic .forum-content > #bbpress-forums > .bbp-breadcrumb,
.bbp-search-results .forum-content > #bbpress-forums > .bbp-breadcrumb,
.topic-tag .forum-content > #bbpress-forums > .bbp-breadcrumb {
	display: none;
}

/* Forum Content Section
   Container for forum lists with consistent spacing */
.forum-content {
	padding: 40px 0 80px;
}

/* ==========================================================================
   PAGINATION
   Pagination styling for topic lists.
   ========================================================================== */

/* Pagination Container */
.bbp-pagination {
	padding: 0 0 40px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

/* Pagination Count Text */
.bbp-pagination-count {
	font-size: 14px;
	color: var(--muted);
}

/* Pagination Links Container */
.bbp-pagination-links {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
}

/* Pagination Link Items */
.bbp-pagination-links a,
.bbp-pagination-links span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 16px;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	transition: all 0.2s ease;
}

/* Default Link State */
.bbp-pagination-links a {
	color: var(--ink);
	background: var(--bg);
	border: 1px solid var(--line);
}

/* Link Hover State */
.bbp-pagination-links a:hover {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--bg);
}

/* Current Page */
.bbp-pagination-links span.current {
	background: var(--accent);
	color: var(--bg);
	border: 1px solid var(--accent);
}

/* Dots/Ellipsis */
.bbp-pagination-links span.dots {
	border: none;
	background: transparent;
	color: var(--muted);
	min-width: auto;
	padding: 0 8px;
}

/* Prev/Next Links */
.bbp-pagination-links a.prev,
.bbp-pagination-links a.next {
	gap: 8px;
}

/* ==========================================================================
   EMPTY STATES & NOTICES
   Styling for when there are no replies, topic is closed, etc.
   ========================================================================== */

/* No Replies Notice */
.bbp-template-notice,
div.bbp-template-notice {
	padding: 20px 24px;
	background: var(--subtle-bg);
	border-radius: 12px;
	font-size: 15px;
	color: var(--muted);
	margin-bottom: 24px;
}

.bbp-template-notice p {
	margin: 0;
}

/* Info Notice */
.bbp-template-notice.info {
	background: #eff6ff;
	color: #1e40af;
	border: 1px solid #bfdbfe;
}

/* Warning Notice (e.g., topic closed) */
.bbp-template-notice.warning,
.bbp-template-notice.important {
	background: #fffbeb;
	color: #92400e;
	border: 1px solid #fcd34d;
}

/* Error Notice */
.bbp-template-notice.error {
	background: var(--error-bg);
	color: var(--error-text);
	border: 1px solid var(--error-border);
}

/* Success Notice */
.bbp-template-notice.success {
	background: var(--success-bg);
	color: var(--success-text);
	border: 1px solid var(--success-border);
}

/* Author Link in Template Notice
   Inline avatar and name for forum info messages */
.bbp-template-notice .bbp-author-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	vertical-align: middle;
	color: var(--accent);
	text-decoration: none;
}

.bbp-template-notice .bbp-author-link:hover {
	color: var(--ink);
}

.bbp-template-notice .bbp-author-avatar {
	display: inline-flex;
	align-items: center;
}

.bbp-template-notice .bbp-author-avatar img {
	border-radius: 50%;
	width: 20px;
	height: 20px;
	vertical-align: middle;
}

.bbp-template-notice .bbp-author-name {
	font-weight: 500;
}

/* ==========================================================================
   LOGIN FORM
   Inline login form shown to logged-out users on forum pages.
   ========================================================================== */

/* Login Form Container
   Card appearance matching other forum components */
#bbpress-forums fieldset.bbp-form:has(.bbp-username) {
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 32px;
	margin-top: 0;
}

/* Login Form Legend (Title) */
#bbpress-forums fieldset.bbp-form:has(.bbp-username) legend {
	font-size: 20px;
	font-weight: 600;
	color: var(--ink);
	padding: 0;
	margin: 0 0 24px;
	width: 100%;
	float: none;
}

/* Login Form Field Containers */
#bbpress-forums .bbp-username,
#bbpress-forums .bbp-password {
	margin-bottom: 20px;
}

/* Login Form Labels */
#bbpress-forums .bbp-username label,
#bbpress-forums .bbp-password label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
	line-height: 1.4;
	margin-bottom: 6px;
}

/* Login Form Inputs */
#bbpress-forums .bbp-username input[type="text"],
#bbpress-forums .bbp-password input[type="password"] {
	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);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

/* Login Form Input Focus State */
#bbpress-forums .bbp-username input[type="text"]:focus,
#bbpress-forums .bbp-password input[type="password"]:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(5, 14, 57, 0.1);
}

/* Remember Me Container */
#bbpress-forums .bbp-remember-me {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 24px;
}

/* Remember Me Checkbox */
#bbpress-forums .bbp-remember-me input[type="checkbox"] {
	width: 18px;
	height: 18px;
	margin: 0;
	cursor: pointer;
	accent-color: var(--accent);
	flex-shrink: 0;
}

/* Remember Me Label */
#bbpress-forums .bbp-remember-me label {
	font-size: 14px;
	font-weight: 400;
	color: var(--ink);
	cursor: pointer;
	margin: 0;
}

/* Login Submit Button */
#bbpress-forums fieldset.bbp-form .bbp-submit-wrapper button.user-submit,
#bbpress-forums fieldset.bbp-form button.user-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	background: var(--btn-primary);
	color: #fff;
	border: 1px solid var(--btn-primary);
	border-radius: 14px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	cursor: pointer;
	transition: all 0.2s ease;
}

/* Login Submit Button Hover */
#bbpress-forums fieldset.bbp-form .bbp-submit-wrapper button.user-submit:hover,
#bbpress-forums fieldset.bbp-form button.user-submit:hover {
	background: var(--btn-primary-hover);
	border-color: var(--btn-primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

/* Login Submit Button Active */
#bbpress-forums fieldset.bbp-form .bbp-submit-wrapper button.user-submit:active,
#bbpress-forums fieldset.bbp-form button.user-submit:active {
	transform: translateY(0);
	box-shadow: none;
}

/* Login Submit Button Focus */
#bbpress-forums fieldset.bbp-form .bbp-submit-wrapper button.user-submit:focus,
#bbpress-forums fieldset.bbp-form button.user-submit:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
}

/* Login Form Submit Wrapper */
#bbpress-forums fieldset.bbp-form:has(.bbp-username) .bbp-submit-wrapper {
	margin-top: 0;
}

/* "Must be logged in" Notice Spacing
   Adds visual separation between notice and login form */
#bbpress-forums .bbp-template-notice + fieldset.bbp-form {
	margin-top: 24px;
}

/* Notice list styling within login context */
#bbpress-forums .bbp-template-notice ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

#bbpress-forums .bbp-template-notice li {
	margin: 0;
}

/* ==========================================================================
   LOGIN FORM RESPONSIVE
   Mobile adjustments for login form.
   ========================================================================== */

@media (max-width: 640px) {
	/* Reduce padding on mobile */
	#bbpress-forums fieldset.bbp-form:has(.bbp-username) {
		padding: 24px 20px;
	}

	/* Full-width login button on mobile */
	#bbpress-forums fieldset.bbp-form .bbp-submit-wrapper button.user-submit,
	#bbpress-forums fieldset.bbp-form button.user-submit {
		width: 100%;
	}
}

/* ==========================================================================
   CORE RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 1100px) {
	/* Adjust main container for full-width */
	#bbpress-forums {
		max-width: 100%;
		padding: 0 24px;
	}

	/* Forum hero adjustments */
	.forum-hero {
		padding: 90px 0 50px;
	}

	.forum-hero--compact {
		padding: 75px 0 35px;
	}

	.forum-hero--minimal {
		padding: 65px 0 20px;
	}
}

@media (max-width: 900px) {
	/* Forum Hero */
	.forum-hero {
		padding: 80px 0 48px;
	}

	.forum-hero-title {
		font-size: clamp(28px, 5vw, 40px);
	}

	.forum-hero--compact {
		padding: 70px 0 32px;
	}

	.forum-hero--compact .forum-hero-title {
		font-size: clamp(24px, 4vw, 32px);
	}

	.forum-hero--minimal {
		padding: 60px 0 18px;
	}

	.forum-hero--minimal .forum-hero-title {
		font-size: clamp(20px, 3vw, 24px);
	}

	.forum-hero-breadcrumb .bbp-breadcrumb {
		font-size: 13px;
	}

	/* Forum content section */
	.forum-content {
		padding: 32px 0 60px;
	}

	/* Pagination adjustments */
	.bbp-pagination {
		padding: 0 0 32px;
	}

	/* Page wrapper */
	.bbpress-page-wrapper {
		padding: 80px 0 60px;
	}
}

@media (max-width: 640px) {
	/* Forum Hero */
	.forum-hero {
		padding: 60px 0 40px;
	}

	.forum-hero-title {
		font-size: clamp(28px, 8vw, 36px);
	}

	.forum-hero-description {
		font-size: 16px;
	}

	.forum-hero--compact {
		padding: 55px 0 28px;
	}

	.forum-hero--compact .forum-hero-title {
		font-size: clamp(22px, 6vw, 28px);
	}

	.forum-hero--minimal {
		padding: 50px 0 16px;
	}

	.forum-hero--minimal .forum-hero-title {
		font-size: clamp(18px, 5vw, 22px);
	}

	.forum-hero-breadcrumb .bbp-breadcrumb {
		font-size: 12px;
		gap: 3px;
	}

	/* Forum content section */
	.forum-content {
		padding: 24px 0 48px;
	}

	/* Container padding - increased from 16px to 20px for better mobile breathing room */
	#bbpress-forums {
		padding: 0 20px;
	}

	/* Page wrapper */
	.bbpress-page-wrapper {
		padding: 60px 0 48px;
	}

	/* Pagination mobile */
	.bbp-pagination {
		padding: 0 0 24px;
		gap: 12px;
	}

	.bbp-pagination-count {
		font-size: 13px;
	}

	.bbp-pagination-links {
		flex-wrap: wrap;
	}

	.bbp-pagination-links a,
	.bbp-pagination-links span {
		min-width: 40px;
		height: 40px;
		padding: 0 12px;
		font-size: 14px;
	}

	/* Breadcrumbs */
	.bbp-breadcrumb {
		font-size: 13px;
		margin-bottom: 20px;
	}

	/* Template notices */
	.bbp-template-notice,
	div.bbp-template-notice {
		padding: 16px 20px;
		font-size: 14px;
		border-radius: 8px;
	}
}

/* ==========================================================================
   ACCESSIBILITY: FOCUS-VISIBLE STATES
   Keyboard navigation focus indicators for core elements.
   ========================================================================== */

/* Pagination links */
.bbp-pagination-links a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Breadcrumb links */
.bbp-breadcrumb a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ==========================================================================
   ACCESSIBILITY: PREFERS-REDUCED-MOTION
   Disable animations and transitions for users who prefer reduced motion.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	/* Pagination links */
	.bbp-pagination-links a {
		transition: none;
	}

	/* Breadcrumb links */
	.bbp-breadcrumb a {
		transition: none;
	}
}

