/* styles.css */
/* Ensure Inter or your preferred font is loaded in the HTML or via @import */
/* @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); */

body {
    font-family: 'Inter', sans-serif;
    /* display: flex; Flex behavior handled by Tailwind on body/main containers */
    /* height: 100vh; Handled by Tailwind h-screen */
    /* overflow: hidden; Handled by Tailwind overflow-hidden */
}

/* Admin Panel Styles */
.admin-menu-item.active {
    background-color: #374151; /* gray-700 */
    font-weight: 600;
}

/* Modal animation */
#repoModal {
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Repository card hover effect */
.repo-card {
    transition: all 0.2s ease-in-out;
}

.repo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Sidebar specific styles */
#past-chats-list .past-chat-item {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.2s ease-in-out;
    /* Changed from break-all to break-word for better readability where possible */
    overflow-wrap: break-word;
    word-break: break-word; /* Fallback */
    font-size: 0.9em; /* Consider responsive font size if needed: text-xs sm:text-sm */
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

#past-chats-list .past-chat-item .chat-name {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#past-chats-list .past-chat-item .delete-chat-btn {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    background: none;
    border: none;
    color: #ef4444; /* red-500 */
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
    margin-left: 8px;
    flex-shrink: 0;
}

#past-chats-list .past-chat-item:hover .delete-chat-btn {
    opacity: 1;
}

#past-chats-list .past-chat-item .delete-chat-btn:hover {
    background-color: rgba(239, 68, 68, 0.1); /* red with opacity */
    color: #dc2626; /* red-600 */
}

#past-chats-list .past-chat-item:hover {
    background-color: #4a5568; /* gray-700 */
}
#past-chats-list .past-chat-item.active {
    background-color: #2c5282; /* Tailwind dark blue, adjust as needed */
    font-weight: bold; /* Tailwind class: font-bold */
}
#past-chats-list .past-chat-item.active .delete-chat-btn {
    opacity: 0.7;
}



/* Header Bar Styles */
header {
    backdrop-filter: blur(10px);
    z-index: 40;
}

/* Breadcrumb Styles */
nav.breadcrumb-nav {
    max-width: calc(100vw - 300px);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

nav.breadcrumb-nav::-webkit-scrollbar {
    display: none;
}

/* Standardized Header Menu Dropdown Styles */
.dropdown-menu {
    transform: translateY(-10px);
    pointer-events: none;
}

.group:hover .dropdown-menu {
    transform: translateY(0);
    pointer-events: auto;
}

/* Ensure dropdowns appear above other elements */
.dropdown-menu {
    z-index: 1000;
}

/* Mobile dropdown adjustments */
@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed;
        right: 1rem;
        left: 1rem;
        width: auto;
        min-width: auto;
    }
}

/* Header responsive improvements */
@media (max-width: 768px) {
    header nav {
        gap: 0.25rem;
    }
    
    /* Hide dropdown text on mobile, show icons only */
    .dropdown-trigger-text {
        display: none;
    }
    
    header .text-xl {
        font-size: 1.125rem;
    }
    
    /* Hide breadcrumb on mobile */
    nav.breadcrumb-nav {
        display: none;
    }
    
    /* Reduce spacing between menu items */
    header nav {
        space-x: 0.5rem;
    }
}

@media (max-width: 640px) {
    header nav button span,
    header nav a span {
        display: none !important;
    }
    
    header nav {
        gap: 0.125rem;
    }
    
    header nav button,
    header nav a {
        padding: 0.5rem;
        min-width: 2.5rem;
    }
}

/* Sidebar Styles */
#sidebar {
    backdrop-filter: blur(10px);
}

/* Mobile sidebar animation improvements */
@media (max-width: 640px) {
    #sidebar {
        backdrop-filter: none;
    }
}

/* Chat bubble and thinking process styles */
.chat-turn { 
    margin-bottom: 1rem; /* Tailwind class: mb-4 */
    display: flex;
    flex-direction: column;
}

