/* KennyExchangeView (src/Kenny.UI.Common/Components/Exchange/KennyExchangeView/KennyExchangeView.razor).

   Lives here, not in a <style> block inside the component: an inline block is emitted once per
   rendered instance, and /markets mounts one KennyExchangeView per asset card — 21-29 identical
   8.3 KB copies, each re-diffed on every card render (Chrome trace 2026-11-06). */

.kenny-chart-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.kenny-panels-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.kenny-currency-panel {
    display: flex;
    align-items: center;
    justify-content: left;
    gap: 12px;
    flex: 1 1 auto; /* fill the row so the trailing fit-button group can pin to the right */
    order: 1;
}

.kenny-currency-panel-icon {
    object-fit: contain;
}

.kenny-timescale-panel {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1 1 auto;
    min-width: fit-content;
    order: 2;
}

.kenny-autofit-panel {
    display: flex;
    align-items: center;
}

.kenny-autofit-panel--active .mud-icon-root {
    color: var(--mud-color-kenny-orange);
}

.kenny-fitall-panel {
    display: flex;
    align-items: center;
}

/* Groups the fit-all + price-auto-fit buttons and pins them to the far right of the
   actions row on desktop. On mobile the actions row is full-width (flex-basis: 100%),
   so margin-left: auto keeps the group on the right there too. */
.kenny-chart-fit-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.kenny-chart-fade-in {
    opacity: 1;
    transition: opacity 750ms ease-in-out;
}

.kenny-currency-fade-in {
    opacity: 1;
    transition: opacity 750ms ease-in-out;
}

.kenny-panel-fade-in {
    opacity: 1;
    transition: opacity 450ms ease-in-out;
}

.kenny-chart-fade-out {
    opacity: 0;
    transition: opacity 350ms ease-in-out;
}

.kenny-currency-fade-out {
    opacity: 0;
    transition: opacity 350ms ease-in-out;
}

.kenny-panel-fade-out {
    opacity: 0;
    transition: opacity 150ms ease-in-out;
}

.kenny-currency-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 12px;
}

.kenny-currency-text-responsive {
    font-weight: bold;
}

/* Mobile screens (default - up to 768px) */
@media (max-width: 768px) {
    .kenny-currency-icon-responsive {
        width: 100px !important;
        height: 100px !important;
    }

    .kenny-currency-text-responsive {
        font-size: 60px;
    }
}

/* Tablet screens (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .kenny-currency-icon-responsive {
        width: 140px !important;
        height: 140px !important;
    }

    .kenny-currency-text-responsive {
        font-size: 84px;
    }
}

/* Desktop screens (1025px and up) */
@media (min-width: 1025px) {
    .kenny-currency-icon-responsive {
        width: 140px !important;
        height: 140px !important;
    }

    .kenny-currency-text-responsive {
        font-size: 84px;
    }
}

/* Large desktop screens (1440px and up) */
@media (min-width: 1440px) {
    .kenny-currency-icon-responsive {
        width: 140px !important;
        height: 140px !important;
    }

    .kenny-currency-text-responsive {
        font-size: 84px;
    }
}

.kenny-tv-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.23);
    cursor: pointer;
    padding: 0 16px;
    height: 32px;
    border-radius: 16px;
    transition: background-color 200ms ease, border-color 200ms ease;
    text-decoration: none;
    color: var(--mud-palette-text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.kenny-tv-trigger:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.5);
}

.kenny-interval-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.23);
    cursor: pointer;
    padding: 0 9px;
    height: 28px;
    border-radius: 14px;
    opacity: 0.72;
    transition: opacity 200ms ease, background-color 200ms ease, border-color 200ms ease, color 200ms ease;
    color: rgb(255 255 255 / 0.76);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1;
    font-family: inherit;
    white-space: nowrap;
}

.kenny-interval-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.5);
}

.kenny-interval-btn--active {
    opacity: 1;
    border-color: rgba(255, 165, 0, 0.7);
    color: rgb(255, 165, 0);
}

.kenny-interval-btn--active:hover {
    background-color: rgba(255, 165, 0, 0.08);
    border-color: rgba(255, 165, 0, 0.9);
}

/* Groups the HISTORY trigger + interval selector so they can move together.
   Grows to fill the row so the trailing fit-button group can pin to the right. */
.kenny-currency-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Mobile (≤768px): drop HISTORY + interval selector onto a second row
   below the currency icon/name instead of crowding the first row. */
@media (max-width: 768px) {
    .kenny-currency-panel {
        flex-wrap: wrap;
    }

    .kenny-currency-actions {
        flex-basis: 100%;
        order: 2;
        /* HoverStats keeps its desktop position (between the interval pill and the fit
           buttons) whenever the row is wide enough — its lead chip is flex-shrink: 0, so
           when the row is too narrow the chip wraps to the next line and the trailing fit
           buttons follow it there (chip left, fit buttons re-pinned right by their
           margin-left: auto). */
        flex-wrap: wrap;
    }
}

.kenny-history-loader {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 26px;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    background-color: #202124;
    transition: opacity 300ms ease-in-out;
}

.kenny-history-loader--visible {
    opacity: 1;
}

.kenny-history-loader .mud-progress-linear {
    height: 3px;
}

/* Stop the indeterminate animation while the loader is hidden.

   `opacity: 0` hides the bar but does NOT stop its CSS animation, and MudBlazor's
   indeterminate keyframes animate `left`/`right` (MudBlazor.min.css,
   mud-progress-linear-horizontal-keyframes-indeterminate1/2) — layout-triggering
   properties, so every frame costs style + layout + paint + a compositing pass.
   One loader is mounted per KennyExchangeView, so a 21-card Markets grid ran 21
   invisible bars at display rate forever. Measured on a 24 s DevTools trace of
   /markets: 14,369 paints of `.mud-progress-linear-bar` (90% of all node-attributed
   paints) and 51% of the *idle* renderer main thread inside `Layerize`, with JS at
   under 1%. Killing the animation is what returns the page to an idle main thread.

   `!important` is required, not stylistic: MudBlazor's own rule is a 4-class
   selector (0,4,0) and this one is (0,3,0), so specificity alone loses.

   Cost of the trade: during the 300 ms fade-OUT the bar is frozen instead of
   animating. Fade-in is unaffected (the class lands before the frame is painted). */
.kenny-history-loader:not(.kenny-history-loader--visible) .mud-progress-linear-bar {
    animation: none !important;
}
