/* ==========================================================================
   BSA member dashboard — the pages under /members/
   Markup reference: docs/shortcodes.md section 7 (and 10.4 for the
   design-system suggestions). No mockup: designed from the design
   system's components and tokens.
   Needs tokens.css, typography.css, buttons.css and forms.css first.
   Forms on these pages (Your Account, Renew, Payments) get their fields,
   errors and notices from forms.css; this file lays out the pages and
   styles the widgets that aren't forms.

   Divi classes this file relies on (set in the CSS Class field):
     bsa-dash-row      Theme Builder (members' sidebar template): the row
                       with the 1/4 sidebar column and 3/4 content column
     bsa-dash-alerts   the Code module holding [bsa_member_alerts]
                       (hidden when the member has no alerts)

   Each member page's own layout is one section and one row, with Code
   modules for the shortcodes and Text modules for h2 headings. That
   layout sits inside the template's Post Content module, so Divi gives
   it section padding and an 80% row a second time. Section 1 removes
   both, so the page's content sits flush in the 3/4 column.

   Specificity:
   - Divi's structure rules on Theme Builder pages are prefixed
     ".et-db #et-boc .et-l". The layout rules here use
     "body #et-boc .et-l .bsa-dash-row" plus classes, which outranks them
     in and out of media queries.
   - Lists, tables and links: ":not(#bsa)" (no element has that ID) adds
     an ID's weight, to beat Divi's ".et-l--body ul" and table rules.
   - Headings: typography.css styles them as "body.et-db #et-boc .et-l
     h2"; heading rules here use that prefix plus a class, with a plain
     fallback for pages without .et-db.
   - profile.css colours any .bsa-tier-* element (the tier label). The
     roster's sections carry those classes too, so section 9 resets them.

   Uses :has() to hide modules whose shortcode printed nothing.

   Breakpoints follow Divi: 980px (tablet) and 767px (phone).
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Page layout inside the template's content column
   -------------------------------------------------------------------------- */

/* The page's own sections and rows: no padding, full column width. */
body #et-boc .et-l .bsa-dash-row .et-l--post .et_pb_section:not(#bsa) {
	padding: 0;
	background-color: transparent;
}

body #et-boc .et-l .bsa-dash-row .et-l--post .et_pb_row:not(#bsa) {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
}

body #et-boc .et-l .bsa-dash-row .et-l--post .et_pb_row:not(#bsa) + .et_pb_row {
	margin-top: var(--space-12);
}

/* Modules: 32px apart, nothing after the last. */
body #et-boc .et-l .bsa-dash-row .et-l--post .et_pb_module:not(#bsa) {
	margin-bottom: var(--space-8);
}

body #et-boc .et-l .bsa-dash-row .et-l--post .et_pb_column .et_pb_module:last-child:not(#bsa) {
	margin-bottom: 0;
}

/* A Text module holding only an h2 is a section heading. After the first
   one, each starts a new section: a hairline and space above it. */
body #et-boc .et-l .bsa-dash-row .et-l--post .et_pb_text:has(> .et_pb_text_inner > h2:only-child):not(#bsa) {
	margin-bottom: var(--space-4);
}

body #et-boc .et-l .bsa-dash-row .et-l--post .et_pb_module + .et_pb_text:has(> .et_pb_text_inner > h2:only-child):not(#bsa) {
	margin-top: var(--space-4);
	padding-top: calc(var(--space-8) + var(--space-2));
	border-top: 1px solid var(--border);
}

body #et-boc .et-l .bsa-dash-row .et-l--post .et_pb_text > .et_pb_text_inner > h2:only-child {
	margin: 0;
}

/* A Code module whose shortcode printed nothing (no alerts, no welcome
   message) takes no space. */
body #et-boc .et-l .bsa-dash-row .et_pb_code:not(:has(.et_pb_code_inner > *)):not(#bsa),
body #et-boc .et-l .bsa-dash-row .bsa-dash-alerts:not(:has(.bsa-alerts)):not(#bsa) {
	display: none;
}

/* Widgets and forms keep a readable width; tables may use the column. */
.bsa-dash-row :is(.bsa-welcome, .bsa-status, .bsa-alerts, .bsa-email, .bsa-close, .bsa-payments-credit, .bsa-news-list) {
	max-width: 720px;
}