.user-query-container { 
    display: flex;
    justify-content: flex-end; 
    margin-bottom: 0.5rem; /* Tailwind class: mb-2 */
}
.user-bubble {
    background-color: #3b82f6; /* Tailwind class: bg-blue-500 */
    color: white; /* Tailwind class: text-white */
    padding: 10px 15px; /* Tailwind classes: py-2 px-3 or p-3 etc. */
    border-radius: 20px; /* Tailwind class: rounded-xl or rounded-2xl */
    max-width: 85%; /* Adjusted for potentially more space, can be sm:max-w-3/4 or similar */
    overflow-wrap: break-word; /* Standard property for word wrapping */
    word-break: break-word; /* Fallback for older browsers */
    align-self: flex-end; 
    /* min-w-0 might be needed if it's a direct flex child and content pushes boundaries */
}

.assistant-response-container { 
    display: flex;
    flex-direction: column;
    align-items: flex-start; 
    width: 100%; /* Ensure it takes full width to allow child max-width to work effectively */
}

.thinking-process-block {
    width: 100%;
    max-width: 95%; /* Allow a bit more width */
    margin-bottom: 1rem; /* Increased spacing */
    align-self: flex-start;
}

.thinking-toggle {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); /* Subtle gradient */
    color: #475569; /* slate-600 for better readability */
    border: 1px solid #cbd5e1; /* slate-300 border */
    padding: 14px 18px; /* More generous padding */
    border-radius: 8px 8px 0 0; /* Rounded top only when collapsed */
    cursor: pointer;
    font-size: 0.875rem; /* Slightly larger text */
    font-weight: 500; /* font-medium */
    margin-bottom: 0; /* No margin bottom for seamless connection */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%; /* Full width for better appearance */
    transition: all 0.2s ease-in-out; /* Smooth transitions */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Subtle shadow */
    overflow-wrap: break-word;
    word-break: break-word;
    position: relative; /* For better z-index control */
    z-index: 1; /* Ensure toggle appears above content */
}

.thinking-toggle:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #d1d5db 100%);
    border-color: #94a3b8; /* slate-400 */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); /* Enhanced shadow on hover */
    transform: translateY(-1px); /* Subtle lift effect */
}

.thinking-toggle:active {
    transform: translateY(0); /* Reset on click */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.thinking-toggle .toggle-icon {
    margin-left: 12px; /* More space */
    transition: transform 0.3s ease-in-out; /* Smoother rotation */
    color: #64748b; /* slate-500 for icon */
    font-size: 0.75rem; /* Slightly smaller icon */
}

.thinking-toggle.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* When expanded, the toggle should have rounded corners on top only */
.thinking-toggle.expanded {
    border-radius: 8px 8px 0 0;
    border-bottom: none; /* Remove bottom border when expanded */
}

/* When collapsed, the toggle should have full rounded corners */
.thinking-toggle.collapsed {
    border-radius: 8px;
    margin-bottom: 1rem; /* Add spacing when collapsed */
}

/* Add some visual hierarchy with a subtle left border */
.thinking-process-block {
    border-left: 3px solid #3b82f6; /* blue-500 accent */
    padding-left: 12px; /* More padding for better visual hierarchy */
    background-color: rgba(59, 130, 246, 0.02); /* Very subtle blue tint */
    border-radius: 0 8px 8px 0; /* Round right side only */
    margin-left: 4px; /* Slight indentation */
}

.thinking-steps-content {
    background-color: #ffffff; /* Pure white for better contrast */
    border: 1px solid #e2e8f0; /* slate-200 border */
    border-top: none; /* Remove top border to connect with toggle */
    padding: 20px; /* More generous padding */
    border-radius: 0 0 8px 8px; /* Rounded bottom only to connect with toggle */
    font-size: 0.875rem; /* Consistent with toggle text size */
    margin-top: 0; /* No gap from toggle for seamless connection */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); /* Slightly softer shadow */
    line-height: 1.4; /* Tighter line spacing for compact reading */
    /* Add word wrapping for content within thinking steps */
    overflow-wrap: break-word;
    word-break: break-word;
}

.thinking-steps-content.hidden {
    display: none; /* Tailwind: hidden */
}

