/* Remove styles for more buttons and related elements */
.more-btn, 
.action-buttons {
    display: none !important;
}

/* Remove any CSS that references the more buttons */
.chat-history-item .more-btn,
.chat-history-item [data-lucide="more-horizontal"],
.chat-history-item .lucide-more-horizontal {
    display: none !important;
}

/* Update chat history item styling to be cleaner without buttons */
.chat-history-item {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    margin: 1px 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
    /* Remove justify-between since we don't have action buttons anymore */
    justify-content: flex-start;
}

.chat-history-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.chat-history-item.active-chat {
    background-color: rgba(68, 76, 231, 0.15);
}

.chat-history-item.context-active {
    background-color: rgba(60, 60, 65, 0.6);
}

.chat-title {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    line-height: 1.4;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    user-select: none;
}

/* Update the subtle indicator for right-click to be more visible */
.chat-history-item::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-history-item:hover::after {
    opacity: 1;
}

/* Make sure context menu works properly */
.chat-history-item {
    cursor: context-menu;
}

/* Enhanced word wrapping for all chat content */
#chat-container,
#chat-container * {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
}

/* User message bubbles - enhanced word wrapping */
.bg-primary.text-white.py-3.px-4.rounded-2xl {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 90%;
    overflow: hidden;
    hyphens: auto;
}

/* Assistant message content - enhanced word wrapping */
.text-gray-200.flex-1.markdown-content {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    overflow: hidden;
    hyphens: auto;
}

/* ...existing styles... */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #444ce7;
    --primary-hover: #3a41c5;
    --dark-bg: #18191a;
    --dark-bg2: #212223;
    --dark-bg3: #2a2b2d;
    --glass-bg: rgba(42, 43, 45, 0.8);
    --glass-border: rgba(255, 255, 255, 0.05);
    --transition-ease: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--dark-bg);
    color: #fff;
}

