/* =========================================================
   TRIMARKETA SMART FUNDAMENTAL — PREMIUM MOTION V1
   White / Navy / Indigo / Cyan
   ========================================================= */

:root {
    --tm-navy: #0b1629;
    --tm-navy-2: #14233d;
    --tm-indigo: #4f46e5;
    --tm-indigo-2: #6366f1;
    --tm-cyan: #06b6d4;
    --tm-green: #059669;
    --tm-red: #dc2626;
    --tm-border: #e5eaf1;
    --tm-muted: #71809a;
    --tm-bg: #f7f9fc;
}

/* ---------------------------------------------------------
   MAIN TERMINAL
   --------------------------------------------------------- */

#tm-stock-terminal-v4 {
    position: relative;
    isolation: isolate;
}

/* subtle ambient light */
#tm-stock-terminal-v4::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    top: -180px;
    right: -160px;
    background:
        radial-gradient(
            circle,
            rgba(79,70,229,.10) 0%,
            rgba(6,182,212,.045) 30%,
            transparent 70%
        );
    pointer-events: none;
    z-index: -1;
    animation: tmAmbient 8s ease-in-out infinite alternate;
}

@keyframes tmAmbient {
    from {
        transform: translate3d(0,0,0) scale(1);
        opacity: .65;
    }
    to {
        transform: translate3d(-25px,15px,0) scale(1.08);
        opacity: 1;
    }
}

/* ---------------------------------------------------------
   BRANDING
   --------------------------------------------------------- */

.tm-smart-brand {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: #059669;
    opacity: 0;
    transform: translateY(10px);
    animation: tmFadeUp .65s .05s cubic-bezier(.22,1,.36,1) forwards;
}

.tm-smart-title {
    position: relative;
    display: inline-block;
    margin: 0;
    color: var(--tm-navy);
    font-weight: 900;
    letter-spacing: -.045em;
    line-height: 1.04;
    opacity: 0;
    transform: translateY(16px);
    animation: tmTitleIn .8s .12s cubic-bezier(.22,1,.36,1) forwards;
}

.tm-smart-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0;
    height: 3px;
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        var(--tm-indigo),
        var(--tm-cyan)
    );
    animation: tmTitleLine 1s .75s ease forwards;
}

.tm-smart-subtitle {
    opacity: 0;
    transform: translateY(8px);
    animation: tmFadeUp .7s .35s ease forwards;
}

@keyframes tmTitleIn {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(.985);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes tmTitleLine {
    to {
        width: 100%;
    }
}

/* ---------------------------------------------------------
   REVEAL
   --------------------------------------------------------- */

.tm-motion-ready {
    opacity: 0;
    transform: translateY(18px);
}

.tm-motion-ready.tm-visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity .65s ease,
        transform .65s cubic-bezier(.22,1,.36,1);
}

/* ---------------------------------------------------------
   SUMMARY CARDS
   --------------------------------------------------------- */

#tm-stock-terminal-v4 .tm-stat-card,
#tm-stock-terminal-v4 .tm-summary-card,
#tm-stock-terminal-v4 [class*="stat-card"] {
    transition:
        transform .3s cubic-bezier(.22,1,.36,1),
        box-shadow .3s ease,
        border-color .3s ease;
}

#tm-stock-terminal-v4 .tm-stat-card:hover,
#tm-stock-terminal-v4 .tm-summary-card:hover,
#tm-stock-terminal-v4 [class*="stat-card"]:hover {
    transform: translateY(-5px);
    box-shadow:
        0 18px 45px rgba(11,22,41,.09),
        0 0 0 1px rgba(79,70,229,.08);
}

/* stagger */
#tm-stock-terminal-v4 .tm-stat-card:nth-child(1) { animation-delay: .08s; }
#tm-stock-terminal-v4 .tm-stat-card:nth-child(2) { animation-delay: .14s; }
#tm-stock-terminal-v4 .tm-stat-card:nth-child(3) { animation-delay: .20s; }
#tm-stock-terminal-v4 .tm-stat-card:nth-child(4) { animation-delay: .26s; }
#tm-stock-terminal-v4 .tm-stat-card:nth-child(5) { animation-delay: .32s; }

/* ---------------------------------------------------------
   NUMBER COUNT UP
   --------------------------------------------------------- */

.tm-counting {
    font-variant-numeric: tabular-nums;
    transition:
        transform .2s ease,
        color .25s ease;
}

.tm-counting.tm-count-done {
    animation: tmNumberPop .35s cubic-bezier(.22,1,.36,1);
}

@keyframes tmNumberPop {
    0%   { transform: scale(.92); }
    60%  { transform: scale(1.035); }
    100% { transform: scale(1); }
}

/* ---------------------------------------------------------
   LIVE INDICATOR
   --------------------------------------------------------- */

.tm-live-dot,
#tm-stock-terminal-v4 .live-dot {
    position: relative;
}

.tm-live-dot::after,
#tm-stock-terminal-v4 .live-dot::after {
    content: "";
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(5,150,105,.35);
    border-radius: 50%;
    animation: tmLivePulse 1.8s ease-out infinite;
}

@keyframes tmLivePulse {
    0% {
        transform: scale(.7);
        opacity: .9;
    }
    75% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

/* ---------------------------------------------------------
   SEARCH / SELECT / FILTER
   --------------------------------------------------------- */

#tm-stock-terminal-v4 input,
#tm-stock-terminal-v4 select {
    transition:
        border-color .2s ease,
        box-shadow .2s ease,
        transform .2s ease;
}

