/* =========================================================================
   ApexRush Table Builder — Frontend Styles
   https://apexrush.com
   ========================================================================= */

/* ── Elementor widget wrapper ────────────────────────────────────────────── */

.elementor-widget-apexrush_table_builder,
.elementor-widget-apexrush_table_builder > .elementor-widget-container {
	width: 100%;
}

/* ── Wrapper & Scroll Container ─────────────────────────────────────────── */

.ar-table-wrap {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.ar-table-scroll {
	width: 100%; /* default; overridden by Elementor width control */
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* Search bar always spans the full wrap width, not affected by align-items */
.ar-table-search-wrap {
	align-self: stretch;
}

/* ── Base Table ──────────────────────────────────────────────────────────── */

.ar-table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	font-size: inherit;
	line-height: 1.55;
	table-layout: auto;
}

/* ── Caption ─────────────────────────────────────────────────────────────── */

.ar-table caption {
	caption-side: bottom;
	font-size: 0.85em;
	color: #6b7280;
	text-align: left;
	padding: 8px 4px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.ar-table thead th {
	background-color: #1a3a6e;
	color: #ffffff;
	font-weight: 600;
	font-size: 0.8125rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 14px 18px;
	text-align: left;
	border: 1px solid #e2e8f0;
	white-space: nowrap;
	position: relative;
	user-select: none;
}

/* ── Sortable Header ─────────────────────────────────────────────────────── */

.ar-table.ar-sortable thead th.ar-sortable-col {
	cursor: pointer;
	padding-right: 34px;
}

.ar-table.ar-sortable thead th.ar-sortable-col:hover {
	background-color: #163163;
}

.ar-table thead th .ar-sort-icon {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 0.75em;
	color: rgba(255, 255, 255, 0.5);
	transition: color 0.15s ease;
	line-height: 1;
}

.ar-table thead th.ar-sort-asc .ar-sort-icon::after {
	content: ' ▲';
	color: #fff;
}

.ar-table thead th.ar-sort-desc .ar-sort-icon::after {
	content: ' ▼';
	color: #fff;
}

.ar-table thead th.ar-sort-asc .ar-sort-icon,
.ar-table thead th.ar-sort-desc .ar-sort-icon {
	color: transparent;
}

/* ── Body Cells ──────────────────────────────────────────────────────────── */

.ar-table tbody td {
	padding: 12px 18px;
	color: #374151;
	border: 1px solid #e2e8f0;
	border-style: solid;
	border-width: 1px;
	border-color: #e2e8f0;
	vertical-align: middle;
	transition: background-color 0.12s ease;
}

/* ── Alternating Row Stripes ─────────────────────────────────────────────── */

.ar-table tbody tr:nth-child(odd):not(.ar-row-subheader) td {
	background-color: #ffffff;
}

.ar-table tbody tr:nth-child(even):not(.ar-row-subheader) td {
	background-color: #f4f7fb;
}

/* ── Hover ───────────────────────────────────────────────────────────────── */

.ar-table tbody tr:not(.ar-row-subheader):hover td {
	background-color: #e8f0fe;
}

/* ── Sub-Header Rows ─────────────────────────────────────────────────────── */

.ar-table tbody tr.ar-row-subheader td {
	background-color: #dde5f0;
	color: #1a3a6e;
	font-weight: 600;
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding-top: 10px;
	padding-bottom: 10px;
}

/* ── Hidden rows (search filter) ────────────────────────────────────────── */

.ar-table tbody tr.ar-hidden {
	display: none;
}

/* ── Search Bar ──────────────────────────────────────────────────────────── */

.ar-table-search-wrap {
	margin-bottom: 16px;
	position: relative;
}

.ar-table-search-wrap::before {
	content: '';
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: contain;
	pointer-events: none;
}

.ar-table-search {
	width: 100%;
	max-width: 320px;
	padding: 10px 14px 10px 38px;
	font-size: 0.9rem;
	color: #374151;
	background-color: #ffffff;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	box-sizing: border-box;
}

.ar-table-search:focus {
	border-color: #1a3a6e;
	box-shadow: 0 0 0 3px rgba(26, 58, 110, 0.12);
}

.ar-table-search::placeholder {
	color: #9ca3af;
}

/* ── Responsive: Stack Mode ──────────────────────────────────────────────── */

@media (max-width: 640px) {
	.ar-table-scroll.ar-resp-stack .ar-table,
	.ar-table-scroll.ar-resp-stack .ar-table thead,
	.ar-table-scroll.ar-resp-stack .ar-table tbody,
	.ar-table-scroll.ar-resp-stack .ar-table thead th,
	.ar-table-scroll.ar-resp-stack .ar-table tbody td,
	.ar-table-scroll.ar-resp-stack .ar-table tbody tr {
		display: block;
	}

	.ar-table-scroll.ar-resp-stack .ar-table thead tr {
		position: absolute;
		top: -9999px;
		left: -9999px;
	}

	.ar-table-scroll.ar-resp-stack .ar-table tbody td {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 12px;
		border: none;
		border-bottom: 1px solid #e2e8f0;
		padding: 10px 12px;
		text-align: right;
		white-space: normal;
	}

	.ar-table-scroll.ar-resp-stack .ar-table tbody td::before {
		content: attr(data-label);
		flex: 0 0 auto;
		max-width: 45%;
		font-weight: 600;
		font-size: 0.8rem;
		color: #1a3a6e;
		white-space: nowrap;
		text-align: left;
	}

	.ar-table-scroll.ar-resp-stack .ar-table tbody tr {
		margin-bottom: 12px;
		border: 1px solid #e2e8f0;
		border-radius: 8px;
		overflow: hidden;
	}

	/* Sub-header rows in stack mode: full-width category divider, no label prefix */
	.ar-table-scroll.ar-resp-stack .ar-table tbody tr.ar-row-subheader {
		border-radius: 0;
		margin-bottom: 0;
		margin-top: 8px;
	}

	.ar-table-scroll.ar-resp-stack .ar-table tbody tr.ar-row-subheader td {
		display: block;
		padding-left: 12px;
		text-align: left;
	}

	.ar-table-scroll.ar-resp-stack .ar-table tbody tr.ar-row-subheader td::before {
		content: none;
	}

	.ar-table-search {
		max-width: 100%;
	}
}

/* ── Responsive: Scroll Mode (default) ──────────────────────────────────── */

.ar-table-scroll.ar-resp-scroll {
	overflow-x: auto;
}

/* ── No-results message ──────────────────────────────────────────────────── */

.ar-table-no-results {
	text-align: center;
	padding: 32px 16px;
	color: #9ca3af;
	font-size: 0.9rem;
	display: none;
}

.ar-table-no-results.ar-visible {
	display: block;
}

/* ── Comparison Mode ────────────────────────────────────────────────────── */

.ar-table-wrap.ar-comparison .ar-table {
	border-collapse: collapse;
}

/* Flatten row backgrounds — section/page provides the dark canvas */
.ar-table-wrap.ar-comparison .ar-table tbody tr:nth-child(odd):not(.ar-row-subheader) td,
.ar-table-wrap.ar-comparison .ar-table tbody tr:nth-child(even):not(.ar-row-subheader) td {
	background-color: transparent;
}

.ar-table-wrap.ar-comparison .ar-table tbody tr:not(.ar-row-subheader):hover td {
	background-color: rgba(255, 255, 255, 0.03);
}

/* Header cells */
.ar-table-wrap.ar-comparison .ar-table thead th {
	background-color: transparent;
	color: rgba(255, 255, 255, 0.45);
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	border-top: 2px solid transparent;
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
	border-left: 1px solid transparent;
	border-right: 1px solid transparent;
	padding-top: 18px;
}

/* Body cells */
.ar-table-wrap.ar-comparison .ar-table tbody td {
	background-color: transparent;
	color: rgba(255, 255, 255, 0.75);
	border-top: none;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	border-left: 1px solid transparent;
	border-right: 1px solid transparent;
}

/* Winner column — header */
.ar-table-wrap.ar-comparison .ar-table thead th.ar-col-winner {
	color: #43C1C3;
	border-top-color: #43C1C3;
	border-left-color: rgba(67, 193, 195, 0.25);
	border-right-color: rgba(67, 193, 195, 0.25);
}

/* Winner column — cells */
.ar-table-wrap.ar-comparison .ar-table td.ar-col-winner {
	color: rgba(255, 255, 255, 0.92);
	border-left-color: rgba(67, 193, 195, 0.25);
	border-right-color: rgba(67, 193, 195, 0.25);
}

/* Loser column — header */
.ar-table-wrap.ar-comparison .ar-table thead th.ar-col-loser {
	color: rgba(255, 255, 255, 0.3);
}

/* Loser column — cells */
.ar-table-wrap.ar-comparison .ar-table td.ar-col-loser {
	color: rgba(255, 255, 255, 0.3);
}

/* ── Focus accessibility ─────────────────────────────────────────────────── */

.ar-table.ar-sortable thead th.ar-sortable-col:focus-visible {
	outline: 3px solid #3b82f6;
	outline-offset: -2px;
}
