﻿/* ── item wrapper ────────────────────────────────────────────────── */
.ticker-v4-item {
    flex-shrink: 0;
    width: max-content;
    margin-right: 16px;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 5px;
    contain: content;
}

/* ── skeleton → loaded fade-in ───────────────────────────────────── */
/* Fires automatically when the <a> is inserted into the DOM (skeleton branch
   uses <div>, loaded branch uses <a>), so the animation triggers on every
   skeleton → data transition without any JS or Razor changes. Duration
   matches the marquee reveal (300 ms) so both feel part of the same moment. */
@keyframes tickerItemFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

a.ticker-v4-item {
    animation: tickerItemFadeIn 300ms ease-out backwards;
    /* backwards: pin opacity:0 from insertion so there's no one-frame flash at full
       opacity before the animation clock starts. will-change hints the compositor to
       promote each item to its own layer during the 300 ms fade, avoiding per-item
       opacity compositing atop the marquee scroll transform. */
    will-change: opacity;
}

@media (prefers-reduced-motion: reduce) {
    a.ticker-v4-item { animation: none; }
}

/* ── marquee reveal transition ───────────────────────────────────── */

/* Real marquee starts invisible; .ticker-marquee-visible is added once to trigger the CSS fade-in. */
.ticker-marquee-reveal {
    opacity: 0;
    transition: opacity 300ms ease-out;
    will-change: opacity;
}

.ticker-marquee-reveal.ticker-marquee-visible {
    opacity: 1;
}

/* ── item box styles ─────────────────────────────────────────────── */
/* Fixed width prevents layout shift (CLS) when skeleton → real data.
   155px = 15px padding + 24px icon + 8px gap + 93px details + 15px padding.
   93px details accommodates prices up to $99,999 at 1rem bold. */
.ticker-item-v2,
.ticker-item-no-shadow-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 155px;
    padding: 0 15px;
    height: 43px;
    border-radius: 5px;
    background-color: #202124;
    user-select: none;
    -webkit-user-select: none;
}

/* ── icon container ──────────────────────────────────────────────── */
.ticker-icon-container-v2 {
    position: relative;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    contain: layout size style;
}

.ticker-icon-v2 {
    width: 24px;
    height: 24px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    image-rendering: crisp-edges;
    position: absolute;
    top: 0;
    left: 0;
    will-change: opacity;
    transform: translateZ(0);
}

.ticker-icon-fallback-v2 {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    position: absolute;
    top: 0;
    left: 0;
}

/* ── text details ────────────────────────────────────────────────── */
.ticker-details-v2 {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.ticker-price-v2 {
    font-size: 1rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticker-symbol-v2 {
    font-size: 0.75rem;
    color: #b4b3b3;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── 1h pct chip — sits inline next to the symbol ───────────────────── */
.ticker-symbol-row-v2 {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

/* Allow the symbol text to shrink/ellipsize when space is tight so the
   chip can sit on the same horizontal line. Without this override the
   symbol's white-space: nowrap + default min-width: auto pushes the chip
   off the row. Scoped so other usages of .ticker-symbol-v2 are untouched. */
.ticker-symbol-row-v2 .ticker-symbol-v2 {
    flex: 0 1 auto;
    min-width: 0;
}

.ticker-pct-v2 {
    /* typography matches .ticker-symbol-v2 */
    font-size: 0.75rem;
    line-height: 1;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ticker-pct-v2--up   { color: var(--mud-palette-success); }
.ticker-pct-v2--down { color: var(--mud-palette-error); }
.ticker-pct-v2--flat { color: rgba(255, 255, 255, 0.55); }

/* defensive copy of CurrencyPriceList's arrow rule so the ticker works on
   pages where CurrencyPriceList is not mounted (its <style> block is the
   only declaration of .cpl-pct-arrow elsewhere in the app). */
.cpl-pct-arrow {
    margin-right: 3px;
}


