/* Nepal BFI Base Rates — front-end only (standalone plugin) */

.nbfi-wrapper.nbfi-base-rates {
	--nbfi-br-bg: #f6f7fb;
	--nbfi-br-surface: #ffffff;
	--nbfi-br-text: #0f172a;
	--nbfi-br-muted: #64748b;
	--nbfi-br-border: #e2e8f0;
	--nbfi-br-accent: #2563eb;
	--nbfi-br-chip-bg: #eef2ff;
	--nbfi-br-chip-active: #2563eb;
	--nbfi-br-rate: #0ea5e9;
	--nbfi-br-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
	box-sizing: border-box;
	width: 100%;
	max-width: min(960px, 100%);
	margin: 1.25rem auto;
	padding: 0 0.75rem 1.5rem;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--nbfi-br-text);
	background: transparent;
	color-scheme: light;
}

.nbfi-wrapper.nbfi-base-rates *,
.nbfi-wrapper.nbfi-base-rates *::before,
.nbfi-wrapper.nbfi-base-rates *::after {
	box-sizing: border-box;
}

/* Explicit dark */
.nbfi-wrapper.nbfi-base-rates[data-theme='dark'] {
	--nbfi-br-bg: #0f172a;
	--nbfi-br-surface: #1e293b;
	--nbfi-br-text: #f1f5f9;
	--nbfi-br-muted: #94a3b8;
	--nbfi-br-border: #334155;
	--nbfi-br-accent: #60a5fa;
	--nbfi-br-chip-bg: #1e3a5f;
	--nbfi-br-chip-active: #38bdf8;
	--nbfi-br-rate: #7dd3fc;
	--nbfi-br-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 40px rgba(0, 0, 0, 0.35);
	color-scheme: dark;
}

/* theme=auto: dark palette ONLY when .nbfi-br-site-dark is set by JS (never force via OS media query — site light + OS dark was broken). */

/* Site / theme toggle dark (Elementor, Kadence, Bootstrap, etc.) when shortcode uses theme="auto" */
.nbfi-wrapper.nbfi-base-rates[data-theme='auto'].nbfi-br-site-dark {
	--nbfi-br-bg: #0f172a;
	--nbfi-br-surface: #1e293b;
	--nbfi-br-text: #f1f5f9;
	--nbfi-br-muted: #94a3b8;
	--nbfi-br-border: #334155;
	--nbfi-br-accent: #60a5fa;
	--nbfi-br-chip-bg: #1e3a5f;
	--nbfi-br-chip-active: #38bdf8;
	--nbfi-br-rate: #7dd3fc;
	--nbfi-br-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 40px rgba(0, 0, 0, 0.35);
	color-scheme: dark;
}

.nbfi-wrapper.nbfi-base-rates[data-theme='auto'] {
	color-scheme: light;
}

.nbfi-wrapper.nbfi-base-rates[data-theme='light'] {
	color-scheme: light;
}

.nbfi-br-app {
	background: var(--nbfi-br-bg);
	border-radius: 16px;
	padding: 1rem;
	box-shadow: var(--nbfi-br-shadow);
	border: 1px solid var(--nbfi-br-border);
}

.nbfi-br-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 0.85rem;
}

.nbfi-br-toolbar-sticky {
	position: sticky;
	top: 0;
	z-index: 5;
	padding: 0.5rem 0;
	margin: 0 -0.25rem 0.75rem;
	background: linear-gradient(to bottom, var(--nbfi-br-bg) 70%, transparent);
}

