/*
 * MECUL Community: Communities page, thread form and thread view.
 * Inherits fonts and link colors from the theme. Adjust the variables to match the site.
 */

.mecul-cm,
.mecul-cm-topic,
.mecul-cm-form-wrap,
.mecul-cm-signin {
	--mecul-cm-accent: #003a70;
	--mecul-cm-border: #dcdfe3;
	--mecul-cm-muted: #5f6670;
	--mecul-cm-surface: #f6f7f9;
	--mecul-cm-radius: 6px;
}

/* Sign-in prompt -------------------------------------------------------- */

.mecul-cm-signin {
	max-width: 520px;
	margin: 2em auto;
	padding: 2em;
	text-align: center;
	border: 1px solid var(--mecul-cm-border);
	border-radius: var(--mecul-cm-radius);
	background: var(--mecul-cm-surface);
}

/* Buttons --------------------------------------------------------------- */

.mecul-cm {
	--mecul-cm-control-height: 44px;
	--mecul-cm-control-font: 16px; /* 16px+ stops iOS zooming into fields */
	--mecul-cm-custom-font: 1.2em;
}

.mecul-cm-button,
.mecul-cm .mecul-cm-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	height: var(--mecul-cm-control-height, 44px);
	margin: 0;
	padding: 0 18px;
	border: 1px solid var(--mecul-cm-accent);
	border-radius: var(--mecul-cm-radius);
	background: #fff;
	color: var(--mecul-cm-accent);
	font-family: inherit;
	font-size: var(--mecul-cm-control-font, 16px);
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.mecul-cm-button:hover,
.mecul-cm-button:focus-visible {
	background: var(--mecul-cm-surface);
}

.mecul-cm-button--primary,
.mecul-cm .mecul-cm-button--primary {
	background: var(--mecul-cm-accent);
	color: #fff;
}

.mecul-cm-button--primary:hover,
.mecul-cm-button--primary:focus-visible {
	background: var(--mecul-cm-accent);
	color: #fff;
	filter: brightness(1.15);
}

/* Toolbar: row 1 actions, row 2 search ---------------------------------- */

.mecul-cm-toolbar {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 1.5em;
}

.mecul-cm-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.mecul-cm-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

/* Every control in the search row: same height and font size. */
.mecul-cm-filters > input[type="search"],
.mecul-cm-filters > select,
.mecul-cm-filters > button {
	box-sizing: border-box;
	height: var(--mecul-cm-control-height);
	margin: 0;
	font-family: inherit;
	font-size: var(--mecul-cm-control-font);
	line-height: normal;
	vertical-align: middle;
}

.mecul-cm-filters > input[type="search"],
.mecul-cm-filters > select {
	padding: 0 12px;
	border: 1px solid var(--mecul-cm-border);
	border-radius: var(--mecul-cm-radius);
	background-color: #fff;
	color: inherit;
}

.mecul-cm-filters > input[type="search"] {
	flex: 1 1 240px;
	min-width: 0;
	-webkit-appearance: none;
	appearance: none;
}

.mecul-cm-filters > select {
	flex: 0 1 240px;
	min-width: 160px;
	padding-right: 32px;
}

.mecul-cm-filters__clear {
	display: inline-flex;
	align-items: center;
	height: var(--mecul-cm-control-height);
	font-size: var(--mecul-cm-control-font);
}

@media (max-width: 600px) {
	/* Search button and field share a row; categories get their own. */
	.mecul-cm-filters > input[type="search"] {
		flex: 1 1 0;
	}
	.mecul-cm-filters > select {
		flex: 1 1 100%;
	}
}

/* Form fields: new thread, edit, reply ---------------------------------- */

