/**
 * Seeking — front-end styles.
 *
 * Covers:
 *   1. The profile tab icon inside BuddyPress / GeneratePress menus.
 *   2. The editable form (checkboxes + sliders + visibility radios).
 *   3. The read-only horizontal pill row (3 commitment-level styles).
 *   4. The privacy gate for logged-out viewers on member-only profiles.
 */

/* ----------------------------------------------------------------
 * Nav tab icon — rendered via CSS ::before on the BP-generated <li>.
 *
 * Uses a local SVG file via mask-image so no Font Awesome dependency
 * is needed. mask-image colours the icon with currentColor (inherits
 * the link colour from the active theme) and survives all BP / GP
 * sanitization because it is pure CSS — no PHP output involved.
 *
 * The pseudo-element is sized at 1em × 1em so it scales naturally
 * with whatever font-size the theme sets on the nav link — matching
 * the visual footprint Font Awesome glyphs had at the same em size.
 * ---------------------------------------------------------------- */

#seeking-profile-tab-personal-li > a::before,
#user-seeking-profile-tab::before,
li[id^="seeking-profile-tab"] > a::before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	margin-right: 6px;
	vertical-align: -0.125em;          /* matches FA's baseline offset */

	/* Local SVG as mask — icon inherits the link's color. */
	-webkit-mask-image: url('../img/seeking-icon.svg');
	        mask-image: url('../img/seeking-icon.svg');
	-webkit-mask-repeat: no-repeat;
	        mask-repeat: no-repeat;
	-webkit-mask-position: center;
	        mask-position: center;
	-webkit-mask-size: contain;
	        mask-size: contain;

	background-color: currentColor;

	/* Prevent FA webfont from accidentally overriding this pseudo-element
	 * if Font Awesome is loaded by another plugin on the same page. */
	font-family: unset;
	font-weight: unset;
	speak: none;
}

/* Admin <h1> title icon — rendered as a local SVG <img>.
 * Width/height controlled by the PHP constant (22×22px).
 * This class only provides the layout glue. */
.seeking-fa-icon {
	display: inline-block;
	margin-right: 6px;
	vertical-align: middle;
}

/* ----------------------------------------------------------------
 * Profile tab body wrapper.
 *
 * margin-top: -35px pulls the Seeking content up under the BP nav,
 * tightening the visual gap between the profile nav and the form.
 * ---------------------------------------------------------------- */

.seeking-profile-wrap {
	padding: 16px 0;
	margin-top: -35px;
}

.seeking-profile-wrap .seeking-profile-empty {
	color: #6b7280;
	font-style: italic;
	padding: 20px;
	background: #f9fafb;
	border-radius: 6px;
	border: 1px dashed #d1d5db;
	text-align: center;
}

/* Success notice after saving. */
.seeking-profile-wrap .seeking-profile-notice {
	padding: 10px 14px;
	margin-bottom: 16px;
	background: #ecfdf5;
	border-left: 4px solid #10b981;
	color: #065f46;
	font-size: 14px;
	border-radius: 4px;
}

/* ----------------------------------------------------------------
 * Editable view — vertical checkbox list (owner / admin / editor).
 * ---------------------------------------------------------------- */

