/* ==========================================================================
   LDAP Staff Directory — public styles
   Customise via CSS variables or the "Custom CSS" field in the admin panel.
   ========================================================================== */

:root {
	--ldap-primary-color:    #0073aa;
	--ldap-card-bg:          #ffffff;
	--ldap-card-border:      #e2e4e7;
	--ldap-card-shadow:      0 1px 3px rgba(0, 0, 0, .06);
	--ldap-card-radius:      8px;
	--ldap-font-size:        14px;
	--ldap-name-size:        1.05em;
	--ldap-text-color:       #3c434a;
	--ldap-muted-color:      #646970;
	--ldap-search-border:    #c3c4c7;
	--ldap-columns:          3;
	--ldap-gap:              20px;

	/* Avatar circle */
	--ldap-avatar-size:      44px;
	--ldap-avatar-bg:        var( --ldap-primary-color );

	/* Department badge */
	--ldap-dept-badge-bg:    rgba( 0, 115, 170, .08 );
	--ldap-dept-badge-color: #005a87;
}

/* ── Wrapper ────────────────────────────────────────────────────────────── */

.ldap-directory-wrap {
	font-family: inherit;
	font-size: var( --ldap-font-size );
	color: var( --ldap-text-color );
}

/* ── Department filter bar ──────────────────────────────────────────────── */

.ldap-dept-filters {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	overflow-x: auto;
	white-space: nowrap;
	padding-bottom: 4px;
	margin-bottom: 24px;
	/* Hide scrollbar visually while keeping it functional */
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.ldap-dept-filters::-webkit-scrollbar {
	display: none;
}

.ldap-dept-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 14px;
	font-size: .82em;
	font-family: inherit;
	font-weight: 500;
	color: var( --ldap-text-color );
	background: transparent;
	border: 1px solid var( --ldap-card-border );
	border-radius: 20px;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
	transition: border-color .15s ease, background-color .15s ease, color .15s ease;
	flex-shrink: 0;
}

a.ldap-dept-chip:hover {
	border-color: var( --ldap-primary-color );
	color: var( --ldap-primary-color );
}

.ldap-dept-chip.is-active {
	background: var( --ldap-primary-color );
	border-color: var( --ldap-primary-color );
	color: #fff;
	cursor: default;
}

.ldap-dept-chip-clear {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 2px;
	font-size: 1.1em;
	font-weight: 700;
	color: inherit;
	text-decoration: none;
	opacity: .75;
	cursor: pointer;
	transition: opacity .15s ease;
}

.ldap-dept-chip-clear:hover {
	opacity: 1;
}

/* ── Search ─────────────────────────────────────────────────────────────── */

.ldap-search-wrap {
	position: relative;
	margin-bottom: 24px;
}

/* Magnifying-glass icon injected purely via CSS — no extra markup needed. */
.ldap-search-wrap::before {
	content: '';
	position: absolute;
	left: 11px;
	top: 50%;
	transform: translateY( -50% );
	width: 15px;
	height: 15px;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8f94' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7.5'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E" );
	background-size: contain;
	background-repeat: no-repeat;
	pointer-events: none;
}