.thinking-bubble {
    background-color: #f8fafc; /* Lighter, more subtle background */
    border-left: 3px solid #60a5fa; /* blue-400 */
    padding: 16px 20px; /* More generous padding to match chat */
    margin-bottom: 16px; /* Better spacing between bubbles to match chat */
    border-radius: 6px; /* Slightly more rounded */
    border-top-left-radius: 0; /* Keep left edge connected to border */
    border-bottom-left-radius: 0;
    font-size: 0.875rem; /* Consistent with parent content */
    line-height: 1.4; /* Compact line spacing for better readability */
    white-space: pre-wrap; /* Allows wrapping of pre-formatted text */
    overflow-wrap: break-word; /* Crucial for breaking long unbreakable strings */
    word-break: break-word; /* Fallback */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); /* Very subtle shadow */
}
.thinking-bubble strong {
    color: #3b82f6; /* blue-500 */
}

/* Add compact spacing for text content within thinking sections */
.thinking-steps-content p,
.thinking-bubble p {
    margin-bottom: 0.6em; /* Reduced paragraph spacing */
}

.thinking-steps-content ul,
.thinking-bubble ul,
.thinking-steps-content ol,
.thinking-bubble ol {
    margin-bottom: 0.6em; /* Reduced list spacing */
    padding-left: 1.2em; /* Slightly less indent */
}

.thinking-steps-content li,
.thinking-bubble li {
    margin-bottom: 0.2em; /* Tighter space between list items */
}

/* Ensure text blocks within thinking have compact spacing */
.thinking-steps-content > *:not(:last-child),
.thinking-bubble > *:not(:last-child) {
    margin-bottom: 0.5em; /* Reduced spacing between blocks */
}
.thinking-bubble.error {
    border-left-color: #ef4444; /* red-500 */
    background-color: #fee2e2; /* red-100 */
}
.thinking-bubble.error strong {
    color: #dc2626; /* red-600 */
}

/* Special styling for reasoning steps */
.thinking-bubble.reasoning {
    background-color: #f0f9ff; /* Very light blue background for reasoning */
    border-left-color: #3b82f6; /* blue-500 for reasoning steps */
    font-size: 0.9rem; /* Slightly larger text for reasoning */
    line-height: 1.6; /* Better line height for reading */
}

.thinking-bubble.reasoning strong {
    color: #1e40af; /* blue-800 for reasoning headers */
}
.thinking-bubble a {
    color: #3b82f6; /* blue-500 */
    text-decoration: underline;
    text-underline-offset: 2px;
}
.thinking-bubble a:hover {
    color: #1d4ed8; /* blue-700 */
    text-decoration: underline;
}

/* Markdown specific styles within thinking bubbles or assistant bubbles */
/* Styles for <pre> blocks (typically containing <code>) */
.thinking-bubble pre, .assistant-bubble pre { 
    background-color: #e5e7eb; /* Tailwind: bg-gray-200 */
    padding: 0.5rem; /* Tailwind: p-2 */
    border-radius: 0.25rem; /* Tailwind: rounded-sm or rounded */
    margin-top: 0.5rem; /* Tailwind: mt-2 */
    margin-bottom: 0.5rem; /* Tailwind: mb-2 */
    overflow-x: auto; /* Essential for horizontal scrolling of long code lines */
    font-family: 'Courier New', Courier, monospace; /* Tailwind: font-mono */
    font-size: 0.875em; /* Tailwind: text-sm */
    border: 1px solid #d1d5db; /* Tailwind: border border-gray-300 */
    white-space: pre-wrap;  /* Allows lines to wrap if they are too long */
    word-break: break-all;  /* Breaks long words/tokens if they would overflow the pre block */
}

/* Styles for inline <code> tags (not inside <pre>) */
.thinking-bubble code, .assistant-bubble code { 
    background-color: #e5e7eb; /* Tailwind: bg-gray-200 */
    padding: 0.1em 0.3em;
    border-radius: 0.2rem; /* Tailwind: rounded-sm */
    font-family: 'Courier New', Courier, monospace; /* Tailwind: font-mono */
    font-size: 0.9em; /* Slightly smaller than surrounding text */
    overflow-wrap: break-word; /* Allow long inline code to wrap */
    word-break: break-all; /* More aggressive breaking for inline code strings */
}

