/**
 * Chamber Fusion — public directory styles (app-style grid).
 *
 * Minimalist, mobile-first card grid for [chamber_fusion_directory]:
 * swipeable category pills, featured-tier card accents, avatar fallbacks,
 * 2-line clamped titles, and pure-CSS skeleton loaders. Scoped under
 * .cf-directory, theme-agnostic. No external libraries.
 *
 * @package Chamber_CRM
 * @since   1.2.0
 * @since   1.19.0 App-style rewrite.
 */

.cf-directory {
	/* White-label engine: the chamber-configured palette arrives as
	   :root custom properties (Chamber Fusion → Settings → Branding).
	   Every rule below consumes these scoped tokens, so this block is
	   the single re-theme point; hex fallbacks cover any context where
	   the wp_head injector did not run. Duplicate declarations are
	   deliberate — browsers without color-mix() drop the invalid line
	   and keep the static fallback. */
	--cf-accent: var(--cf-primary-color, #1e40af);
	--cf-accent-dark: #1e3a8a;
	--cf-accent-dark: color-mix(in srgb, var(--cf-accent) 80%, #000000);
	--cf-gold: var(--cf-accent-color, #dba617);
	--cf-surface: #ffffff;
	--cf-border: #e2e8f0;
	--cf-text: #1e293b;
	--cf-muted: #64748b;
	--cf-radius: 12px;

	margin: 0 auto;
}

/* ------------------------------------------------------------------ */
/* Controls: search bar + swipeable category pills.                    */
/* ------------------------------------------------------------------ */

.cf-directory__controls {
	margin-bottom: 8px;
}

.cf-directory__search {
	width: 100%;
	padding: 13px 18px;
	border: 1px solid var(--cf-border);
	border-radius: var(--cf-radius);
	font-size: 16px;
	color: var(--cf-text);
	background: var(--cf-surface);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cf-directory__search:focus {
	outline: none;
	border-color: var(--cf-accent);
	box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--cf-accent) 18%, transparent);
}

/* Horizontal, swipe-scrollable pill row. */

.cf-directory__pills {
	display: flex;
	gap: 8px;
	margin-top: 12px;
	padding-bottom: 6px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;            /* Firefox */
}

.cf-directory__pills::-webkit-scrollbar {
	display: none;                    /* Chrome/Safari */
}

.cf-pill {
	flex: 0 0 auto;
	cursor: pointer;
}

/* The radio is functionally present but visually hidden. */
.cf-pill__input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.cf-pill__label {
	display: inline-block;
	padding: 7px 16px;
	border: 1px solid var(--cf-border);
	border-radius: 999px;
	background: var(--cf-surface);
	color: var(--cf-muted);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cf-pill:hover .cf-pill__label {
	border-color: var(--cf-accent);
	color: var(--cf-accent);
}

.cf-pill__input:checked + .cf-pill__label {
	background: var(--cf-accent);
	border-color: var(--cf-accent);
	color: #ffffff;
}

.cf-pill__input:focus-visible + .cf-pill__label {
	outline: 2px solid var(--cf-accent);
	outline-offset: 2px;
}

.cf-directory__status {
	margin: 4px 0 18px;
	font-size: 14px;
	color: var(--cf-muted);
}

/* ------------------------------------------------------------------ */
/* The grid + minimalist cards.                                        */
/* ------------------------------------------------------------------ */

.cf-directory__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 18px;
}

.cf-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 26px 18px 18px;
	background: var(--cf-surface);
	border: 1px solid var(--cf-border);
	border-radius: var(--cf-radius);
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cf-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

/* Featured tier accent: gold top border + corner badge. */

.cf-card-featured {
	border-top: 3px solid var(--cf-gold);
}

.cf-card__featured-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	padding: 2px 10px;
	border-radius: 999px;
	background: #fcf9e8;
	background: color-mix(in srgb, var(--cf-gold) 12%, #ffffff);
	border: 1px solid var(--cf-gold);
	color: #996800;
	color: color-mix(in srgb, var(--cf-gold) 55%, #000000);
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* Avatar: synced logo, or first-letter fallback. */

.cf-card__logo,
.cf-avatar-fallback {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	margin-bottom: 12px;
	object-fit: cover;
	border: 1px solid var(--cf-border);
}

.cf-avatar-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--cf-accent);
	color: #ffffff;
	font-size: 26px;
	font-weight: 700;
	line-height: 1;
	border: none;
}

/* 2-line clamped business name keeps card heights uniform. */

.cf-card__name {
	margin: 0 0 4px;
	font-size: 16px;
	font-weight: 700;
	color: var(--cf-text);
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(2 * 1.3em);
}

.cf-card__verified {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	margin-left: 4px;
	line-height: 0;
}

.cf-card__verified svg {
	display: block;
}

.cf-card__category {
	margin-bottom: 14px;
	font-size: 12px;
	font-weight: 600;
	color: var(--cf-muted);
}

/* Call to action row. */

.cf-card__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	margin-top: auto;
}

.cf-card__view {
	flex: 1;
	max-width: 150px;
	padding: 9px 14px;
	border-radius: 8px;
	background: var(--cf-accent);
	color: #ffffff;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.cf-card__view:hover {
	background: var(--cf-accent-dark);
	color: #ffffff;
}

.cf-card__call {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #f1f5f9;
	color: var(--cf-muted);
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.cf-card__call:hover {
	background: var(--cf-accent);
	color: #ffffff;
}

.cf-card__call .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* ------------------------------------------------------------------ */
/* Skeleton loaders (pure CSS pulse).                                  */
/* ------------------------------------------------------------------ */

@keyframes cf-skeleton-pulse {
	0%, 100% { opacity: 1; }
	50%      { opacity: 0.45; }
}

.cf-skeleton-loader {
	pointer-events: none;
	animation: cf-skeleton-pulse 1.4s ease-in-out infinite;
}

.cf-skeleton__avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	margin-bottom: 12px;
	background: #e9eef5;
}

.cf-skeleton__line {
	height: 12px;
	border-radius: 6px;
	background: #e9eef5;
	margin-bottom: 8px;
}

.cf-skeleton__line--title { width: 75%; }
.cf-skeleton__line--meta  { width: 45%; margin-bottom: 18px; }

.cf-skeleton__button {
	width: 60%;
	height: 34px;
	border-radius: 8px;
	background: #e9eef5;
	margin-top: auto;
}

/* ------------------------------------------------------------------ */
/* Empty state + pagination.                                           */
/* ------------------------------------------------------------------ */

.cf-directory__empty {
	padding: 56px 20px;
	text-align: center;
	color: var(--cf-muted);
	border: 1px dashed var(--cf-border);
	border-radius: var(--cf-radius);
}

.cf-directory__empty .dashicons {
	font-size: 36px;
	width: 36px;
	height: 36px;
	margin-bottom: 8px;
}

.cf-directory__pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin-top: 28px;
	/* Clean separation from the site footer / content below (v1.82.0). */
	margin-bottom: 3rem;
}

.cf-directory__page {
	min-width: 40px;
	padding: 8px 12px;
	border: 1px solid var(--cf-border);
	border-radius: 8px;
	background: var(--cf-surface);
	color: var(--cf-text);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.cf-directory__page:hover:not(:disabled) {
	background: var(--cf-accent);
	border-color: var(--cf-accent);
	color: #ffffff;
}

.cf-directory__page.is-current {
	background: var(--cf-accent);
	border-color: var(--cf-accent);
	color: #ffffff;
	cursor: default;
}
