/**
 * WB Listora — List Page (Pattern B) CSS
 *
 * Styles for Reviews, Claims, and Listing Types admin pages.
 *
 * @package WBListora
 */

/* ─── Filter Tabs ─── */

.listora-filter-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid var(--listora-border);
	margin-bottom: 16px;
}

.listora-filter-tab {
	padding: 8px 16px;
	font-size: 13px;
	color: var(--listora-fg-muted);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	transition: all 0.12s;
}

.listora-filter-tab:hover {
	color: var(--listora-fg-default);
}

.listora-filter-tab.is-active {
	color: var(--listora-accent);
	border-bottom-color: var(--listora-accent);
	font-weight: 500;
}

.listora-filter-tab__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 18px;
	padding: 0 6px;
	margin-right: 4px;
	font-size: 11px;
	font-weight: 600;
	background: var(--listora-bg-tertiary);
	border-radius: 10px;
	color: var(--listora-fg-muted);
}

.listora-filter-tab.is-active .listora-filter-tab__count {
	background: rgba(34, 113, 177, 0.1);
	color: var(--listora-accent);
}

/* ─── Filter Bar ─── */

.listora-filter-bar {
	display: flex;
	gap: 8px;
	margin-bottom: 16px;
	align-items: center;
}

.listora-search-input {
	padding: 6px 12px;
	border: 1px solid var(--listora-border);
	border-radius: var(--listora-radius-md);
	font-size: 13px;
	min-width: 240px;
}

.listora-search-input:focus-visible {
	outline: 2px solid var(--listora-primary, var(--listora-info));
	outline-offset: 2px;
	border-color: var(--listora-accent);
	box-shadow: 0 0 0 1px var(--listora-accent);
}

.listora-filter-select {
	padding: 6px 12px;
	border: 1px solid var(--listora-border);
	border-radius: var(--listora-radius-md);
	font-size: 13px;
	background: var(--listora-fg-inverse, var(--listora-bg-elevated));
}

.listora-filter-select:focus-visible {
	outline: 2px solid var(--listora-primary, var(--listora-info));
	outline-offset: 2px;
	border-color: var(--listora-accent);
	box-shadow: 0 0 0 1px var(--listora-accent);
}

/* ─── Table ─── */

.listora-table-wrap {
	overflow-x: auto;
}

.listora-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--listora-fg-inverse, var(--listora-bg-elevated));
	border: 1px solid var(--listora-border);
	border-radius: var(--listora-radius-lg);
	overflow: hidden;
}

.listora-table th {
	padding: 10px 16px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--listora-fg-muted);
	background: var(--listora-bg-muted);
	border-bottom: 1px solid var(--listora-border);
	text-align: right;
}

.listora-table td {
	padding: 12px 16px;
	font-size: 13px;
	border-bottom: 1px solid var(--listora-border);
	color: var(--listora-fg-default);
}

.listora-table tbody tr:last-child td {
	border-bottom: none;
}

.listora-table tbody tr:hover {
	background: var(--listora-bg-muted);
}

.listora-table__check {
	width: 40px;
}

.listora-row-title {
	font-weight: 600;
	color: var(--listora-fg-default);
}

.listora-row-actions {
	display: flex;
	gap: 8px;
}

.listora-action-link {
	font-size: 12px;
	color: var(--listora-accent);
	text-decoration: none;
}

.listora-action-link:hover {
	text-decoration: underline;
}

.listora-action-link--danger {
	color: var(--listora-danger);
}

.listora-action-link--danger:hover {
	color: var(--listora-danger);
}

/* ─── Star Rating ─── */

.listora-star-rating {
	color: var(--listora-warning);
	font-size: 14px;
	letter-spacing: 1px;
}

.listora-star-rating__empty {
	color: var(--listora-text-tertiary);
}

/* ─── Review Excerpt ─── */

.listora-review-excerpt__title {
	font-weight: 600;
	margin-bottom: 2px;
}

.listora-review-excerpt__text {
	color: var(--listora-fg-muted);
	font-size: 12px;
}

/* ─── Table Footer ─── */

.listora-table-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 12px;
}

.listora-bulk-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.listora-pagination {
	display: flex;
	gap: 4px;
}

/* ─── Type Icon Cell ─── */

.listora-type-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: var(--listora-radius-md);
	background: var(--listora-bg-muted);
	color: var(--listora-accent);
}

.listora-type-icon [data-lucide] {
	width: 16px;
	height: 16px;
}

/* ─── Narrow phones (moderation screens) ──────────────────────────────────
 *
 * Reviews and Claims are the two screens an owner moderates from, and at
 * 320px both pushed the document past the viewport: 332px and 328px
 * respectively, with the Rejected tab ending beyond the right edge and the
 * search field holding a 240px floor next to a gap and a Filter button
 * (BC 10208352202).
 *
 * The tabs WRAP rather than scroll. A horizontal scroller hides the last tab
 * behind a gesture with no affordance, and "Rejected" being invisible on a
 * moderation queue is the tab most likely to matter. Wrapping costs a row of
 * height and hides nothing.
 * ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {

	.listora-filter-tabs {
		flex-wrap: wrap;
		row-gap: 4px;
	}

	/* The 240px floor is what pushed the row past the viewport. Below 480px
	   the field takes the row it is on instead. */
	.listora-search-input {
		min-width: 0;
		flex: 1 1 100%;
	}

	.listora-list-filters,
	.listora-filter-row {
		flex-wrap: wrap;
	}
}

/* ─── Wide admin tables must be reachable ─────────────────────────────────
 *
 * .listora-card sets overflow: hidden to keep its rounded corners, and the
 * Claims/Reviews tables are 940px of eight columns. At iPad portrait that is
 * 940 inside a 729px card, so the Actions column - the entire point of a
 * moderation screen - was cut off with NO way to reach it: hidden overflow
 * cannot be scrolled, panned or tabbed into view (BC 10208352202, QA bounce).
 *
 * A card that CONTAINS one of these tables scrolls horizontally instead of
 * hiding it. Scoped with :has() so every other admin card keeps its clipped
 * corners; only the ones holding a wide table change behaviour.
 *
 * min-width on the table keeps the columns legible rather than letting eight
 * of them compress into 729px, which "fits" while being unreadable.
 * ──────────────────────────────────────────────────────────────────────── */
.listora-card:has( > .listora-table ) {
	overflow-x: auto;
}

.listora-card > .listora-table {
	min-width: 820px;
}

@media (max-width: 1024px) {

	.listora-card:has( > .listora-table ) {
		/* Trailing-edge fade: the cue that the row continues. Without it the
		   Actions column simply looks absent rather than off-screen. */
		--listora-table-fade-dir: to right;
		mask-image: linear-gradient(var(--listora-table-fade-dir), #000 96%, transparent 100%);
	}

	[dir="rtl"] .listora-card:has( > .listora-table ) {
		--listora-table-fade-dir: to left;
	}
}