/* Reset styles for <code> tags that are inside <pre> blocks */
.thinking-bubble pre code, .assistant-bubble pre code { 
    background-color: transparent; /* No separate background from the <pre> */
    padding: 0; /* No extra padding */
    font-size: 1em; /* Inherit font size from the <pre> tag */
    /* word-break and overflow-wrap will be inherited from the parent <pre> */
    border-radius: 0; /* No border radius for code within pre */
}


.assistant-bubble {
    background-color: #e5e7eb; /* Tailwind gray-200 */
    color: #1f2937; /* Tailwind gray-800 */
    padding: 10px 15px; /* py-2 px-3 or p-3 */
    border-radius: 20px; /* rounded-xl or rounded-2xl */
    max-width: 85%; /* Adjusted, can be sm:max-w-3/4 etc. */
    overflow-wrap: break-word; /* Standard property for word wrapping */
    word-break: break-word; /* Fallback */
    align-self: flex-start;
    /* min-w-0 might be needed if it's a direct flex child and content pushes boundaries */
}
/* Markdown specific styles for assistant-bubble */
.assistant-bubble h1, .assistant-bubble h2, .assistant-bubble h3 { margin-top: 0.5em; margin-bottom: 0.25em; line-height: 1.2; font-weight: 600;}
.assistant-bubble h1 { font-size: 1.5em; } /* text-xl or text-2xl */
.assistant-bubble h2 { font-size: 1.25em; } /* text-lg or text-xl */
.assistant-bubble h3 { font-size: 1.1em; } /* text-base or text-lg */
.assistant-bubble p { margin-bottom: 0.5em; overflow-wrap: break-word; word-break: break-word; } /* Ensure paragraphs wrap */
.assistant-bubble ul, .assistant-bubble ol { margin-left: 1.5em; margin-bottom: 0.5em; list-style-position: outside; overflow-wrap: break-word; word-break: break-word;}
.assistant-bubble ul { list-style-type: disc; }
.assistant-bubble ol { list-style-type: decimal; }
.assistant-bubble li { margin-bottom: 0.25em; overflow-wrap: break-word; word-break: break-word;}
.assistant-bubble blockquote {
    border-left: 3px solid #9ca3af; /* gray-400 */
    padding-left: 0.75em; /* pl-3 */
    margin-left: 0.25em; /* ml-1 */
    margin-top: 0.5em; /* mt-2 */
    margin-bottom: 0.5em; /* mb-2 */
    font-style: italic; /* italic */
    color: #4b5563; /* gray-600 */
    overflow-wrap: break-word; 
    word-break: break-word;
}
.assistant-bubble table {
    width: auto; /* Let table size itself, but not exceed container */
    max-width: 100%; /* Ensure table does not overflow its container */
    border-collapse: collapse;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    font-size: 0.9em;
    table-layout: fixed; /* Distributes column width more predictably; content can still wrap or be clipped */
}
.assistant-bubble th, .assistant-bubble td {
    border: 1px solid #d1d5db; /* gray-300 */
    padding: 0.3em 0.6em;
    text-align: left;
    overflow-wrap: break-word; /* Ensure cell content wraps */
    word-break: break-word;   /* Break words if necessary to prevent overflow */
}
.assistant-bubble th {
    background-color: #f3f4f6; /* gray-100 */
    font-weight: 600; /* font-semibold */
}
.assistant-bubble a {
    color: #3b82f6; /* blue-500 */
    text-decoration: underline;
    text-underline-offset: 2px;
}
.assistant-bubble a:hover {
    color: #1d4ed8; /* blue-700 */
    text-decoration: underline;
}

/* Copy code button style (used in script.js) */
.copy-code-button {
    /* Positioned absolutely within a relative <pre> tag */
    /* Tailwind classes are added directly in script.js for this */
    /* Example: 'absolute top-2 right-2 p-1 text-xs bg-gray-600 hover:bg-gray-700 text-white rounded opacity-75 hover:opacity-100 transition-opacity' */
    z-index: 10; /* Ensure it's above the code block's content */
}


