/* /mnt/data/index.css */
:root {
    --bg-color: #1c1c1c;
    --input-bg-color: #252525;
    --bubble-bg-color: #333333;
    --text-primary: #e8e8e8;
    --text-secondary: #888888;
    --border-color: #3a3a3a;
    --accent-color: #007aff;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-family-monospace: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --transition-fast: 0.2s ease;
}

html { box-sizing: border-box; font-size: 16px; }
*, *::before, *::after { box-sizing: inherit; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    height: var(--vh, 100vh);
}

.app-container { display: flex; flex-direction: column; height: 100%; max-width: 820px; margin: 0 auto; }

#chatBox {
    flex: 1; overflow-y: auto; padding: 2rem 1.5rem;
    display: flex; flex-direction: column; gap: 1.5rem;
    scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
#chatBox::-webkit-scrollbar { width: 6px; }
#chatBox::-webkit-scrollbar-track { background: transparent; }
#chatBox::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 3px; }

.message-wrapper { display: flex; flex-direction: column; max-width: 90%; animation: fadeIn 0.4s var(--transition-fast) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: translateY(0);} }

.user-wrapper { align-self: flex-end; }
.user-bubble { background-color: var(--bubble-bg-color); padding: 0.6rem 1.1rem; border-radius: var(--border-radius-lg); white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; cursor: pointer; }

.assistant-wrapper { align-self: flex-start; justify-content: flex-start; white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; }
.assistant-wrapper > span { display: block; } /* Ensure text parts are on new lines if needed */
.assistant-wrapper.typing::after { content: '▋'; display: inline-block; animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0;} }

/* === START: NEW STYLES for code blocks === */
.code-block-container {
    background-color: #101010;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    margin: 0.5rem 0;
    overflow: hidden;
}
.code-block-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background-color: #2a2a2a;
    border-bottom: 1px solid var(--border-color);
}
.copy-button {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.copy-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}
.copy-button svg {
    width: 14px;
    height: 14px;
}
.assistant-wrapper pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.assistant-wrapper pre::-webkit-scrollbar { height: 6px; }
.assistant-wrapper pre::-webkit-scrollbar-track { background: transparent; }
.assistant-wrapper pre::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 3px; }

.assistant-wrapper code {
    font-family: var(--font-family-monospace);
    font-size: 0.9rem;
    color: #d1d5db; /* Light gray for code text */
    white-space: pre;
}
/* === END: NEW STYLES for code blocks === */


#inputContainer { padding: 1rem 1.5rem 1.5rem; background-color: var(--bg-color); flex-shrink: 0; }
.input-wrapper {
    display: flex; align-items: flex-end; gap: 0.75rem;
    padding: 0.5rem 0.5rem 0.5rem 1rem; background-color: var(--input-bg-color);
    border: 1px solid var(--border-color); border-radius: var(--border-radius-md);
}
#inputBox {
    flex: 1; background: none; border: none; outline: none; color: var(--text-primary);
    font-family: var(--font-family); font-size: 1rem; line-height: 1.5; padding: 0.25rem;
    resize: none; overflow-y: hidden; max-height: calc(1.5em * 5 + 0.5rem);
    scrollbar-width: none;
}
#inputBox::-webkit-scrollbar{ display:none; }
#inputBox::placeholder{ color: var(--text-secondary); }

#sendBtn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; background-color: var(--accent-color);
    border: none; border-radius: 50%; color: white; cursor: pointer;
    transition: opacity var(--transition-fast); flex-shrink: 0;
}
#sendBtn svg { width: 18px; height: 18px; transform: rotate(45deg) translate(-1px, 1px); }
#sendBtn:hover { opacity: 0.85; }

.context-menu {
    position: absolute; display: none; min-width: 180px;
    background-color: rgba(40,40,40,0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius-md); border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3); padding: 0.5rem; z-index: 1000; opacity: 0;
    transform: scale(0.95); transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.context-menu.visible { opacity: 1; transform: scale(1); }
.context-menu-item {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem;
    color: var(--text-primary); font-size: 0.9rem; cursor: pointer; border-radius: 8px; user-select: none;
    transition: background-color var(--transition-fast);
}
.context-menu-item:hover { background-color: var(--accent-color); color: white; }
.context-menu-item svg { width: 16px; height: 16px; }
.context-menu-separator { height: 1px; background-color: var(--border-color); margin: 0.5rem 0; }

@media (max-width: 768px) {
    html { font-size: 22px; }
    #chatBox { padding: 1rem; }
    #inputContainer { padding: 0.5rem 1rem 1rem; }
    .input-wrapper { padding: 0.4rem 0.4rem 0.4rem 0.8rem; }
}

@media (min-width: 769px) {
    #desktop-wrapper { display: flex; height: 100vh; }
    #sidebar {
        flex: 0 0 calc(100% / 6);
        max-width: 320px; background-color: #151515; border-right: 1px solid var(--border-color);
        padding: 1rem; display: flex; flex-direction: column; gap: 0.1rem; overflow-y: auto;
    }
    .app-container { flex: 1; max-width: none; }

    .sidebar-item {
        display: flex; align-items: center; padding: 0.4rem 1rem;
        color: var(--text-primary); text-decoration: none; border-radius: var(--border-radius-md);
        font-weight: 500; position: relative; overflow: hidden; cursor: pointer; user-select: none;
        transition: color 0.2s ease, background-color 0.2s ease;
    }
    .sidebar-item .icon { margin-right: 0.5rem; font-size: 1.2rem; display: inline-block; width: 24px; text-align: center; }
    .sidebar-item:hover { background-color: rgba(255,255,255,0.04); }
    .sidebar-item.icon-only { padding: 0.4rem 1rem; }
    .sidebar-item.icon-only .icon { margin-right: 0; font-size: 1.5rem; }
    .sidebar-spacer { height: 0.2rem; }

    /* 选中高亮 */
    .sidebar-item.active { background-color: rgba(255,255,255,0.08); }

    /* === START: New styles for icons === */
    .sidebar-item svg {
        flex-shrink: 0;
        margin-right: 0.8rem;
        transition: transform 0.2s ease-out;
    }
    .sidebar-item:hover svg {
        transform: scale(1.1) rotate(5deg);
    }
    .sidebar-item .model-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-grow: 1;
    }
    .sidebar-item.icon-only svg {
        margin-right: 0;
    }
    /* === END: New styles for icons === */
}
