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

/* ---------- Page shell ---------- */
body {
    font-family: 'Segoe UI', sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ---------- Two column layout ---------- */
.wrapper {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    align-items: flex-start;
}

/* ---------- Left: chat area ---------- */
.container {
    flex: 1;
    min-width: 0;
    padding: 20px;
}

/* ---------- Header ---------- */
header { text-align: center; margin-bottom: 24px; }
header h1 { font-size: 1.8rem; color: #a78bfa; }
header p { color: #888; margin-top: 6px; }

/* ---------- Agent pipeline ---------- */
.pipeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.agent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #1e1e2e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.agent.active {
    border-color: #a78bfa;
    background: #2a1f3d;
    box-shadow: 0 0 12px #a78bfa44;
}

.agent .icon { font-size: 1.3rem; }
.arrow { color: #555; font-size: 1.2rem; }

/* ---------- Chat box ---------- */
.chat-box {
    background: #1e1e2e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 16px;
    height: 320px;
    overflow-y: auto;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.message.bot {
    background: #2a2a3e;
    border: 1px solid #444;
    align-self: flex-start;
}

.message.user {
    background: #4c1d95;
    align-self: flex-end;
}

.message.thinking {
    background: #1a2a1a;
    border: 1px solid #2d5a2d;
    color: #88cc88;
    font-style: italic;
}

/* ---------- Quick reply buttons ---------- */
.quick-replies {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.quick-btn {
    background: #1e1e2e;
    border: 1px solid #444;
    color: #ccc;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:hover {
    border-color: #a78bfa;
    color: #a78bfa;
    background: #2a1f3d;
}

/* ---------- Input row ---------- */
.input-area {
    display: flex;
    gap: 10px;
}

input {
    flex: 1;
    background: #1e1e2e;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px 16px;
    color: #e0e0e0;
    font-size: 1rem;
    outline: none;
}

input:focus { border-color: #a78bfa; }

button {
    background: #7c3aed;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover { background: #6d28d9; }
button:disabled { background: #444; cursor: not-allowed; }

/* ---------- Meta info ---------- */
.meta {
    text-align: center;
    font-size: 0.8rem;
    color: #555;
    margin-top: 12px;
}

/* ---------- Right: Agent trace panel ---------- */
.trace-container {
    width: 340px;
    flex-shrink: 0;
    background: #12121f;
    border: 1px solid #2a2a3e;
    border-radius: 16px;
    overflow: hidden;
    position: sticky;
    top: 20px;
}

.trace-header {
    background: #1a1a2e;
    border-bottom: 1px solid #2a2a3e;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #a78bfa;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trace-subtitle {
    font-size: 0.75rem;
    color: #555;
    font-weight: 400;
}

.trace-panel {
    padding: 16px;
    height: 560px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trace-placeholder {
    color: #444;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 40px;
    font-style: italic;
}

.trace-room {
    font-size: 0.78rem;
    color: #666;
    background: #1e1e2e;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 4px;
}

.trace-step {
    background: #1e1e2e;
    border: 1px solid #2a2a3e;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trace-agent-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #c4b5fd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trace-time {
    font-size: 0.72rem;
    color: #555;
    font-weight: 400;
    background: #12121f;
    padding: 2px 8px;
    border-radius: 10px;
}

.trace-detail {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.trace-label {
    font-size: 0.72rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trace-value {
    font-size: 0.78rem;
    color: #aaa;
    background: #12121f;
    border-radius: 6px;
    padding: 6px 8px;
    word-break: break-all;
    font-family: monospace;
}

.trace-arrow {
    text-align: center;
    color: #333;
    font-size: 1rem;
    margin-top: 4px;
}