/* Power Shift Africa – Media Centre AJAX search
   ------------------------------------------------------------------------
   One clearly-labelled block per component, matching the granular
   shortcodes ([psa_search_input], [psa_search_button], [psa_topic_filters],
   [psa_tabs], [psa_page_title], [psa_grid], [psa_pagination]).

   If you're styling a piece from Elementor instead: each shortcode's
   wrapper renders inside Elementor's own ".elementor-widget-container",
   which already gets a full Style/Advanced tab (background, border,
   spacing, etc) natively — no CSS needed for that. Use the classes below
   only for things Elementor's native panel can't reach (e.g. the exact
   look of the <input> itself), or delete a block entirely if you're
   handling that component 100% via Elementor Global Classes instead. */

/* ---------- psa_search_input ---------- */
.psa-widget--search-input-wrap {
	position: relative;
	display: block;
	width: 100%;
}

.psa-widget--search-input {
	padding: 10px 14px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 14px;
	width: 100%;
	box-sizing: border-box;
}

.psa-widget--search-input__icon {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	pointer-events: none;
}

.psa-widget--search-input__icon--before {
	left: 12px;
}

.psa-widget--search-input__icon--after {
	right: 12px;
}

/* Default breathing room so text doesn't run under the icon — overridden
   automatically if you set your own Padding in the widget's Style tab. */
.psa-widget--search-input.psa-has-icon-before {
	padding-left: 36px;
}

.psa-widget--search-input.psa-has-icon-after {
	padding-right: 36px;
}

/* ---------- psa_search_button ---------- */
.psa-widget--search-button {
	box-sizing: border-box;
	padding: 10px 20px;
	border: none;
	border-radius: 4px;
	background: #6fa93b;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

/* ---------- psa_topic_filters ---------- */
.psa-widget--topic-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	font-size: 13px;
}

.psa-widget--topic-filters__label {
	font-weight: 600;
	text-transform: uppercase;
	font-size: 12px;
}

.psa-widget--topic-filters__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
}

.psa-widget--topic-filters__item--all {
	font-weight: 600;
}

/* Custom checkbox appearance — native checkboxes can't be reliably styled
   (shape/background/size) across browsers, so we hide the native control
   visually with appearance:none and draw the box + checkmark ourselves.
   Every property below is overridable from the PSA Topic Filters widget's
   Style tab (Checkbox section) without touching this file. */
.psa-topic-input {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	width: 16px;
	height: 16px;
	margin: 0;
	border: 1px solid #999;
	border-radius: 3px;
	background-color: #fff;
	display: inline-block;
	vertical-align: middle;
	cursor: pointer;
	position: relative;
	flex-shrink: 0;
}

.psa-topic-input:checked {
	background-color: #6fa93b;
	border-color: #6fa93b;
}

.psa-topic-input:checked::after {
	content: '';
	position: absolute;
	left: 30%;
	top: 12%;
	width: 25%;
	height: 50%;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* ---------- psa_tabs ---------- */
.psa-widget--tabs {
	display: flex;
	gap: 8px;
}

.psa-tab {
	padding: 12px 24px;
	border: none;
	background: #f2e2c4;
	color: #333;
	font-weight: 600;
	cursor: pointer;
}

.psa-tab.is-active {
	background: #6fa93b;
	color: #fff;
}

/* Toggled either via the PSA Tabs widget's "Stretch Tabs Equally" switcher
   (Content tab, using Elementor's prefix_class mechanism — lands on an
   ancestor element) or via [psa_tabs stretch="yes"] (lands directly on
   .psa-widget--tabs) — the selector below covers both cases. */
.psa-tabs-stretch-yes .psa-widget--tabs,
.psa-widget--tabs.psa-tabs-stretch-yes {
	display: flex;
	width: 100%;
}

.psa-tabs-stretch-yes .psa-tab {
	flex: 1 1 0;
	text-align: center;
}

/* ---------- psa_page_title ---------- */
.psa-widget--page-title {
	margin: 24px 0;
}

/* ---------- psa_grid (one per category: news / analysis) ---------- */
.psa-widget--grid {
	margin-bottom: 40px;
}

.psa-widget--grid__heading {
	margin-bottom: 16px;
}

.psa-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	transition: opacity 0.15s ease;
}

.psa-grid.is-loading {
	opacity: 0.4;
	pointer-events: none;
}

/* "Featured + Grid" layout (PSA Post Grid → Content → Grid Layout) — the
   first post in the query renders large, spanning 2 columns and 2 rows;
   everything else fills in as a smaller grid alongside/below it. Same
   dynamic post data and card markup as the uniform grid — this only
   changes placement/sizing via CSS Grid, so it survives AJAX refreshes
   automatically (the class lives on the grid wrapper, not the cards). */