.seeking-profile-wrap .seeking-edit-list {
	list-style: none;
	margin: 0 0 20px 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.seeking-profile-wrap .seeking-edit-item {
	margin: 0;
	padding: 10px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	transition: background-color .15s ease, border-color .15s ease;
}

.seeking-profile-wrap .seeking-edit-item:hover {
	background: #f9fafb;
	border-color: #cbd5e1;
}

.seeking-profile-wrap .seeking-edit-label {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 auto;
	font-size: 15px;
	line-height: 1.4;
	cursor: pointer;
	background: transparent;
	border: 0;
	padding: 0;
}

.seeking-profile-wrap .seeking-edit-label:hover {
	background: transparent;
	border: 0;
}

.seeking-profile-wrap .seeking-edit-label input[type="checkbox"] {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 0;
	cursor: pointer;
}

.seeking-profile-wrap .seeking-edit-text {
	flex: 1 1 auto;
	word-break: break-word;
}

.seeking-profile-wrap .seeking-edit-actions {
	margin-top: 8px;
}

.seeking-profile-wrap .seeking-update-btn {
	min-width: 120px;
}

/* Edit view: title, visibility radios, limit notice, disabled state. */

.seeking-profile-wrap .seeking-edit-title {
	margin: 0 0 14px 0;
	padding: 12px 14px;
	background: #f8fafc;
	border-left: 3px solid #2271b1;
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.5;
	color: #334155;
}

.seeking-profile-wrap .seeking-visibility-fieldset {
	border: 0;
	padding: 0;
	margin: 0 0 16px 0;
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	align-items: center;
}

.seeking-profile-wrap .seeking-visibility-option {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	cursor: pointer;
	color: #334155;
}

.seeking-profile-wrap .seeking-visibility-option input[type="radio"] {
	margin: 0;
	cursor: pointer;
	accent-color: #2271b1;
}

.seeking-profile-wrap .seeking-limit-notice {
	margin: 0 0 14px 0;
	padding: 10px 14px;
	background: #fef3c7;
	border-left: 3px solid #f59e0b;
	color: #78350f;
	font-size: 13px;
	line-height: 1.5;
	border-radius: 4px;
}

/* Disabled (cap-reached) state for unchecked items. */
.seeking-profile-wrap .seeking-edit-item--disabled {
	opacity: 0.45;
}
.seeking-profile-wrap .seeking-edit-item--disabled .seeking-edit-label {
	cursor: not-allowed;
}
.seeking-profile-wrap .seeking-edit-item--disabled .seeking-edit-label:hover {
	background: #fff;
	border-color: #e5e7eb;
}
.seeking-profile-wrap .seeking-edit-item--disabled .seeking-edit-checkbox {
	cursor: not-allowed;
}

/* ----------------------------------------------------------------
 * Privacy gate — logged-out visitor on a "members-only" profile.
 * ---------------------------------------------------------------- */

.seeking-privacy-gate {
	padding: 24px;
	margin: 0;
	background: #f8fafc;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	text-align: center;
}

.seeking-privacy-gate p {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: #334155;
}

.seeking-privacy-gate .seeking-auth-link {
	color: #2271b1;
	text-decoration: underline;
	font-weight: 600;
}

.seeking-privacy-gate .seeking-auth-link:hover {
	color: #1e5f92;
}

/* ----------------------------------------------------------------
 * Commitment slider — 7px × 150px track, 3px radius, 20px knob,
 * three snap positions (left / center / right).
 *
 * The label above the slider switches between:
 *   Exploring        (pos 0)
 *   Actively Seeking (pos 1)
 *   Immediate Need   (pos 2)
 * ---------------------------------------------------------------- */

.seeking-profile-wrap .seeking-slider {
	flex: 0 0 auto;
	width: 160px; /* 150 track + 5 overhang each side so knob doesn't clip */
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	user-select: none;
}

.seeking-profile-wrap .seeking-slider-label {
	font-size: 12px;
	font-weight: 500;
	color: #475569;
	letter-spacing: 0.01em;
	text-align: center;
	line-height: 1.2;
	white-space: nowrap;
	min-height: 14px;
	transition: color .2s ease;
}

.seeking-profile-wrap .seeking-slider[data-level="2"] .seeking-slider-label {
	color: #2271b1;
	font-weight: 600;
}

.seeking-profile-wrap .seeking-slider-track {
	position: relative;
	width: 150px;
	height: 7px;
	background: #e2e8f0;
	border-radius: 3px;
	cursor: pointer;
	outline: none;
	margin: 7px 0;
}

.seeking-profile-wrap .seeking-slider-track:focus-visible {
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.25);
}

/* Click targets for the three positions. Invisible but clickable. */
.seeking-profile-wrap .seeking-slider-tick {
	position: absolute;
	top: -10px;
	width: 24px;
	height: 27px;
	transform: translateX(-50%);
	cursor: pointer;
}
.seeking-profile-wrap .seeking-slider-tick[data-pos="0"] { left: 0; }
.seeking-profile-wrap .seeking-slider-tick[data-pos="1"] { left: 50%; }
.seeking-profile-wrap .seeking-slider-tick[data-pos="2"] { left: 100%; }

