/**
 * news-ticker.css — TRAI-flagged Events Horizontal Scroller Styling
 *
 * Styles the NewsTicker panel's marquee layout, sentiment dot colors, animations,
 * and interactive states. Loaded as external <link> from unified-dashboard.html
 * for design ownership and reusability. Fallback minimal CSS injected by JS as
 * safety net if this file fails to load (ensures container positioning works).
 *
 * All class names prefixed `nt-` (NewsTicker namespace) to prevent collisions
 * with other modules. Theme variables (--bg-panel, --text-primary, etc.) pulled
 * from root :root in unified-dashboard.html.
 */

/* ─── Container & Layout ──────────────────────────────────────────────────── */

#newsTicker {
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 10px 0;
    margin: 10px 0;
    overflow: hidden;
    position: relative;
    user-select: none;
}

.nt-container {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 45px;
    overflow: hidden;
}

.nt-scroller {
    display: flex;
    gap: 16px;
    padding: 0 20px;
    position: relative;
    will-change: transform;
    align-items: center;
}

/* ─── Item Styling ────────────────────────────────────────────────────────── */

.nt-item {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-primary);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.nt-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.08);
}

/* ─── Sentiment Dot Colors ────────────────────────────────────────────────── */

.nt-dot {
    font-size: 10px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 2px currentColor);
}

.nt-sent-bullish .nt-dot {
    color: var(--profit-color);  /* #00ff88 */
}

.nt-sent-neutral .nt-dot {
    color: var(--ml-color);  /* #ffd700 */
}

.nt-sent-defensive .nt-dot {
    color: var(--loss-color);  /* #ff3366 */
}

/* ─── Item Hover Glow by Sentiment ────────────────────────────────────────── */

.nt-sent-bullish:hover {
    border-color: rgba(0, 255, 136, 0.30);
    background: rgba(0, 255, 136, 0.06);
    box-shadow: 0 2px 12px rgba(0, 255, 136, 0.15);
}

.nt-sent-neutral:hover {
    border-color: rgba(255, 215, 0, 0.30);
    background: rgba(255, 215, 0, 0.06);
    box-shadow: 0 2px 12px rgba(255, 215, 0, 0.15);
}

.nt-sent-defensive:hover {
    border-color: rgba(255, 51, 102, 0.30);
    background: rgba(255, 51, 102, 0.06);
    box-shadow: 0 2px 12px rgba(255, 51, 102, 0.15);
}

/* ─── Time & Source Labels ────────────────────────────────────────────────── */

.nt-time {
    color: #888888;
    font-size: 11px;
    min-width: 60px;
    text-align: right;
    flex-shrink: 0;
}

.nt-source {
    color: #888888;
    font-size: 10px;
    flex-shrink: 0;
    opacity: 0.8;
}

/* ─── Headline Text ───────────────────────────────────────────────────────── */

.nt-headline {
    flex: 1 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-weight: 500;
}

/* ─── Pause State (on hover) ──────────────────────────────────────────────── */

#newsTicker.nt-paused .nt-scroller {
    animation-play-state: paused !important;
}

/* ─── Popup Modal ─────────────────────────────────────────────────────────── */

.nt-popup {
    /* Styling applied inline by JS (fixed positioning, z-index, transforms, etc.)
       This selector is here for any additional CSS that should apply to popups. */
}

/* ─── Empty State ─────────────────────────────────────────────────────────── */

.nt-empty {
    padding: 12px 20px;
    color: #666666;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
}

/* ─── Animations ──────────────────────────────────────────────────────────── */

/**
 * Marquee animation: horizontal scroll RTL. Duration scales with content width
 * so the visual speed remains consistent. JavaScript handles animation via
 * requestAnimationFrame + transform, so this keyframe is not actively used
 * in the current implementation but left as reference for future CSS-driven
 * approaches.
 */
@keyframes nt-marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/**
 * Live indicator pulse: optional animation for a "live" dot or badge indicating
 * a real event just arrived (not used in v1 but available for enhancement).
 */
@keyframes nt-pulse {
    0% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7);
    }
    50% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 0 8px rgba(0, 255, 136, 0);
    }
}

.nt-live-indicator {
    animation: nt-pulse 2s ease-in-out infinite;
}

/* ─── Responsive & Reduced Motion ─────────────────────────────────────────── */

/**
 * Operator dashboards are desktop-only per platform positioning, so minimal
 * responsive breakpoints. However, respect user's prefers-reduced-motion.
 */
@media (prefers-reduced-motion: reduce) {
    .nt-item {
        transition: none;
    }

    .nt-live-indicator {
        animation: none;
    }

    .nt-scroller {
        animation: none;
    }
}

/* ─── Small Screen Fallback (mobile viewing, edge case) ──────────────────── */

@media (max-width: 768px) {
    #newsTicker {
        margin: 8px 0;
        padding: 8px 0;
    }

    .nt-scroller {
        gap: 12px;
        padding: 0 12px;
    }

    .nt-item {
        padding: 6px 10px;
        font-size: 11px;
    }

    .nt-time {
        font-size: 10px;
        min-width: 50px;
    }

    .nt-source {
        font-size: 9px;
    }
}
