/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: text; /* Enable text selection */
}

:root {
    --primary-bg: #1a1a1a;
    --secondary-bg: #2d2d2d;
    --text-color: #f0f0f0;
    --primary-accent: #3a86ff;
    --secondary-accent: #8338ec;
    --border-color: #3a3a3a;
    --user-msg-bg: #2d2d2d;
    --bot-msg-bg: #383838;
    --hover-color: #3a3a3a;
    --code-bg: #282c34;
    --code-output-bg: #1e1e1e;
    --success-color: #4caf50;
    --error-color: #f44336;
    --warning-color: #ff9800;
    --sidebar-width: 280px;
    --sidebar-mobile-width: 260px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 100;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
}

.menu-toggle:hover {
    background-color: var(--hover-color);
}

/* Sidebar styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow-y: auto;
    height: 100vh;
    transition: all 0.3s ease;
    z-index: 10;
}

.logo {
    padding: 10px 0;
    margin-bottom: 15px;
    text-align: center;
}

.logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
}

.new-chat-btn {
    background-color: var(--primary-accent);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.new-chat-btn:hover {
    background-color: #2b74e2;
}

.model-selector {
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.model-selector label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.model-selector select {
    width: 100%;
    padding: 8px 10px;
    background-color: var(--primary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    outline: none;
}

.model-selector select:focus {
    border-color: var(--primary-accent);
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-item {
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chat-item-content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.chat-item:hover {
    background-color: var(--hover-color);
}

.chat-item.active {
    background-color: var(--hover-color);
    border-left: 3px solid var(--primary-accent);
}

.delete-chat-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 3px;
    opacity: 0.6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    color: var(--error-color);
    background-color: rgba(244, 67, 54, 0.1);
}

/* Main content styles */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    display: none;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.chat-header h1 {
    font-size: 1.3rem;
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
}

.chat-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    opacity: 0.8;
    padding: 0 20px;
}

.welcome-message h2 {
    margin-bottom: 10px;
    font-size: 2rem;
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.welcome-message p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px;
}

.model-indicator {
    margin-top: 15px;
    padding: 8px;
    background-color: rgba(58, 134, 255, 0.2);
    border-radius: 5px;
    border-left: 3px solid var(--primary-accent);
    font-size: 0.9rem;
}

