/* Excelra Knowledge Hub — brand color tokens (override in your child theme
 * if needed). Typography deliberately uses `inherit` throughout instead of
 * hardcoded fonts, so headings/body text pick up whatever font family and
 * weight your theme/Elementor Global Typography settings already define —
 * no separate font stack to keep in sync. */
:root {
	--ekh-pink: #D255A0;
	--ekh-pink-link: #FF64B9;
	--ekh-blue: #71AAE8;
	--ekh-navy: #2D3142;
	--ekh-border: #E5E7EB;
	--ekh-bg-soft: #F7F8FA;
}

.ekh-kh-filters, .ekh-kh-grid {
	font-family: inherit;
	color: var(--ekh-navy);
}

/* Only used by the [excelra_knowledge_hub] shortcode (backward-compat combined
 * layout). Individual "KH Filters" / "KH Grid" Elementor widgets are NOT
 * wrapped in this — their position/columns are controlled entirely by
 * Elementor's own section/column settings instead. */
.ekh-combined-wrap {
	display: grid;
	grid-template-columns: 280px 1fr;
	gap: 40px;
	align-items: start;
	width: 100%;
}

@media (max-width: 900px) {
	.ekh-combined-wrap { grid-template-columns: 1fr; }
}

/* ============ Sidebar (KH Filters widget) ============ */
.ekh-sidebar {
	background: #fff;
	border: 1px solid var(--ekh-border);
	border-radius: 18px;
	padding: 26px 24px;
	box-shadow: 0 4px 18px rgba(45, 49, 66, 0.05);
}

.ekh-sidebar-title {
	font-size: 26px;
	margin: 0 0 20px;
	color: var(--ekh-navy);
	position: relative;
	padding-bottom: 14px;
}
.ekh-sidebar-title::after {
	content: '';
	position: absolute;
	left: 0;
	bottom: 0;
	width: 42px;
	height: 3px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--ekh-pink), var(--ekh-blue));
}

.ekh-searchbar {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--ekh-bg-soft);
	border: 1px solid var(--ekh-border);
	border-radius: 999px;
	padding: 11px 16px;
	margin-bottom: 16px;
	transition: border-color 0.15s ease, background 0.15s ease;
}
.ekh-searchbar:focus-within { border-color: var(--ekh-pink); background: #fff; }
.ekh-searchbar svg { flex-shrink: 0; opacity: 0.45; }
.ekh-searchbar input {
	border: none;
	outline: none;
	width: 100%;
	font-family: inherit;
	font-size: 14px;
	background: transparent;
	color: var(--ekh-navy);
}

.ekh-results-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ekh-navy);
	margin-bottom: 6px;
	flex-wrap: wrap;
}

.ekh-clear-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: var(--ekh-bg-soft) !important;
	border: 1px solid var(--ekh-border) !important;
	border-radius: 999px !important;
	padding: 6px 14px !important;
	font-size: 12px;
	font-weight: 600;
	color: var(--ekh-navy) !important;
	cursor: pointer;
	white-space: nowrap;
	box-shadow: none !important;
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ekh-clear-btn:hover { border-color: var(--ekh-pink) !important; color: var(--ekh-pink) !important; background: rgba(210, 85, 160, 0.06) !important; }

/* Filter groups — expanded by default */
.ekh-filter-group {
	border-top: 1px solid var(--ekh-border);
	padding: 18px 0;
}
.ekh-filter-group:first-of-type { border-top: 1px solid var(--ekh-border); margin-top: 6px; }

.ekh-filter-header {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: none !important;
	border: none !important;
	padding: 0 !important;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	color: var(--ekh-navy);
	cursor: pointer;
	box-shadow: none !important;
	text-align: left;
}
.ekh-chevron {
	transition: transform 0.15s ease;
	font-size: 12px;
	color: var(--ekh-pink);
	opacity: 0.8;
}
.ekh-filter-group.is-open .ekh-chevron { transform: rotate(180deg); }

.ekh-filter-panel {
	display: none;
	margin-top: 14px;
	width: 100%;
}
.ekh-filter-group.is-open .ekh-filter-panel { display: block; }

/* Only the Content Type panel uses this (8 content types = tallest list).
 * Topic/Solution Area/Date panels intentionally have NO max-height/overflow
 * at all, so there's nothing for the browser (or a theme's custom-scrollbar
 * script) to attach a scrollbar to. */