.psa-grid--featured {
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 1fr;
}

.psa-grid--featured .psa-card:first-child {
	grid-column: span 2;
	grid-row: span 2;
}

.psa-grid--featured .psa-card:first-child .psa-card__thumb {
	height: 100%;
	min-height: 320px;
}

.psa-grid--featured .psa-card:first-child .psa-card__title {
	font-size: 1.4em;
}

@media (max-width: 900px) {
	.psa-grid--featured .psa-card:first-child {
		grid-column: 1 / -1;
		grid-row: span 1;
	}
	.psa-grid--featured .psa-card:first-child .psa-card__thumb {
		min-height: 200px;
	}
}

/* Card markup is shared by every grid — see psa_render_card() in the PHP */
.psa-card {
	display: flex;
	flex-direction: column;
	background: #fff;
}

/* PSA Post Grid "Card Source: Elementor Template" — the template controls
   its own layout/background entirely, so undo the built-in card's opinions
   rather than fighting them. */
.psa-card--template {
	display: block;
	background: none;
}

.psa-card__thumb-wrap {
	position: relative;
}

.psa-card__thumb-link {
	display: block;
}

.psa-card__thumb {
	width: 100%;
	height: 200px;
	object-fit: cover;
	display: block;
}

.psa-card__badge {
	position: absolute;
	left: 12px;
	bottom: 12px;
	background: #e9c46a;
	color: #333;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	padding: 4px 10px;
	text-decoration: none;
	transition: color 0.15s ease, background-color 0.15s ease;
}

a.psa-card__badge:hover {
	text-decoration: underline;
}

.psa-card__body {
	padding: 12px 0;
}

.psa-card__title {
	font-size: 16px;
	margin: 0 0 8px;
	transition: color 0.15s ease;
}

.psa-card__title a {
	color: inherit;
	text-decoration: none;
}

.psa-card__date {
	font-size: 12px;
	color: #777;
	margin-bottom: 8px;
	transition: color 0.15s ease;
}

.psa-card__readmore {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	color: #6fa93b;
	text-decoration: none;
	transition: color 0.15s ease;
}

.psa-no-results {
	grid-column: 1 / -1;
	text-align: center;
	padding: 40px 0;
	color: #777;
}

/* ---------- psa_pagination ---------- */
.psa-widget--pagination {
	margin-top: 32px;
}

.psa-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
}

.psa-page-btn {
	box-sizing: border-box;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	border: 1px solid #ccc;
	background: #fff;
	color: #333;
	cursor: pointer;
	border-radius: 4px;
	outline: none;
	font: inherit;
	transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.psa-page-btn.is-active {
	background: #144d36;
	color: #fff;
	border-color: #144d36;
}

.psa-page-btn--nav,
.psa-page-btn--jump {
	font-weight: 600;
}

.psa-page-btn--nav {
	padding: 0 16px;
}

.psa-page-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* ---------- psa_reset_button ---------- */
.psa-widget--reset-button {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 20px;
	border: none;
	border-radius: 4px;
	background: #e2e2e2;
	color: #333;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.psa-widget--reset-button__icon {
	display: inline-flex;
	align-items: center;
}

/* ---------- shared utility ---------- */
/* Toggled by JS on any element carrying data-psa-category, based on the
   active tab — including your own custom Elementor elements tagged the
   same way. */
.psa-is-hidden {
	display: none !important;
}

/* data-psa-show-until-search / data-psa-show-after-search (or the
   equivalent psa-show-until-search / psa-show-after-search CSS classes on
   free Elementor) — the DEFAULT state (before any search/filter/tab/page
   interaction) is a real CSS rule, not something JS applies after the page
   has already painted, so there's no flash of an after-search element (like
   a Reset button) before it gets hidden. JS only ever toggles one class,
   .psa-has-searched, on <body> — see applySearchStateVisibility() in
   media-center-ajax.js. */
[data-psa-show-after-search],
.psa-show-after-search {
	display: none !important;
}

body.psa-has-searched [data-psa-show-until-search],
body.psa-has-searched .psa-show-until-search {
	display: none !important;
}

body.psa-has-searched [data-psa-show-after-search],
body.psa-has-searched .psa-show-after-search {
	display: block !important;
}

/* legacy .psa-search-bar / .psa-search-row wrapper, used only by the
   backward-compatible [psa_media_center_search] shortcode */
.psa-search-bar {
	max-width: 900px;
}

.psa-search-row {
	display: flex;
	gap: 12px;
	margin-bottom: 12px;
}

@media (max-width: 900px) {
	.psa-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.psa-grid {
		grid-template-columns: 1fr;
	}
	.psa-search-row {
		flex-direction: column;
	}
}