.model-select-mobile {
    width: 100%;
    padding: 12px;
    background-color: var(--secondary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 15px;
    outline: none;
}

.model-selection-help {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #abb2bf;
    font-style: italic;
}

.start-chat-btn {
    padding: 12px 20px;
    background-color: var(--primary-accent);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.start-chat-btn:hover {
    background-color: #2b74e2;
}

.message {
    display: flex;
    gap: 15px;
    max-width: 90%;
    animation: fadeIn 0.3s ease;
}

.message.user {
    align-self: flex-end;
}

.message.bot {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background-color: var(--primary-accent);
}

.message.bot .message-avatar {
    background-color: var(--secondary-accent);
}

.message-content {
    background-color: var(--user-msg-bg);
    padding: 12px 16px;
    border-radius: 15px;
    border-top-right-radius: 3px;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow: auto; /* Adds scrollbars when needed */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.message.bot .message-content {
    background-color: var(--bot-msg-bg);
    border-top-right-radius: 15px;
    border-top-left-radius: 3px;
}

/* Fix for long messages with no breaks */
.message-content * {
    max-width: 100%;
}

.message-content img {
    max-width: 100%;
    border-radius: 8px;
    display: block; /* Prevents inline issues */
    width: auto;
    height: auto;
    max-height: 800px; /* Increased from default */
    object-fit: contain;
    margin: 10px auto; /* Center images */
}

.message-content img.fullscreen-image {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-content img.fullscreen-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Full screen overlay styles */
.fullscreen-overlay {
    transition: opacity 0.3s ease;
    animation: fadeIn 0.3s ease;
}

.fullscreen-overlay img {
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

/* Fix for any overflowing elements in messages */
.message-content pre {
    max-width: 100%;
    overflow-x: auto;
}

/* Ensure code details are contained within the message */
.message-content .code-details {
    max-width: 100%;
    margin: 15px 0;
}

.file-attachment {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    padding: 8px 12px;
    margin: 5px 0;
    gap: 10px;
    font-size: 0.9em;
}

.file-attachment i {
    font-size: 1.5em;
    color: var(--primary-accent);
}

.message-content p {
    margin-bottom: 10px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre {
    margin: 10px 0;
    border-radius: 5px;
    overflow: auto;
}

.message-content code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background-color: var(--code-bg);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

.message-content pre code {
    display: block;
    padding: 10px;
    border-radius: 5px;
    white-space: pre;
    overflow-x: auto;
}

/* Collapsible code details styling */
.code-details {
    margin: 15px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background-color: rgba(40, 44, 52, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.code-summary {
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    color: white;
    padding: 10px 15px;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-summary::-webkit-details-marker {
    display: none;
}

.code-label {
    display: flex;
    align-items: center;
}

.code-label:before {
    content: '▶';
    font-size: 0.8em;
    margin-right: 8px;
    transition: transform 0.3s ease;
}

details[open] .code-label:before {
    transform: rotate(90deg);
}

.code-block {
    padding: 0;
    margin: 0;
    background-color: var(--code-bg);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #21252b;
    padding: 8px 15px;
    font-size: 0.8rem;
    color: #abb2bf;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-header + pre {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.code-language {
    font-weight: bold;
}

.code-copy-btn, .code-run-btn {
    background: none;
    border: none;
    color: #abb2bf;
    cursor: pointer;
    transition: color 0.2s ease;
    margin-left: 10px;
}

.code-copy-btn:hover, .code-run-btn:hover {
    color: white;
}

.code-header-buttons {
    display: flex;
    align-items: center;
}

.code-details .download-btn {
    margin: 10px 15px;
    display: inline-block;
}

.code-details pre {
    margin: 0;
    border-radius: 0;
    background-color: var(--code-bg); /* Ensure consistent background */
}

/* Add some spacing and styling to code blocks to make them more readable */
.code-details .code-block {
    padding: 0 0 10px 0;
    border-top: none;
}

/* Make buttons more visible on hover */
.code-copy-btn:hover, .code-run-btn:hover {
    color: white;
    transform: scale(1.1);
}

/* Make the code summary more engaging */
.code-summary:hover {
    background: linear-gradient(45deg, #4a86ff, #9d38ec);
}

/* Run button styling */
.code-run-btn {
    color: #4caf50;
}

.code-run-btn:hover {
    color: #66bb6a;
}

.download-btn {
    background-color: var(--primary-accent);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    margin-top: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s ease;
}

.download-btn:hover {
    background-color: #2b74e2;
}

.thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #abb2bf;
    font-style: italic;
}

.thinking .dots {
    display: flex;
    gap: 3px;
}

.thinking .dot {
    width: 6px;
    height: 6px;
    background-color: #abb2bf;
    border-radius: 50%;
    animation: pulseDot 1.5s infinite;
}

.thinking .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking .dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Input area styles */
.input-area {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--primary-bg);
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.input-container {
    display: flex;
    align-items: flex-end;
    background-color: var(--secondary-bg);
    border-radius: 10px;
    padding: 10px 15px;
    gap: 10px;
    width: 100%;
}

#user-input {
    flex-grow: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-color);
    resize: none;
    padding: 5px 0;
    max-height: 150px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
}

.buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.upload-btn, .search-btn, #send-btn, #regenerate-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.upload-btn:hover, .search-btn:hover, #send-btn:hover, #regenerate-btn:hover {
    color: var(--primary-accent);
}

#send-btn {
    color: var(--primary-accent);
    transition: all 0.3s ease;
}

#send-btn.streaming {
    color: var(--warning-color);
    animation: pulse 1.5s infinite;
}

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

.search-btn {
    color: var(--warning-color);
}

.search-btn:hover {
    color: #ffb74d;
}

.search-btn.active {
    color: var(--warning-color);
    text-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

#regenerate-btn:disabled {
    color: #5a5a5a;
    cursor: not-allowed;
}

.upload-preview {
    margin-top: 10px;
    position: relative;
    display: flex;
    align-items: center;
    background-color: rgba(45, 45, 45, 0.5);
    border-radius: 8px;
    padding: 10px;
    max-width: 100%;
}

#preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.upload-preview img {
    max-height: 150px;
    max-width: 100%;
    border-radius: 8px;
    margin-right: 10px;
}

#file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #ddd;
}

#file-info i {
    font-size: 1.5rem;
    color: var(--primary-accent);
}

#file-name {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

#file-size {
    color: #abb2bf;
    font-size: 0.85rem;
}

#remove-upload {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 10px;
}

/* Code execution area styles */
#code-execution-area {
    margin-top: 20px;
    margin-bottom: 20px;
    background-color: var(--code-output-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.code-execution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(45deg, #3a86ff, #4a56e2);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.code-execution-header span {
    font-weight: bold;
    color: white;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

#close-execution {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: color 0.2s ease;
}

#close-execution:hover {
    color: white;
}

#code-output {
    padding: 15px;
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    color: #ddd;
    max-height: 300px;
    overflow-y: auto;
    background-color: #1a1a1a;
    border-radius: 0 0 8px 8px;
}

