/* ARX Reporting — shared base styles.
   Reuses the same CSS-variable language as ARX Course Catalogue / ARX
   Dashboard Widgets (--arx-accent / --arx-text / --arx-muted / --arx-border
   / --arx-card-bg) for visual consistency across all three plugins, without
   a hard runtime dependency between them - see class-reporting-data.php's
   docblock for why the data layer stays independent too. Elementor's own
   Style-tab controls override these per-instance. */

.arx-report-summary,
.arx-report-table {
	--arx-accent: #559fc5;
	--arx-text: #1f2937;
	--arx-muted: #6b7280;
	--arx-border: #e5e7eb;
	--arx-card-bg: #ffffff;
	font-family: inherit;
	color: var( --arx-text );
}

.arx-report-summary,
.arx-report-summary *,
.arx-report-table,
.arx-report-table * {
	box-sizing: border-box;
}

.arx-reporting-widget.arx-empty-state {
	padding: 40px 24px;
	text-align: center;
	color: var( --arx-muted );
	background: var( --arx-card-bg );
	border: 1px dashed var( --arx-border );
	border-radius: 4px;
}

/* Summary stat tiles - same visual spec as ARX Dashboard Widgets'
   .arx-stat-tile (white card, 12px radius, same shadow values), duplicated
   under its own class name rather than shared since the two plugins don't
   depend on each other's CSS being loaded. */
.arx-report-summary {
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	gap: 16px;
}

.arx-report-tile {
	background: var( --arx-card-bg );
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.06 ), 0 1px 3px rgba( 16, 24, 40, 0.1 );
}

.arx-report-tile__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	border-radius: 50%;
	background-color: #eaf3f8;
	padding: 12px;
}

.arx-report-tile__icon svg {
	display: block;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

.arx-report-tile__number {
	font-size: 24px;
	font-weight: 800;
}

.arx-report-tile__label {
	font-size: 13px;
	color: var( --arx-muted );
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* Report table card - identical border/radius/padding/shadow treatment to
   ARX Course Catalogue's .arx-filter-bar, for the same "read as the same
   card surface as the rest of the site" reasoning. */
.arx-report-table {
	background: var( --arx-card-bg );
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	padding: 24px;
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.06 ), 0 1px 3px rgba( 16, 24, 40, 0.1 );
}

.arx-report-table__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}

.arx-report-table__field {
	position: relative;
}

.arx-report-table__field--search {
	flex: 1 1 auto;
	min-width: 200px;
}

.arx-report-table__search-icon {
	position: absolute;
	top: 50%;
	left: 14px;
	width: 16px;
	height: 16px;
	transform: translateY( -50% );
	color: var( --arx-muted );
	pointer-events: none;
}

/* Written as `.arx-report-table .arx-report-table__search` (not a bare
   class) for the same reason as ARX Course Catalogue's identically-scoped
   search input rule: Hello Elementor's reset.css styles `input[type=search]`
   directly, and that compound selector is *more* specific than a single
   class, so a bare class here would silently lose padding/border/radius to
   the theme regardless of stylesheet load order. */
.arx-report-table .arx-report-table__search {
	width: 100%;
	padding: 11px 14px 11px 38px;
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	font-size: 14px;
	color: var( --arx-text );
	background: var( --arx-card-bg );
}

.arx-report-table__select {
	flex: 0 0 auto;
	width: auto;
	max-width: 220px;
	padding: 11px 34px 11px 14px;
	border: 1px solid var( --arx-border );
	border-radius: 4px;
	font-size: 14px;
	color: var( --arx-text );
	background-color: var( --arx-card-bg );
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 12px center;
	/* No explicit width/height on that SVG (only a viewBox) - without a
	   background-size, browsers fall back to a default replaced-element
	   size (often 300x150) instead of the viewBox's 20x20, and the chevron
	   renders huge and bleeds across the option text. Pin it down. */
	background-size: 14px 14px;
}