.nbfi-br-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.nbfi-br-chip {
	border: 1px solid var(--nbfi-br-border);
	background: var(--nbfi-br-chip-bg);
	color: var(--nbfi-br-text);
	border-radius: 999px;
	padding: 0.35rem 0.75rem;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.nbfi-br-chip:hover {
	border-color: var(--nbfi-br-accent);
}

.nbfi-br-chip.active {
	background: var(--nbfi-br-chip-active);
	border-color: var(--nbfi-br-chip-active);
	color: #fff;
}

.nbfi-br-chip-n {
	font-weight: 500;
	opacity: 0.85;
	font-size: 0.78rem;
}

.nbfi-br-search-label {
	flex: 1 1 180px;
	min-width: 140px;
}

.nbfi-br-search-label input {
	width: 100%;
	border: 1px solid var(--nbfi-br-border);
	border-radius: 10px;
	padding: 0.45rem 0.65rem;
	font-size: 0.9rem;
	background: var(--nbfi-br-surface);
	color: var(--nbfi-br-text);
}

.nbfi-br-search-label input:focus {
	outline: 2px solid var(--nbfi-br-accent);
	outline-offset: 1px;
}

.nbfi-br-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.nbfi-br-row {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: center;
	gap: 0.65rem 0.75rem;
	background: var(--nbfi-br-surface);
	border: 1px solid var(--nbfi-br-border);
	border-radius: 14px;
	padding: 0.65rem 0.75rem;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.nbfi-br-row:hover {
	border-color: var(--nbfi-br-accent);
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}

.nbfi-br-row.nbfi-hidden {
	display: none !important;
}

.nbfi-br-row-main {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-width: 0;
}

.nbfi-br-logo-wrap {
	position: relative;
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	overflow: hidden;
	background: var(--nbfi-br-bg);
	border: 1px solid var(--nbfi-br-border);
}

.nbfi-br-logo {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.nbfi-br-logo-fallback {
	display: none;
	position: absolute;
	inset: 0;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 0.65rem;
	color: var(--nbfi-br-muted);
	background: var(--nbfi-br-bg);
}

.nbfi-br-meta {
	display: flex;
	flex-direction: column;
	gap: 0.12rem;
	min-width: 0;
}

.nbfi-br-short {
	font-weight: 700;
	font-size: 0.95rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nbfi-br-full {
	font-size: 0.78rem;
	color: var(--nbfi-br-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nbfi-br-class {
	font-size: 0.72rem;
	color: var(--nbfi-br-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.nbfi-br-spread {
	font-size: 0.78rem;
	color: var(--nbfi-br-accent);
	font-weight: 600;
}

.nbfi-br-rate-cell {
	display: flex;
	align-items: baseline;
	gap: 0.15rem;
	justify-content: flex-end;
	min-width: 4.5rem;
}

.nbfi-br-rate {
	font-weight: 800;
	font-size: 1.35rem;
	color: var(--nbfi-br-rate);
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.nbfi-br-rate.nbfi-br-na {
	font-weight: 600;
	font-size: 1rem;
	color: var(--nbfi-br-muted);
}

.nbfi-br-pct {
	font-weight: 700;
	font-size: 0.85rem;
	color: var(--nbfi-br-muted);
}

.nbfi-br-link {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--nbfi-br-accent);
	text-decoration: none;
	white-space: nowrap;
	align-self: center;
}

.nbfi-br-link:hover {
	text-decoration: underline;
}

/* Medals — lowest base among visible */
.nbfi-br-row.nbfi-br-medal-gold {
	border-color: #eab308;
	box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.35);
}

.nbfi-br-row.nbfi-br-medal-silver {
	border-color: #94a3b8;
}

.nbfi-br-row.nbfi-br-medal-bronze {
	border-color: #d97706;
}

@media (max-width: 560px) {
	.nbfi-br-row {
		grid-template-columns: 1fr auto;
		grid-template-rows: auto auto;
	}

	.nbfi-br-rate-cell {
		grid-column: 2;
		grid-row: 1 / span 2;
		align-self: center;
	}

	.nbfi-br-link {
		grid-column: 1;
		justify-self: start;
	}
}

/* Mobile / narrow columns: edge-to-edge within viewport (break out of skinny content areas) */
@media (max-width: 782px) {
	.nbfi-wrapper.nbfi-base-rates {
		width: 100vw;
		max-width: none;
		margin-left: calc(50% - 50vw);
		margin-right: calc(50% - 50vw);
		padding-left: max(12px, env(safe-area-inset-left, 0px));
		padding-right: max(12px, env(safe-area-inset-right, 0px));
		padding-bottom: 1.25rem;
	}

	.nbfi-br-app {
		padding-left: 0.65rem;
		padding-right: 0.65rem;
		border-radius: 12px;
	}

	.nbfi-br-toolbar-sticky {
		margin-left: -0.35rem;
		margin-right: -0.35rem;
		padding-left: 0.35rem;
		padding-right: 0.35rem;
	}
}