/* --------------------------------------------------------------------------
   2. Sidebar menu (the WordPress menu in the template's Sidebar module)
   -------------------------------------------------------------------------- */

/* No border on the menu itself (it would be only as tall as the menu).
   The divider is the content column's left edge instead (below), so it
   runs the full height of the page's content. */
body #et-boc .et-l .bsa-dash-row .et_pb_widget_area:not(#bsa) {
	padding-right: 0;
	border-right: 0;
}

@media (min-width: 981px) {
	body #et-boc .et-l .bsa-dash-row > .et_pb_column_3_4:not(#bsa) {
		padding-left: var(--space-12);
		border-left: 1px solid var(--border);
	}
}

.bsa-dash-row .et_pb_widget_area .et_pb_widget:not(#bsa) {
	float: none;
	width: 100%;
	margin: 0;
}

.bsa-dash-row .et_pb_widget_area ul.menu:not(#bsa) {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
	line-height: 24px;
}

.bsa-dash-row .et_pb_widget_area ul.menu > li:not(#bsa) {
	margin: 0;
	padding: 0;
}

.bsa-dash-row .et_pb_widget_area ul.menu > li > a:not(#bsa) {
	display: flex;
	align-items: center;
	min-height: 44px;
	box-sizing: border-box;
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-sm);
	color: var(--ink-muted);
	font-size: 1rem;
	font-weight: 400;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.bsa-dash-row .et_pb_widget_area ul.menu > li > a:not(#bsa):hover {
	background: var(--paper);
	color: var(--ink);
}

/* The page you're on: Blue, bold, a Blue bar on the left (not colour
   alone: the weight and the bar mark it too, and aria-current names it). */
.bsa-dash-row .et_pb_widget_area ul.menu > li.current-menu-item > a:not(#bsa),
.bsa-dash-row .et_pb_widget_area ul.menu > li > a[aria-current="page"]:not(#bsa) {
	background: var(--blue-50);
	box-shadow: inset 3px 0 0 var(--Blue);
	color: var(--Blue);
	font-weight: 600;
}


/* Desktop: the menu column stays on screen while the page scrolls, like
   the event details on a single event. Only when the window is tall
   enough to show the whole menu (about 400px); the WordPress admin bar,
   which staff see, is allowed for. It stops at the bottom of the row. */
@media (min-width: 981px) and (min-height: 600px) {
	body #et-boc .et-l .bsa-dash-row > .et_pb_column_1_4:not(#bsa) {
		position: sticky;
		top: calc(var(--space-6) + var(--wp-admin--admin-bar--height, 0px));
	}
}


/* --------------------------------------------------------------------------
   3. Alerts ([bsa_member_alerts], 7.3): Orange-50 panels with an Orange
   bar. The words say what's wrong; the colour only draws the eye.
   -------------------------------------------------------------------------- */

.bsa-alerts > ul:not(#bsa) {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bsa-alerts .bsa-alert:not(#bsa) {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	margin: 0;
	padding: var(--space-4) var(--space-6) var(--space-4) calc(var(--space-4) + var(--space-1));
	border-left: 4px solid var(--Orange);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	background: var(--orange-50);
	color: var(--ink);
	line-height: 28px;
}

.bsa-alert > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

/* The list of what a profile still needs */
.bsa-alert > ul:not(#bsa) {
	margin: 0;
	padding: 0 0 0 1.25em;
	list-style: disc;
	line-height: 28px;
}

.bsa-alert > ul > li:not(#bsa) {
	margin: 0;
	padding: 0;
}

/* Staff's note when they hid the profile: a plain quoted block, not the
   big pull-quote style typography.css gives blockquotes. */
body.et-db #et-boc .et-l .bsa-alert > blockquote,
.bsa-alert > blockquote:not(#bsa) {
	margin: var(--space-1) 0;
	padding: var(--space-3) var(--space-4);
	border: 0;
	border-left: 3px solid var(--border-strong);
	background: var(--surface);
	font-family: var(--font-sans);
	font-size: 1rem;
	font-style: normal;
	line-height: 26px;
	color: var(--ink);
}