/* Loader spinner */
.loader {
    border: 4px solid #f3f3f3; /* Light grey */
    border-top: 4px solid #3b82f6; /* Blue */
    border-radius: 50%; /* rounded-full */
    width: 24px; /* w-6 */
    height: 24px; /* h-6 */
    animation: spin 1s linear infinite;
    /* display: none; Tailwind: hidden. Controlled by JS. */
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Make loader inside button smaller */
.loader-small {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff; /* White */
    border-radius: 50%; /* rounded-full */
    width: 18px; /* w-4.5 (custom or closest like w-4 or w-5) */
    height: 18px; /* h-4.5 */
    animation: spin 1s linear infinite;
    display: inline-block; /* inline-block */
    vertical-align: middle; /* align-middle */
    margin-right: 8px; /* mr-2 */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 640px) { /* sm breakpoint in Tailwind */
    /* Adjust sidebar for full-width stacking on small screens */
    /* The HTML structure change (fixed position for sidebar, mt for main content) handles this. */
    
    /* Reduce padding and font sizes in chat input area for very small screens if needed */
    .chat-input-area {
        padding: 0.5rem; /* p-2 */
        flex-wrap: wrap; /* Allow items to wrap if not enough space */
    }
    #user-query-input {
        font-size: 0.875rem; /* text-sm */
        padding: 0.5rem 0.75rem; /* py-2 px-3 */
    }
    #send-query-button {
        font-size: 0.875rem; /* text-sm */
        padding: 0.5rem 0.75rem; /* py-2 px-3 */
    }

    /* Adjust chat bubble max-width for smaller screens */
    .user-bubble, .assistant-bubble {
        max-width: 90%; /* Bubbles can take up more width on small screens */
        padding: 8px 12px; /* py-2 px-3 */
        font-size: 0.9rem; /* Slightly smaller text in bubbles */
    }
    .assistant-bubble pre, .thinking-bubble pre {
        font-size: 0.8rem; /* Smaller code font on mobile */
    }

    /* Reduce font size of past chat items */
    #past-chats-list .past-chat-item {
        font-size: 0.8rem; /* text-xs */
    }

    /* Adjustments for the "Show Thinking" toggle on small screens */
    .thinking-toggle {
        font-size: 0.8rem; /* Slightly smaller toggle button text */
        padding: 10px 12px; /* Adjusted padding for mobile */
    }
    .thinking-steps-content {
        font-size: 0.8rem; /* Slightly smaller thinking steps text */
        padding: 16px; /* Reduced padding for mobile */
    }
    .thinking-bubble {
        padding: 10px 12px; /* Reduced padding for mobile */
        margin-bottom: 10px; /* Tighter spacing on mobile */
        font-size: 0.8rem; /* Smaller text on mobile */
    }
}

/* Design Document Styles */

/* Document Grid Layout */
.document-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

.document-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.document-title {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    max-height: 2.8em;
}

.document-content-preview {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    max-height: 4.5em;
}

/* Split-Screen Layout */
.split-container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.split-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Resizer */
#resizer {
    user-select: none;
    touch-action: none;
    z-index: 10;
}

#resizer:active {
    background-color: #3b82f6 !important;
}

/* Markdown Editor */
#markdown-editor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.6;
    tab-size: 4;
    outline: none;
    border: none;
    resize: none;
    overflow-y: auto;
    background-color: #fafafa;
}

#markdown-editor:focus {
    background-color: #ffffff;
}

/* Markdown Preview */
#markdown-preview {
    overflow-y: auto !important;
    background-color: #ffffff;
    height: 100%;
    min-height: 0;
}

/* Ensure preview view can scroll */
#preview-view {
    min-height: 0;
    overflow: hidden;
}

/* Prose styles for markdown preview */
.prose {
    line-height: 1.7;
    color: #374151;
}

.prose h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.prose h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.prose h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.prose p {
    margin-bottom: 1rem;
}

.prose ul, .prose ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.prose li {
    margin-bottom: 0.25rem;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #6b7280;
}

.prose code {
    background-color: #f3f4f6;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.prose pre {
    background-color: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.4;
}