/* The moving knob. 20px round. Snaps to 0 / 50% / 100%. */
.seeking-profile-wrap .seeking-slider-knob {
	position: absolute;
	top: 50%;
	left: 0;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
	border: 1px solid #94a3b8;
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.08),
		0 2px 4px rgba(0, 0, 0, 0.06);
	transform: translate(-50%, -50%);
	transition: left .18s cubic-bezier(0.4, 0, 0.2, 1),
	            background .18s ease,
	            border-color .18s ease;
	pointer-events: none;
}

.seeking-profile-wrap .seeking-slider[data-level="0"] .seeking-slider-knob { left: 0; }
.seeking-profile-wrap .seeking-slider[data-level="1"] .seeking-slider-knob { left: 50%; }
.seeking-profile-wrap .seeking-slider[data-level="2"] .seeking-slider-knob { left: 100%; }

/* Track fill — colors the portion from left to the knob position. */
.seeking-profile-wrap .seeking-slider-track::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	border-radius: 3px 0 0 3px;
	background: linear-gradient(90deg, #60a5fa 0%, #2271b1 100%);
	transition: width .18s cubic-bezier(0.4, 0, 0.2, 1);
	pointer-events: none;
}

.seeking-profile-wrap .seeking-slider[data-level="0"] .seeking-slider-track::before { width: 0; }
.seeking-profile-wrap .seeking-slider[data-level="1"] .seeking-slider-track::before { width: 50%; }
.seeking-profile-wrap .seeking-slider[data-level="2"] .seeking-slider-track::before {
	width: 100%;
	border-radius: 3px;
}

/* Highlight the knob itself at level 2. */
.seeking-profile-wrap .seeking-slider[data-level="2"] .seeking-slider-knob {
	background: linear-gradient(180deg, #2271b1 0%, #1e5f92 100%);
	border-color: #1e5f92;
}

.seeking-profile-wrap .seeking-slider-track:hover .seeking-slider-knob {
	box-shadow:
		0 2px 4px rgba(0, 0, 0, 0.12),
		0 4px 8px rgba(0, 0, 0, 0.08);
}

/* Mobile — stack the slider below the label so everything fits. */
@media (max-width: 520px) {
	.seeking-profile-wrap .seeking-edit-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}
	.seeking-profile-wrap .seeking-slider {
		align-self: flex-end;
	}
}

/* ----------------------------------------------------------------
 * Read-only view — title above the pill row.
 * ---------------------------------------------------------------- */

.seeking-profile-wrap .seeking-public-title {
	margin: 0 0 18px 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.5;
	color: #475569;
	font-style: italic;
}

/* ----------------------------------------------------------------
 * Read-only view — horizontal inline-flow list.
 *
 * Items flow horizontally with ~15px horizontal space between them,
 * wrap naturally when the container's right edge is reached, and have
 * 15px of VERTICAL space between wrapped rows.
 *
 * Each item is a soft pill whose size/color/padding/radius scales
 * with the owner's commitment slider position.
 * ---------------------------------------------------------------- */

.seeking-profile-wrap .seeking-public-row {
	line-height: 1;
	word-spacing: normal;
	margin-left: -7px;
}

.seeking-public-item {
	display: inline-block;
	vertical-align: middle;
	margin: 0 7px 15px 7px;
}

/* Level 0 — Exploring. */
.seeking-profile-wrap .seeking-public-item[data-level="0"] {
	font-size: 15px;
	color: #000;
	background: #cccccc30;
	padding: 6px 13px;
	border-radius: 8px;
}

/* Level 1 — Actively Seeking. */
.seeking-profile-wrap .seeking-public-item[data-level="1"] {
	font-size: 18px;
	color: #566f49;
	background: #bbc3ac3b;
	padding: 6px 15px;
	border-radius: 10px;
	font-weight: 600;
}

/* Level 2 — Immediate Need. */
.seeking-profile-wrap .seeking-public-item[data-level="2"] {
	font-size: 23px;
	color: #47752f;
	font-weight: 600;
	padding: 8px 15px;
	background: #d1ddc052;
	border-radius: 12px;
}

