/**
 * Public organization directory.
 *
 * Colours are the set already contrast-checked for the assessments grid, so the
 * two tables look like one component and neither needs re-measuring: #1d4e73 on
 * white is 8.79:1, the #6f7d88 control borders are 4.23:1 against the 3:1 that
 * WCAG 1.4.11 asks of a component boundary, and the #6b6f70 muted text is
 * 5.08:1.
 *
 * Only one column of data, so there is no horizontal scroll to manage here -
 * the work is in the controls above the table, which stack rather than crowd.
 */

.rr-orgs {
	margin: 0 0 24px;
	font-size: 14px;
}

/* --- controls ----------------------------------------------------------- */

.rr-orgs__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	margin: 0 0 12px;
}

.rr-orgs__search {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
}

.rr-orgs__search label {
	margin: 0;
	font-weight: 600;
	color: #2b2f30;
}

.rr-orgs__search input[type="search"] {
	min-height: 40px;
	padding: 6px 10px;
	border: 1px solid #6f7d88;
	border-radius: 3px;
	background: #fff;
	color: #2b2f30;
	font-size: 14px;
}

.rr-orgs__go {
	min-height: 40px;
	padding: 7px 16px;
	border: 1px solid #a4343a;
	border-radius: 3px;
	background: #a4343a;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}

.rr-orgs__go:hover {
	background: #8c2c31;
	border-color: #8c2c31;
}

.rr-orgs__count {
	margin: 0;
	color: #6b6f70;
}

/* --- table -------------------------------------------------------------- */

.rr-orgs__table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	background: #fff;
}

.rr-orgs__table thead th {
	padding: 0;
	background: #f4f5f5;
	border-bottom: 2px solid #d4d7d8;
	text-align: left;
}

.rr-orgs__table thead th button {
	display: flex;
	align-items: center;
	gap: 6px;
	width: 100%;
	/* 40px tall, matching every other control in this component. */
	min-height: 40px;
	padding: 10px 12px;
	background: none;
	border: 0;
	color: #2b2f30;
	font-size: 14px;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
}

.rr-orgs__table thead th button:hover {
	background: #e9ebeb;
}

.rr-orgs__arrow {
	font-size: 10px;
	color: #6b6f70;
}

.rr-orgs__table tbody td {
	padding: 9px 12px;
	border-bottom: 1px solid #eff0f0;
	color: #2b2f30;
}

.rr-orgs__table tbody tr:nth-child(even) td {
	background: #fafbfb;
}

.rr-orgs__table tbody tr:last-child td {
	border-bottom: 0;
}

.rr-orgs__icon {
	margin-right: 8px;
	color: #a4343a;
	vertical-align: -1px;
}

.rr-orgs__empty {
	padding: 18px 12px !important;
	color: #6b6f70;
	text-align: center;
}

/* While a fetch is in flight the old rows stay readable, just quietened. */
.rr-orgs.is-loading .rr-orgs__table tbody {
	opacity: 0.55;
}

/* --- pager -------------------------------------------------------------- */

.rr-orgs__pager {
	margin: 14px 0 0;
}

.rr-orgs__pager ul {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rr-orgs__pager li {
	margin: 0;
	list-style: none;
}

/*
 * Specificity deliberately raised past the theme: Avada underlines every link
 * inside page content, which on a row of page numbers reads as running text
 * rather than controls. The colours below win on their own; only the
 * underline needed the extra weight.
 */
.rr-orgs .rr-orgs__pager a.rr-orgs__page,
.rr-orgs .rr-orgs__pager a.rr-orgs__page:hover,
.rr-orgs .rr-orgs__pager a.rr-orgs__page:focus {
	text-decoration: none;
}

.rr-orgs__page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 40px;
	padding: 6px 12px;
	border: 1px solid #6f7d88;
	border-radius: 3px;
	background: #fff;
	color: #1d4e73;
	font-size: 14px;
	text-decoration: none;
}

.rr-orgs__page:hover {
	background: #eef4f8;
	color: #143752;
	text-decoration: none;
}

.rr-orgs__page.is-current {
	background: #1d4e73;
	border-color: #1d4e73;
	color: #fff;
	font-weight: 700;
}

/*
 * A step that leads nowhere is rendered as text, not a disabled link, so it is
 * never a focus stop. It is exempt from contrast as an inactive control, but is
 * kept at #6b6f70 (5.08:1) rather than faded out, so it stays readable.
 */
.rr-orgs__page.is-disabled {
	border-color: #d4d7d8;
	color: #6b6f70;
}

.rr-orgs__gap {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 4px;
	color: #6b6f70;
}

/* --- focus -------------------------------------------------------------- */

.rr-orgs a:focus-visible,
.rr-orgs button:focus-visible,
.rr-orgs input:focus-visible {
	outline: 3px solid #1c6bba;
	outline-offset: 2px;
}

.rr-orgs .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* --- narrow screens ----------------------------------------------------- */

@media screen and (max-width: 600px) {
	.rr-orgs__controls {
		align-items: stretch;
		flex-direction: column;
	}

	.rr-orgs__search {
		flex-wrap: nowrap;
	}

	/* The field takes the room the row gives it rather than overflowing. */
	.rr-orgs__search input[type="search"] {
		flex: 1 1 auto;
		min-width: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rr-orgs * {
		transition: none !important;
	}
}

/* --- membership at a glance --------------------------------------------- */

/*
 * The one-cell total that replaces wpDataTable 10. Sized and coloured like the
 * directory table above so the two public components match; the figure is set
 * a little larger because it is the whole point of the page.
 */
.rr-member-count {
	width: auto;
	min-width: 240px;
	margin: 0 auto;
	border-collapse: collapse;
	background: #fff;
}

.rr-member-count thead th {
	padding: 10px 18px;
	background: #f4f5f5;
	border: 1px solid #d4d7d8;
	color: #2b2f30;
	font-size: 14px;
	font-weight: 700;
	text-align: center;
}

.rr-member-count tbody td {
	padding: 10px 18px;
	border: 1px solid #d4d7d8;
	border-top: 0;
	background: #fafbfb;
	color: #2b2f30;
	font-size: 16px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.rr-member-count__value {
	font-variant-numeric: tabular-nums;
}