.ekh-filter-panel--scroll {
	max-height: 280px;
	overflow-y: auto;
	overflow-x: hidden !important;
	padding-right: 4px;
	scrollbar-width: thin; /* Firefox: vertical-only thin scrollbar, no horizontal track */
}
/* Defensive: if the theme runs a custom-scrollbar JS library (PerfectScrollbar,
 * SimpleBar, OverlayScrollbars, mCustomScrollbar, etc.) that auto-adds a
 * horizontal rail regardless of actual overflow, these hide the common
 * class names those libraries use. Harmless no-ops if none are present. */
.ekh-filter-panel--scroll .ps__rail-x,
.ekh-filter-panel--scroll .simplebar-horizontal,
.ekh-filter-panel--scroll .os-scrollbar-horizontal,
.ekh-filter-panel--scroll .mCSB_scrollTools.mCSB_scrollTools_horizontal {
	display: none !important;
}

.ekh-radio {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 14px;
	color: #4B5065;
	padding: 8px 10px;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.12s ease, color 0.12s ease;
	width: 100%;
	box-sizing: border-box;
}
.ekh-radio:hover { background: var(--ekh-bg-soft); color: var(--ekh-navy); }
.ekh-radio:has(input:checked) { color: var(--ekh-pink); font-weight: 600; }
.ekh-radio input { accent-color: var(--ekh-pink); width: 15px; height: 15px; flex-shrink: 0; }
.ekh-radio span, .ekh-radio { word-break: break-word; }

/* ============ Main content ============ */
.ekh-main-header {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	margin-bottom: 20px;
	min-height: 34px;
}

.ekh-sort-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ekh-navy);
}

.ekh-sort {
	border: 1px solid var(--ekh-border) !important;
	border-radius: 8px !important;
	padding: 8px 12px !important;
	font-family: inherit;
	font-size: 13px;
	background: #fff !important;
	color: var(--ekh-navy) !important;
	box-shadow: none !important;
}

.ekh-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	transition: opacity 0.2s ease;
}
.ekh-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.ekh-grid.is-loading { opacity: 0.5; pointer-events: none; }

@media (max-width: 1100px) { .ekh-grid, .ekh-grid--cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .ekh-grid, .ekh-grid--cols-3 { grid-template-columns: 1fr; } }

/* Card */
.ekh-card {
	background: #fff;
	border: 1px solid var(--ekh-border);
	border-radius: 16px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}
.ekh-card:hover {
	box-shadow: 0 16px 36px rgba(45, 49, 66, 0.13);
	transform: translateY(-4px);
	border-color: rgba(210, 85, 160, 0.25);
}

.ekh-card__thumb-link { position: relative; display: block; overflow: hidden; }
.ekh-card__thumb {
	width: 100%;
	height: 180px;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}
.ekh-card:hover .ekh-card__thumb { transform: scale(1.05); }
.ekh-card__thumb--placeholder {
	background: linear-gradient(135deg, var(--ekh-pink), var(--ekh-blue));
	height: 180px;
	position: relative;
	overflow: hidden;
}
.ekh-card__thumb--placeholder::after {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at 25% 25%, rgba(255,255,255,0.25), transparent 55%);
}

.ekh-card__type-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	background: rgba(45, 49, 66, 0.85);
	backdrop-filter: blur(2px);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 5px 11px;
	border-radius: 999px;
}

.ekh-card__body { padding: 20px 22px 24px; display: flex; flex-direction: column; flex-grow: 1; }

.ekh-card__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ekh-card__tag {
	font-size: 11px;
	font-weight: 600;
	color: var(--ekh-pink);
	background: rgba(210, 85, 160, 0.08);
	padding: 3px 10px;
	border-radius: 999px;
}
.ekh-card__tag:nth-child(2n) { color: var(--ekh-blue); background: rgba(113, 170, 232, 0.10); }

.ekh-card__title {
	font-size: 16px;
	line-height: 1.4;
	margin: 0 0 10px;
}
.ekh-card__title a { color: #444444 !important; text-decoration: none; transition: color 0.15s ease; }
.ekh-card__title a:hover { color: var(--ekh-pink-link) !important; }

.ekh-card__excerpt {
	font-size: 14px;
	color: #5B6072;
	line-height: 1.55;
	margin: 0 0 16px;
	flex-grow: 1;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ekh-card__meta {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 12px;
	color: #9AA0AE;
	margin-bottom: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--ekh-border);
}

.ekh-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 700;
	color: var(--ekh-pink);
	text-decoration: none;
	transition: gap 0.15s ease, color 0.15s ease;
}
.ekh-card__cta svg { transition: transform 0.15s ease; }
.ekh-card__cta:hover { color: var(--ekh-pink-link); gap: 9px; }
.ekh-card__cta:hover svg { transform: translateX(2px); }