/* Glass morphism effect for components */
.glass-component {
    background-color: rgba(42, 43, 45, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
    backdrop-filter: blur(10px);
    transition: var(--transition-ease);
    padding: 10px 14px;
}

.glass-component:hover {
    background-color: rgba(42, 43, 45, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

/* Prevent modal content from having hover effects */
.modal-content.glass-component:hover {
    background-color: var(--dark-bg2);
    box-shadow: none;
    border: 1px solid var(--glass-border);
    transform: none;
}

/* Enhanced sidebar styling */
.w-64 {
    background-color: var(--dark-bg2);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    width: 280px !important;
}

/* Compact sidebar sections */
.sidebar-section {
    padding: 0;
    margin-bottom: 8px;
}

/* Improved section headers */
.sidebar-section .date-label {
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 500;
    padding: 4px 14px 2px;
    margin-top: 10px;
    letter-spacing: 0.5px;
}

/* Search input styling - updated to match image */
.search-container {
    position: relative;
    margin-bottom: 12px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    transition: all 0.2s;
}

.search-container:focus-within {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-input {
    color: white;
    font-size: 14px;
    padding: 7px 8px;
    transition: var(--transition-ease);
    outline: none;
}

.search-input:focus {
    outline: none;
}

.keyboard-shortcut {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* Chat content area styling - UPDATED */
#chat-container {
    background-color: var(--dark-bg);
    position: relative;
    /* increased top padding for more downward spacing */
    padding: 24px 24px 12px 24px;
    display: flex;
    flex-direction: column;
    /* allow full-width wrappers so bubbles hug the top */
    align-items: stretch;
}

#chat-container::before {
    display: none;
}

/* Chat bubble styling - IMPROVED to match textarea */
.chat-bubble {
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition-ease);
    background-color: rgba(33, 34, 35, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 28px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    /* increased max-width for wider bubbles */
    max-width: 95%;
    position: relative;
    z-index: 1;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.chat-bubble.show {
    opacity: 1;
    transform: translateY(0);
}

.chat-bubble:hover {
    background-color: rgba(42, 43, 45, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.welcome-message {
    animation: fadeIn 0.8s ease 0.3s forwards;
    background-color: rgba(33, 34, 35, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    padding: 24px;
    margin-bottom: 16px;
}

/* Input Container styles - KEEP THE SAME */
.input-container {
    position: relative;
    background-color: rgba(42, 43, 45, 0.8);
    border-radius: 16px;
    padding: 16px 20px;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transition: var(--transition-ease);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

/* Modified focus state to prevent hover effect when clicked */
.input-container:focus-within {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(68, 76, 231, 0.3);
    transform: none;
}

/* Textarea styles - NOT CHANGING */
textarea {
    min-height: 28px;
    max-height: 200px;
    line-height: 1.6;
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    padding: 8px 0;
    border-radius: 0;
    transition: var(--transition-ease);
    width: 100%;
    box-shadow: none;
    margin: 0;
    border: none;
    font-size: 16px;
    color: #ffffff;
    letter-spacing: 0.2px;
    background-color: transparent;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    font-size: 16px;
    letter-spacing: 0.2px;
    font-family: 'Outfit', sans-serif;
}

textarea:focus {
    box-shadow: none;
    outline: none;
}

/* Updated modern buttons to match textarea style */
.model-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    transition: var(--transition-ease);
    border: none;
    backdrop-filter: blur(10px);
}

.model-button:hover {
    background-color: rgba(42, 43, 45, 0.4);
    transform: translateY(-1px);
    border: none;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(42, 43, 45, 0.2);
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.icon-button:hover {
    background-color: rgba(42, 43, 45, 0.4);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.send-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background-color: var(--primary-color);
    color: white;
    transition: var(--transition-ease);
    border: none;
    box-shadow: 0 4px 12px rgba(68, 76, 231, 0.4);
}

.send-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(68, 76, 231, 0.5);
}

.send-button:active {
    transform: translateY(0);
}

/* small badge above prompt when "Create image" mode is active */
.mode-label {
    position: absolute;
    left: 20px;
    top: 16px;
    transform: none;
    color: var(--primary-color);
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
}

/* Enhanced input for renaming chat */
.rename-input {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(68, 76, 231, 0.5);
    border-radius: 4px;
    padding: 2px 6px;
    color: white;
    width: 100%;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
}

.rename-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(68, 76, 231, 0.3);
    border-color: rgba(68, 76, 231, 0.8);
}

/* Improved toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Bottom buttons area - UPDATED */
.bottom-buttons-area {
    background-color: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border-radius: 0 0 0 16px;
    padding: 16px;
}

/* Simple typing indicator - no italic, just animated text - UPDATED */
.simple-typing-indicator {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    animation: pulse 2s ease-in-out infinite;
}

/* Dots animation for typing */
.simple-typing-indicator:not(:contains("Searching")):not(:contains("Generating"))::after {
    content: '';
    animation: typingDots 1.5s infinite;
}

@keyframes typingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Remove old fancy typing indicator styles */
.fancy-typing-indicator {
    display: none;
}

.typing-text {
    display: none;
}

/* Reaction buttons inside chat bubbles */
.reaction-group {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.reaction-button {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 6px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
}

.reaction-button:hover {
    background: rgba(60, 62, 65, 0.3);
    color: #fff;
}

.reaction-button.selected {
    color: var(--primary-color);
    background: rgba(68, 76, 231, 0.1);
}

.reaction-button.delete {
    color: rgba(244, 67, 54, 0.8);
}

.reaction-button.delete:hover {
    color: rgba(244, 67, 54, 1);
    background: rgba(244, 67, 54, 0.1);
}

/* Logo styling */
#logoArea {
    display: flex;
    align-items: center;
    transition: opacity 0.2s ease;
}

#logoArea:hover {
    opacity: 0.8;
}

/* Improved user profile button styles */
.user-profile-btn {
    background-color: transparent;
    border: none;
    transition: background-color 0.2s ease;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px 12px;
    margin: 2px 0;
}

.user-profile-btn:hover {
    background-color: rgba(42, 43, 45, 0.5);
}

.user-profile-btn .rounded-full {
    transition: all 0.3s ease;
    background-color: rgba(80, 80, 80, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile-btn:hover .rounded-full {
    background-color: rgba(90, 90, 90, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-profile-btn i[data-lucide="settings"] {
    opacity: 0.6;
    transition: all 0.2s ease;
}

.user-profile-btn:hover i[data-lucide="settings"] {
    opacity: 0.9;
    transform: rotate(30deg);
}

/* Make most buttons fully transparent (no borders or bg), except key primary actions */
button:not(.send-button):not(.primary-button):not(#newChatBtn) {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Explicitly ensure model/icon/reaction buttons are borderless */
.model-button,
.icon-button,
.reaction-button {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.font-sans {
    font-family: 'Outfit', ui-sans-serif, system-ui !important;
}

/* Add styles for clickable logo */
#logoArea {
    transition: opacity 0.2s ease;
    background-color: transparent !important;
}

#logoArea:hover {
    background-color: transparent !important;
    opacity: 0.8;
}

#logoArea:active {
    transform: scale(0.98);
    background-color: transparent !important;
}

/* New styles for modals and context menus */

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 90%;
    max-width: 450px;
    border-radius: 16px;
    overflow: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    background-color: var(--dark-bg2);
    border: 1px solid var(--glass-border);
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px;
}

.close-modal {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.close-modal:hover {
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

/* Setting group styles */
.setting-group {
    margin-bottom: 24px;
}

.setting-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    background-color: rgba(42, 43, 45, 0.4);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.setting-button.active {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid transparent;
}

.setting-button:hover:not(.active),
.setting-button.no-hover:hover {
    background-color: rgba(42, 43, 45, 0.4);
    transform: none;
}

/* Custom scrollbar for sidebar */
.overflow-y-auto::-webkit-scrollbar {
    width: 4px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Sidebar content padding adjustment */
.sidebar-content {
    padding: 0 2px;
}

/* Model selector in header */
.model-selector {
    position: relative;
}

#currentModelBtn {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.model-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 280px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
    background-color: var(--dark-bg2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.model-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.model-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background-color 0.15s;
}

.model-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.model-option.active {
    background-color: rgba(68, 76, 231, 0.15);
}

.model-option > div {
    flex: 1;
}

.model-dropdown::-webkit-scrollbar {
    width: 4px;
}
.model-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.model-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* center and scale generated images */
#chat-container img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

/* Enhanced Code Block Styling */
.markdown-content {
    line-height: 1.6;
    font-family: 'Outfit', sans-serif;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.3rem; }
.markdown-content h3 { font-size: 1.1rem; }
.markdown-content h4 { font-size: 1rem; }

.markdown-content p {
    margin: 8px 0;
    color: rgba(255, 255, 255, 0.9);
}

.markdown-content strong {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.markdown-content em {
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
}

.markdown-content ul,
.markdown-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.markdown-content li {
    margin: 4px 0;
    color: rgba(255, 255, 255, 0.9);
}

.markdown-content blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--primary-color);
    background-color: rgba(68, 76, 231, 0.1);
    border-radius: 0 8px 8px 0;
    color: rgba(255, 255, 255, 0.9);
}

/* UPDATED: More neutral inline code styling for assistant messages */
.markdown-content code:not(pre code) {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e5e5;
    padding: 0.25em 0.5em;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.12);
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
    display: inline;
    overflow: hidden;
    hyphens: auto;
    vertical-align: baseline;
}

.markdown-content code:not(pre code):hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f0f0f0;
}

/* Enhanced code block container styling */
.markdown-content .code-block-container {
    margin: 16px 0;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 100%;
}

/* Code header with language and copy button */
.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: #27272a;
    font-size: 0.75rem;
    color: #a1a1aa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-header-language {
    text-transform: lowercase;
    font-weight: 500;
}

.code-copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
    background: transparent;
    border: none;
    color: #a1a1aa;
}

.code-copy-btn:hover {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

/* Code body with syntax highlighting */
.code-body {
    padding: 0;
}

.markdown-content pre {
    background: #1a1a1a;
    padding: 1rem;
    margin: 0;
    overflow-x: auto;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.5;
    max-width: 100%;
    white-space: pre;
    word-wrap: normal;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    color: #e4e4e7;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    word-break: normal;
    white-space: pre;
}

/* Syntax highlighting overrides */
.hljs {
    background: transparent !important;
    color: #e4e4e7 !important;
}

.hljs-keyword {
    color: #c792ea !important;
}

.hljs-string {
    color: #c3e88d !important;
}

.hljs-number {
    color: #f78c6c !important;
}

.hljs-comment {
    color: #546e7a !important;
    font-style: italic;
}

.hljs-function {
    color: #82aaff !important;
}

.hljs-variable {
    color: #eeffff !important;
}

.hljs-built_in {
    color: #ffcb6b !important;
}

.hljs-type {
    color: #c792ea !important;
}

.hljs-class {
    color: #ffcb6b !important;
}

.hljs-attr {
    color: #f07178 !important;
}

.hljs-tag {
    color: #f07178 !important;
}

.hljs-title {
    color: #82aaff !important;
}

/* Table styling */
.markdown-content table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    text-align: left;
}

.markdown-content th {
    background-color: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.markdown-content td {
    color: rgba(255, 255, 255, 0.9);
}

/* Link styling */
.markdown-content a {
    color: #22d3ee;
    text-decoration: none;
    transition: color 0.2s;
}

.markdown-content a:hover {
    color: #06b6d4;
    text-decoration: underline;
}

/* Horizontal rule */
.markdown-content hr {
    border: none;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 16px 0;
}

/* Image styling */
.markdown-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1em 0;
}

/* Ensure reaction buttons stay at the bottom */
.markdown-content .reaction-group {
    margin-top: 16px;
}

/* Copy success animation */
@keyframes copySuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.code-copy-btn.copied {
    animation: copySuccess 0.3s ease;
    color: #10b981 !important;
}

/* User message specific styling for markdown */
.user-message {
    /* User messages now have rounded corners but support markdown */
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.user-message h1,
.user-message h2,
.user-message h3,
.user-message h4,
.user-message h5,
.user-message h6 {
    margin: 12px 0 6px 0;
    font-weight: 600;
}

.user-message h1 { font-size: 1.3rem; }
.user-message h2 { font-size: 1.2rem; }
.user-message h3 { font-size: 1.1rem; }
.user-message h4 { font-size: 1rem; }

.user-message p {
    margin: 6px 0;
}

.user-message ul,
.user-message ol {
    margin: 6px 0;
    padding-left: 16px;
}

.user-message li {
    margin: 2px 0;
}

.user-message blockquote {
    margin: 8px 0;
    padding: 6px 12px;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0 6px 6px 0;
}

/* UPDATED: Better inline code wrapping */
.markdown-content code:not(pre code) {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e5e5;
    padding: 0.25em 0.5em;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.12);
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
    display: inline;
    overflow: hidden;
    hyphens: auto;
    vertical-align: baseline;
}

/* UPDATED: Better inline code wrapping for user messages */
.user-message code:not(pre code) {
    background: rgba(255, 255, 255, 0.15);
    color: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 5px;
    font-size: 0.9em;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
    display: inline;
    overflow: hidden;
    hyphens: auto;
    vertical-align: baseline;
}

.user-message .code-block-container {
    margin: 12px 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.user-message pre {
    background: rgba(0, 0, 0, 0.3);
    overflow-x: auto;
    max-width: 100%;
}

/* Context menu positioning fixed */
.context-menu {
    position: fixed; 
    min-width: 180px;
    border-radius: 12px;
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    transform: scale(0.95);
    transform-origin: top left;
    visibility: hidden;
    transition: all 0.2s ease;
    background-color: var(--dark-bg2);
    border: 1px solid var(--glass-border);
    padding: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.context-menu.show {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}

.context-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    width: 100%;
    border-radius: 8px;
    transition: all 0.2s;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.9);
    border: none;
    text-align: left;
}

.context-item:hover {
    background-color: rgba(42, 43, 45, 0.7);
}

.context-item.delete {
    color: rgba(244, 67, 54, 0.9);
}

.context-item.delete:hover {
    background-color: rgba(244, 67, 54, 0.1);
}

/* Enhanced delete confirmation styling */
.chat-history-item.pending-delete {
    background-color: rgba(244, 67, 54, 0.08);
    border: 1px dashed rgba(244, 67, 54, 0.3);
}

.delete-confirm-wrapper {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    justify-content: flex-end;
}

.delete-confirm-btn, .delete-cancel-btn {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-confirm-btn {
    background-color: rgba(244, 67, 54, 0.2);
    color: rgba(244, 67, 54, 1);
}

.delete-confirm-btn:hover {
    background-color: rgba(244, 67, 54, 0.3);
}

.delete-cancel-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.delete-cancel-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Shared highlight effect */
.chat-history-item.shared-highlight {
    background-color: rgba(68, 76, 231, 0.15);
    transition: background-color 0.3s;
}

/* Animation for deleting items */
.deleting {
    animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

/* Thinking dropdown styles */
.thinking-dropdown {
    margin: 8px 0;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.thinking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background-color: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.thinking-header:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.8);
}

.thinking-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
}

.thinking-chevron {
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.thinking-header.expanded .thinking-chevron {
    transform: rotate(180deg);
}

.thinking-content {
    padding: 0 12px;
    background-color: rgba(0, 0, 0, 0.1);
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    line-height: 1.5;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.thinking-content > *:first-child {
    margin-top: 12px;
}

.thinking-content > *:last-child {
    margin-bottom: 12px;
}

/* Animation for the spinner */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Delete button styling in modal */
#confirmDeleteBtn {
    background-color: rgba(244, 67, 54, 0.1) !important;
    border-color: rgba(244, 67, 54, 0.3) !important;
    color: rgba(244, 67, 54, 0.9) !important;
}

#confirmDeleteBtn:hover {
    background-color: rgba(244, 67, 54, 0.2) !important;
    border-color: rgba(244, 67, 54, 0.4) !important;
    color: rgba(244, 67, 54, 1) !important;
}

/* Make all delete-related text red */
.context-item.delete,
.delete-confirm-btn,
#confirmDeleteBtn span {
    color: rgba(244, 67, 54, 0.9) !important;
}

#confirmDeleteBtn i[data-lucide="trash-2"] {
    color: rgba(244, 67, 54, 0.9) !important;
}

/* Override modal delete button icon is red with higher specificity */
.modal #confirmDeleteBtn i[data-lucide="trash-2"] {
    color: rgba(244, 67, 54, 0.9) !important;
}

/* Override modal confirm delete icon to red */
.modal #confirmDeleteBtn svg,
#confirmDeleteBtn svg {
    stroke: rgba(244, 67, 54, 0.9) !important;
    fill: none !important;
}

/* Profile customization form styling */
.setting-group input[type="text"],
.setting-group textarea,
.setting-group select {
    background-color: var(--dark-bg3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 14px;
    transition: all 0.2s;
    font-family: 'Outfit', sans-serif;
}

.setting-group input[type="text"]:focus,
.setting-group textarea:focus,
.setting-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(68, 76, 231, 0.2);
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for modern browsers */
        max-height: 100vh;
        max-height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px !important;
        overflow-y: auto;
    }
    
    /* Show sidebar when .show class is added */
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Sidebar overlay for mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mobile code block improvements */
    .markdown-content .code-block-container {
        margin: 12px 0;
        border-radius: 8px;
        max-width: 100%;
        overflow: hidden;
        width: 100%;
        box-sizing: border-box;
    }
    
    .markdown-content pre {
        overflow-x: auto;
        overflow-y: hidden;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .markdown-content pre code {
        white-space: pre-wrap;
        word-wrap: break-word;
        word-break: break-all;
        overflow-wrap: break-word;
        min-width: 100%;
        display: block;
    }
    
    /* Ensure code blocks don't break out of chat containers */
    .text-gray-200.flex-1.markdown-content,
    .bg-primary.text-white.py-3.px-4.rounded-2xl {
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    /* ...existing mobile styles... */
}

/* Better mobile viewport handling */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific fixes */
    body {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
    
    .flex.h-screen {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
    
    /* iOS Safari specific sidebar fixes */
    @media (max-width: 768px) {
        .sidebar {
            height: -webkit-fill-available;
            min-height: -webkit-fill-available;
        }
    }
}

/* Hide mobile elements on desktop */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

/* Mobile viewport fixes to prevent bottom cutoff */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific fixes */
    body {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
    
    .flex.h-screen {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
}

/* Better mobile viewport handling */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific fixes */
    body {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
    
    .flex.h-screen {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
    
    /* iOS Safari specific sidebar fixes */
    @media (max-width: 768px) {
        .sidebar {
            height: -webkit-fill-available;
            min-height: -webkit-fill-available;
        }
    }
}

/* Image upload and preview styles */
.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    max-height: 120px;
    overflow-y: auto;
}

.image-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-preview:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-image:hover {
    background: rgba(244, 67, 54, 0.8);
    transform: scale(1.1);
}

/* Image grid for uploaded images in chat */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    max-width: 400px;
}

.uploaded-image-display {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
}

.uploaded-image-display:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

.uploaded-image-display img {
    width: 100%;
    height: auto;
    min-height: 120px;
    max-height: 200px;
    object-fit: cover;
}

/* Full-size image modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
}

.image-modal-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 90vw;
    max-height: 90vh;
}

.close-image-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.close-image-modal:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Mobile image preview adjustments */
@media (max-width: 768px) {
    .image-preview-container {
        max-height: 120px;
    }
    
    .image-preview {
        width: 80px;
        height: 80px;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        max-width: 300px;
    }
    
    .uploaded-image-display img {
        min-height: 100px;
        max-height: 150px;
    }
}

/* ...existing styles... */

/* Chat image boxes - similar to ChatGPT interface */
.chat-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    max-width: 320px;
}

.chat-image-box {
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    width: 100px;
    height: 100px;
    position: relative;
}

/* Mobile adjustments for chat images */
@media (max-width: 768px) {
    .chat-image-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        max-width: 320px;
    }
    
    .chat-image-box {
        border-radius: 6px;
        width: 80px;
        height: 80px;
    }
}

/* ...existing styles... */

/* Library page styles */
.library-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
}

