/* ═══════════════════════════════════════════════
   AGENT TRACE VIEWER STYLES
   ═══════════════════════════════════════════════ */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #faf8f5;
    color: #2d2a26;
    line-height: 1.6;
}

/* ─── Hero ─── */
.trace-hero {
    text-align: center;
    padding: 60px 40px 40px;
    max-width: 700px;
    margin: 0 auto;
}

.trace-hero .label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #558b2f;
    background: #edf7ee;
    padding: 4px 12px;
    border-radius: 20px;
}

.trace-hero h1 {
    font-size: 32px;
    font-weight: 800;
    margin-top: 16px;
    letter-spacing: -0.02em;
}

.trace-hero .subtitle {
    font-size: 15px;
    color: #6b665e;
    margin-top: 10px;
    line-height: 1.7;
}

/* ─── Input Bar ─── */
.trace-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px 60px;
}

.trace-input-bar {
    display: flex;
    gap: 10px;
}

.session-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #e8e4de;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    background: #fffefa;
    color: #2d2a26;
    outline: none;
    transition: border-color 0.2s;
}

.session-input:focus {
    border-color: #66bb6a;
    box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.1);
}

.session-input::placeholder {
    color: #c4bfb8;
}

.btn-load {
    font-size: 13px;
    font-weight: 700;
    padding: 12px 22px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #66bb6a, #43a047);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-load:hover {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.25);
    transform: translateY(-1px);
}

.demo-row {
    text-align: center;
    margin-top: 12px;
}

.btn-demo {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid #e8e4de;
    border-radius: 8px;
    background: #fffefa;
    color: #8a857d;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-demo:hover {
    border-color: #66bb6a;
    color: #558b2f;
}

/* ─── Timeline ─── */
.timeline-container {
    margin-top: 32px;
    background: #fffefa;
    border: 1px solid #e8e4de;
    border-radius: 14px;
    overflow: hidden;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f0ece6;
}

.timeline-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.timeline-stats {
    font-size: 12px;
    color: #9e9890;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
}

.timeline {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

/* ─── Step Nodes ─── */
.step-node {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.step-node:hover {
    background: #f5f3ee;
}

.step-node.selected {
    background: #edf7ee;
    border: 1px solid #c8e6c9;
}

/* Vertical line */
.step-node:not(:last-child)::before {
    content: '';
    position: absolute;
    top: 46px;
    left: 31px;
    width: 2px;
    height: calc(100% - 18px);
    background: #e8e4de;
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    z-index: 1;
}

.step-dot.guardrail {
    background: #e3f2fd;
    color: #1565c0;
}

.step-dot.llm {
    background: #f3e5f5;
    color: #7b1fa2;
}

.step-dot.memory {
    background: #fff8e1;
    color: #f57f17;
}

.step-dot.credit {
    background: #e8f5e9;
    color: #2e7d32;
}

.step-dot.error {
    background: #ffebee;
    color: #c62828;
}

.step-dot.default {
    background: #f5f3ee;
    color: #6b665e;
}

.step-info {
    flex: 1;
    min-width: 0;
}

.step-fn {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
}

.step-summary {
    font-size: 12px;
    color: #8a857d;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-timing {
    font-size: 12px;
    font-weight: 600;
    color: #9e9890;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    flex-shrink: 0;
    padding-top: 2px;
}

/* ─── Detail Panel ─── */
.detail-panel {
    margin-top: 20px;
    background: #fffefa;
    border: 1px solid #c8e6c9;
    border-radius: 14px;
    overflow: hidden;
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f0ece6;
    background: #f5faf6;
}

.detail-step {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #558b2f;
}

.detail-header h3 {
    font-size: 16px;
    font-weight: 700;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    margin-top: 2px;
}

.btn-close-detail {
    width: 28px;
    height: 28px;
    border: 1px solid #e8e4de;
    background: #fffefa;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a857d;
}

.btn-close-detail:hover {
    background: #f0ece6;
    color: #2d2a26;
}

.detail-body {
    padding: 20px 24px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9e9890;
    margin-bottom: 8px;
}

.detail-code {
    background: #1a1816;
    color: #c8e6c9;
    padding: 16px;
    border-radius: 10px;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.detail-meta {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.meta-chip {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    background: #f5f3ee;
    color: #6b665e;
    border: 1px solid #e8e4de;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .trace-hero {
        padding: 40px 20px 30px;
    }

    .trace-section {
        padding: 0 20px 40px;
    }

    .trace-input-bar {
        flex-direction: column;
    }
}
/* ─── Community Banner ─── */
.community-banner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px 60px;
}
.community-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: linear-gradient(135deg, #f5faf6, #edf7ee);
    border: 1px solid #c8e6c9;
    border-radius: 14px;
}
.community-text { display: flex; align-items: center; gap: 16px; }
.community-icon { font-size: 28px; }
.community-text h3 { font-size: 16px; font-weight: 700; color: #1a1816; margin-bottom: 2px; }
.community-text p { font-size: 13px; color: #6b665e; }
.community-link {
    display: inline-flex; align-items: center; font-size: 14px; font-weight: 600;
    padding: 10px 22px; border-radius: 10px; background: #2d2a26; color: #fff;
    text-decoration: none; transition: all 0.2s ease; white-space: nowrap;
}
.community-link:hover {
    background: #1a1816; box-shadow: 0 4px 12px rgba(0,0,0,.15); transform: translateY(-1px);
}
