/* ============================================================
   BuddyBoss Member Directory – style.css
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
.bmd-directory {
	--bmd-accent:        #924cd8;
	--bmd-accent-hover:  #7c3bbf;
	--bmd-bg:            #ffffff;
	--bmd-surface:       #f9fafb;
	--bmd-border:        #e5e7eb;
	--bmd-text:          #111827;
	--bmd-text-muted:    #6b7280;
	--bmd-radius:        8px;
	--bmd-radius-lg:     12px;
	--bmd-shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
	--bmd-shadow-hover:  0 10px 25px rgba(0,0,0,.12);
	--bmd-transition:    0.2s ease;
	--bmd-card-min:      180px;
	font-family: inherit;
	box-sizing: border-box;
	color: var(--bmd-text);
}

.bmd-directory *,
.bmd-directory *::before,
.bmd-directory *::after {
	box-sizing: inherit;
}

/* ── Filter bar ─────────────────────────────────────────────── */
.bmd-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-end;
	background: var(--bmd-surface);
	border: 1px solid var(--bmd-border);
	border-radius: var(--bmd-radius-lg);
	padding: 18px 20px;
	margin-bottom: 20px;
}

.bmd-filter-group {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 160px;
}

.bmd-filter-search {
	flex: 1 1 220px;
}

.bmd-filter-label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--bmd-text-muted);
}

/* shared input / select base */
.bmd-input,
.bmd-select {
	height: 40px;
	padding: 0 12px;
	border: 1px solid var(--bmd-border);
	border-radius: var(--bmd-radius);
	background: var(--bmd-bg);
	font-size: 14px;
	color: var(--bmd-text);
	outline: none;
	width: 100%;
	transition: border-color var(--bmd-transition), box-shadow var(--bmd-transition);
	-webkit-appearance: none;
	appearance: none;
}

.bmd-input:focus,
.bmd-select:focus {
	border-color: var(--bmd-accent);
	box-shadow: 0 0 0 3px rgba(146,76,216,.15);
}

/* Search icon inside input */
.bmd-input-wrap {
	position: relative;
}

.bmd-search-icon {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	color: var(--bmd-text-muted);
	pointer-events: none;
}

.bmd-filter-search .bmd-input {
	padding-left: 34px;
}

/* Select caret */
.bmd-select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 16px;
	padding-right: 32px;
}

/* Buttons */
.bmd-filter-actions {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	padding-bottom: 1px;
}

.bmd-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 40px;
	padding: 0 18px;
	border-radius: var(--bmd-radius);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	transition: background var(--bmd-transition), color var(--bmd-transition), box-shadow var(--bmd-transition);
	white-space: nowrap;
}

.bmd-btn svg {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
}

.bmd-btn--primary {
	background: var(--bmd-accent);
	color: #fff;
}

.bmd-btn--primary:hover {
	background: #ede9fe !important;
	color: var(--bmd-accent) !important;
	box-shadow: none !important;
}

.bmd-btn--ghost {
	background: transparent;
	color: var(--bmd-text-muted);
	border: 1px solid var(--bmd-border);
}

.bmd-btn--ghost:hover {
	background: var(--bmd-border);
	color: var(--bmd-text);
}

/* ── Results bar ────────────────────────────────────────────── */
.bmd-results-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
	min-height: 24px;
}

.bmd-results-info {
	font-size: 14px;
	color: var(--bmd-text-muted);
}

/* Loading spinner */
.bmd-spinner {
	display: none;
	width: 20px;
	height: 20px;
	border: 2px solid var(--bmd-border);
	border-top-color: var(--bmd-accent);
	border-radius: 50%;
}

.bmd-directory.bmd-loading .bmd-spinner {
	display: block;
	animation: bmd-spin .7s linear infinite;
}

@keyframes bmd-spin {
	to { transform: rotate(360deg); }
}

/* Fade members while loading */
.bmd-directory.bmd-loading .bmd-members-grid {
	opacity: .4;
	pointer-events: none;
	transition: opacity .2s;
}

/* ── Member grid ────────────────────────────────────────────── */
.bmd-members-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--bmd-card-min), 1fr));
	gap: 20px;
	transition: opacity .2s;
}

