/**
 * Protect Youth Verified Badge — front-end styles.
 *
 * Renders the bundled "PYS Background Check" image badge.
 */

/* ------------------------------------------------------------------ */
/* Base badge container                                                */
/* ------------------------------------------------------------------ */
.pyb-badge {
	position: relative;
	display: inline-block;
	vertical-align: middle;
	line-height: 0;        /* Avoid extra baseline space under <img>. */
	max-width: 100%;
	text-decoration: none;
}

.pyb-badge__image {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

/* ------------------------------------------------------------------ */
/* Sizes — height-driven; width auto-scales with the image's ratio.    */
/* ------------------------------------------------------------------ */
.pyb-badge--small  .pyb-badge__image { height: 24px; }
.pyb-badge--medium .pyb-badge__image { height: 40px; }
.pyb-badge--large  .pyb-badge__image { height: 64px; }

/* ------------------------------------------------------------------ */
/* Tooltip                                                              */
/* ------------------------------------------------------------------ */
.pyb-badge__tooltip {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: #111;
	color: #fff;
	padding: .4em .65em;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.35;
	white-space: normal;
	width: max-content;
	max-width: 220px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s ease, transform .15s ease;
	z-index: 9999;
}
.pyb-badge__tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #111;
}
.pyb-badge--has-tooltip:hover .pyb-badge__tooltip,
.pyb-badge--has-tooltip:focus .pyb-badge__tooltip,
.pyb-badge--has-tooltip:focus-within .pyb-badge__tooltip {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ------------------------------------------------------------------ */
/* Layout safety on cards (wraps gracefully)                            */
/* ------------------------------------------------------------------ */
.directorist-listing-single__header__title .pyb-badge,
.directorist-listing-card__title .pyb-badge {
	margin-left: .4em;
	vertical-align: middle;
}

/* ------------------------------------------------------------------ */
/* Elementor "Posts" widget — top-right corner overlay on the card     */
/* ------------------------------------------------------------------ */

/* Establish a positioning context on the thumbnail link only.
   Do NOT touch overflow on .elementor-post__thumbnail — Elementor relies
   on overflow:hidden there to crop oversized images. */
.elementor-post__thumbnail__link {
	position: relative;
}

/* The overlay is pinned to the top-right of the thumbnail link. */
.pyb-card-overlay {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 5;
	display: inline-block;
	width: auto;
	height: auto;
	margin: 0;
	padding: 0;
	pointer-events: none;
	line-height: 0;
}

.pyb-card-overlay .pyb-badge {
	display: inline-block;
	position: static;
	margin: 0;
	pointer-events: auto;
}

.pyb-card-overlay .pyb-badge__image {
	display: block;
	height: 32px;
	width: auto;
	max-width: none;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
}

@media (max-width: 768px) {
	.pyb-card-overlay {
		top: 6px;
		right: 6px;
	}
	.pyb-card-overlay .pyb-badge__image {
		height: 26px;
	}
}

/* ------------------------------------------------------------------ */
/* Single listing page — extra horizontal breathing room.               */
/* ------------------------------------------------------------------ */
.single-at_biz_dir .pyb-badge,
.directorist-single-listing .pyb-badge,
.directorist-single-listings-header .pyb-badge {
	margin-left: 10px;
	margin-right: 10px;
}

/* ------------------------------------------------------------------ */
/* Mobile size step-down                                               */
/* ------------------------------------------------------------------ */
@media (max-width: 480px) {
	.pyb-badge--medium .pyb-badge__image { height: 32px; }
	.pyb-badge--large  .pyb-badge__image { height: 48px; }
	.pyb-badge__tooltip { max-width: 160px; }
}

/* ------------------------------------------------------------------ */
/* Admin meta-box tweak                                                 */
/* ------------------------------------------------------------------ */
.pyb-switch {
	display: inline-flex;
	align-items: center;
	gap: .5em;
	font-weight: 500;
}