.bsa-alert > blockquote > p:not(#bsa) {
	margin: 0;
	padding: 0;
	font: inherit;
}

.bsa-alert a:not(#bsa) {
	color: var(--blue-700);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.bsa-alert a:not(#bsa):hover {
	text-decoration-thickness: 2px;
}


/* --------------------------------------------------------------------------
   4. Welcome message ([bsa_dashboard_welcome], 7.1): a Paper panel.
   Staff write it, so it holds p, h3, ul, ol, strong, em and links.
   -------------------------------------------------------------------------- */

.bsa-welcome {
	padding: var(--space-6);
	border-radius: var(--radius-md);
	background: var(--paper);
	color: var(--ink);
}

.bsa-welcome > :first-child {
	margin-top: 0 !important;
}

.bsa-welcome > :last-child {
	margin-bottom: 0 !important;
	padding-bottom: 0 !important;
}

.bsa-welcome > p:not(#bsa) {
	margin: 0 0 var(--space-3);
	padding: 0;
}

.bsa-welcome > :is(ul, ol):not(#bsa) {
	margin: 0 0 var(--space-3);
	padding: 0 0 0 1.25em;
	line-height: 28px;
}

.bsa-welcome > ul:not(#bsa) { list-style: disc; }
.bsa-welcome > ol:not(#bsa) { list-style: decimal; }

/* Its headings, in the h4 style (sans 20/28, 600). */
body.et-db #et-boc .et-l .bsa-welcome > h3,
.bsa-welcome > h3:not(#bsa) {
	margin: var(--space-6) 0 var(--space-2);
	padding: 0;
	font-family: var(--font-sans);
	font-size: 1.25rem;
	line-height: 28px;
	font-weight: 600;
}

.bsa-welcome a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.bsa-welcome a:not(#bsa):hover {
	color: var(--blue-700);
	text-decoration-thickness: 2px;
}


/* --------------------------------------------------------------------------
   5. Membership status ([bsa_member_status], 7.2): a bordered card,
   label and value per row with hairlines, the Renew button below.
   -------------------------------------------------------------------------- */

.bsa-status {
	padding: var(--space-2) var(--space-6) var(--space-6);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
}

.bsa-status > dl {
	margin: 0;
}

.bsa-status > dl > div {
	display: grid;
	grid-template-columns: 11rem 1fr;
	gap: var(--space-1) var(--space-6);
	padding: var(--space-4) 0;
	border-bottom: 1px solid var(--border);
}

.bsa-status > dl > div > dt {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 28px;
	font-weight: 600;
	color: var(--ink-muted);
}

.bsa-status > dl > div > dd {
	margin: 0;
	line-height: 28px;
	color: var(--ink);
}

.bsa-status dd a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.bsa-status dd a:not(#bsa):hover {
	color: var(--blue-700);
	text-decoration-thickness: 2px;
}

/* Without the Renew button the last row needs no line under it. */
.bsa-status:not(:has(.bsa-status-renew)) > dl > div:last-child {
	border-bottom: 0;
	padding-bottom: var(--space-2);
}

.bsa-status > .bsa-status-renew:not(#bsa) {
	margin: var(--space-6) 0 0;
	padding: 0;
}


/* --------------------------------------------------------------------------
   6. Payments ([bsa_member_payments], 7.4): the credit line as a notice,
   then the history table. On narrow screens the table scrolls sideways
   inside its box rather than squeezing five columns.
   -------------------------------------------------------------------------- */

.bsa-payments > .bsa-payments-credit:not(#bsa) {
	margin: 0 0 var(--space-6);
	padding: var(--space-4) var(--space-6);
	border-radius: var(--radius-md);
	background: var(--blue-50);
	line-height: 28px;
}

.bsa-payments > .bsa-payments-none:not(#bsa) {
	margin: 0;
	padding: 0;
	color: var(--ink-muted);
}

.bsa-payments {
	overflow-x: auto;
}

.bsa-payments-table:not(#bsa) {
	width: 100%;
	min-width: 40rem;              /* below this it scrolls instead */
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

/* "Payment history": a small heading (h4 style) above the table. */
.bsa-payments-table:not(#bsa) > caption {
	caption-side: top;
	padding: 0 0 var(--space-3);
	text-align: left;
	font-size: 1.25rem;
	line-height: 28px;
	font-weight: 600;
	color: var(--ink);
}

.bsa-payments-table:not(#bsa) :is(th, td) {
	padding: var(--space-3) var(--space-4) var(--space-3) 0;
	border: 0;
	border-bottom: 1px solid var(--border);
	background: none;
	text-align: left;
	vertical-align: top;
	font-size: 1rem;
	line-height: 24px;
	color: var(--ink);
}

.bsa-payments-table:not(#bsa) thead th {
	padding-top: 0;
	border-bottom-color: var(--border-strong);
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--ink-muted);
}

/* Date, Amount and Receipt stay on one line; Amount lines up right. */
.bsa-payments-table:not(#bsa) :is(th, td):is(:first-child, :nth-child(4), :last-child) {
	white-space: nowrap;
}

.bsa-payments-table:not(#bsa) :is(th, td):nth-child(4) {
	text-align: right;
}

.bsa-payments-table:not(#bsa) :is(th, td):last-child {
	padding-right: 0;
	padding-left: var(--space-2);
}

.bsa-payments-table a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.bsa-payments-table a:not(#bsa):hover {
	color: var(--blue-700);
	text-decoration-thickness: 2px;
}


/* --------------------------------------------------------------------------
   7. Your Account: change email (7.6) and close account (7.8).
   The contact details and password forms need nothing beyond forms.css.
   -------------------------------------------------------------------------- */

/* 7.1 Change email: current address, the pending box (if any), the form */
.bsa-email {
	display: flex;
	flex-direction: column;
	gap: var(--space-6);
}

.bsa-email > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

.bsa-email-pending {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	padding: var(--space-6);
	border-radius: var(--radius-md);
	background: var(--paper);
}

.bsa-email-pending > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

/* Resend link and Cancel this change, side by side */
.bsa-form.bsa-email-pending-form {
	flex-direction: row;
	flex-wrap: wrap;
	gap: var(--space-3);
}

/* 7.2 Close account: a box with a danger-red border around the
   explanation and the form, so it reads as separate from the rest. */
.bsa-close {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	padding: var(--space-6);
	border: 1px solid var(--danger);
	border-radius: var(--radius-md);
}

.bsa-close > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

.bsa-close > .bsa-close-lead:not(#bsa) {
	font-weight: 600;
}

.bsa-close > .bsa-close-effects:not(#bsa) {
	margin: calc(var(--space-2) * -1) 0 0;
	padding: 0 0 0 1.25em;
	list-style: disc;
	line-height: 28px;
}

.bsa-close > .bsa-close-effects > li:not(#bsa) {
	margin: 0;
	padding: 0;
}

.bsa-close > .bsa-form {
	margin-top: var(--space-4);
}

/* The "Turn off automatic renewal" link in the opening line (not the
   error summary's links, which stay red). */
.bsa-close > p a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}


/* --------------------------------------------------------------------------
   8. Roster ([bsa_member_roster], 7.9): one section per tier, each a
   heading with the tier marker and a Name / Email table.
   -------------------------------------------------------------------------- */

.bsa-roster > .bsa-roster-count:not(#bsa) {
	margin: 0;
	padding: 0;
	font-size: 0.9375rem;
	line-height: 24px;
	color: var(--ink-muted);
}

/* profile.css colours any .bsa-tier-* element: not the whole section. */
.bsa-roster .bsa-roster-tier:not(#bsa) {
	display: block;
	margin: var(--space-8) 0 0;
	color: var(--ink);
}

/* The tier's heading at the h3 size (25/32), with the design system's
   tier marker: a small coloured block before it. */
body.et-db #et-boc .et-l .bsa-roster-tier > h2,
.bsa-roster-tier > h2:not(#bsa) {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	margin: 0 0 var(--space-3);
	padding: 0;
	font-size: 1.5625rem;
	line-height: 32px;
}

.bsa-roster-tier > h2::before {
	content: "";
	flex: none;
	width: 10px;
	height: 16px;
	background: var(--border-strong);
}

.bsa-roster-tier.bsa-tier-distinguished > h2::before { background: var(--Orange); }
.bsa-roster-tier.bsa-tier-exhibiting > h2::before    { background: var(--Blue); }
.bsa-roster-tier.bsa-tier-associate > h2::before     { background: var(--Green); }
.bsa-roster-tier.bsa-tier-student > h2::before       { background: var(--border-strong); }

.bsa-roster-table:not(#bsa) {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	table-layout: fixed;
}

.bsa-roster-table:not(#bsa) :is(th, td) {
	padding: var(--space-2) var(--space-4) var(--space-2) 0;
	border: 0;
	border-bottom: 1px solid var(--border);
	background: none;
	text-align: left;
	vertical-align: top;
	font-size: 1rem;
	line-height: 24px;
	color: var(--ink);
	overflow-wrap: anywhere;       /* long email addresses */
}

.bsa-roster-table:not(#bsa) thead th {
	border-bottom-color: var(--border-strong);
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--ink-muted);
}

/* Linked names (public profiles) and plain ones sit side by side, so
   links are underlined, not just coloured. */
.bsa-roster-table a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.bsa-roster-table a:not(#bsa):hover {
	color: var(--blue-700);
	text-decoration-thickness: 2px;
}


/* --------------------------------------------------------------------------
   9. Announcements ([bsa_member_news], 7.10): a list with dividers.
   -------------------------------------------------------------------------- */

.bsa-news-list:not(#bsa) {
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--border);
}