/* When pills are rendered as <a> (autolink to filtered members directory),
 * strip default link styling so the pill's per-level color/background shows
 * through unchanged. The cursor remains a pointer (default <a> behavior)
 * which is exactly what we want.
 *
 * `position: relative` on the anchor is essential — it's the positioning
 * anchor for the custom tooltip drawn via the ::after pseudo-element below.
 */
.seeking-profile-wrap a.seeking-public-item,
.seeking-profile-wrap a.seeking-public-item:hover,
.seeking-profile-wrap a.seeking-public-item:focus,
.seeking-profile-wrap a.seeking-public-item:visited {
	text-decoration: none;
	color: inherit;
	position: relative;
}

.seeking-profile-wrap a.seeking-public-item:hover {
	filter: brightness(0.94);
	transition: filter .15s ease;
}

/* ----------------------------------------------------------------
 * Custom tooltip on profile pills.
 *
 * The native browser title="..." attribute produces a tooltip whose
 * appearance is entirely controlled by the OS — typically a small
 * black/dark-grey rectangle with cramped padding. We replace it with
 * a CSS-styled tooltip rendered via ::after, anchored to the pill.
 *
 * The tooltip text comes from data-tooltip="..." on the anchor and
 * is rendered as the ::after pseudo-element's content. The little
 * arrow under the tooltip is drawn via ::before.
 *
 * Note: if a parent ancestor has `overflow: hidden`, the tooltip
 * will be clipped. The default BP / GeneratePress profile chrome
 * does not have that constraint, but a heavily-customized theme might
 * need to override `overflow: visible` on the immediate container.
 *
 * Per spec:
 *   - background: dark blue #426db2 (not the OS-native dark grey)
 *   - padding: 9px 14px (~5/10 more than typical native tooltips)
 *   - max-width: 200px, with line-wrap for long content
 *   - font-size: 14px (~2px larger than typical native ~12px)
 * ---------------------------------------------------------------- */

.seeking-profile-wrap a.seeking-public-item[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%);

	/* Sizing & wrapping */
	max-width: 250px;
	width: max-content;
	white-space: normal;
	word-wrap: break-word;
	overflow-wrap: break-word;
	text-align: center;
	line-height: 1.4;

	/* Appearance */
	background: #426db2;
	color: #ffffff;
	font-size: 14px;
	font-weight: 500;
	font-style: normal;
	font-family: inherit;
	letter-spacing: 0;
	padding: 9px 14px;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(34, 53, 90, 0.25);

	/* Hidden by default; fade in on hover/focus. */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .15s ease, visibility .15s ease, transform .15s ease;
	z-index: 100;
}

/* Little triangular arrow under the tooltip pointing at the pill. */
.seeking-profile-wrap a.seeking-public-item[data-tooltip]::before {
	content: "";
	position: absolute;
	bottom: calc(100% + 4px);
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 6px solid #426db2;

	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .15s ease, visibility .15s ease;
	z-index: 100;
}

/* Show on hover or keyboard focus. */
.seeking-profile-wrap a.seeking-public-item[data-tooltip]:hover::after,
.seeking-profile-wrap a.seeking-public-item[data-tooltip]:focus-visible::after {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(-2px);
}

.seeking-profile-wrap a.seeking-public-item[data-tooltip]:hover::before,
.seeking-profile-wrap a.seeking-public-item[data-tooltip]:focus-visible::before {
	opacity: 1;
	visibility: visible;
}

/* ----------------------------------------------------------------
 * Members directory — filter banner.
 *
 * Rendered by Seeking_Autolink::render_filter_banner() when the URL
 * carries a ?seeking=<tag>&level=<n> query string. Per spec, the
 * banner shows ONLY a "Clear Filter" link — no "Filtered by: X" text.
 * The link points straight to the bare members directory permalink
 * so all filters (this one, plus any other URL params) drop off in
 * one click.
 * ---------------------------------------------------------------- */

.seeking-filter-banner {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	padding: 10px 14px;
	margin: -20px 0 18px 0;
	background: #eef4fb;
	background-clip: border-box;
	border-left: 4px solid #2271b1;
	color: #1e3a5f;
	font-size: 14px;
	line-height: 1.4;
	border-radius: 4px;
}

