/* Speed Demo Terminal */
.speed-demo-container {
    margin-top: 60px;
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    border: 1px solid #333;
    max-width: 700px; /* Limit width */
    display: flex; /* Use Flexbox for internal layout */
    flex-direction: column;
}

.demo-header {
    background: #2d2d2d;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    flex-shrink: 0; /* Prevent header from shrinking */
    min-height: 40px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s;
    flex-shrink: 0;
}

.status-dot.online {
    background: #10a37f;
    box-shadow: 0 0 6px rgba(16, 163, 127, 0.5);
}

.status-dot.connecting {
    background: #f1c40f;
    animation: pulse 1.5s infinite;
}

.status-dot.error {
    background: #e74c3c;
}

.latency-display {
    font-size: 0.75rem;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    background: #252525;
    border-radius: 4px;
    transition: all 0.3s;
    flex-shrink: 0; /* Ensure latency display is never compressed */
    margin-left: 10px;
}

.latency-display.highlight {
    background: rgba(16, 163, 127, 0.2);
    color: #10a37f;
    border: 1px solid #10a37f;
}

.latency-display .value {
    font-weight: 600;
    color: #fff;
}

.latency-display.highlight .value {
    color: #10a37f;
}

.demo-terminal {
    padding: 16px;
    /* height is controlled by flex container */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contain inner scroll */
    min-height: 0; /* Allow flex child to shrink properly in Firefox */
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
    padding-right: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Scrollbar for terminal */
.terminal-output::-webkit-scrollbar {
    width: 4px;
}
.terminal-output::-webkit-scrollbar-track {
    background: #1e1e1e;
}
.terminal-output::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}

.terminal-msg {
    margin-bottom: 8px;
    word-wrap: break-word;
}

.terminal-msg.system {
    color: #666;
    font-size: 0.75rem;
}

.terminal-msg.user {
    color: #fff;
}

.terminal-msg.user .prompt {
    color: #aaa;
    margin-right: 6px;
}

.terminal-msg.ai {
    color: #10a37f;
}

.terminal-msg.ai .prompt {
    color: #10a37f;
    margin-right: 6px;
    font-weight: bold;
}

.terminal-msg.ai .content {
    color: #ddd;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    border-top: 1px solid #333;
    padding-top: 12px;
    flex-shrink: 0; /* Input line shouldn't shrink */
    gap: 8px;
}

.terminal-input-line .prompt {
    color: #10a37f;
    margin-right: 4px;
    font-weight: bold;
    font-size: 0.9rem;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
}

#terminal-input::placeholder {
    color: #555;
}

#terminal-input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Send Button */
.terminal-send-btn {
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.terminal-send-btn:not(:disabled):hover {
    color: #10a37f;
    background: rgba(16, 163, 127, 0.1);
}

.terminal-send-btn:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

/* Highlight effect for system prompt */
.highlight-text {
    color: #ffffff; /* Pure white for maximum contrast */
    font-weight: bold;
    background: #10a37f; /* Solid brand green background */
    padding: 4px 8px; /* Larger padding */
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(16, 163, 127, 0.6); /* Glow effect */
    display: inline-block; /* Ensure box model works well */
    margin: 0 2px;
    animation: flash 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