.library-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.model-card {
    background: var(--dark-bg2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.model-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.model-card.featured {
    border-color: rgba(68, 76, 231, 0.3);
    background: linear-gradient(135deg, var(--dark-bg2) 0%, rgba(68, 76, 231, 0.05) 100%);
}

.featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-image {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.model-image img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.model-content {
    flex: 1;
    margin-bottom: 16px;
}

.model-header {
    margin-bottom: 12px;
}

.model-name {
    font-size: 18px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
}

.model-provider {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.model-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    margin-bottom: 16px;
}

.model-capabilities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.capability-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.model-actions {
    margin-top: auto;
}

.model-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.model-action-btn.add {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
}

.model-action-btn.add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(68, 76, 231, 0.4);
}

.model-action-btn.remove {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.8), rgba(244, 67, 54, 1));
    color: white;
}

.model-action-btn.remove:hover {
    background: linear-gradient(135deg, rgba(244, 67, 54, 1), rgba(220, 50, 40, 1));
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.model-action-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.model-action-btn.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Toast notifications */
.toast-notification {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--dark-bg2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-notification i {
    color: var(--primary-color);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .model-card {
        padding: 16px;
    }
    
    .model-name {
        font-size: 16px;
    }
    
    .model-description {
        font-size: 13px;
    }
    
    .capability-badge {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* ...existing styles... */

/* ...existing styles... */

.library-link-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    text-decoration: none;
}

.library-link-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.95);
}

/* ...existing styles... */

}