.arx-report-table__search:focus,
.arx-report-table__select:focus {
	outline: none;
	border-color: var( --arx-accent );
	box-shadow: 0 0 0 3px color-mix( in srgb, var( --arx-accent ) 15%, transparent );
}

.arx-report-table__count {
	margin-left: auto;
	flex: 0 0 auto;
	font-size: 13px;
	color: var( --arx-muted );
	white-space: nowrap;
}

.arx-report-table__count [data-arx-report-count] {
	font-weight: 700;
	color: var( --arx-text );
}

.arx-report-table__scroll {
	overflow-x: auto;
}

.arx-report-table__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.arx-report-table__table th,
.arx-report-table__table td {
	padding: 14px 16px;
	text-align: left;
	white-space: nowrap;
	border-bottom: 1px solid var( --arx-border );
}

/* Rows get a hover tint even though nothing in them is clickable except
   the title/sort controls - matches the hover-as-"this is a live list, not
   static text" cue ARX Dashboard Widgets' pagination/tag-pill controls use,
   so the table reads as part of the same interactive product rather than
   static spreadsheet output. */
.arx-report-table__table tbody tr:hover td {
	background-color: #f9fafb;
}

.arx-report-table__table thead th {
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --arx-muted );
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	transition: color 0.15s ease;
}

/* A table column's final width is decided from every cell in it together -
   the header included. Without this, the unconstrained "Progress" <th>
   was still telling the table's auto layout "this column can be wider
   than 180px", leaving dead space to the right of the (correctly-capped,
   correctly-filled) bar in every body row. Mirroring the same width/
   max-width here gives the header and body cells one consistent signal. */
.arx-report-table__table th[data-sort="progress"] {
	width: 180px;
	max-width: 180px;
}

.arx-report-table__table thead th:hover {
	color: #2a77a8;
}

.arx-report-table__table thead th.is-sorted-asc,
.arx-report-table__table thead th.is-sorted-desc {
	color: #2a77a8;
}

/* Same chevron path/technique as .arx-report-table__select's dropdown
   arrow (see its comment above on background-size), reused here via
   mask-image instead of background-image so a single SVG can be recolored
   with background-color for the idle/hover/active states below - ties the
   sort affordance visually to the filter dropdowns right above it instead
   of reading as a generic HTML table sort indicator. */
.arx-report-table__table thead th::after {
	content: "";
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-left: 4px;
	vertical-align: middle;
	background-color: var( --arx-muted );
	opacity: 0.45;
	-webkit-mask-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" );
	mask-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" );
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: 10px 10px;
	mask-size: 10px 10px;
	transition: opacity 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.arx-report-table__table thead th:hover::after {
	opacity: 0.7;
}

.arx-report-table__table thead th.is-sorted-asc::after,
.arx-report-table__table thead th.is-sorted-desc::after {
	opacity: 1;
	background-color: var( --arx-accent );
}

.arx-report-table__table thead th.is-sorted-asc::after {
	transform: rotate( 180deg );
}

.arx-report-table__title-cell a {
	color: var( --arx-text );
	font-weight: 600;
	text-decoration: none;
	white-space: normal;
}

.arx-report-table__title-cell a:hover {
	text-decoration: underline;
}

/* Echoes .arx-course-card__category's accent-tinted label treatment so a
   splash of brand color shows up per row instead of the table being pure
   grayscale text apart from the status badge/progress bar. */
.arx-report-table__category-cell {
	color: #2a77a8;
	font-weight: 600;
	font-size: 13px;
}

/* Quiets "no value" placeholders (category/enrolled/completed) so they
   read as an intentional empty state rather than broken/missing data. */
.arx-report-table__dash {
	color: var( --arx-border );
}

/* Same soft pill treatment as .arx-course-card__meta-item, so "2 of 2"
   reads as a small metadata chip rather than bare table text. */
.arx-report-table__steps-chip {
	display: inline-block;
	font-size: 13px;
	color: var( --arx-muted );
	background: #f9fafb;
	border: 1px solid var( --arx-border );
	border-radius: 3px;
	padding: 3px 10px;
}

.arx-report-status-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 3px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #fff;
	background-color: var( --arx-muted );
}

