/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Textarea ── */
#message-input {
    max-height: 200px;
    scrollbar-width: thin;
}

/* ── Messages area smooth scroll ── */
#messages {
    scroll-behavior: smooth;
}

/* ── Markdown content ── */
.message-content p {
    margin-bottom: 0.625rem;
}
.message-content p:last-child {
    margin-bottom: 0;
}
.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}
.message-content ul {
    list-style-type: disc;
}
.message-content ol {
    list-style-type: decimal;
}
.message-content li {
    margin-bottom: 0.25rem;
}
.message-content pre {
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    font-size: 0.8125rem;
    line-height: 1.6;
}
.message-content code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.8125rem;
}
.message-content :not(pre) > code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
}
.message-content blockquote {
    border-left: 3px solid rgba(99, 102, 241, 0.5);
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: #94a3b8;
}
.message-content table {
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.875rem;
    width: 100%;
}
.message-content th,
.message-content td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.message-content th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}
.message-content a {
    color: #818cf8;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.message-content a:hover {
    color: #a5b4fc;
}
.message-content h1,
.message-content h2,
.message-content h3 {
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}
.message-content h1 { font-size: 1.25rem; }
.message-content h2 { font-size: 1.125rem; }
.message-content h3 { font-size: 1rem; }

/* ── Typing indicator ── */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}
.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6366f1;
    animation: typing-blink 1.4s infinite both;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-blink {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ── Agent status pill ── */
.agent-status {
    padding: 0 0 0.375rem 0;
}
.agent-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 0.8125rem;
    color: #a5b4fc;
    animation: agent-fade-in 0.3s ease;
}
.agent-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #818cf8;
    animation: agent-pulse 1.5s ease-in-out infinite;
}
@keyframes agent-pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.15); }
}
@keyframes agent-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── File chips ── */
.file-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding-bottom: 0.5rem;
}
.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 200px;
    padding: 0.25rem 0.5rem 0.25rem 0.625rem;
    border-radius: 0.5rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    font-size: 0.75rem;
    color: #c7d2fe;
    animation: agent-fade-in 0.2s ease;
}
.file-chip span {
    max-width: 140px;
}
.file-chip-remove {
    flex-shrink: 0;
    padding: 2px;
    border-radius: 4px;
    color: #94a3b8;
    transition: color 0.15s, background 0.15s;
}
.file-chip-remove:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* ── Session item ── */
.session-item {
    transition: background 0.15s;
}
.session-item.active {
    background: rgba(99, 102, 241, 0.15);
}
.session-item .delete-btn {
    opacity: 0;
    transition: opacity 0.15s;
}
.session-item:hover .delete-btn {
    opacity: 1;
}

/* ── Message status (checkmarks) ── */
.msg-status {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}
.msg-status svg {
    width: 15px;
    height: 15px;
}
/* sending — clock icon, pulsing */
.msg-status.sending svg {
    color: rgba(255,255,255,0.5);
    animation: status-pulse 1s ease-in-out infinite;
}
@keyframes status-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
/* sent — single grey check */
.msg-status.sent svg { color: rgba(255,255,255,0.55); }
/* delivered — double grey check */
.msg-status.delivered svg { color: rgba(255,255,255,0.55); }
/* read — double blue check */
.msg-status.read svg { color: #60a5fa; }

/* ── Mobile sidebar ── */
@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(0, 0, 0, 0.5);
    }
    .sidebar-overlay.show {
        display: block;
    }
}
