﻿/* =========================================
   Inference Profiler Variables
   ========================================= */
:root {
    --pr-bg: #0f172a;
    --pr-panel: #1e293b;
    --pr-border: #334155;
    --pr-text: #f8fafc;
    --pr-muted: #94a3b8;
    --pr-cyan: #06b6d4;
    --pr-blue: #3b82f6;
    --pr-green: #10b981;
}

/* Modal Base */
#profiler-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.profiler-modal-hidden {
    opacity: 0 !important;
    pointer-events: none;
}

.profiler-modal-container {
    background: var(--pr-bg);
    border: 1px solid var(--pr-border);
    border-radius: 12px;
    width: 1000px;
    max-width: 95vw;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* Header */
.profiler-modal-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--pr-border);
    color: var(--pr-text);
}

    .profiler-modal-header h4 {
        margin: 0;
        font-size: 1.1rem;
    }

.profiler-close-btn {
    background: none;
    border: none;
    color: var(--pr-text);
    font-size: 1.5rem;
    cursor: pointer;
}

.profiler-mono {
    font-family: monospace;
}

/* Body Layout */
.profiler-modal-body {
    display: flex;
    height: 500px;
}

/* Sidebar */
.profiler-sidebar {
    width: 280px;
    background: var(--pr-panel);
    border-right: 1px solid var(--pr-border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profiler-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--pr-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.profiler-textarea {
    width: 100%;
    height: 120px;
    background: #0f172a;
    color: var(--pr-text);
    border: 1px solid var(--pr-border);
    border-radius: 6px;
    padding: 0.8rem;
    font-size: 0.85rem;
    resize: none;
}

.profiler-heading {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--pr-muted);
    text-transform: uppercase;
    margin: 0 0 1rem 0;
    border-bottom: 1px dashed var(--pr-border);
    padding-bottom: 0.5rem;
}

.profiler-range-field {
    margin-bottom: 1rem;
}

.profiler-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--pr-text);
    margin-bottom: 0.3rem;
}

.profiler-range {
    width: 100%;
    accent-color: var(--pr-cyan);
}

/* Main Chat Panel */
.profiler-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #070b14;
}

/* HUD Telemetry */
.profiler-hud {
    display: flex;
    justify-content: space-around;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--pr-border);
    padding: 0.8rem;
}

.hud-metric {
    text-align: center;
}

.hud-label {
    font-size: 0.7rem;
    color: var(--pr-muted);
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 0.2rem;
}

.hud-value {
    font-size: 1.2rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--pr-text);
}

.hud-cyan {
    color: var(--pr-cyan);
}

/* Chat Window */
.profiler-chat-window {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

    .profiler-chat-window::-webkit-scrollbar {
        width: 6px;
    }

    .profiler-chat-window::-webkit-scrollbar-track {
        background: transparent;
    }

    .profiler-chat-window::-webkit-scrollbar-thumb {
        background: #334155;
        border-radius: 4px;
    }

.profiler-msg {
    padding: 1rem;
    border-radius: 8px;
    max-width: 85%;
    line-height: 1.5;
    font-size: 0.95rem;
}

.user-msg {
    align-self: flex-end;
    background: #1e293b;
    color: var(--pr-text);
    border: 1px solid var(--pr-border);
}

.ai-msg {
    align-self: flex-start;
    background: transparent;
    color: var(--pr-text);
    width: 100%;
    max-width: 100%;
    font-family: monospace;
}

/* Token Streaming Animation */
.token-chunk {
    display: inline-block;
    /* Flash effect when token arrives */
    animation: token-flash 0.3s ease-out forwards;
}

@keyframes token-flash {
    0% {
        background: rgba(6, 182, 212, 0.4);
    }

    100% {
        background: transparent;
    }
}

/* Action Area */
.profiler-action-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--pr-border);
    background: var(--pr-panel);
    display: flex;
    justify-content: flex-end;
}

/* Mobile Adaptability */
@media (max-width: 768px) {
    .profiler-modal-body {
        flex-direction: column;
        height: 80vh;
    }

    .profiler-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--pr-border);
        height: 250px;
        overflow-y: auto;
    }
}
.ai-msg {
    align-self: flex-start;
    background: transparent;
    color: var(--pr-text);
    width: 100%;
    max-width: 100%;
    font-family: monospace;
    white-space: pre-wrap; 
    word-wrap: break-word; 
}

.token-chunk {
    display: inline; 
    animation: token-flash 0.3s ease-out forwards;
}