/* The descriptive label sits at the LEFT of the flex row.
 * justify-content: flex-end pushes the Clear Filter link to the
 * right; we use margin-right: auto on the label to push the link
 * to the right while the label itself keeps left alignment. */
.seeking-filter-banner-label {
	flex: 1 1 auto;
	margin-right: auto;
	color: #1e3a5f;
}
.seeking-filter-banner-label strong {
	color: #2271b1;
}
.seeking-filter-banner-label em {
	font-style: italic;
	color: #475569;
}

.seeking-filter-banner-clear {
	flex: 0 0 auto;
	color: #2271b1;
	text-decoration: underline;
	font-size: 14px;
	font-weight: 600;
}

.seeking-filter-banner-clear:hover {
	color: #1e3a5f;
}

/* ----------------------------------------------------------------
 * Hiring Now ribbon — overlay on the BP profile cover image.
 *
 * Positioning strategy:
 *   - The ribbon <div> is rendered server-side INSIDE #item-header
 *     (BuddyPress's profile header container). Most BP themes set
 *     `position: relative` on #item-header already, but we set it
 *     defensively below as well.
 *   - The ribbon is `position: absolute; top: 0; right: 0;` so it
 *     anchors to the top-right corner of the header — visually
 *     "above" the cover image because cover is a background-image
 *     on a sibling div, while the ribbon sits in front of it.
 *   - z-index: 5 keeps the ribbon above the cover image but below
 *     BP's modal overlays (z-index 999+) and the admin bar.
 *   - pointer-events: none lets clicks pass through to the cover
 *     image (which BP makes interactive for cover-image upload UI
 *     when the profile owner is viewing their own profile).
 *
 * Sizing:
 *   - Fixed 120×120px on every screen size. The ribbon does not scale
 *     down on tablet/mobile per spec — it stays the same size always.
 * ---------------------------------------------------------------- */

/* Defensive — ensure the BP header is a positioning context for our
 * absolute-positioned ribbon. Targets every common BP header wrapper
 * across legacy templates and BP Nouveau. */
body.seeking-has-hiring #item-header,
body.seeking-has-hiring #buddypress #item-header,
body.seeking-has-hiring .bp-user .user-header,
body.seeking-has-hiring #header-cover-image {
	position: relative;
}

/* Cover-image lift — pulls the BP cover-image div up so the ribbon
 * (rendered as a sibling element by `bp_before_member_header_meta`)
 * visually overlaps the cover image as a layer on top of it.
 *
 * SCOPED to `body.seeking-has-hiring` so this offset ONLY applies on
 * profiles where the ribbon is actually rendered. Profiles without
 * Hiring keep their cover image in its default position untouched.
 *
 * The -228px / -5px values were derived empirically from the
 * production theme's cover-image dimensions. If the theme is later
 * customized with a different cover-image height, override these in
 * a child theme using the same `body.seeking-has-hiring` selector. */
body.seeking-has-hiring div#item-header-cover-image {
	margin-top: -228px;
	margin-right: -5px;
}

.seeking-hiring-ribbon {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 5;
	pointer-events: none;
	line-height: 0;          /* prevent inline-baseline whitespace */
	width: 120px;
	height: 120px;
	user-select: none;
	-webkit-user-select: none;
	/* drop-shadow gives the ribbon depth against any cover image color */
	filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
	/* Subtle entrance animation on first render so the ribbon
	 * doesn't pop suddenly when the page paints. */
	animation: seeking-ribbon-in .35s ease-out both;
}

.seeking-hiring-ribbon__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	pointer-events: none;
	border: 0;
	background: transparent;
}

@keyframes seeking-ribbon-in {
	from { opacity: 0; transform: translate(8px, -8px) scale(0.92); }
	to   { opacity: 1; transform: translate(0, 0) scale(1); }
}

/* Respect users who prefer reduced motion — skip the entrance animation. */
@media (prefers-reduced-motion: reduce) {
	.seeking-hiring-ribbon {
		animation: none;
	}
}