.arx-report-status-badge--completed {
	background-color: #16a34a;
}

.arx-report-status-badge--in-progress {
	background-color: var( --arx-accent );
}

.arx-report-status-badge--not-started {
	background-color: var( --arx-muted );
}

/* `width` (not just `min-width`) is deliberate: .progress-bar inside here
   has `overflow: hidden`, which resets a flex item's automatic minimum
   size to ~0, so under `table-layout: auto` the browser has almost no
   reliable content signal for how wide this column should be and under-
   allocates it - the bar+text then overflow past the cell's real (too
   narrow) boundary unclipped, which is what made a correctly-100%-filled
   bar look like it stopped partway. An explicit `width` gives the table's
   column-sizing algorithm a hard number instead of an ambiguous one. */
.arx-report-table__progress-cell {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 180px;
	min-width: 140px;
	/* `width` alone is a *preferred* size hint to the table's auto column-
	   sizing, not a cap - once the other mostly-dash columns (category/
	   enrolled/completed) claim very little space for themselves, this
	   column's now well-defined preferred size was getting handed extra
	   leftover width on top, stretching the cell (and the visible gap
	   after the bar/label) well past 180px. `max-width` pins it as a hard
	   ceiling so it can't be over-allocated regardless of how little space
	   neighboring columns claim for themselves. */
	max-width: 180px;
}

.arx-report-table__progress-bar {
	position: relative;
	flex: 1;
	height: 10px;
	background: var( --arx-border );
	border-radius: 3px;
	overflow: hidden;
}

/* Absolutely positioned (not a plain block child sized by `width: X%`)
   so its percentage resolves against .progress-bar's own padding box
   directly, rather than through .progress-bar's dual role as both a flex
   item (flex: 1, of the row above) and, being inside a `display: flex` td,
   an input to the table's own auto column-width pass - a combination some
   browsers don't reconcile consistently, which was under-filling the bar
   at high percentages. */
.arx-report-table__progress-bar-fill {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background: var( --arx-accent );
	border-radius: 3px;
}

.arx-report-table__progress-percent {
	font-size: 13px;
	color: var( --arx-muted );
	flex-shrink: 0;
}

.arx-report-table__empty-row td {
	text-align: center;
	color: var( --arx-muted );
	padding: 32px 14px;
	white-space: normal;
}

@media ( max-width: 767px ) {
	.arx-report-summary {
		grid-template-columns: repeat( 2, 1fr );
	}

	.arx-report-table__field--search,
	.arx-report-table__select {
		flex: 1 1 100%;
		width: 100%;
		max-width: none;
	}

	.arx-report-table__count {
		margin-left: 0;
		flex: 1 1 100%;
	}
}

@media ( max-width: 480px ) {
	.arx-report-summary {
		grid-template-columns: 1fr;
	}
}

.arx-report-table__cert-link { display: inline-flex; align-items: center; padding: 4px 12px; border: 1px solid #2f7fb3; border-radius: 4px; color: #2f7fb3; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.arx-report-table__cert-link:hover { background: #2f7fb3; color: #ffffff; }

/* v1.1.1: keep the progress column a real table cell (a flex <td> drew its own box and misaligned the row),
   and set chapter names in a readable weight rather than condensed bold. */
.arx-report-table__table td.arx-report-table__progress-cell { display: table-cell; vertical-align: middle; width: 190px; white-space: nowrap; }
.arx-report-table__progress-cell .arx-report-table__progress-bar { display: inline-block; vertical-align: middle; width: calc( 100% - 48px ); }
.arx-report-table__progress-cell .arx-report-table__progress-percent { display: inline-block; vertical-align: middle; width: 42px; margin-left: 6px; text-align: right; }
body .arx-report-table__title-cell a { font-family: "Roboto", system-ui, sans-serif; font-size: 14px; font-weight: 600; }