.prose pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.prose th, .prose td {
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.prose th {
    background-color: #f9fafb;
    font-weight: 600;
}

.prose a {
    color: #3b82f6;
    text-decoration: underline;
}

.prose a:hover {
    color: #1d4ed8;
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.prose hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 2rem 0;
}

/* Format buttons */
.format-button {
    transition: background-color 0.2s ease;
    border-radius: 0.25rem;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: #6b7280;
}

.format-button:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.format-button:active {
    background-color: #e5e7eb;
}

/* Chat integration in editor */
#chat-messages {
    background-color: #f9fafb;
    min-height: 0;
}

.chat-message {
    margin-bottom: 1rem;
}

.chat-message.user {
    text-align: right;
}

.chat-message.assistant {
    text-align: left;
}

.chat-bubble {
    display: inline-block;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    max-width: 85%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-bubble.user {
    background-color: #3b82f6;
    color: white;
}

.chat-bubble.assistant {
    background-color: white;
    color: #374151;
    border: 1px solid #e5e7eb;
}

/* Document List Specific Styles */
.document-list-item {
    transition: all 0.2s ease-in-out;
}

.document-list-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.document-meta {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Status indicators */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-saved {
    background-color: #10b981;
}

.status-unsaved {
    background-color: #f59e0b;
}

.status-error {
    background-color: #ef4444;
}

/* Loading states */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Code Viewer Styles */
.code-container {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 0;
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    tab-size: 4;
    -moz-tab-size: 4;
    min-height: 300px;
    max-height: 80vh;
    overflow-y: auto;
}

.code-container code {
    background: transparent !important;
    padding: 0 !important;
    font-size: inherit !important;
    color: inherit !important;
    border-radius: 0 !important;
}

/* Custom scrollbar for code container */
.code-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-container::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.code-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.code-container::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Override highlight.js theme for better contrast */
.hljs {
    background: #1e1e1e !important;
    color: #d4d4d4 !important;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in {
    color: #569cd6 !important;
}

.hljs-string,
.hljs-attribute {
    color: #ce9178 !important;
}

.hljs-comment {
    color: #6a9955 !important;
    font-style: italic;
}

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

.hljs-function .hljs-title,
.hljs-title.class_,
.hljs-title.function_ {
    color: #dcdcaa !important;
}

.hljs-type,
.hljs-class .hljs-title {
    color: #4ec9b0 !important;
}

.hljs-variable,
.hljs-property {
    color: #9cdcfe !important;
}

.hljs-operator {
    color: #d4d4d4 !important;
}

.hljs-punctuation {
    color: #d4d4d4 !important;
}

/* Line numbers styling */
.code-container.has-line-numbers {
    padding-left: 3.5rem;
    position: relative;
}

.line-numbers {
    position: absolute;
    top: 0;
    left: 0;
    width: 3rem;
    padding: 1.5rem 0.5rem;
    background-color: #252526;
    color: #858585;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    text-align: right;
    user-select: none;
    border-right: 1px solid #3e3e3e;
    overflow: hidden;
}

/* Responsive Design Document Layout */
@media (max-width: 768px) {
    .split-container {
        flex-direction: column;
    }
    
    #resizer {
        width: 100%;
        height: 4px;
        cursor: row-resize;
    }
    
    .split-panel {
        min-height: 300px;
    }
    
    .format-button {
        width: 1.75rem;
        height: 1.75rem;
    }
    
    .chat-bubble {
        max-width: 95%;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    #markdown-editor {
        font-size: 0.9rem;
    }
    
    .prose {
        font-size: 0.9rem;
    }
    
    .prose h1 {
        font-size: 1.5rem;
    }
    
    .prose h2 {
        font-size: 1.25rem;
    }
    
    .prose h3 {
        font-size: 1.125rem;
    }
    
    /* Code viewer responsive styles */
    .code-container {
        font-size: 0.8rem;
        padding: 1rem;
        max-height: 70vh;
    }
    
    .code-container.has-line-numbers {
        padding-left: 2.5rem;
    }

    .line-numbers {
        width: 2rem;
        padding: 1rem 0.25rem;
        font-size: 0.75rem;
    }
}

/* Typing Cursor Animation */
.typing-cursor {
    color: #007acc;
    font-weight: bold;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