.ldap-search {
	width: 100%;
	max-width: 380px;
	padding: 9px 12px 9px 34px;
	font-size: var( --ldap-font-size );
	font-family: inherit;
	color: var( --ldap-text-color );
	background: var( --ldap-card-bg );
	border: 1px solid var( --ldap-search-border );
	border-radius: 6px;
	box-sizing: border-box;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.ldap-search:focus {
	outline: none;
	border-color: var( --ldap-primary-color );
	box-shadow: 0 0 0 2px rgba( 0, 115, 170, .14 );
}

/* ── Grid ───────────────────────────────────────────────────────────────── */

.ldap-directory-grid {
	display: grid;
	grid-template-columns: repeat( var( --ldap-columns ), 1fr );
	gap: var( --ldap-gap );
}

@media ( max-width: 900px ) {
	.ldap-directory-grid {
		grid-template-columns: repeat( 2, 1fr );
	}
}

@media ( max-width: 540px ) {
	.ldap-directory-grid {
		grid-template-columns: 1fr;
	}
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.ldap-staff-card {
	background: var( --ldap-card-bg );
	border: 1px solid var( --ldap-card-border );
	border-radius: var( --ldap-card-radius );
	box-shadow: var( --ldap-card-shadow );
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 3px;
	transition: box-shadow .18s ease, border-color .18s ease;
}

.ldap-staff-card:hover {
	box-shadow: 0 4px 14px rgba( 0, 0, 0, .1 );
	border-color: #c3c4c7;
}

/* Avatar initials circle */
.ldap-card-avatar {
	width: var( --ldap-avatar-size );
	height: var( --ldap-avatar-size );
	border-radius: 50%;
	background-color: var( --ldap-avatar-bg );
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: calc( var( --ldap-avatar-size ) * .38 );
	font-weight: 700;
	letter-spacing: .02em;
	margin-bottom: 12px;
	flex-shrink: 0;
	user-select: none;
}

/* ── Card fields ────────────────────────────────────────────────────────── */

.ldap-name {
	margin: 0 0 2px;
	font-size: var( --ldap-name-size );
	font-weight: 600;
	color: var( --ldap-text-color );
	line-height: 1.3;
}

.ldap-title {
	margin: 0;
	color: var( --ldap-muted-color );
	font-size: .9em;
	line-height: 1.4;
}

/* Department shown as a tinted pill */
.ldap-department {
	margin: 4px 0 0;
}

.ldap-dept-badge {
	display: inline-block;
	background: var( --ldap-dept-badge-bg );
	color: var( --ldap-dept-badge-color );
	padding: 2px 8px;
	border-radius: 10px;
	font-size: .78em;
	font-weight: 500;
	letter-spacing: .03em;
	line-height: 1.6;
}

.ldap-email {
	margin-top: 10px;
	font-size: .88em;
	color: var( --ldap-primary-color );
	word-break: break-all;
	text-decoration: none;
	transition: opacity .15s ease;
}

.ldap-email:hover {
	text-decoration: underline;
	opacity: .82;
}

.ldap-phone {
	margin-top: 4px;
	font-size: .88em;
	color: var( --ldap-primary-color );
	word-break: break-all;
	text-decoration: none;
	transition: opacity .15s ease;
}

.ldap-phone:hover {
	text-decoration: underline;
	opacity: .82;
}

/* ── No-results ─────────────────────────────────────────────────────────── */

.ldap-no-results {
	grid-column: 1 / -1;
	text-align: center;
	color: var( --ldap-muted-color );
	padding: 48px 20px;
	font-size: .95em;
}

.ldap-no-results--search {
	text-align: center;
	color: var( --ldap-muted-color );
	padding: 20px 0;
	font-size: .95em;
}

/* ── Pagination ─────────────────────────────────────────────────────────── */

.ldap-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 32px;
}

/* Self-contained buttons — no dependency on wp-admin or theme .button class. */
.ldap-btn {
	display: inline-flex;
	align-items: center;
	padding: 7px 16px;
	font-size: var( --ldap-font-size );
	font-family: inherit;
	font-weight: 500;
	line-height: 1.4;
	color: var( --ldap-primary-color );
	background: transparent;
	border: 1px solid var( --ldap-primary-color );
	border-radius: var( --ldap-card-radius );
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}

.ldap-btn:hover:not( :disabled ) {
	background: var( --ldap-primary-color );
	color: #fff;
}

.ldap-btn:focus-visible {
	outline: 2px solid var( --ldap-primary-color );
	outline-offset: 2px;
}

.ldap-btn:disabled,
.ldap-btn[aria-disabled="true"] {
	opacity: .38;
	cursor: default;
	pointer-events: none;
	border-color: var( --ldap-card-border );
	color: var( --ldap-muted-color );
}

.ldap-page-info {
	font-size: var( --ldap-font-size );
	color: var( --ldap-muted-color );
	min-width: 56px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}
