/* Layout Styles */

/* Chat Interface */
#chat-interface {
    height: 100vh;
    display: flex;
}

/* Sidebar */
#sidebar {
    width: 16rem;
    background: var(--sidebar-bg);
    color: var(--text-light);
    transition: width var(--transition-speed) ease-in-out, transform var(--transition-speed) ease-in-out;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#sidebar.collapsed {
    width: 0;
    padding: 0;
}

#sidebar-top {
    padding: 1rem;
}

#conversation-list-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

#sidebar-bottom {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Main Chat Area */
#main-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
#top-bar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Chat Messages */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Input Area */
#input-area {
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    align-items: stretch;
}

/* Responsive Design */
@media (max-width: 768px) {
    #sidebar {
        position: absolute;
        z-index: 10;
        height: 100%;
        transform: translateX(0);
        
    }
    #sidebar.collapsed {
        transform: translateX(-100%);
    }

    #main-chat-area {
        width: 100%;
    }
}

/* Ensure content inside messages wraps properly */
.message > div {
    max-width: 100%; /* Ensure content doesn't exceed message width */
}

/* Handle long words in code blocks */
.message pre {
    white-space: pre-wrap; /* Allow wrapping in code blocks */
    word-break: break-all; /* Break long words in code blocks */
}

/* Adjust message bubble max-width for smaller screens */
@media (max-width: 640px) {
    .message {
        max-width: 90%;
    }
}