/* ══════════════════════════════════
   TRENDING PANEL
   ══════════════════════════════════ */

.trending-panel {
    margin-bottom: 28px;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #0B1522 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 207, 255, 0.02);
}

.trending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.trending-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trending-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FF4C4C;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 76, 76, 0.5); }
    50% { opacity: 0.6; box-shadow: 0 0 8px 4px rgba(255, 76, 76, 0.15); }
}

.trending-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(0, 207, 255, 0.12);
}

.trending-period {
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tp-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tp-block-label {
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.22);
}

.tp-block-current .tp-block-label {
    color: var(--accent);
    opacity: 0.8;
}

.tp-block-dates {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.tp-block-current .tp-block-dates {
    color: var(--text-primary);
}

.tp-arrow {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    margin-bottom: 2px;
}

.tp-docs {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.2);
    padding-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 2px;
    align-self: flex-end;
}

.trending-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

/* Category column */
.trending-category {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
    animation: card-fade-in 0.6s ease both;
}

.trending-category:nth-child(1) { animation-delay: 0.05s; }
.trending-category:nth-child(2) { animation-delay: 0.12s; }
.trending-category:nth-child(3) { animation-delay: 0.19s; }
.trending-category:nth-child(4) { animation-delay: 0.26s; }

@keyframes card-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.trending-category:hover {
    border-color: rgba(0, 207, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 207, 255, 0.04), inset 0 0 20px rgba(0, 207, 255, 0.02);
}

.trending-chart-wrap {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    height: 140px;
    position: relative;
}

.trending-chart-label {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.18);
    margin-bottom: 6px;
}

.trending-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.trending-desc {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.03em;
    margin-bottom: 18px;
    line-height: 1.5;
}

.trending-cat-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Top entity (big) */
.trending-top-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.trending-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0, 207, 255, 0.3);
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(0, 207, 255, 0.15), 0 0 4px rgba(0, 207, 255, 0.1);
    animation: avatar-glow 3s ease-in-out infinite;
}

@keyframes avatar-glow {
    0%, 100% { box-shadow: 0 0 12px rgba(0, 207, 255, 0.15), 0 0 4px rgba(0, 207, 255, 0.1); }
    50%      { box-shadow: 0 0 18px rgba(0, 207, 255, 0.25), 0 0 6px rgba(0, 207, 255, 0.15); }
}

