/**
 * ReportHype Enhancer — front-end + admin styles.
 * All colors/spacing are namespaced under .rhe- to avoid theme collisions.
 */

/* ---------- Shared ticker shell ---------- */
.rhe-ticker {
	display: flex;
	align-items: center;
	width: 100%;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	position: relative;
	z-index: 9999;
	overflow: hidden;
}

/* ---------- Breaking News ---------- */
.rhe-breaking-news {
	background: #111111;
	color: #ffffff;
	padding: 8px 0;
}

.rhe-ticker__label {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 6px;
	background: #d32f2f;
	color: #ffffff;
	font-weight: 700;
	letter-spacing: 0.5px;
	padding: 6px 14px;
	border-radius: 3px;
	margin-left: 12px;
	white-space: nowrap;
}

.rhe-ticker__viewport {
	flex: 1 1 auto;
	overflow: hidden;
	margin-left: 12px;
	mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}

.rhe-ticker__track {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	white-space: nowrap;
	width: max-content;
	animation: rhe-scroll-left var(--rhe-scroll-speed, 40s) linear infinite;
}

.rhe-breaking-news[data-paused="true"] .rhe-ticker__track,
.rhe-ticker:hover .rhe-ticker__track.rhe-paused-on-hover {
	animation-play-state: paused;
}

.rhe-ticker__item {
	display: inline-flex;
	align-items: center;
	margin-right: 48px;
}

.rhe-ticker__link {
	color: inherit;
	text-decoration: none;
}

.rhe-ticker__link:hover,
.rhe-ticker__link:focus {
	text-decoration: underline;
}

.rhe-ticker__time {
	display: inline-block;
	margin-left: 8px;
	opacity: 0.65;
	font-size: 12px;
}

@keyframes rhe-scroll-left {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-50%);
	}
}

/* ---------- Exchange Rates ---------- */
.rhe-exchange-rates {
	background: #1a2332;
	color: #e8ecf1;
	padding: 6px 12px;
	gap: 10px;
}

.rhe-ticker__spinner {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.25);
	border-top-color: #e8ecf1;
	border-radius: 50%;
	animation: rhe-spin 0.8s linear infinite;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.rhe-exchange-rates.is-loading .rhe-ticker__spinner {
	opacity: 1;
}

@keyframes rhe-spin {
	to {
		transform: rotate(360deg);
	}
}

.rhe-rates__track {
	/* Inherits .rhe-ticker__track's scroll animation; --rhe-scroll-speed
	   is set per-instance via JS from the exchange_rates.scroll_speed setting. */
}

.rhe-rates__item {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	white-space: nowrap;
}

.rhe-rates__label {
	opacity: 0.75;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}

.rhe-rates__value {
	font-weight: 700;
}

.rhe-rates__trend--up {
	color: #4caf50;
}

.rhe-rates__trend--down {
	color: #f44336;
}

.rhe-rates__attribution {
	margin-left: auto;
	flex: 0 0 auto;
	font-size: 10px;
	opacity: 0.4;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}

.rhe-rates__attribution:hover {
	opacity: 0.75;
}

/* ---------- WhatsApp floating button ---------- */
.rhe-whatsapp {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 99999;
}

.rhe-whatsapp__link {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #25d366;
	color: #ffffff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	text-decoration: none;
}

.rhe-whatsapp__pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: #25d366;
	animation: rhe-pulse 2s ease-out infinite;
	z-index: -1;
}

@keyframes rhe-pulse {
	0% {
		transform: scale(1);
		opacity: 0.6;
	}
	100% {
		transform: scale(1.9);
		opacity: 0;
	}
}

.rhe-whatsapp__tooltip {
	position: absolute;
	left: 64px;
	top: 50%;
	transform: translateY(-50%);
	background: #111111;
	color: #ffffff;
	padding: 6px 10px;
	border-radius: 4px;
	font-size: 12px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.rhe-whatsapp__link:hover .rhe-whatsapp__tooltip,
.rhe-whatsapp__link:focus .rhe-whatsapp__tooltip {
	opacity: 1;
}

.rhe-whatsapp__close {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 20px;
	height: 20px;
	line-height: 18px;
	border-radius: 50%;
	background: #ffffff;
	color: #111111;
	border: 1px solid rgba(0, 0, 0, 0.15);
	cursor: pointer;
	font-size: 14px;
	padding: 0;
}

.rhe-whatsapp.is-hidden {
	display: none;
}

/* ---------- Accessibility helper ---------- */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.rhe-ticker__track,
	.rhe-whatsapp__pulse,
	.rhe-ticker__spinner {
		animation: none !important;
	}
}

/* ---------- Responsive ---------- */
@media (max-width: 782px) {
	.rhe-ticker__label {
		margin-left: 8px;
		padding: 5px 10px;
		font-size: 12px;
	}

	.rhe-ticker__viewport {
		margin-left: 8px;
	}

	.rhe-rates__item {
		margin-right: 28px;
	}

	.rhe-whatsapp {
		left: 14px;
		bottom: 14px;
	}

	.rhe-whatsapp__link {
		width: 48px;
		height: 48px;
	}

	.rhe-whatsapp__tooltip {
		display: none;
	}
}

/* ---------- Auto-inserted related links (Internal Link Enhancer) ---------- */
.rhe-related-links {
	margin: 1.5em 0;
	padding: 12px 16px;
	background: rgba(0, 0, 0, 0.03);
	border-left: 3px solid #d32f2f;
	border-radius: 2px;
}

.rhe-related-links__heading {
	margin: 0 0 6px;
	font-weight: 700;
	font-size: 14px;
}

.rhe-related-links__list {
	margin: 0;
	padding: 0 0 0 18px;
}

.rhe-related-links__list li {
	margin: 2px 0;
}

/* ---------- Admin page ---------- */
.rhe-admin .nav-tab-wrapper {
	margin-bottom: 16px;
}

.rhe-admin .form-table th {
	width: 280px;
}