/* ── Member card ────────────────────────────────────────────── */
.bmd-member-card {
	background: var(--bmd-bg);
	border: 1px solid var(--bmd-border);
	border-radius: var(--bmd-radius-lg);
	overflow: hidden;
	box-shadow: var(--bmd-shadow);
	transition: transform var(--bmd-transition), box-shadow var(--bmd-transition);
}

.bmd-member-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--bmd-shadow-hover);
}

.bmd-member-link {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	height: 100%;
}

.bmd-avatar-wrap {
	background: linear-gradient(135deg, #ede9fe, #c7d2fe);
	aspect-ratio: 1;
	overflow: hidden;
}

.bmd-avatar {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.bmd-member-info {
	padding: 14px 16px 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.bmd-member-name {
	font-size: 15px;
	font-weight: 700;
	color: var(--bmd-text);
	line-height: 1.3;
}

.bmd-member-card:hover .bmd-member-name {
	color: var(--bmd-accent);
}

.bmd-member-role {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--bmd-accent);
	background: rgba(146,76,216,.08);
	padding: 2px 8px;
	border-radius: 20px;
	width: fit-content;
}

.bmd-member-location {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	font-size: 12px;
	color: var(--bmd-text-muted);
	margin-top: 1px;
}

.bmd-member-location svg {
	width: 11px;
	height: 11px;
	flex-shrink: 0;
	color: var(--bmd-accent);
}

.bmd-popup-info .bmd-member-location {
	font-size: 12px;
}

/* ── No results ─────────────────────────────────────────────── */
.bmd-no-results {
	grid-column: 1 / -1;
	text-align: center;
	padding: 48px 24px;
	color: var(--bmd-text-muted);
}

.bmd-no-results svg {
	width: 48px;
	height: 48px;
	margin: 0 auto 12px;
	opacity: .35;
	display: block;
}

.bmd-no-results p {
	margin: 0;
	font-size: 15px;
}

/* ── Pagination ─────────────────────────────────────────────── */
.bmd-pagination {
	margin-top: 28px;
}

.bmd-pagination-nav {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.bmd-page-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
}

.bmd-page-list li {
	margin: 0;
}

.bmd-page-btn {
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: 1px solid var(--bmd-border);
	border-radius: var(--bmd-radius);
	background: var(--bmd-bg);
	font-size: 14px;
	color: var(--bmd-text);
	cursor: pointer;
	transition: background var(--bmd-transition), border-color var(--bmd-transition), color var(--bmd-transition);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.bmd-page-btn:hover:not(:disabled):not(.active) {
	background: var(--bmd-surface);
	border-color: var(--bmd-accent);
	color: var(--bmd-accent);
}

.bmd-page-btn.active {
	background: var(--bmd-accent);
	border-color: var(--bmd-accent);
	color: #fff;
	font-weight: 700;
	pointer-events: none;
}

.bmd-page-btn:disabled {
	opacity: .35;
	cursor: not-allowed;
}

.bmd-ellipsis {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	color: var(--bmd-text-muted);
	font-size: 14px;
}

.bmd-page-count {
	margin: 0;
	font-size: 13px;
	color: var(--bmd-text-muted);
}

/* ── Following / Connections checkbox row ───────────────────── */
.bmd-filter-row-full {
	width: 100%;
	display: flex;
	gap: 24px;
	align-items: center;
	padding-top: 14px;
	margin-top: 4px;
	border-top: 1px solid var(--bmd-border);
}

.bmd-toggle-filter {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 14px;
	font-weight: 500;
	color: var(--bmd-text-muted);
	cursor: pointer;
	user-select: none;
	transition: color var(--bmd-transition);
}

.bmd-toggle-filter:hover {
	color: var(--bmd-text);
}

.bmd-toggle-filter input[type="checkbox"] {
	accent-color: var(--bmd-accent);
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	cursor: pointer;
}

.bmd-toggle-filter input[type="checkbox"]:checked + svg {
	color: var(--bmd-accent);
}

.bmd-toggle-filter input[type="checkbox"]:checked ~ * {
	color: var(--bmd-accent);
}

.bmd-toggle-filter svg {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
	transition: color var(--bmd-transition);
}

/* ── View toggle (Grid / Map) ───────────────────────────────── */
.bmd-view-toggle {
	display: flex;
	gap: 4px;
	margin-bottom: 16px;
	background: var(--bmd-surface);
	border: 1px solid var(--bmd-border);
	border-radius: var(--bmd-radius);
	padding: 4px;
	width: fit-content;
}

.bmd-view-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 16px;
	border: none;
	border-radius: calc( var(--bmd-radius) - 2px );
	background: transparent;
	color: var(--bmd-text-muted);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--bmd-transition), color var(--bmd-transition), box-shadow var(--bmd-transition);
}

.bmd-view-btn svg { width: 15px; height: 15px; }

.bmd-view-btn.active {
	background: #439bc0;
	color: #ffffff;
	box-shadow: none;
}

.bmd-view-btn:not(.active):hover { color: var(--bmd-text); }

/* ── Map radius bar ─────────────────────────────────────────── */
.bmd-map-radius-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	background: var(--bmd-surface);
	border: 1px solid var(--bmd-border);
	border-radius: var(--bmd-radius-lg);
	padding: 14px 16px;
	margin-bottom: 12px;
}