.mecul-cm-form input[type="text"],
.mecul-cm-form select,
.mecul-cm-form textarea {
	padding: 9px 12px;
	border: 1px solid var(--mecul-cm-border);
	border-radius: var(--mecul-cm-radius);
	background: #fff;
	font-family: inherit;
	font-size: 16px; /* 16px+ stops iOS zooming into the field */
	/* Explicit: bbPress gives the editor wrapper line-height: 0, which made lines overlap. */
	line-height: 1.5;
	color: inherit;
}

#bbpress-forums .mecul-cm-form textarea,
#bbpress-forums .mecul-cm-form .wp-editor-area {
	line-height: 1.5;
	font-size: 16px;
	white-space: pre-wrap;
}

.mecul-cm-form button[type="submit"] {
	cursor: pointer;
}

/* Thread list ------------------------------------------------------------ */

.mecul-cm-count,
.mecul-cm-empty {
	color: var(--mecul-cm-muted);
}

.mecul-cm-threads {
	list-style: none;
	margin: 0 0 1.5em;
	padding: 0 !important;
	border-top: 1px solid var(--mecul-cm-border);
}

.mecul-cm-thread {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
	justify-content: space-between;
	padding: 16px 0;
	border-bottom: 1px solid var(--mecul-cm-border);
}

.mecul-cm-thread__main {
	flex: 1 1 360px;
	min-width: 0;
}

.mecul-cm-thread__title {
	margin: 0 0 4px;
	padding: 0;
	font-size: 1.15em;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.mecul-cm-thread__meta,
.mecul-cm-thread__stats {
	margin: 0;
	padding: 0;
	font-size: 0.9em;
	color: var(--mecul-cm-muted);
}

.mecul-cm-thread__stats {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	text-align: right;
	flex: 0 0 auto;
}

.mecul-cm-thread__replies {
	font-weight: 600;
	color: inherit;
}

.mecul-cm-sep {
	margin: 0 0.4em;
}

.mecul-cm-thread__category {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--mecul-cm-surface);
	border: 1px solid var(--mecul-cm-border);
	font-size: 0.85em;
	text-decoration: none;
}

.mecul-cm-topic__header .mecul-cm-thread__category {font-size:1.2em;}

.mecul-cm-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 8px;
	border-radius: 999px;
	background: #eef0f2;
	color: var(--mecul-cm-muted);
	font-size: 0.7em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	vertical-align: middle;
}

@media (max-width: 600px) {
	.mecul-cm-thread__stats {
		align-items: flex-start;
		text-align: left;
	}
}

/* Forum dashboard ------------------------------------------------------- */

.mecul-cm-dashboard__hello {
	margin: 0;
	padding: 0;
}

.mecul-cm-dashboard .mecul-cm-toolbar {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
}

.mecul-cm-dashboard__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.mecul-cm-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 1em;
	border-bottom: 1px solid var(--mecul-cm-border);
}

.mecul-cm-tab {
	padding: 10px 16px;
	margin-bottom: -1px;
	border: 1px solid transparent;
	border-radius: var(--mecul-cm-radius) var(--mecul-cm-radius) 0 0;
	color: var(--mecul-cm-muted);
	text-decoration: none;
	font-weight: 600;
}

.mecul-cm-tab:hover {
	color: var(--mecul-cm-accent);
}

.mecul-cm-tab.is-active {
	border-color: var(--mecul-cm-border);
	border-bottom-color: #fff;
	background: #fff;
	color: var(--mecul-cm-accent);
}

.mecul-cm-item-actions {
	display: flex;
	gap: 12px;
	margin-top: 4px;
	font-weight: 600;
}

.mecul-cm-reply-item__excerpt {
	margin: 4px 0 0;
	padding: 0;
	overflow-wrap: anywhere;
}

.mecul-cm-badge.is-pending {
	background: #fff4d6;
	color: #7a5600;
}

.mecul-cm-thread.is-pending {
	background: #fffcf2;
}

/* Notification settings (forum dashboard) ------------------------------- */

.mecul-cm-notifications {
	margin-top: 2.5em;
	padding-top: 1.5em;
	border-top: 1px solid var(--mecul-cm-border);
	scroll-margin-top: 120px; /* Clear sticky headers when jumping to #notifications */
}

