/* Bob.Chat - Custom Styles */

/* Smooth scrollbar for dark theme */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #2a2a4a;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3a3a5a;
}

/* Auto-grow textarea */
#chat-input {
    field-sizing: content;
    min-height: 48px;
}

/* Message styles */
.message-bubble {
    max-width: 48rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.message-user {
    background: #2a2a4a;
    border-radius: 1rem 1rem 0.25rem 1rem;
    margin-left: auto;
    max-width: 80%;
    width: fit-content;
}

.message-assistant {
    width: 100%;
}

/* Markdown content styles */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    font-weight: 700;
    margin: 1rem 0 0.5rem;
}
.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.25rem; }
.markdown-content h3 { font-size: 1.1rem; }

.markdown-content p {
    margin: 0.5rem 0;
    line-height: 1.7;
}

.markdown-content ul, .markdown-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}
.markdown-content ul { list-style-type: disc; }
.markdown-content ol { list-style-type: decimal; }
.markdown-content li { margin: 0.25rem 0; }

.markdown-content code {
    background: #1a1a2e;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
}

.markdown-content pre {
    background: #0f0f1a;
    border: 1px solid #2a2a4a;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 0.75rem 0;
    overflow-x: auto;
    position: relative;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.markdown-content blockquote {
    border-left: 3px solid #6c63ff;
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: #8888a8;
}

.markdown-content a {
    color: #6c63ff;
    text-decoration: underline;
}

.markdown-content table {
    border-collapse: collapse;
    margin: 0.75rem 0;
    width: 100%;
}
.markdown-content th, .markdown-content td {
    border: 1px solid #2a2a4a;
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.markdown-content th {
    background: #1a1a2e;
    font-weight: 600;
}

/* Code copy button */
.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #2a2a4a;
    border: none;
    color: #8888a8;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}
.markdown-content pre:hover .code-copy-btn {
    opacity: 1;
}
.code-copy-btn:hover {
    color: #e4e4f0;
    background: #3a3a5a;
}

/* Thinking / loading animation */
.thinking-dots span {
    animation: blink 1.4s infinite both;
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #6c63ff;
    border-radius: 50%;
    margin: 0 2px;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Image in chat */
.chat-image {
    max-width: 512px;
    max-height: 512px;
    border-radius: 0.75rem;
    border: 1px solid #2a2a4a;
    cursor: pointer;
    transition: transform 0.2s;
}
.chat-image:hover {
    transform: scale(1.02);
}

/* Image lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 0.5rem;
}

/* Thread item styles */
.thread-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s;
    gap: 0.5rem;
}
.thread-item:hover {
    background: #22223a;
}
.thread-item.active {
    background: #2a2a4a;
}
.thread-item .thread-title {
    flex: 1;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.thread-item .thread-delete {
    opacity: 0;
    color: #8888a8;
    flex-shrink: 0;
    transition: opacity 0.15s, color 0.15s;
}
.thread-item:hover .thread-delete {
    opacity: 1;
}
.thread-item .thread-delete:hover {
    color: #e74c6f;
}

/* VRAM swap indicator */
.swap-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    color: #8888a8;
}
.swap-indicator .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #2a2a4a;
    border-top-color: #6c63ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Message action buttons */
.message-actions {
    opacity: 0;
    transition: opacity 0.15s;
}
.message-wrapper:hover .message-actions {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .message-user {
        max-width: 90%;
    }
    .message-bubble {
        padding: 0.75rem 1rem;
    }
}

/* Image generation progress bar */
.image-progress {
    width: 100%;
    height: 4px;
    background: #2a2a4a;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.image-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6c63ff, #a78bfa);
    border-radius: 2px;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
    width: 40%;
}
@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}
