/**
 * Clients plugin styles (v1.0.2).
 *
 * ─── ICON STRATEGY ────────────────────────────────────────────────────────
 * The "Clients" nav-tab icon (fa-solid fa-book) is rendered via a CSS
 * `::before` pseudo-element on the BP nav <li>, using the `item_css_id`
 * we set in PHP (`clients-profile-tab`). Because this is a pure CSS
 * pseudo-element, it's generated by the browser at render time and CANNOT
 * be stripped by BuddyPress's `wp_kses_data` filter (which would otherwise
 * eat any inline <i> tag we put in the nav `name`).
 *
 * The font stack covers the common FontAwesome family names used across
 * themes. The `fa-book` glyph is `\f02d` in all FA5 / FA6 versions.
 *
 * ─── COLOR PALETTE ────────────────────────────────────────────────────────
 * Brand accent: #527293 (slate-blue), inherited from the reference plugins.
 * Used for: focus rings, search border, primary buttons, role-badge accents.
 */

/* ==========================================================================
   1. Nav icons — book on the parent tab, book on My Respected Clients,
      dolly on My Service Providers. All rendered via CSS pseudo-elements
      so BP's wp_kses_data filter (which strips <i> from nav `name`) cannot
      eat them.

      Selectors are written redundantly across both the LI ID and the inner
      <a> because BP's subnav rendering varies between Legacy / Nouveau /
      BuddyBoss — covering both shapes guarantees one of them matches.
   ========================================================================== */

/* Shared FontAwesome base — applied to every Clients nav pseudo-element. */
#clients-profile-tab-personal-li > a::before,
#user-clients-profile-tab::before,
li[id^="clients-profile-tab"] > a::before,
#clients-subtab-my-clients-personal-li > a::before,
#clients-subtab-my-clients > a::before,
li[id^="clients-subtab-my-clients"] > a::before,
li#clients-subtab-my-clients::before,
#clients-subtab-my-providers-personal-li > a::before,
#clients-subtab-my-providers > a::before,
li[id^="clients-subtab-my-providers"] > a::before,
li#clients-subtab-my-providers::before {
	font-family: "Font Awesome 6 Free",
				 "Font Awesome 6 Pro",
				 "Font Awesome 5 Free",
				 "Font Awesome 5 Pro",
				 "FontAwesome";
	font-weight: 900; /* fa-solid */
	font-style: normal;
	font-variant: normal;
	text-rendering: auto;
	line-height: 1;
	display: inline-block;
	margin-right: 6px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	speak: none;
	vertical-align: -1px;
}

/* Parent "Clients" tab — fa-book (\f02d). */
#clients-profile-tab-personal-li > a::before,
#user-clients-profile-tab::before,
li[id^="clients-profile-tab"] > a::before {
	content: "\f02d";
}

/* Sub-tab: My Respected Clients — fa-book (\f02d). */
#clients-subtab-my-clients-personal-li > a::before,
#clients-subtab-my-clients > a::before,
li[id^="clients-subtab-my-clients"] > a::before,
li#clients-subtab-my-clients::before {
	content: "\f02d";
}

/* Sub-tab: My Service Providers — fa-dolly (\f472). */
#clients-subtab-my-providers-personal-li > a::before,
#clients-subtab-my-providers > a::before,
li[id^="clients-subtab-my-providers"] > a::before,
li#clients-subtab-my-providers::before {
	content: "\f472";
}

/* ==========================================================================
   2. Wrapper + intro
   ========================================================================== */
.clients-wrap,
.clients-wrapper {
	margin-top: 1em;
}
.clients-section-header {
	margin-bottom: 1.25em;
}
.clients-section-desc {
	margin: 0;
	color: #666;
}
.clients-intro {
	margin: -15px 0 0px 0 !important;
	padding: 14px 16px !important;
	font-size: 13.5px !important;
	line-height: 1.65 !important;
	color: #555 !important;
	background: #f4f7fa !important;
	border-left: 3px solid #527293 !important;
	border-radius: 0 4px 4px 0 !important;
	box-sizing: border-box !important;
}

/* ==========================================================================
   3. Search field + suggestions dropdown (carried from v1.0.1, unchanged)
   ========================================================================== */
.clients-search-wrap {
	position: relative;
	width: 100%;
	margin-bottom: 1em;
}
.clients-search-field {
	position: relative;
	width: 100%;
}
.clients-member-search {
	width: 100% !important;
	padding: 12px 44px 12px 16px;
	border: solid 1px #527293 !important;
	border-radius: 8px;
	background: #fff;
	font-size: 15px;
	line-height: 1.4;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
	transition: border-color .15s ease, box-shadow .15s ease;
	box-sizing: border-box;
}
.clients-member-search:focus {
	outline: none;
	border-color: #527293 !important;
	box-shadow: 0 0 0 3px rgba(82, 114, 147, 0.18);
}
.clients-search-icon {
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: #527293;
	pointer-events: none;
	font-size: 18px;
	line-height: 1;
}
.clients-search-icon i { font-size: 18px; }

