:root {
    color-scheme: light;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.navbar-brand .fa-otter {
    font-size: 1.5rem;
}

.card {
    border-radius: 1rem;
}

.chat-scroll {
    overflow-y: auto;
    padding-right: 0.5rem;
}

.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 320px;
}

.message {
    display: flex;
    gap: 0.75rem;
}

.message.assistant {
    align-items: flex-start;
}

.message.assistant .bubble {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(129, 140, 248, 0.08));
    border: 1px solid rgba(79, 70, 229, 0.15);
}

.message.user {
    flex-direction: row-reverse;
    text-align: right;
}

.message.user .bubble {
    background: var(--bs-primary-bg-subtle);
    border: 1px solid rgba(13, 110, 253, 0.3);
}

.message .avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--bs-gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-gray-700);
    font-weight: 600;
    flex-shrink: 0;
}

.message.user .avatar {
    background: var(--bs-primary);
    color: #fff;
}

.message .bubble {
    flex: 1 1 auto;
    background: #fff;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.08);
    position: relative;
}

.message .bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.message .bubble-header .meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.message .bubble-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message .controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message .controls .btn {
    --bs-btn-padding-y: 0.25rem;
    --bs-btn-padding-x: 0.5rem;
    --bs-btn-font-size: 0.8rem;
}

.markdown-body p:last-child {
    margin-bottom: 0;
}

.markdown-body pre {
    background: #0e1116;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    overflow-x: auto;
}

.markdown-body code {
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
    font-size: 0.9rem;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 0.75rem;
}

.markdown-body table thead {
    background: rgba(13, 110, 253, 0.08);
}

.markdown-body th,
.markdown-body td {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.thought-thread {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.thought-card {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.thought-card:last-child {
    border-bottom: none;
}

.thought-card .meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.thought-card .badge {
    font-size: 0.75rem;
}

.thought-stream {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.45;
}

.thought-stream-chunk {
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    background: rgba(111, 66, 193, 0.08);
    border: 1px solid rgba(111, 66, 193, 0.15);
    white-space: pre-wrap;
    animation: fade-in 0.25s ease-out;
}

.thought-stream-chunk .chunk-time {
    display: block;
    font-size: 0.75rem;
    color: rgba(15, 23, 42, 0.55);
    margin-top: 0.25rem;
}

.placeholder.emptyThoughts {
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

.composer textarea {
    resize: none;
}

.toast:not(.show) {
    opacity: 1;
}

.badge-thought {
    background: rgba(111, 66, 193, 0.15);
    color: rgb(111, 66, 193);
}

.badge-standard {
    background: rgba(100, 116, 139, 0.2);
    color: rgb(71, 85, 105);
}

#connectionStatus i {
    font-size: 0.65rem;
}

.history-list {
    padding: 0.75rem;
    background: #fff;
}

.history-entry {
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding: 0.75rem 0;
}

.history-entry:last-child {
    border-bottom: none;
}

.history-entry .entry-meta {
    font-size: 0.75rem;
    color: rgba(15, 23, 42, 0.6);
}

.history-entry pre {
    background: rgba(15, 23, 42, 0.05);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.metrics {
    font-size: 0.78rem;
    color: rgba(15, 23, 42, 0.6);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-group.w-100 > .btn {
    flex: 1 1 0;
}

.request-inspector .response-log {
    max-height: 180px;
}

.inspector-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.inspector-toggle.active {
    background: rgba(13, 110, 253, 0.15);
    border-color: rgba(13, 110, 253, 0.4);
}

.response-log {
    background: #0e1116;
    color: #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    max-height: 240px;
    overflow-y: auto;
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 0.8rem;
}

.response-log::-webkit-scrollbar {
    width: 0.5rem;
}

.response-log::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 1rem;
}

.chart-holder {
    position: relative;
    height: 220px;
}

.chart-holder canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

.chart-container {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 1rem;
}

#thoughtTimeline::-webkit-scrollbar,
#messageScroller::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
    width: 0.5rem;
}

#thoughtTimeline::-webkit-scrollbar-thumb,
#messageScroller::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 1rem;
}

@media (max-width: 1199.98px) {
    .thought-thread {
        max-height: none;
    }
    #thoughtsCard {
        order: -1;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand span {
        font-size: 1rem;
    }

    .message .bubble {
        padding: 0.85rem 1rem;
    }

    .message .controls {
        display: none;
    }
}