/* Output styling for code execution */
.output-header {
    background-color: #21252b;
    color: white;
    padding: 8px 15px;
    font-weight: bold;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.output-logs {
    padding: 10px 0;
}

/* Make code output more visually appealing */
.output-line {
    position: relative;
    padding-left: 15px;
    line-height: 1.5;
    margin-bottom: 2px;
    margin-left: 10px;
}

.output-line::before {
    content: '>';
    position: absolute;
    left: 0;
    color: #666;
}

.output-stdout {
    color: #ddd;
}

.output-stderr {
    color: var(--error-color);
}

.output-result {
    color: var(--success-color);
    margin-top: 10px;
    padding: 10px 15px;
    border-top: 1px dashed #444;
    position: relative;
    padding-left: 30px;
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.output-result::before {
    content: '✓';
    position: absolute;
    left: 10px;
    color: var(--success-color);
}

.output-line {
    margin: 2px 0;
    line-height: 1.4;
}

.output-stdout {
    color: #ddd;
}

.output-stderr {
    color: var(--error-color);
}

.output-result {
    color: var(--success-color);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #444;
}

.output-error {
    color: var(--error-color);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #444;
}

/* Run button for each code block */
.code-run-btn {
    color: #4caf50;
}

.code-run-btn:hover {
    color: #66bb6a;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 5;
}

/* Start typing notification */
.start-typing-notification {
    text-align: center;
    padding: 10px;
    margin: 20px auto 0;
    color: var(--primary-accent);
    font-style: italic;
    animation: fadeInOut 3s forwards;
    max-width: 90%;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes pulseDot {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Message context menu styling */
.message-context-menu {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    width: 200px;
    z-index: 1000;
    position: fixed;
}

.menu-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-option:hover {
    background-color: var(--hover-color);
}

.menu-option i {
    width: 18px;
}

/* Toast notification styling */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(50px);
    background-color: rgba(50, 50, 50, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-size: 0.9rem;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

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

/* Image carousel for multiple images */
.image-carousel {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 15px;
    padding: 10px 0;
    margin: 10px 0;
    width: 100%;
}

.carousel-item {
    flex: 0 0 auto;
    width: 100%;
    scroll-snap-align: start;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.carousel-item img {
    width: 100%;
    display: block;
    border-radius: 8px;
    object-fit: contain;
    min-height: 400px;
    max-height: 800px;
    margin: 0 auto;
}

.carousel-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.8rem;
}

.image-loading-placeholder {
    background: linear-gradient(110deg, #2a2a2a 30%, #3a3a3a 50%, #2a2a2a 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    width: 100%;
    min-height: 400px;
    height: auto;
    aspect-ratio: 1/1; /* Square aspect ratio by default */
    position: relative;
    margin: 0 auto;
    max-width: 800px; /* Larger maximum width */
}

.image-loading-placeholder::after {
    content: "Generating image...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #abb2bf;
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
}

.placeholder-dimensions {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 5;
}

@keyframes shimmer {
    0% {
        background-position: -50% 0;
    }
    100% {
        background-position: 150% 0;
    }
}

/* Image controls */
.carousel-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.carousel-controls button {
    background-color: var(--primary-accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.carousel-controls button:hover {
    background-color: #2b74e2;
}

.carousel-controls button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

/* Media queries for responsiveness */
@media (max-width: 992px) {
    .sidebar {
        width: var(--sidebar-mobile-width);
    }
}

@media (max-width: 768px) {
    body {
        overflow: hidden;
    }
    
    .container {
        display: flex;
        flex-direction: column;
        height: 100vh;
    }
    
    .menu-toggle {
        display: block;
        position: fixed; /* Ensure it's always visible */
        top: 15px;
        left: 15px;
        z-index: 30; /* Above the sidebar */
    }
    
    .chat-header {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 60px;
        padding-left: 50px; /* Make room for menu toggle */
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        width: var(--sidebar-mobile-width);
        z-index: 20;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
        height: 100%;
        overflow-y: auto;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content {
        width: 100%;
        padding-top: 0;
        display: flex;
        flex-direction: column;
        height: 100vh;
    }
    
    .chat-area {
        flex: 1;
        height: calc(100vh - 170px); /* Adjust to leave space for input area and header */
        overflow-y: auto;
    }
    
    .input-area {
        position: sticky;
        bottom: 0;
        width: 100%;
        background-color: var(--primary-bg);
        padding: 10px;
        z-index: 10;
        border-top: 1px solid var(--border-color);
    }
    
    .message {
        max-width: 100%;
    }
    
    .model-select-mobile {
        display: block;
    }
    
    .welcome-message {
        padding-top: 40px;
    }
}

@media (max-width: 480px) {
    .chat-area {
        padding: 15px;
    }
    
    .input-area {
        padding: 10px;
    }
    
    .welcome-message h2 {
        font-size: 1.8rem;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .message-content {
        padding: 10px 12px;
    }
    
    #file-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .buttons {
        gap: 8px;
    }
}
