/* TradingView — native CoinToday chrome */

.tv-ticker {
	--tv-ticker-h: 58px;
	position: relative;
	width: 100%;
	height: var(--tv-ticker-h);
	overflow: hidden;
	line-height: 1;
	background:
		linear-gradient(90deg, rgba(13, 159, 154, 0.06), transparent 28%),
		#fff;
	border-bottom: 1px solid rgba(20, 48, 86, 0.1);
	box-shadow: 0 1px 0 rgba(13, 159, 154, 0.08);
}

.tv-ticker::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 3px;
	background: linear-gradient(180deg, #0d9f9a, #143056);
	z-index: 2;
	pointer-events: none;
}

.tradingview-widget-copyright {
	display: none !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	border: 0 !important;
	line-height: 0 !important;
}

.tv-ticker .tradingview-widget-container,
.tv-ticker .tradingview-widget-container__widget,
.tv-ticker__widget {
	width: 100%;
	height: var(--tv-ticker-h);
	min-height: 0;
	margin: 0;
	padding: 0;
	line-height: 0;
}

.tv-ticker iframe {
	display: block;
	width: 100% !important;
	height: var(--tv-ticker-h) !important;
	max-height: var(--tv-ticker-h) !important;
	border: 0;
}

/* —— Panel chrome —— */
.tv-panel {
	position: relative;
	overflow: hidden;
	border-radius: 0.75rem !important;
	background: #fff !important;
	border: 1px solid rgba(20, 48, 86, 0.12) !important;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.8) inset,
		0 8px 28px rgba(11, 31, 58, 0.07);
	transition: box-shadow 0.28s ease, transform 0.28s ease, border-color 0.28s ease;
}

.tv-panel:hover {
	border-color: rgba(13, 159, 154, 0.28) !important;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.9) inset,
		0 14px 36px rgba(11, 31, 58, 0.1);
}

.tv-panel__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.55rem 0.85rem;
	background:
		linear-gradient(180deg, #f7fafc 0%, #eef3f9 100%);
	border-bottom: 1px solid rgba(20, 48, 86, 0.1);
}

.tv-panel__bar-meta {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-width: 0;
}

.tv-panel__label {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #4a5d78;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tv-live {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.18rem 0.5rem;
	border-radius: 0.25rem;
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #0a8581;
	background: rgba(13, 159, 154, 0.12);
	flex-shrink: 0;
}

.tv-live__dot {
	width: 0.45rem;
	height: 0.45rem;
	border-radius: 50%;
	background: #0d9f9a;
	box-shadow: 0 0 0 0 rgba(13, 159, 154, 0.55);
	animation: tv-live-pulse 1.8s ease-out infinite;
}

.tv-panel__source {
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: rgba(74, 93, 120, 0.85);
	text-decoration: none;
	transition: color 0.2s ease;
}

.tv-panel__source:hover {
	color: #0a8581;
}

/* —— Frames —— */
.tv-frame {
	position: relative;
	min-height: 120px;
	overflow: hidden;
	background:
		linear-gradient(180deg, #fafcfe 0%, #fff 40%);
}

.tv-frame--quote {
	min-height: 126px;
}

.tv-frame--overview {
	height: 460px;
}

.tv-frame--ta {
	height: 380px;
}

.tv-frame--heatmap {
	height: 480px;
}

.tv-frame--forex,
.tv-frame--calendar {
	height: 420px;
}

.tv-frame--chart {
	height: 520px;
}

.tv-frame .tradingview-widget-container {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
}

.tv-frame .tradingview-widget-container__widget {
	flex: 1 1 auto;
	width: 100%;
	height: 100% !important;
	min-height: 0;
	margin: 0;
	padding: 0;
}

.tv-frame .tradingview-widget-container iframe,
.tv-frame iframe {
	display: block;
	width: 100% !important;
	height: 100% !important;
	min-height: 100% !important;
	border: 0;
}

.tv-panel .card-body.tv-frame {
	padding: 0 !important;
}

/* Skeleton while lazy widget hydrates */
.tv-frame::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background:
		linear-gradient(90deg, transparent, rgba(13, 159, 154, 0.06), transparent),
		repeating-linear-gradient(
			-12deg,
			transparent,
			transparent 10px,
			rgba(20, 48, 86, 0.015) 10px,
			rgba(20, 48, 86, 0.015) 20px
		);
	opacity: 1;
	transition: opacity 0.45s ease;
}

.tv-frame.is-loaded::before,
.tv-panel.is-loaded .tv-frame::before {
	opacity: 0;
}

.tv-frame .tradingview-widget-container {
	position: relative;
	z-index: 1;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.45s ease, transform 0.45s ease;
}

.tv-frame.is-loaded .tradingview-widget-container,
.tv-panel.is-loaded .tradingview-widget-container,
[data-tv-loaded="1"] {
	opacity: 1;
	transform: none;
}

[data-tv-lazy] {
	opacity: 0.92;
	transition: opacity 0.4s ease;
}

[data-tv-loaded="1"] {
	opacity: 1;
}

@keyframes tv-live-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(13, 159, 154, 0.55);
	}
	70% {
		box-shadow: 0 0 0 8px rgba(13, 159, 154, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(13, 159, 154, 0);
	}
}

@media (max-width: 575.98px) {
	.tv-frame--overview,
	.tv-frame--heatmap,
	.tv-frame--forex,
	.tv-frame--calendar,
	.tv-frame--chart {
		height: 340px;
	}

	.tv-panel__bar {
		padding: 0.45rem 0.65rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tv-live__dot {
		animation: none;
	}

	.tv-panel,
	.tv-frame .tradingview-widget-container,
	.tv-frame::before {
		transition: none;
	}
}
