/*
 * WP Rankings v2 — Archive / Search hero band polish.
 * Styles ONLY the Blockstrap hero/header shell around the native GeoDirectory
 * search + loop. The GD search widget, loop, paging and the listing rows are
 * left entirely to GeoDirectory.
 */

.wpr-v2-arch-hero {
	--wpr-home-ink: #101828;
	--wpr-home-muted: #667085;
	--wpr-home-line: #e4e7ec;
	--wpr-home-primary: #5b39f2;
	--wpr-home-primary-2: #8c3cf7;
	position: relative;
	/* Clear the Bootstrap .fixed-top navbar (~60px) plus breathing room. */
	padding: clamp(5.5rem, 6vw, 7rem) 0 clamp(1.5rem, 2.6vw, 2.4rem);
	color: var(--wpr-home-ink);
	background:
		radial-gradient(circle at 15% 14%, rgba(91, 57, 242, 0.12), transparent 30rem),
		radial-gradient(circle at 92% 18%, rgba(140, 60, 247, 0.07), transparent 30rem),
		linear-gradient(180deg, #fff 0%, #fbfbff 100%);
	font-family: Inter, -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif;
}

/* Guard against the mb-3 Blockstrap JS recovery can inject on the section container. */
.wpr-v2-arch-hero.mb-3 {
	margin-bottom: 0 !important;
}

.wpr-v2-arch-title {
	margin: 0;
	font-family: Montserrat, -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif;
	font-size: clamp(1.8rem, 3vw, 2.6rem);
	line-height: 1.1;
	font-weight: 800;
	letter-spacing: -0.015em;
	color: #111827;
}

.wpr-v2-arch-subtitle {
	margin: 0.55rem 0 0;
	max-width: 46rem;
	color: #475467;
	font-size: clamp(1rem, 1.2vw, 1.12rem);
	line-height: 1.5;
	font-weight: 400;
}

/* Polished container around the native GD search bar (spacing/card only). */
.wpr-v2-arch-search {
	margin-top: 1.4rem;
}

.wpr-v2-arch-search .geodir-search-form-wrapper {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

/* Native search-results count line (gd_loop_paging) shown in the search header. */
.wpr-header-search-numbers {
	margin-top: 0.85rem;
	color: var(--wpr-home-muted);
	font-size: 0.85rem;
}

/* ---- Hero top row: left = title/subtitle, right = compact horizontal stat cards.
       (The native GD search bar sits full-width BELOW this row.) ---- */
.wpr-v2-arch-row {
	--bs-gutter-x: 1.4rem;
	--bs-gutter-y: 1rem;
	align-items: center;
}

.wpr-v2-arch-main,
.wpr-v2-arch-aside {
	min-width: 0;
}

/* 3 small cards side by side; right-aligned to the title on desktop. */
.wpr-v2-arch-stats {
	display: flex;
	flex-flow: row wrap;
	gap: 0.6rem;
	justify-content: flex-start;
}

.wpr-v2-arch-stat {
	flex: 1 1 0;
	min-width: 7rem;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	padding: 0.6rem 0.8rem;
	border: 1px solid rgba(16, 24, 40, 0.08);
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}

.wpr-v2-arch-stat-label {
	color: var(--wpr-home-muted);
	font-size: 0.66rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.wpr-v2-arch-stat-value {
	font-family: Montserrat, -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif;
	font-size: clamp(0.95rem, 1.15vw, 1.1rem);
	line-height: 1.15;
	font-weight: 700;
	color: #111827;
	white-space: nowrap;
}

.wpr-v2-arch-stat.is-muted .wpr-v2-arch-stat-value {
	color: var(--wpr-home-muted);
	font-weight: 600;
}

/* Neutralise any stray <p> wpautop injects around the stats shortcode. */
.wpr-v2-arch-aside p {
	margin: 0;
	display: contents;
}

@media (min-width: 992px) {
	.wpr-v2-arch-stats {
		justify-content: flex-end;
		flex-wrap: nowrap;
	}
}

/* Mobile: let the cards breathe across the full width. */
@media (max-width: 575.98px) {
	.wpr-v2-arch-stat {
		flex-basis: 100%;
	}
}

/* ---- Ranking table (CoinMarketCap-style) ---- */
.wpr-v2-rank-wrap {
	--wpr-home-ink: #101828;
	--wpr-home-muted: #667085;
	--wpr-home-line: #e9ebf0;
	--wpr-home-primary: #5b39f2;
	margin: 0;
	border: 1px solid rgba(16, 24, 40, 0.08);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 18px 48px rgba(16, 24, 40, 0.07);
	overflow: hidden;
	font-family: Inter, -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif;
}

.wpr-v2-rank-table {
	margin: 0;
	color: var(--wpr-home-ink);
	font-size: 0.9rem;
	vertical-align: middle;
}

.wpr-v2-rank-table > thead > tr > th {
	padding: 0.85rem 1rem;
	border-bottom: 1px solid var(--wpr-home-line);
	background: #fbfbfe;
	color: var(--wpr-home-muted);
	font-size: 0.74rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.wpr-v2-rank-table > tbody > tr > td {
	padding: 0.7rem 1rem;
	border-top: 1px solid var(--wpr-home-line);
	vertical-align: middle;
}

.wpr-v2-rank-table > tbody > tr:first-child > td {
	border-top: 0;
}

.wpr-v2-rank-row:hover {
	background-color: rgba(91, 57, 242, 0.04);
}

.wpr-c-rank {
	width: 1%;
	white-space: nowrap;
	color: #475467;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.wpr-c-num,
.wpr-c-est {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.wpr-v2-row-link {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	gap: 0.6rem;
	min-width: 0;
	color: var(--wpr-home-ink);
	text-decoration: none;
	font-weight: 600;
	line-height: 1.2;
}

.wpr-v2-row-link:hover {
	color: var(--wpr-home-primary);
}

.wpr-v2-row-link:hover .wpr-v2-row-name {
	color: var(--wpr-home-primary);
	text-decoration: underline;
}

.wpr-v2-row-ico {
	flex: none;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 6px;
	object-fit: cover;
	background: #f2f4f7;
	border: 1px solid rgba(16, 24, 40, 0.08);
}

.wpr-v2-row-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpr-v2-est-main {
	display: block;
	font-weight: 600;
}

.wpr-v2-est-official {
	display: block;
	margin-top: 0.1rem;
	color: var(--wpr-home-muted);
	font-size: 0.72rem;
	font-weight: 400;
}

/* Growth / movement indicators */
.wpr-up {
	color: #027a48;
	font-weight: 600;
}

.wpr-down {
	color: #b42318;
	font-weight: 600;
}

.wpr-flat {
	color: var(--wpr-home-muted);
}

/* ----------------------------------------------------------------------------
 * Fit all six columns inside the card at desktop width — no horizontal scroll
 * (scrollWidth === clientWidth), mirroring the single-page compare-card fix.
 * Root cause of the prior overflow: an auto-layout table let the long Plugin
 * names force the table wider than the card. Fixed layout + a flexible name
 * column makes the name ellipsis-truncate while every numeric column stays put.
 * Applies to both the /trending/ widget table and the /plugins/ archive (same
 * .wpr-v2-rank-table component).
 * -------------------------------------------------------------------------- */
.wpr-v2-rank-table {
	table-layout: fixed;
	width: 100%;
}

/* Allow the long "Estimated installs" header to wrap within its fixed column. */
.wpr-v2-rank-table > thead > tr > th {
	white-space: normal;
}

/* Tighter horizontal padding so the numeric columns need less room. */
.wpr-v2-rank-table > thead > tr > th,
.wpr-v2-rank-table > tbody > tr > td {
	padding-left: 0.7rem;
	padding-right: 0.7rem;
}

/* Column widths: fixed for rank + numbers + estimate; Plugin takes the rest. */
.wpr-c-rank {
	width: 3rem;
}

.wpr-c-num {
	width: 5rem;
	text-align: right;
}

.wpr-c-est {
	width: 9.5rem;
	text-align: right;
}

.wpr-c-name {
	width: auto;
}

/* The name link must fill the cell so the name can shrink + ellipsis. */
.wpr-v2-row-link {
	display: flex;
	width: 100%;
}

.wpr-v2-row-name {
	flex: 1 1 auto;
}

/* Estimated-installs cell keeps the estimate and the "+ official" active-installs
   line stacked and right-aligned — both stay visible after the fit. */
.wpr-c-est .wpr-v2-est-main,
.wpr-c-est .wpr-v2-est-official {
	white-space: nowrap;
}

/* Responsive: drop the lowest-priority columns on narrow viewports, always
   keeping rank, plugin, 24h trend, and the Estimated/Active installs column. */
@media (max-width: 991.98px) {
	.wpr-c-est {
		width: 8.5rem;
	}
	.wpr-c-num {
		width: 4.25rem;
	}
}

@media (max-width: 767.98px) {
	/* hide Growth % (column 5) */
	.wpr-v2-rank-table > thead > tr > th:nth-child(5),
	.wpr-v2-rank-table > tbody > tr > td:nth-child(5) {
		display: none;
	}
}

@media (max-width: 575.98px) {
	/* also hide 7d (column 4); keep #, Plugin, 24h, Estimated installs */
	.wpr-v2-rank-table > thead > tr > th:nth-child(4),
	.wpr-v2-rank-table > tbody > tr > td:nth-child(4) {
		display: none;
	}
	.wpr-v2-rank-table {
		font-size: 0.82rem;
	}
	.wpr-c-num {
		width: 3.75rem;
	}
	.wpr-c-est {
		width: 7rem;
	}
}

/* ============================================================================
 * Native GeoDirectory search + Advanced Search filter panel — visual polish.
 *
 * Scoped ENTIRELY under .wpr-v2-arch-search (the v2 wrapper around the native
 * [gd_search] block) so it never touches the ranking table/loop or any global
 * form. We only restyle the native GD markup — no markup is added or removed,
 * no filter behaviour is changed. Filters are opened by the native block
 * setting customize_filters='always' (data-show-adv="always"); CSS only.
 * ========================================================================== */
.wpr-v2-arch-search {
	--wpr-f-ink: #101828;
	--wpr-f-muted: #667085;
	--wpr-f-line: #e4e7ec;
	--wpr-f-primary: #5b39f2;
	font-family: Inter, -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif;
}

/* One polished panel: the whole search container reads as a single white card. */
.wpr-v2-arch-search .geodir-search-container {
	background: #fff;
	border: 1px solid var(--wpr-f-line);
	border-radius: 14px;
	padding: 0.7rem 0.8rem;
	box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
}

.wpr-v2-arch-search .geodir-search-form-wrapper {
	margin: 0 !important;
}

/* Compact, subtle inputs (scoped — not a global .form-control override). */
.wpr-v2-arch-search .form-control,
.wpr-v2-arch-search .cat_input {
	height: auto;
	padding: 0.4rem 0.65rem;
	font-size: 0.9rem;
	border: 1px solid var(--wpr-f-line);
	border-radius: 9px;
	color: var(--wpr-f-ink);
	background-color: #fff;
}

.wpr-v2-arch-search .form-control:focus,
.wpr-v2-arch-search .cat_input:focus {
	border-color: var(--wpr-f-primary);
	box-shadow: 0 0 0 0.18rem rgba(91, 57, 242, 0.15);
}

/* Keyword search icon stays muted; never purple unless interacted with. */
.wpr-v2-arch-search .geodir-search-input-label {
	color: var(--wpr-f-muted);
}

/* Cleaner field labels: small, uppercase, muted. */
.wpr-v2-arch-search .form-field-label {
	margin-bottom: 0.25rem;
	color: var(--wpr-f-muted);
	font-size: 0.68rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	line-height: 1.2;
}

/* The advanced filter tray: a light inset that connects to the bar, compact. */
.wpr-v2-arch-search .customize_filter_inner {
	margin: 0.55rem 0 0 !important;
	padding: 0.75rem 0.75rem 0.25rem !important;
	background: #fbfbff !important;
	border: 1px solid var(--wpr-f-line);
	border-radius: 11px;
	row-gap: 0 !important;
}

/* Compact filter cells; tighter wrapping than the native 200px min-width. */
.wpr-v2-arch-search .geodir-filter-cat {
	min-width: 170px !important;
	margin-bottom: 0.65rem !important;
}

/* From/to numeric pair: keep them snug as one control. */
.wpr-v2-arch-search .geodir-filter-cat .input-group {
	gap: 0.4rem;
	flex-wrap: nowrap;
}

.wpr-v2-arch-search .geodir-filter-cat .input-group .cat_input {
	border-radius: 9px;
}

/* Submit: kill the giant full-width purple button — compact + accent only.
   Applies to both the main-bar submit and the in-panel submit. */
.wpr-v2-arch-search .geodir_submit_search.btn {
	width: auto !important;
	min-width: 7.5rem;
	padding: 0.45rem 1.1rem;
	border-radius: 9px;
	font-size: 0.9rem;
	font-weight: 600;
	white-space: nowrap;
}

/* Align the main-bar submit vertically with the keyword input. */
.wpr-v2-arch-search .geodir-search > .gd-search-field-search:last-of-type {
	align-self: center;
}

/* In-panel submit sits at the end of the filter row, right-aligned. */
.wpr-v2-arch-search .geodir-advance-search {
	display: flex;
	justify-content: flex-end;
	margin-top: 0.25rem;
}

.wpr-v2-arch-search .geodir-advance-search .gd-search-field-search {
	flex: 0 0 auto;
}

/* Duplicate-submit hierarchy: the [gd_search] form natively renders TWO submit
   buttons when filters are open (customize_filters='always') — one in the main
   search row, one at the foot of the filter panel. Both are native and kept.
   Keep the MAIN-BAR submit prominent (solid primary, set above); demote the
   IN-PANEL submit to a compact secondary/outline "apply" action so the pair
   reads as intentional. CSS only — no markup, label, or behaviour change.
   (The button's icon/label can't be changed natively without AJAX search,
   which is intentionally off, so we only restyle it.) */
.wpr-v2-arch-search .geodir-advance-search .geodir_submit_search.btn {
	min-width: 0;
	padding: 0.32rem 0.85rem;
	font-size: 0.82rem;
	color: var(--wpr-f-primary);
	background-color: #fff;
	background-image: none;
	border: 1px solid rgba(91, 57, 242, 0.35);
	box-shadow: none;
}

.wpr-v2-arch-search .geodir-advance-search .geodir_submit_search.btn:hover,
.wpr-v2-arch-search .geodir-advance-search .geodir_submit_search.btn:focus {
	color: #fff;
	background-color: var(--wpr-f-primary);
	border-color: var(--wpr-f-primary);
	box-shadow: 0 0 0 0.18rem rgba(91, 57, 242, 0.15);
}

/* ----------------------------------------------------------------------------
 * Alpha: no advanced filters are configured for gd_place, so the native
 * "Advanced Filters" cog toggle would open an EMPTY panel (just a duplicate
 * submit). With nothing to filter, hide the empty advanced-filter affordances
 * so the search reads as a clean keyword box + one submit. CSS only, scoped to
 * .wpr-v2-arch-search — the native markup, keyword search, main submit, loop,
 * and the preserved search URL are all untouched. Re-add advanced fields in
 * GD > CPT > Search to bring these back automatically.
 * -------------------------------------------------------------------------- */
.wpr-v2-arch-search .gd-search-field-search-filters,
.wpr-v2-arch-search .geodir-filter-container {
	display: none !important;
}

/* Mobile: stack filters and let controls breathe; full-width submit is fine here. */
@media (max-width: 575.98px) {
	.wpr-v2-arch-search .geodir-filter-cat {
		min-width: 100% !important;
	}

	.wpr-v2-arch-search .geodir_submit_search.btn {
		width: 100% !important;
	}

	.wpr-v2-arch-search .geodir-advance-search {
		justify-content: stretch;
	}
}

/* ============================================================================
 * UsersWP profile / account "Plugins" tab — WP Rankings card variant.
 * Rendered by WPR_V2_Archive_Item::render_profile_card() inside the native
 * UsersWP listings grid (.geodir-category-list-view .row-cols-1.row-cols-sm-2).
 * One line only: the plugin title (icon + name) and, for owners, the Edit
 * plugin action. Rank + stats live on the main /plugins/ archive table, not
 * here. No archive/search markup is touched — this only styles the card block.
 * ========================================================================== */

/* Full-width, stacked rows: one plugin per row at the full container width, instead
   of the native row-cols 2/3-column grid. The cards are the direct children of the
   .geodir-category-list-view row, so override their column width. Scoped to the
   UsersWP profile page (body.uwp_profile_page) so the archive/category grids are
   untouched. Per-card layout (icon + name left, Edit plugin right) is handled by
   .wpr-v2-pc-head below. */
body.uwp_profile_page .geodir-category-list-view > * {
	flex: 0 0 100%;
	max-width: 100%;
	width: 100%;
}

.wpr-v2-profile-card {
	--wpr-home-ink: #101828;
	--wpr-home-muted: #667085;
	--wpr-home-line: #e9ebf0;
	--wpr-home-primary: #5b39f2;
	height: 100%;
	margin-bottom: 1rem;
	padding: 0.9rem 1rem;
	border: 1px solid rgba(16, 24, 40, 0.08);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
	font-family: Inter, -apple-system, BlinkMacSystemFont, "segoe ui", Roboto, Helvetica, Arial, sans-serif;
}

.wpr-v2-pc-head {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	min-width: 0;
}

.wpr-v2-pc-title {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	flex: 1 1 auto;
	min-width: 0;
	color: var(--wpr-home-ink);
	text-decoration: none;
	font-weight: 600;
	line-height: 1.2;
}

.wpr-v2-pc-title:hover,
.wpr-v2-pc-title:hover .wpr-v2-pc-name {
	color: var(--wpr-home-primary);
}

.wpr-v2-pc-title:hover .wpr-v2-pc-name {
	text-decoration: underline;
}

.wpr-v2-pc-ico {
	flex: none;
	width: 1.8rem;
	height: 1.8rem;
	border-radius: 6px;
	object-fit: cover;
	background: #f2f4f7;
	border: 1px solid rgba(16, 24, 40, 0.08);
}

.wpr-v2-pc-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpr-v2-pc-actions {
	flex: 0 0 auto;
	margin-left: auto;
}

.wpr-v2-pc-edit {
	font-weight: 600;
}