.ekh-no-results { grid-column: 1 / -1; text-align: center; color: #9AA0AE; padding: 60px 0; }

/* Load more */
.ekh-loadmore-wrap { text-align: center; margin-top: 40px; }
.ekh-loadmore {
	background: var(--ekh-navy) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 999px !important;
	padding: 13px 36px !important;
	font-family: inherit;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.15s ease;
	box-shadow: 0 6px 16px rgba(45, 49, 66, 0.18) !important;
}
.ekh-loadmore:hover { background: var(--ekh-pink) !important; transform: translateY(-1px); }

/* ============================================================
 * HORIZONTAL BAR LAYOUT (alternate to the sidebar layout above)
 * Toggle via the "Layout" control on the KH Filters widget, or
 * [excelra_knowledge_hub layout="horizontal"] on the shortcode.
 * Everything below is scoped under these two modifier classes,
 * so it has zero effect on the default sidebar layout.
 * ============================================================ */

/* Shortcode combined-wrap: stack full-width instead of the 280px+1fr grid */
.ekh-combined-wrap--horizontal {
	display: block;
}
.ekh-combined-wrap--horizontal .ekh-kh-grid { margin-top: 24px; }

/* The filter bar itself: a single horizontal row instead of a tall card */
.ekh-kh-filters--horizontal {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	background: #fff;
	border: 1px solid var(--ekh-border);
	border-radius: 14px;
	box-shadow: 0 4px 14px rgba(45, 49, 66, 0.05);
}

.ekh-kh-filters--horizontal .ekh-searchbar {
	margin-bottom: 0;
	width: auto;
	min-width: 220px;
	flex: 1 1 220px;
	order: 1;
}

.ekh-kh-filters--horizontal .ekh-results-row {
	margin-bottom: 0;
	width: auto;
	flex: 0 0 auto;
	order: 99; /* Clear Filters sits at the end of the bar */
	gap: 8px;
}
.ekh-kh-filters--horizontal .ekh-results-count { display: none; } /* count still updates in JS, just no room to show it inline in the bar */

/* Each filter group becomes a dropdown toggle button instead of a
 * stacked, always-expanded section. */
.ekh-kh-filters--horizontal .ekh-filter-group {
	border-top: none;
	padding: 0;
	position: relative;
	order: 2;
}

.ekh-kh-filters--horizontal .ekh-filter-header {
	display: inline-flex !important;
	width: auto !important;
	align-items: center;
	gap: 6px;
	background: var(--ekh-bg-soft) !important;
	border: 1px solid var(--ekh-border) !important;
	border-radius: 999px !important;
	padding: 9px 16px !important;
	font-size: 13px !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	font-weight: 600;
	white-space: nowrap;
}
.ekh-kh-filters--horizontal .ekh-filter-group.is-open .ekh-filter-header {
	border-color: var(--ekh-pink) !important;
	color: var(--ekh-pink);
	background: rgba(210, 85, 160, 0.06) !important;
}

/* Dropdown panel: absolutely positioned overlay instead of inline block */
.ekh-kh-filters--horizontal .ekh-filter-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 30;
	background: #fff;
	border: 1px solid var(--ekh-border);
	border-radius: 12px;
	box-shadow: 0 14px 32px rgba(45, 49, 66, 0.14);
	padding: 10px 8px;
	min-width: 220px;
	margin-top: 0 !important;
}
.ekh-kh-filters--horizontal .ekh-filter-panel.ekh-filter-panel--scroll {
	max-height: 280px;
	overflow-y: auto;
	overflow-x: hidden !important;
}
.ekh-kh-filters--horizontal .ekh-radio { padding: 8px 10px; }

@media (max-width: 780px) {
	.ekh-kh-filters--horizontal { flex-direction: column; align-items: stretch; }
	.ekh-kh-filters--horizontal .ekh-filter-panel { left: 0; right: 0; min-width: 0; }
}
