/* ==========================================================================
   تم اکوموتیو — باکس بازار، تیکر و نمودار
   ========================================================================== */

.market-box {
	background: var(--c-surface);
	border: 1px solid var(--c-line);
	border-radius: 18px;
	box-shadow: var(--shadow);
	overflow: hidden;
}

.market-box-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	padding: 18px 24px;
	border-bottom: 1px solid var(--c-line);
	background: linear-gradient(180deg, #fbfcfd, var(--c-surface));
}
.market-box-head .section-title { font-size: 1.15rem; }

.market-box-meta {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: .82rem;
	color: var(--c-muted);
	font-weight: 600;
}

.market-box-grid {
	display: grid;
	grid-template-columns: 360px 1fr;
	min-height: 430px;
}

/* ---------- فهرست نمادها ---------- */
.market-list {
	border-inline-end: 1px solid var(--c-line);
	overflow-y: auto;
	max-height: 560px;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.market-group-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: .84rem;
	color: var(--c-muted);
	font-weight: 800;
	margin: 0 4px 8px;
	text-transform: none;
}
.market-group-title i { color: var(--c-accent-2); }

.market-row {
	display: grid;
	grid-template-columns: auto 1fr auto auto;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-radius: var(--radius-sm);
	border-inline-start: 3px solid transparent;
	cursor: pointer;
	transition: background .15s ease;
	user-select: none;
}
.market-row:hover { background: var(--c-bg); }
.market-row.is-active {
	background: var(--c-accent-soft);
	border-inline-start-color: var(--c-accent);
}
.market-row.is-active .market-name { color: var(--c-accent); }

.market-name {
	font-size: .87rem;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.market-price { font-size: .95rem; font-weight: 800; text-align: left; }
.market-row .chg { justify-self: end; min-width: 76px; text-align: center; }

.watch-star {
	border: none;
	background: transparent;
	color: #c2cbd5;
	font-size: .95rem;
	cursor: pointer;
	padding: 2px;
	transition: color .15s ease, transform .15s ease;
}
.watch-star:hover { color: var(--c-accent-2); transform: scale(1.15); }
.watch-star.is-watched { color: var(--c-accent-2); }

/* انیمیشن فلش هنگام تغییر قیمت */
@keyframes flash-up { 0% { background: var(--c-up-bg); } 100% { background: transparent; } }
@keyframes flash-down { 0% { background: var(--c-down-bg); } 100% { background: transparent; } }
.flash-up { animation: flash-up 1s ease; }
.flash-down { animation: flash-down 1s ease; }
.ticker-item.flash-up .num, .market-row.flash-up .market-price { animation: flash-up 1s ease; border-radius: 6px; }
.ticker-item.flash-down .num, .market-row.flash-down .market-price { animation: flash-down 1s ease; border-radius: 6px; }

/* ---------- ستون نمودار ---------- */
.market-chart {
	padding: 20px 24px 18px;
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.market-chart.is-loading { position: relative; }
.market-chart.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, .55);
	backdrop-filter: blur(1px);
	z-index: 3;
	border-radius: inherit;
}
.market-chart.is-loading::before {
	content: "";
	position: absolute;
	top: 90px;
	inset-inline-end: calc(50% - 16px);
	width: 32px; height: 32px;
	border: 3px solid var(--c-accent-soft);
	border-top-color: var(--c-accent);
	border-radius: 50%;
	z-index: 4;
	animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chart-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}
.chart-title strong { font-size: 1.05rem; display: block; }
.chart-unit { font-size: .78rem; color: var(--c-muted); }
.chart-value { display: flex; align-items: center; gap: 12px; }
.chart-price { font-size: 1.65rem; font-weight: 900; line-height: 1.3; }

.chart-ranges {
	display: inline-flex;
	gap: 4px;
	background: var(--c-bg);
	border: 1px solid var(--c-line);
	padding: 4px;
	border-radius: 11px;
	align-self: flex-start;
	margin-bottom: 14px;
}
.range-btn {
	border: none;
	background: transparent;
	color: var(--c-muted);
	font-family: inherit;
	font-size: .82rem;
	font-weight: 700;
	padding: 6px 16px;
	border-radius: 8px;
	cursor: pointer;
	transition: all .18s ease;
}
.range-btn:hover { color: var(--c-accent); }
.range-btn.is-active {
	background: var(--c-accent);
	color: #fff;
	box-shadow: 0 3px 8px -2px rgba(14, 58, 93, .45);
}

.chart-wrap {
	position: relative;
	flex: 1;
	min-height: 300px;
}

.chart-note {
	font-size: .75rem;
	color: var(--c-muted);
	margin: 12px 0 0;
	display: flex;
	align-items: center;
	gap: 6px;
}
.chart-note i { color: var(--c-accent-2); }

/* ---------- نوار نمادهای مرتبط (صفحه خبر) ---------- */
.related-symbols { margin: 26px 0; }
.related-title { font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.symbols-strip {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 12px;
}
.symbol-chip {
	background: var(--c-surface);
	border: 1px solid var(--c-line);
	border-radius: var(--radius-sm);
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.chip-name { font-size: .78rem; color: var(--c-muted); font-weight: 600; }
.chip-price { font-size: 1.05rem; font-weight: 800; }
.symbol-chip .chg { align-self: flex-start; }

/* برچسب داده تقریبی — فقط وقتی سری محلی (fallback) نمایش داده می‌شود */
.chart-approx {
	position: absolute;
	top: 8px;
	inset-inline-start: 8px;
	z-index: 4;
	background: rgba(245, 158, 11, .15);
	color: var(--warning-ink);
	font-size: .7rem;
	font-weight: 700;
	padding: 2px 12px;
	border-radius: 999px;
	pointer-events: none;
}
html[data-theme="dark"] .chart-approx { color: var(--c-accent-2); }

/* کلید روشن/خاموش بروزرسانی زنده */
.live-toggle { color: var(--c-up); }
.live-toggle.is-off { color: var(--c-muted); }
.live-toggle i { font-size: .85rem; }

/* اسپین دکمه بروزرسانی (آیکون SVG) */
@keyframes eco-spin { to { transform: rotate(360deg); } }
#market-refresh.is-busy .refresh-ico { animation: eco-spin .8s linear infinite; }