.clients-search-spinner {
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: #2271b1;
	font-size: 16px;
	display: none;
}
.clients-search-field.is-loading .clients-search-icon { display: none; }
.clients-search-field.is-loading .clients-search-spinner { display: block; }
.clients-spinner-fallback {
	width: 16px; height: 16px;
	border: 2px solid rgba(82, 114, 147, 0.25);
	border-top-color: #527293;
	border-radius: 50%;
	animation: clients-spin 0.8s linear infinite;
	display: inline-block;
}
@keyframes clients-spin { to { transform: rotate(360deg); } }

.clients-search-suggestions {
	position: absolute;
	top: calc(100% + 4px);
	left: 0; right: 0;
	z-index: 50;
	background: #fff;
	border: 1px solid #d0d5dd;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
	list-style: none;
	margin: 0; padding: 4px 0;
	max-height: 340px;
	overflow-y: auto;
}
.clients-search-suggestions li { margin: 0; padding: 0; list-style: none; }
.clients-suggestion {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	cursor: pointer;
	color: #111;
}
.clients-suggestion:hover,
.clients-suggestion.is-active { background: #f2f7fc; }
.clients-suggestion img {
	width: 32px; height: 32px;
	border-radius: 50%;
	flex: 0 0 auto;
}
.clients-suggestion-text {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
	min-width: 0;
}
.clients-suggestion-name {
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.clients-suggestion-login {
	color: #667085;
	font-size: 12px;
}
.clients-suggestion-empty,
.clients-suggestion-error {
	padding: 10px 12px;
	color: #667085;
	font-style: italic;
}

/* ==========================================================================
   4. Selected-member preview card (between search and popup)
   ========================================================================== */
.clients-selected-member { margin: 4px 0 12px; }
.clients-selected-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	background: #f8fafc;
	border: 1px solid #d0d5dd;
	border-radius: 8px;
	position: relative;
}
.clients-selected-avatar {
	width: 48px; height: 48px;
	border-radius: 50%;
	flex: 0 0 auto;
}
.clients-selected-body {
	flex: 1; min-width: 0;
	display: flex;
	flex-direction: column;
	line-height: 1.25;
}
.clients-selected-name {
	margin: 0 !important;
	font-weight: 600;
	font-size: 15px;
	color: #1a1a1a;
}
.clients-selected-login {
	margin: 2px 0 0 !important;
	color: #667085;
	font-size: 12px;
}
.clients-selected-clear {
	background: transparent !important;
	border: none !important;
	color: #888 !important;
	cursor: pointer;
	padding: 6px 8px !important;
	font-size: 16px !important;
	border-radius: 4px;
	box-shadow: none !important;
}
.clients-selected-clear:hover { color: #333 !important; background: #eef2f6 !important; }

/* ==========================================================================
   5. Feedback line
   ========================================================================== */
.clients-feedback {
	margin: 8px 0 0;
	font-size: 13px;
	min-height: 1.4em;
}
.clients-feedback.success { color: #5f9646; font-weight: 600; }
.clients-feedback.error   { color: #dc3232; }
.clients-feedback.info    { color: #527293; }

/* ==========================================================================
   6. Section titles
   ========================================================================== */
.clients-section-title {
	font-size: 15px;
	font-weight: 600;
	margin: 18px 0 14px;
	color: #333;
	display: flex;
	align-items: center;
	gap: 7px;
}
.clients-section-title .count {
	background: #527293;
	color: #fff;
	border-radius: 10px;
	padding: 1px 7px;
	font-size: 12px;
	font-weight: 700;
}

/* ==========================================================================
   7. Pending invitations section + Accept/Deny buttons
   ========================================================================== */
.clients-pending-section {
	margin: 18px 0 28px;
	padding: 18px 20px;
	background: #fafbfc;
	border: 1px solid #e2e8ef;
	border-radius: 8px;
}
.clients-pending-intro {
	margin: 0 0 12px;
	color: #555;
	font-size: 13px;
}
.clients-pending-msg {
	margin: 4px 0 6px !important;
	color: #444;
	font-size: 13px;
}
.clients-role-badge {
	color: #527293 !important;
	font-size: 12px !important;
	margin: 3px 0 8px !important;
}
.clients-role-badge i.fa-briefcase {
	font-size: 10px !important;
	vertical-align: middle !important;
	opacity: .8;
}

/* Force Accept/Deny visibility over BP/GP themes that hide .action by default. */
.clients-pending-section .clients-pending-card .action.clients-pending-action,
.clients-pending-section .item-entry .action.clients-pending-action,
.item-list .clients-pending-card .action.clients-pending-action,
#clients-pending-list .clients-pending-card .action,
.clients-pending-action {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	visibility: visible !important;
	opacity: 1 !important;
	gap: 8px !important;
	margin-top: 10px !important;
	align-items: center !important;
	justify-content: flex-start !important;
	position: static !important;
	left: auto !important; right: auto !important; top: auto !important;
	width: auto !important;
	background: transparent !important;
	pointer-events: auto !important;
}

.clients-accept-btn,
.clients-deny-btn {
	display: inline-flex !important;
	visibility: visible !important;
	opacity: 1 !important;
	align-items: center !important;
	gap: 5px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	text-decoration: none !important;
	padding: 5px 13px !important;
	border-radius: 25px !important;
	line-height: 1.4 !important;
	border: none !important;
	cursor: pointer !important;
	position: static !important;
	/* v1.0.3: now <button>, not <a>. Reset any theme button defaults that
	   could leak through. */
	box-shadow: none !important;
	font-family: inherit !important;
	-webkit-appearance: none !important;
	   -moz-appearance: none !important;
	        appearance: none !important;
}
/* v1.0.3: child icons should not capture clicks — guarantees event.target is
   always the <button> itself, simplifying delegation logic. */
.clients-accept-btn > i,
.clients-accept-btn > .clients-btn-label,
.clients-deny-btn   > i,
.clients-deny-btn   > .clients-btn-label,
.clients-remove-x   > i {
	pointer-events: none !important;
}
.clients-accept-btn,
.clients-accept-btn:visited {
	background: #3a8a3aa1 !important;
	background-color: #3a8a3aa8 !important;
	color: #fff !important;
	-webkit-text-fill-color: #fff !important;
}
.clients-accept-btn:hover {
	background: #2d6e2d !important;
	background-color: #2d6e2d !important;
	color: #fff !important;
	-webkit-text-fill-color: #fff !important;
}
.clients-deny-btn,
.clients-deny-btn:visited {
	background: #dc32329e !important;
	background-color: #dc3232a6 !important;
	color: #fff !important;
	-webkit-text-fill-color: #fff !important;
}
.clients-deny-btn:hover {
	background: #b52a2a !important;
	background-color: #b52a2a !important;
	color: #fff !important;
	-webkit-text-fill-color: #fff !important;
}
.clients-accept-btn.clients-busy,
.clients-deny-btn.clients-busy {
	opacity: .5 !important;
	pointer-events: none !important;
}

/* ==========================================================================
   8. Confirmed member cards — X-remove button
   ========================================================================== */
.clients-remove-x {
	position: absolute !important;
	top: 7px !important;
	right: 7px !important;
	z-index: 10 !important;
	width: 24px !important;
	height: 24px !important;
	border-radius: 50% !important;
	background: #a0a0a0 !important;
	background-color: #a0a0a0 !important;
	background-image: none !important;
	border: none !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	color: #fff !important;
	font-size: 13px !important;
	opacity: .75;
	outline: none !important;
	transition: opacity .15s, background-color .15s;
}
.clients-remove-x:hover {
	background: #888 !important;
	background-color: #888 !important;
	opacity: 1 !important;
}
.clients-remove-x i {
	pointer-events: none !important;
	font-size: 13px !important;
	font-weight: 900 !important;
	color: #ffffff !important;
	-webkit-text-fill-color: #ffffff !important;
	display: block !important;
}

/* Empty-state */
.clients-no-members {
	padding: 16px 0;
	color: #888;
	text-align: center;
}

/* ==========================================================================
   9. Overlay + popups
   ========================================================================== */
.clients-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(255, 255, 255, .72);
	backdrop-filter: blur(1px);
	-webkit-backdrop-filter: blur(1px);
	z-index: 99998;
}
.clients-overlay.clients-active { display: block; }

.clients-popup {
	display: none;
	position: fixed;
	top: 50%; left: 50%;
	transform: translate(-50%, -50%) scale(.96);
	z-index: 99999;
	background: #fff;
	background-clip: border-box;
	border-radius: 12px !important;
	box-shadow: 0 4px 6px rgba(0, 0, 0, .07), 0 12px 40px rgba(0, 0, 0, .14);
	padding: 32px 28px 28px;
	box-sizing: border-box;
	width: 380px;
	max-width: calc(100vw - 32px);
	opacity: 0;
	transition: opacity .18s ease, transform .18s ease;
}
.clients-popup.clients-active {
	display: block;
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}
.clients-popup-close {
	position: absolute !important;
	top: 12px !important;
	right: 14px !important;
	background: transparent !important;
	background-color: transparent !important;
	border: none !important;
	padding: 4px 6px !important;
	cursor: pointer !important;
	color: #888 !important;
	font-size: 18px !important;
	box-shadow: none !important;
	border-radius: 4px !important;
}
.clients-popup-close:hover {
	color: #333 !important;
	background: #f0f0f0 !important;
}

/* v1.0.6: nudge the X-close glyph up a touch so it visually centers in
   its hit area. Same fix applies to BOTH popups (invite + remove) on
   BOTH pipelines — the popup markup is shared, so one rule covers all
   four close buttons. The high-specificity selector chain
   (button#id.class) survives any theme rule that tries to push these
   icons back down. */
button#clients-invite-close.clients-popup-close,
button#clients-remove-close.clients-popup-close {
	margin-top: -3px !important;
}

.clients-popup-body { text-align: center; }
.clients-invite-avatar { margin: 0 auto 12px; width: 80px; height: 80px; }
.clients-invite-avatar img {
	width: 80px !important;
	height: 80px !important;
	border-radius: 50% !important;
	display: block !important;
	border: 2px solid #e8e8e8;
}
.clients-invite-name {
	margin: 0 0 6px !important;
	font-size: 17px !important;
	font-weight: 600 !important;
	color: #1a1a1a !important;
}
.clients-popup-subtitle {
	margin: 0 0 16px !important;
	font-size: 13.5px !important;
	color: #555 !important;
	text-align: center;
}
.clients-popup-title {
	margin: 0 0 6px !important;
	font-size: 17px !important;
	font-weight: 600 !important;
	color: #1a1a1a !important;
	text-align: left;
	padding-right: 24px;
}
.clients-role-input {
	display: block !important;
	width: 100% !important;
	padding: 9px 14px !important;
	margin: 0 0 20px !important;
	font-size: 14px !important;
	border: 1px solid #ccd0d4 !important;
	border-radius: 4px !important;
	background: #fff !important;
	box-sizing: border-box !important;
	outline: none !important;
}
.clients-role-input:focus {
	border-color: #527293 !important;
	box-shadow: 0 0 0 2px rgba(82, 114, 147, 0.18) !important;
}
.clients-invite-success-icon {
	font-size: 40px;
	color: #527293;
	margin: 0 auto 16px;
}
.clients-success-msg {
	/* v1.0.6: bumped from 14.5px to 16px for better readability. The
	   single .clients-success-msg element is reused by both pipelines
	   (the same #clients-success-msg gets its text content rewritten
	   per direction in JS), so this one rule covers both Clients and
	   Service Providers success popups. */
	font-size: 16px !important;
	line-height: 1.7 !important;
	color: #333 !important;
}

.clients-popup-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
}

.clients-confirm-btn {
	display: inline-flex !important;
	align-items: center !important;
	padding: 9px 20px !important;
	background: #527293 !important;
	background-color: #527293 !important;
	color: #fff !important;
	border: none !important;
	border-radius: 25px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	box-shadow: none !important;
}
.clients-confirm-btn:hover {
	background: #3d5a74 !important;
	background-color: #3d5a74 !important;
}
.clients-confirm-btn:disabled {
	opacity: .6 !important;
	cursor: not-allowed !important;
}

.clients-danger-btn {
	display: inline-flex !important;
	align-items: center !important;
	padding: 9px 20px !important;
	background: #d07450 !important;
	background-color: #d07450 !important;
	color: #fff !important;
	border: none !important;
	border-radius: 25px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	box-shadow: none !important;
}
.clients-danger-btn:hover {
	background: #b85e38 !important;
	background-color: #b85e38 !important;
}
.clients-danger-btn:disabled {
	opacity: .6 !important;
	cursor: not-allowed !important;
}

.clients-cancel-btn {
	display: inline-flex !important;
	align-items: center !important;
	padding: 9px 18px !important;
	background: #f0f0f0 !important;
	background-color: #f0f0f0 !important;
	color: #444 !important;
	border: 1px solid #ddd !important;
	border-radius: 25px !important;
	font-size: 14px !important;
	cursor: pointer !important;
	box-shadow: none !important;
}
.clients-cancel-btn:hover {
	background: #e0e0e0 !important;
	background-color: #e0e0e0 !important;
}

/* ==========================================================================
   10. Loading states (grids + sub-tab AJAX swap)
   ========================================================================== */
#clients-grid-clients.clients-loading,
#clients-grid-providers.clients-loading,
#clients-pending-list.clients-loading {
	opacity: .45;
	pointer-events: none;
}

/* v1.0.4: dim the whole sub-tab while it's being swapped via AJAX so the
   user sees feedback that something is happening — without scrolling them
   anywhere. */
.clients-subtab-content.clients-subtab-loading {
	opacity: .55;
	pointer-events: none;
	transition: opacity .12s ease;
}

/* ==========================================================================
   11. Login-required notice (carried from v1.0.1)
   ========================================================================== */
.clients-login-required { padding: 1em 0; }
.clients-login-required p { margin: 0 0 0.75em; }
