/**
 * Currency Exchange Rates Widget - front-end styles.
 *
 * A single, small, dependency-free stylesheet. Per-instance colors are
 * applied via the --wcr-accent CSS custom property set inline by the
 * renderer, so this file never changes and remains fully cacheable
 * (including by CDNs / full-page cache plugins) regardless of how many
 * differently-styled widget instances exist on a site.
 */

.wcr-widget {
	--wcr-accent: #2271b1;
	--wcr-bg: #ffffff;
	--wcr-text: #1d2327;
	--wcr-muted: #646970;
	--wcr-border: #e2e4e7;
	--wcr-row-alt: #f6f7f7;

	box-sizing: border-box;
	background: var(--wcr-bg);
	color: var(--wcr-text);
	border: 1px solid var(--wcr-border);
	border-radius: 8px;
	padding: 16px;
	font-size: 14px;
	line-height: 1.5;
	max-width: 100%;
}

.wcr-widget * {
	box-sizing: border-box;
}

.wcr-widget__title {
	margin: 0 0 12px;
	font-size: 1.1em;
	font-weight: 600;
	color: var(--wcr-text);
	border-bottom: 2px solid var(--wcr-accent);
	padding-bottom: 8px;
}

.wcr-widget__empty {
	margin: 0;
	color: var(--wcr-muted);
}

/* Table layout */
.wcr-widget__table {
	width: 100%;
	border-collapse: collapse;
}

.wcr-widget__table th {
	text-align: left;
	font-size: 0.8em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--wcr-muted);
	padding: 6px 8px;
	border-bottom: 1px solid var(--wcr-border);
}

.wcr-widget__table td {
	padding: 8px;
	border-bottom: 1px solid var(--wcr-border);
	vertical-align: middle;
}

.wcr-widget__table tr:last-child td {
	border-bottom: none;
}

.wcr-rows-striped .wcr-widget__table tbody tr:nth-child(odd) {
	background: var(--wcr-row-alt);
}

.wcr-widget__table .wcr-widget__rate {
	text-align: right;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	white-space: nowrap;
}

/* Inline list layout */
.wcr-widget__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.wcr-widget__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 12px;
	border: 1px solid var(--wcr-border);
	border-radius: 999px;
	flex: 1 1 auto;
	min-width: 140px;
}

.wcr-rows-plain .wcr-widget__row {
	border-radius: 6px;
}

.wcr-widget__row .wcr-widget__rate {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

/* Shared currency label parts */
.wcr-widget .wcr-flag {
	margin-right: 4px;
}

.wcr-widget .wcr-code {
	font-weight: 600;
}

.wcr-widget .wcr-name {
	color: var(--wcr-muted);
	margin-left: 4px;
	font-size: 0.92em;
}

.wcr-widget__updated {
	margin: 12px 0 0;
	font-size: 0.8em;
	color: var(--wcr-muted);
}

/* Dark theme (explicit) */
.wcr-theme-dark {
	--wcr-bg: #1d2327;
	--wcr-text: #f0f0f1;
	--wcr-muted: #a7aaad;
	--wcr-border: #3c434a;
	--wcr-row-alt: #2c3338;
}

/* Auto theme: follow visitor OS preference */
@media (prefers-color-scheme: dark) {
	.wcr-theme-auto {
		--wcr-bg: #1d2327;
		--wcr-text: #f0f0f1;
		--wcr-muted: #a7aaad;
		--wcr-border: #3c434a;
		--wcr-row-alt: #2c3338;
	}
}

/* Responsive: stack table on narrow screens */
@media (max-width: 480px) {
	.wcr-widget {
		padding: 12px;
		font-size: 13px;
	}

	.wcr-widget__table thead {
		display: none;
	}

	.wcr-widget__table,
	.wcr-widget__table tbody,
	.wcr-widget__table tr,
	.wcr-widget__table td {
		display: block;
		width: 100%;
	}

	.wcr-widget__table tr {
		padding: 6px 0;
	}

	.wcr-widget__table td {
		border-bottom: none;
		padding: 2px 0;
	}

	.wcr-widget__table .wcr-widget__rate {
		text-align: left;
	}

	.wcr-widget__row {
		min-width: 100%;
	}
}

/* Accessibility: keyboard focus visibility for any focusable descendants */
.wcr-widget a:focus-visible,
.wcr-widget button:focus-visible {
	outline: 2px solid var(--wcr-accent);
	outline-offset: 2px;
}

.wcr-widget .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}