.bsa-news-list > .bsa-news-item:not(#bsa) {
	margin: 0;
	padding: var(--space-6) 0;
	border-bottom: 1px solid var(--border);
}

/* Titles at the h3 size (25/32). */
body.et-db #et-boc .et-l .bsa-news-item > .bsa-news-title,
.bsa-news-item > .bsa-news-title:not(#bsa) {
	margin: 0 0 var(--space-1);
	padding: 0;
	font-size: 1.5625rem;
	line-height: 32px;
}

.bsa-news-title > a:not(#bsa) {
	color: var(--ink);
	text-decoration: underline;
	text-decoration-color: var(--border-strong);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

.bsa-news-title > a:not(#bsa):hover {
	color: var(--Blue);
	text-decoration-color: var(--Blue);
	text-decoration-thickness: 2px;
}

.bsa-news-item > .bsa-news-date:not(#bsa) {
	margin: 0;
	padding: 0;
	font-size: 0.9375rem;
	line-height: 24px;
	color: var(--ink-muted);
}

.bsa-news-item > .bsa-news-excerpt:not(#bsa) {
	margin: var(--space-3) 0 0;
	padding: 0;
}

/* The lapsed and empty messages' renew link */
:is(.bsa-news-lapsed, .bsa-news-empty) a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}


