/**
 * BRN Plugin — Market Indices table
 */

.brn-mi {
	--brn-thead-bg: #0f3c74;
	--brn-thead-color: #fff;
	--brn-thead-radius: 6px;
	--brn-value-align: center;
	--brn-row-height: 0px;
	--brn-chip-min: 60px;
	--brn-row-border: #eaf0f6;
	--brn-row-accent: #1c9ad6;
	--brn-accent-width: 3px;
	--brn-accent-height: 16px;
	--brn-up: #00a3e0;
	--brn-up-bg: #e4f4fc;
	--brn-down: #e4384f;
	--brn-down-bg: #fdeaed;
	--brn-flat: #8a97a8;

	position: relative;
	box-sizing: border-box;
	background-color: #fff;
	border-radius: 24px;
	padding: 32px 32px 26px;
}

.brn-mi *,
.brn-mi *::before,
.brn-mi *::after {
	box-sizing: border-box;
}

/* Header ------------------------------------------------------------------ */

/* The badge sits level with the middle of the heading block, as in the design. */
.brn-mi__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	margin-block-end: 22px;
}

.brn-mi__heading {
	min-width: 0;
}

.brn-mi__title {
	margin: 0;
	color: #0b2e58;
	font-size: 26px;
	font-weight: 800;
	line-height: 1.3;
}

.brn-mi__subtitle {
	margin: 6px 0 0;
	color: #7c8aa0;
	font-size: 13px;
	line-height: 1.6;
}

.brn-mi__badge {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	flex: none;
	padding: 6px 13px;
	border-radius: 999px;
	background-color: #e7f7f0;
	color: #0e9f6e;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
}

.brn-mi__badge-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background-color: currentColor;
	flex: none;
}

.brn-mi__badge--pulse .brn-mi__badge-dot {
	animation: brn-mi-pulse 1.8s ease-in-out infinite;
}

@keyframes brn-mi-pulse {
	0%,
	100% {
		opacity: 1;
		box-shadow: 0 0 0 0 currentColor;
	}
	70% {
		opacity: 0.6;
		box-shadow: 0 0 0 5px rgba(0, 0, 0, 0);
	}
}

/* Table ------------------------------------------------------------------- */

.brn-mi__scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/*
 * Themes style bare `table`/`td` selectors — Hello Elementor sets a 1px border
 * and a bottom margin on every cell. These rules carry a class, so they outrank
 * the theme's element selectors and give the widget a clean slate.
 */
.brn-mi__table {
	width: 100%;
	min-width: 520px;
	margin: 0;
	border: 0;
	border-collapse: separate;
	border-spacing: 0;
	background-color: transparent;
	font-size: inherit;
	table-layout: auto;
}

.brn-mi__table thead,
.brn-mi__table tbody,
.brn-mi__table tr {
	border: 0;
}

.brn-mi__table th,
.brn-mi__table td {
	padding: 14px;
	border: 0;
	vertical-align: middle;
	text-align: var(--brn-value-align);
	white-space: nowrap;
}

/* `height` on a cell behaves as a minimum, which is what a row needs. */
.brn-mi__td {
	height: var(--brn-row-height);
}

.brn-mi__th {
	background-color: var(--brn-thead-bg);
	color: var(--brn-thead-color);
	font-size: 13px;
	font-weight: 700;
	border: 0;
}

.brn-mi__table thead th:first-child {
	border-start-start-radius: var(--brn-thead-radius);
	border-end-start-radius: var(--brn-thead-radius);
}

.brn-mi__table thead th:last-child {
	border-start-end-radius: var(--brn-thead-radius);
	border-end-end-radius: var(--brn-thead-radius);
}

.brn-mi__th--name,
.brn-mi__td--name {
	text-align: start;
}

.brn-mi__row {
	transition: background-color 0.2s ease;
}

.brn-mi__td {
	font-size: 13px;
	color: #12283f;
}

/* Borderless by design; separators are opt-in. */
.brn-mi--bordered .brn-mi__td {
	border-block-end: 1px solid var(--brn-row-border);
}