.mecul-cm-notifications__title {
	margin: 0 0 0.5em;
	padding: 0;
	font-size: 1.3em;
}

.mecul-cm-toggle {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin: 0 0 12px;
	padding: 12px 16px;
	border: 1px solid var(--mecul-cm-border);
	border-radius: var(--mecul-cm-radius);
	cursor: pointer;
}

.mecul-cm-toggle input[type="checkbox"] {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	cursor: pointer;
}

.mecul-cm-toggle__desc {
	display: block;
	margin-top: 2px;
	font-size: 0.9em;
	color: var(--mecul-cm-muted);
}

.mecul-cm-notice {
	margin: 0 0 1em;
	padding: 10px 14px;
	border-left: 4px solid #2e7d32;
	border-radius: var(--mecul-cm-radius);
	background: #edf7ee;
}

.mecul-cm-notice.is-warning {
	border-left-color: #b26a00;
	background: #fff4d6;
}

/* Pagination ------------------------------------------------------------- */

.mecul-cm-pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0 !important;
}

.mecul-cm-pagination .page-numbers {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid var(--mecul-cm-border);
	border-radius: var(--mecul-cm-radius);
	text-decoration: none;
}

.mecul-cm-pagination .page-numbers.current {
	background: var(--mecul-cm-accent);
	border-color: var(--mecul-cm-accent);
	color: #fff;
}

/* Thread view ------------------------------------------------------------ */

.mecul-cm-topic__header {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: 1.5em;
}

.mecul-cm-back {
	margin: 0 0 1em;
	font-size: 1.2em;
}

.mecul-cm-topic__header .mecul-cm-back {
	margin: 0 auto 0 0;
}

#bbpress-forums .mecul-cm-replies {
	border: 0;
	margin-bottom: 2em;
}

#bbpress-forums .mecul-cm-replies .bbp-body > div,
#bbpress-forums .mecul-cm-replies .bbp-reply-header {
	border-left: 0;
	border-right: 0;
}

/* Forms: new thread, edit thread, reply --------------------------------- */

.mecul-cm-form fieldset.bbp-form {
	margin: 0;
	padding: 0;
	border: 0;
}

.mecul-cm-form legend {
	margin-bottom: 0.75em;
	padding: 0;
	font-size: 1.2em;
	font-weight: 600;
}

.mecul-cm-field {
	margin: 0 0 1.25em;
}

.mecul-cm-field > label {
	display: block;
	margin-bottom: 4px;
	font-weight: 600;
}

.mecul-cm-form input[type="text"],
.mecul-cm-form select,
.mecul-cm-form textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.mecul-cm-form textarea {
	min-height: 180px;
}

.mecul-cm-hint {
	margin: 6px 0 0;
	font-size: 0.85em;
	color: var(--mecul-cm-muted);
}

.mecul-cm-moderation {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0 16px;
	padding: 12px 16px 0;
	margin-bottom: 1.25em;
	border-radius: var(--mecul-cm-radius);
	background: var(--mecul-cm-surface);
}

.mecul-cm-form .bbp-submit-wrapper {
	float: none;
	text-align: left;
}

/* Visually hidden labels (Divi already defines this class; kept for safety) */
.mecul-cm .screen-reader-text,
.mecul-cm-form .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Custom tweaks */
.bbp-reply-content * {font-size: 16px;}
#bbpress-forums textarea#bbp_topic_content,
#bbpress-forums textarea#bbp_reply_content {
	font-size: 16px !important;
	line-height: 1.5 !important;
}

#new-post legend, #new-post label {font-size:16px; letter-spacing:0.3px;color:#00706E !important; padding-bottom:4px;}
#new-post #bbp_forum_id {margin-left:4px;}
#new-post select, #new-post input {padding: 3px 8px !important;}
.bbp-author-role {display:none !important;}