/* Terminal-style CSS - Lightweight & Clean */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #1a1a2e;
    --terminal-bg: #0d0d1a;
    --text-color: #e0e0e0;
    --prompt-color: #00ff88;
    --user-color: #00d4ff;
    --ai-color: #00ff88;
    --system-color: #888;
    --error-color: #ff4757;
    --border-color: #2d2d44;
}

body {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', monospace;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.terminal {
    width: 100%;
    max-width: 900px;
    background: var(--terminal-bg);
    border-radius: 12px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px var(--border-color);
    overflow: hidden;
}

/* Terminal Header - macOS style */
.terminal-header {
    background: linear-gradient(180deg, #3d3d5c 0%, #2d2d44 100%);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.terminal-buttons {
    display: flex;
    gap: 8px;
}

.terminal-buttons .btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.btn.close {
    background: #ff5f56;
}

.btn.minimize {
    background: #ffbd2e;
}

.btn.maximize {
    background: #27ca40;
}

.terminal-title {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: #888;
    margin-right: 52px;
}

/* Terminal Body - Output area */
.terminal-body {
    padding: 20px;
    min-height: 400px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.terminal-body::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-track {
    background: var(--terminal-bg);
}

.terminal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Message lines */
.line {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
}

.line .prefix {
    color: var(--system-color);
    margin-right: 8px;
    user-select: none;
}

.line .text {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
}

.line.user .prefix {
    color: var(--user-color);
}

.line.user .text {
    color: var(--user-color);
}

.line.ai .prefix {
    color: var(--ai-color);
}

.line.ai .text {
    color: var(--text-color);
}

.line.system .text {
    color: var(--system-color);
    font-style: italic;
}

.line.error .text {
    color: var(--error-color);
}

.line.token-usage {
    opacity: 0.6;
    font-size: 12px;
    margin-top: -4px;
}

.line.token-usage .prefix {
    font-size: 11px;
}

.line.token-usage .text {
    color: #888;
    font-style: italic;
}

/* Loading animation */
.line.loading .text::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

/* Input area */
.input-line {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-color);
}

.prompt {
    color: var(--prompt-color);
    font-size: 16px;
    margin-right: 12px;
    user-select: none;
}

#input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    caret-color: var(--prompt-color);
}

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

#input:disabled {
    opacity: 0.5;
}

/* Blinking cursor */
.cursor {
    width: 8px;
    height: 16px;
    background: var(--prompt-color);
    animation: blink 1s step-end infinite;
    margin-left: 2px;
    display: none;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .terminal-body {
        min-height: 300px;
        padding: 15px;
        font-size: 13px;
    }

    .terminal-title {
        display: none;
    }
}

/* Subtle scanline effect (optional) */
.terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px);
    pointer-events: none;
    z-index: 1;
}

.terminal {
    position: relative;
}

.terminal>* {
    position: relative;
    z-index: 2;
}

/* Disclaimer */
.disclaimer {
    width: 100%;
    max-width: 900px;
    margin: 16px auto 0;
    padding: 12px 16px;
    background: rgba(255, 189, 46, 0.1);
    border: 1px solid rgba(255, 189, 46, 0.3);
    border-radius: 8px;
    color: #ffbd2e;
    font-size: 13px;
    text-align: center;
}