.brn-mi--bordered .brn-mi__row:last-child .brn-mi__td {
	border-block-end: 0;
}

/* Name cell + its accent marker ------------------------------------------- */

.brn-mi__td--name {
	position: relative;
	padding-inline-start: calc(var(--brn-accent-width) + 14px);
}

.brn-mi__accent {
	position: absolute;
	inset-inline-start: 0;
	top: 50%;
	transform: translateY(-50%);
	width: var(--brn-accent-width);
	height: var(--brn-accent-height);
	border-radius: 2px;
	background-color: var(--brn-row-accent);
}

.brn-mi__name {
	color: #12283f;
	font-size: 14px;
	font-weight: 700;
}

.brn-mi__name--link {
	text-decoration: none;
	color: inherit;
}

.brn-mi__name--link:hover {
	text-decoration: underline;
}

/* Numeric cells always read left-to-right, even inside an RTL page. */
.brn-mi__value,
.brn-mi__change,
.brn-mi__pct,
.brn-mi__date {
	display: inline-block;
	direction: ltr;
	unicode-bidi: isolate;
	font-variant-numeric: tabular-nums;
}

.brn-mi__value {
	font-weight: 600;
}

.brn-mi__date {
	color: #8a97a8;
}

.brn-mi__arrow {
	font-size: 0.75em;
	margin-inline-end: 3px;
}

/* Direction colouring ------------------------------------------------------ */

.brn-mi__row--up .brn-mi__change,
.brn-mi__row--up .brn-mi__pct {
	color: var(--brn-up);
	font-weight: 600;
}

.brn-mi__row--down .brn-mi__change,
.brn-mi__row--down .brn-mi__pct {
	color: var(--brn-down);
	font-weight: 600;
}

.brn-mi__row--flat .brn-mi__change,
.brn-mi__row--flat .brn-mi__pct {
	color: var(--brn-flat);
}

.brn-mi--chip .brn-mi__pct {
	padding: 4px 9px;
	border-radius: 7px;
	min-width: var(--brn-chip-min);
	text-align: center;
}

.brn-mi--chip .brn-mi__row--up .brn-mi__pct {
	background-color: var(--brn-up-bg);
}

.brn-mi--chip .brn-mi__row--down .brn-mi__pct {
	background-color: var(--brn-down-bg);
}

.brn-mi__row--empty .brn-mi__td,
.brn-mi__row--empty td {
	color: #8a97a8;
	text-align: center;
	padding-block: 28px;
}

/* Live refresh ------------------------------------------------------------- */

.brn-mi__td--updated {
	position: relative;
}

.brn-mi--flash .brn-mi__td--updated::after {
	content: "";
	position: absolute;
	inset: 4px;
	border-radius: 6px;
	pointer-events: none;
	animation: brn-mi-flash 0.9s ease-out forwards;
}

.brn-mi__row--up.brn-mi__row--flashing .brn-mi__td--updated::after {
	background-color: var(--brn-up-bg);
}

.brn-mi__row--down.brn-mi__row--flashing .brn-mi__td--updated::after {
	background-color: var(--brn-down-bg);
}

@keyframes brn-mi-flash {
	from {
		opacity: 0.9;
	}
	to {
		opacity: 0;
	}
}

.brn-mi--loading .brn-mi__body {
	opacity: 0.55;
	transition: opacity 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
	.brn-mi__badge--pulse .brn-mi__badge-dot,
	.brn-mi--flash .brn-mi__td--updated::after {
		animation: none;
	}
}

/* Small screens ------------------------------------------------------------ */

@media (max-width: 600px) {
	.brn-mi {
		padding: 22px 18px 18px;
	}

	.brn-mi__title {
		font-size: 21px;
	}

	.brn-mi__table th,
	.brn-mi__table td {
		padding: 11px 8px;
	}
}

.brn-mi__footnote {
	margin-block-start: 22px;
	color: #9aa6b5;
	font-size: 11px;
	line-height: 1.8;
	text-align: center;
}

.brn-mi__footnote p {
	margin: 0 0 6px;
}

.brn-mi__footnote p:last-child {
	margin-block-end: 0;
}