.trending-avatar-placeholder {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 2px solid rgba(0, 207, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(0, 207, 255, 0.15), 0 0 4px rgba(0, 207, 255, 0.1);
    animation: avatar-glow 3s ease-in-out infinite;
}

.trending-top-info {
    flex: 1;
    min-width: 0;
}

.trending-top-name {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
    word-break: break-word;
}

.trending-top-stats {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.trending-pct {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: #e8f4ff;
    text-shadow: 0 0 10px rgba(0, 207, 255, 0.3), 0 0 3px rgba(0, 207, 255, 0.15);
}

.trending-pct-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* Visibility bar — top entity */
.trending-vis-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.trending-vis-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(to right, var(--accent), rgba(0, 207, 255, 0.5));
    position: relative;
    animation: bar-fill-in 1s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    animation-delay: 0.3s;
}

@keyframes bar-fill-in {
    from { transform: scaleX(0); transform-origin: left; }
    to   { transform: scaleX(1); transform-origin: left; }
}

/* Runner visibility bar */
.trending-runner-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.trending-runner-bar-wrap {
    height: 3px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2px;
    overflow: hidden;
}

.trending-runner-bar {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(to right, rgba(0, 207, 255, 0.5), rgba(0, 207, 255, 0.15));
    transition: width 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Second runner-up: slightly dimmer */
.trending-runner-item + .trending-runner-item .trending-runner-bar {
    background: linear-gradient(to right, rgba(0, 207, 255, 0.3), rgba(0, 207, 255, 0.08));
}

/* Trend badges */
.trend-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.trend-arrow {
    font-size: 0.55rem;
    font-weight: 700;
}

.trend-pct-value {
    font-size: 0.6rem;
    font-weight: 600;
}

.trend-context {
    font-size: 0.5rem;
    opacity: 0.6;
}

.trend-up {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.trend-down {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.trend-stable {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Lead badges (ranking gap indicator) */
.lead-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    color: var(--text-secondary);
    background: rgba(122, 157, 192, 0.08);
    border: 1px solid rgba(122, 157, 192, 0.18);
}

.lead-value {
    font-size: 0.6rem;
    font-weight: 600;
}

.lead-context {
    font-size: 0.5rem;
    opacity: 0.55;
}

/* Runner-up items (smaller) */
.trending-runner-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.trending-runner-item + .trending-runner-item {
    border-top: 1px solid rgba(24, 42, 66, 0.5);
}

.trending-runner-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.trending-runner-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.trending-runner-info {
    flex: 1;
    min-width: 0;
}

.trending-runner-name {
    font-family: var(--font-base);
    font-size: 0.72rem;
    color: #b0c8e0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trending-runner-pct {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-secondary);
    font-weight: 600;
    flex-shrink: 0;
}

.trending-runner-pct-legacy {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.trending-runner-spark {
    display: none;
}

/* ══════════════════════════════════
   MOMENTUM BOARD
   ══════════════════════════════════ */

.momentum-board {
    display: flex;
    gap: 0;
    margin-top: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
}

.momentum-section {
    flex: 1;
    min-width: 0;
}

.momentum-divider {
    width: 1px;
    background: var(--border);
    margin: 0 24px;
}

.momentum-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.momentum-arrow {
    font-size: 0.85rem;
    display: inline-block;
}

.momentum-arrow.rise {
    color: #00e5a0;
    animation: pulse-rise 2s ease-in-out infinite;
}

.momentum-arrow.fall {
    color: #ff4d6a;
    animation: pulse-fall 2s ease-in-out infinite;
}

@keyframes pulse-rise {
    0%, 100% { opacity: 1; text-shadow: 0 0 4px rgba(0, 229, 160, 0.3); }
    50% { opacity: 0.6; text-shadow: 0 0 12px rgba(0, 229, 160, 0.7); }
}

@keyframes pulse-fall {
    0%, 100% { opacity: 1; text-shadow: 0 0 4px rgba(255, 77, 106, 0.3); }
    50% { opacity: 0.6; text-shadow: 0 0 12px rgba(255, 77, 106, 0.7); }
}

.momentum-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.momentum-col-headers {
    display: grid;
    grid-template-columns: 18px 1fr auto 90px 56px 44px;
    gap: 8px;
    padding: 0 12px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.momentum-col-headers span {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.5);
}

.mch-rate { text-align: right; }
.mch-score { text-align: center; }
.mch-sources { text-align: right; }
.mch-cat { text-align: center; }

.momentum-item {
    display: grid;
    grid-template-columns: 18px 1fr auto 90px 56px 44px;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background 0.3s, transform 0.2s;
    gap: 8px;
    border-left: 2px solid transparent;
    animation: momentum-slide-in 0.4s ease both;
}

.momentum-item:nth-child(2) { animation-delay: 0.05s; }
.momentum-item:nth-child(3) { animation-delay: 0.10s; }
.momentum-item:nth-child(4) { animation-delay: 0.15s; }
.momentum-item:nth-child(5) { animation-delay: 0.20s; }
.momentum-item:nth-child(6) { animation-delay: 0.25s; }

@keyframes momentum-slide-in {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.momentum-item:hover {
    background: rgba(255,255,255,0.03);
    transform: translateX(2px);
}

/* Rising: gradient green border, strongest at #1 */
.momentum-risers .momentum-item:nth-child(2) {
    border-left-color: rgba(0, 229, 160, 0.7);
    background: rgba(0, 229, 160, 0.04);
}
.momentum-risers .momentum-item:nth-child(3) {
    border-left-color: rgba(0, 229, 160, 0.5);
    background: rgba(0, 229, 160, 0.025);
}
.momentum-risers .momentum-item:nth-child(4) {
    border-left-color: rgba(0, 229, 160, 0.35);
    background: rgba(0, 229, 160, 0.015);
}
.momentum-risers .momentum-item:nth-child(5) {
    border-left-color: rgba(0, 229, 160, 0.2);
}
.momentum-risers .momentum-item:nth-child(6) {
    border-left-color: rgba(0, 229, 160, 0.1);
}

/* Falling: gradient red border, strongest at #1 */
.momentum-fallers .momentum-item:nth-child(2) {
    border-left-color: rgba(255, 77, 106, 0.7);
    background: rgba(255, 77, 106, 0.04);
}
.momentum-fallers .momentum-item:nth-child(3) {
    border-left-color: rgba(255, 77, 106, 0.5);
    background: rgba(255, 77, 106, 0.025);
}
.momentum-fallers .momentum-item:nth-child(4) {
    border-left-color: rgba(255, 77, 106, 0.35);
    background: rgba(255, 77, 106, 0.015);
}
.momentum-fallers .momentum-item:nth-child(5) {
    border-left-color: rgba(255, 77, 106, 0.2);
}
.momentum-fallers .momentum-item:nth-child(6) {
    border-left-color: rgba(255, 77, 106, 0.1);
}

.momentum-rank {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.momentum-name-group {
    min-width: 0;
    overflow: hidden;
}

.momentum-item-name {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.momentum-item-category {
    font-family: var(--font-mono);
    font-size: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    text-align: center;
    color: var(--accent);
    background: rgba(0, 207, 255, 0.08);
    border: 1px solid rgba(0, 207, 255, 0.15);
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.momentum-rate-shift {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
    white-space: pre-line;
    line-height: 1.4;
}

.momentum-score-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    padding: 2px 8px;
    border-radius: 4px;
}

.momentum-score-badge.rise {
    color: #00e5a0;
    background: rgba(0, 229, 160, 0.1);
}

.momentum-score-badge.fall {
    color: #ff4d6a;
    background: rgba(255, 77, 106, 0.1);
}

.momentum-sources {
    display: flex;
    gap: 3px;
    justify-content: flex-end;
}

.momentum-source-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.7;
}

.momentum-source-dot.inactive {
    background: var(--text-muted);
    opacity: 0.2;
}

.momentum-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px 12px;
}