#tm-stock-terminal-v4 input:focus,
#tm-stock-terminal-v4 select:focus {
    outline: none;
    border-color: rgba(79,70,229,.55) !important;
    box-shadow:
        0 0 0 4px rgba(79,70,229,.08),
        0 8px 25px rgba(79,70,229,.07);
    transform: translateY(-1px);
}

/* buttons */
#tm-stock-terminal-v4 button {
    transition:
        transform .2s cubic-bezier(.22,1,.36,1),
        box-shadow .2s ease,
        background .2s ease;
}

#tm-stock-terminal-v4 button:hover {
    transform: translateY(-2px);
}

#tm-stock-terminal-v4 button:active {
    transform: translateY(0) scale(.97);
}

/* ---------------------------------------------------------
   REFRESH BUTTON
   --------------------------------------------------------- */

.tm-refreshing {
    pointer-events: none;
}

.tm-refreshing svg,
.tm-refreshing .tm-refresh-icon {
    animation: tmSpin .75s linear infinite;
}

@keyframes tmSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------------------------------------------------
   TABLE
   --------------------------------------------------------- */

#tm-stock-terminal-v4 table tbody tr {
    opacity: 0;
    transform: translateY(7px);
    animation: tmRowIn .42s cubic-bezier(.22,1,.36,1) forwards;
    transition:
        background .2s ease,
        box-shadow .2s ease,
        transform .2s ease;
}

#tm-stock-terminal-v4 table tbody tr:hover {
    background: rgba(79,70,229,.025);
    box-shadow:
        inset 3px 0 0 var(--tm-indigo);
}

@keyframes tmRowIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* row stagger */
#tm-stock-terminal-v4 table tbody tr:nth-child(1)  { animation-delay: .03s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(2)  { animation-delay: .05s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(3)  { animation-delay: .07s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(4)  { animation-delay: .09s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(5)  { animation-delay: .11s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(6)  { animation-delay: .13s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(7)  { animation-delay: .15s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(8)  { animation-delay: .17s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(9)  { animation-delay: .19s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(10) { animation-delay: .21s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(11) { animation-delay: .23s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(12) { animation-delay: .25s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(13) { animation-delay: .27s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(14) { animation-delay: .29s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(15) { animation-delay: .31s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(16) { animation-delay: .33s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(17) { animation-delay: .35s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(18) { animation-delay: .37s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(19) { animation-delay: .39s; }
#tm-stock-terminal-v4 table tbody tr:nth-child(20) { animation-delay: .41s; }

/* ---------------------------------------------------------
   PRICE UPDATE FLASH
   --------------------------------------------------------- */

.tm-price-flash {
    animation: tmPriceFlash .75s ease;
}

@keyframes tmPriceFlash {
    0% {
        background: rgba(79,70,229,.16);
        transform: scale(1.02);
    }
    100% {
        background: transparent;
        transform: scale(1);
    }
}

/* ---------------------------------------------------------
   SYMBOL
   --------------------------------------------------------- */

#tm-stock-terminal-v4 a[href*="/stocks/"] {
    transition:
        color .2s ease,
        letter-spacing .2s ease;
}

#tm-stock-terminal-v4 a[href*="/stocks/"]:hover {
    color: var(--tm-indigo) !important;
    letter-spacing: .01em;
}

/* ---------------------------------------------------------
   ACTIVE FILTER
   --------------------------------------------------------- */

.tm-filter-active {
    position: relative;
    box-shadow:
        0 0 0 1px rgba(79,70,229,.12),
        0 8px 25px rgba(79,70,229,.06);
}

.tm-filter-active::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -1px;
    height: 2px;
    border-radius: 20px;
    background: linear-gradient(
        90deg,
        var(--tm-indigo),
        var(--tm-cyan)
    );
}

/* ---------------------------------------------------------
   LOADING SHIMMER
   --------------------------------------------------------- */

.tm-shimmer {
    position: relative;
    overflow: hidden;
}

.tm-shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,.7),
        transparent
    );
    animation: tmShimmer 1.2s infinite;
}

@keyframes tmShimmer {
    100% {
        transform: translateX(100%);
    }
}

/* ---------------------------------------------------------
   TOOLTIP
   --------------------------------------------------------- */

[data-tm-tooltip] {
    position: relative;
}

[data-tm-tooltip]::after {
    content: attr(data-tm-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 9px);
    transform: translate(-50%, 4px);
    white-space: nowrap;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--tm-navy);
    color: white;
    font-size: 11px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity .18s ease,
        transform .18s ease;
    z-index: 50;
    box-shadow: 0 10px 25px rgba(11,22,41,.18);
}

[data-tm-tooltip]:hover::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */

@media (max-width: 768px) {

    #tm-stock-terminal-v4::before {
        width: 280px;
        height: 280px;
        top: -120px;
        right: -120px;
    }

    .tm-smart-title {
        letter-spacing: -.035em;
    }

    #tm-stock-terminal-v4 table tbody tr:hover {
        box-shadow: none;
    }

    [data-tm-tooltip]::after {
        display: none;
    }
}

/* ---------------------------------------------------------
   REDUCE MOTION
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
    }

    #tm-stock-terminal-v4 table tbody tr,
    .tm-motion-ready,
    .tm-smart-title,
    .tm-smart-brand,
    .tm-smart-subtitle {
        opacity: 1 !important;
        transform: none !important;
    }
}