/* --------------------------------------------------------------------------
   10. Tablet (980px and narrower): Divi stacks the sidebar above the
   content. The menu becomes a wrapped row of links instead of a tall
   list, with a hairline under it.
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
	body #et-boc .et-l .bsa-dash-row .et_pb_widget_area:not(#bsa) {
		padding: 0 0 var(--space-6);
		border-right: 0;
		border-bottom: 1px solid var(--border);
	}

	.bsa-dash-row .et_pb_widget_area ul.menu:not(#bsa) {
		flex-direction: row;
		flex-wrap: wrap;
		gap: var(--space-2);
	}

	.bsa-dash-row .et_pb_widget_area ul.menu > li > a:not(#bsa) {
		padding: var(--space-2) var(--space-4);
		border: 1px solid var(--border);
		background: var(--surface);
	}

	.bsa-dash-row .et_pb_widget_area ul.menu > li.current-menu-item > a:not(#bsa),
	.bsa-dash-row .et_pb_widget_area ul.menu > li > a[aria-current="page"]:not(#bsa) {
		border-color: var(--Blue);
		box-shadow: none;
	}
}


/* --------------------------------------------------------------------------
   11. Phone (767px and narrower)
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.bsa-welcome,
	.bsa-email-pending,
	.bsa-close {
		padding: var(--space-4);
	}

	.bsa-status {
		padding: 0 var(--space-4) var(--space-4);
	}

	/* Status rows: label over value */
	.bsa-status > dl > div {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.bsa-alerts .bsa-alert:not(#bsa) {
		padding: var(--space-3) var(--space-4);
	}
}