.bmd-radius-icon { width: 18px; height: 18px; color: var(--bmd-accent); flex-shrink: 0; }
.bmd-radius-address-wrap { flex: 1 1 200px; }
.bmd-radius-distance-wrap { display: flex; gap: 4px; align-items: center; }
.bmd-radius-distance-wrap .bmd-input { width: 70px; }
.bmd-radius-distance-wrap .bmd-select { width: 80px; }

/* ── Map container ──────────────────────────────────────────── */
.bmd-map-container {
	position: relative;
	border-radius: var(--bmd-radius-lg);
	overflow: hidden;
	border: 1px solid var(--bmd-border);
	box-shadow: var(--bmd-shadow);
}

.bmd-map { width: 100%; height: 100%; }

.bmd-map-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(255,255,255,.85);
	z-index: 1000;
	gap: 10px;
}

.bmd-map-loading p { margin: 0; font-size: 14px; color: var(--bmd-text-muted); }
.bmd-map-loading .bmd-spinner { display: block !important; animation: bmd-spin .7s linear infinite; }
.bmd-map-count-line { margin: 10px 0 0; font-size: 13px; color: var(--bmd-text-muted); }
.bmd-map-radius-label { font-style: italic; }

/* ── Leaflet popup card ──────────────────────────────────────── */
.bmd-popup { min-width: 200px; }

.bmd-popup-link {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	text-decoration: none;
	color: inherit;
}

.bmd-popup-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	border: 2px solid var(--bmd-border);
}

.bmd-popup-info { display: flex; flex-direction: column; gap: 4px; }

.bmd-popup-name {
	font-size: 14px;
	font-weight: 700;
	color: var(--bmd-text);
	line-height: 1.3;
}

.bmd-popup-link:hover .bmd-popup-name { color: var(--bmd-accent); }
.bmd-popup .bmd-badges { margin-top: 4px; }
.bmd-popup-badge { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

/* ── List view ──────────────────────────────────────────────── */
.bmd-directory.bmd-is-list .bmd-members-grid {
	grid-template-columns: 1fr !important;
	gap: 10px;
}

.bmd-directory.bmd-is-list .bmd-member-card {
	border-radius: var(--bmd-radius);
}

.bmd-directory.bmd-is-list .bmd-member-link {
	flex-direction: row !important;
	align-items: center;
	gap: 16px;
	padding: 12px 16px;
}

.bmd-directory.bmd-is-list .bmd-avatar-wrap {
	width: 56px;
	height: 56px;
	min-width: 56px;
	border-radius: 50%;
	aspect-ratio: unset;
}

.bmd-directory.bmd-is-list .bmd-avatar {
	border-radius: 50%;
}

.bmd-directory.bmd-is-list .bmd-member-info {
	flex-direction: row;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 14px;
	padding: 0;
}

.bmd-directory.bmd-is-list .bmd-member-name {
	min-width: 130px;
}

.bmd-directory.bmd-is-list .bmd-badges {
	margin-top: 0;
}

/* ── Badge multi-checkbox dropdown ──────────────────────────── */
.bmd-badge-dropdown {
	position: relative;
}

.bmd-badge-dropdown-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	cursor: pointer;
	text-align: left;
	width: 100%;
	background: var(--bmd-bg);
}

.bmd-badge-dropdown-toggle:focus {
	border-color: var(--bmd-accent);
	box-shadow: 0 0 0 3px rgba(146,76,216,.15);
}

.bmd-dropdown-chevron {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	color: var(--bmd-text-muted);
	transition: transform var(--bmd-transition);
}

.bmd-badge-dropdown-toggle[aria-expanded="true"] .bmd-dropdown-chevron {
	transform: rotate(180deg);
}

.bmd-badge-dropdown-panel {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	min-width: 100%;
	max-height: 240px;
	overflow-y: auto;
	background: var(--bmd-bg);
	border: 1px solid var(--bmd-border);
	border-radius: var(--bmd-radius);
	box-shadow: var(--bmd-shadow-hover);
	z-index: 200;
	padding: 6px 0;
	display: none;
}

.bmd-badge-dropdown.bmd-open .bmd-badge-dropdown-panel {
	display: block;
}

/* xProfile multi-select dropdown — mirrors badge dropdown */
.bmd-xp-dropdown {
	position: relative;
}

.bmd-xp-dropdown-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	cursor: pointer;
	text-align: left;
	width: 100%;
	background: var(--bmd-bg);
}

.bmd-xp-dropdown-toggle:focus {
	border-color: var(--bmd-accent);
	box-shadow: 0 0 0 3px rgba(146,76,216,.15);
}

.bmd-xp-dropdown-panel {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	min-width: 100%;
	max-height: 240px;
	overflow-y: auto;
	background: var(--bmd-bg);
	border: 1px solid var(--bmd-border);
	border-radius: var(--bmd-radius);
	box-shadow: var(--bmd-shadow-hover);
	z-index: 200;
	padding: 6px 0;
	display: none;
}

.bmd-xp-dropdown.bmd-open .bmd-xp-dropdown-panel {
	display: block;
}

.bmd-badge-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	font-size: 14px;
	color: var(--bmd-text);
	cursor: pointer;
	transition: background var(--bmd-transition);
	white-space: nowrap;
}

.bmd-badge-option:hover {
	background: var(--bmd-surface);
}

.bmd-badge-option input[type="checkbox"] {
	accent-color: var(--bmd-accent);
	width: 15px;
	height: 15px;
	flex-shrink: 0;
	cursor: pointer;
}

/* ── Card field tags ────────────────────────────────────────── */
.bmd-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 6px;
}

.bmd-card-tag {
	display: inline-block;
	font-size: 11px;
	font-weight: 500;
	padding: 2px 8px;
	border-radius: 20px;
	background: rgba(146,76,216,.1);
	color: var(--bmd-accent);
	border: 1px solid rgba(146,76,216,.2);
	white-space: nowrap;
}

/* ── Earned badges on cards ─────────────────────────────────── */
.bmd-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 6px;
}

.bmd-badge-img {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 2px solid var(--bmd-border);
	object-fit: cover;
	transition: transform var(--bmd-transition);
}

.bmd-badge-img:hover {
	transform: scale(1.2);
	z-index: 1;
}

.bmd-badge-pill {
	display: inline-block;
	font-size: 10px;
	font-weight: 600;
	padding: 2px 7px;
	border-radius: 20px;
	background: linear-gradient(135deg, #fef9c3, #fde68a);
	color: #92400e;
	border: 1px solid #fcd34d;
	white-space: nowrap;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
	.bmd-filters {
		flex-direction: column;
	}

	.bmd-filter-group {
		min-width: 100%;
	}

	.bmd-filter-actions {
		width: 100%;
	}

	.bmd-btn {
		flex: 1;
		justify-content: center;
	}

	.bmd-directory {
		--bmd-card-min: 140px;
	}
}

/* ── Search this area button ────────────────────────────────── */
.bmd-map-results-bar {
	display: flex;
	justify-content: center;
	padding: 12px 0 4px;
}

.bmd-search-area-btn {
	box-shadow: var(--bmd-shadow);
}

/* ── Map results list ───────────────────────────────────────── */
.bmd-map-results-list {
	margin-top: 20px;
	border-top: 2px solid var(--bmd-border);
	padding-top: 16px;
}

.bmd-map-results-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.bmd-map-results-count {
	font-size: 14px;
	font-weight: 600;
	color: var(--bmd-text-muted);
}

.bmd-map-results-cards {
	gap: 10px;
}

/* ── Map popup initial avatar ───────────────────────────────── */
.bmd-popup-initial,
.bmd-avatar-initial {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--bmd-accent);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 700;
	flex-shrink: 0;
}
