/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #1e1e1e;
    color: #ffffff;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* Container layout */
.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Main content area - now first */
.main-content {
    flex: 5;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-right: 1px solid #3c3c3c;
}

.main-content h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #00b4d8;
}

/* AI Sidebar styles - now on right */
.ai-sidebar {
    background-color: #252526;
    display: flex;
    flex: 2;
    flex-direction: column;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
}

.ai-header {
    padding: 1rem;
    background-color: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
}

.ai-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #00b4d8;
}

.chat-container {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.chat-input {
    padding: 1rem;
    background-color: #2d2d2d;
    display: flex;
    gap: 0.5rem;
}

.chat-input textarea {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    background-color: #1e1e1e;
    color: #ffffff;
    resize: none;
    height: 40px;
}

.chat-input button {
    padding: 0.5rem 1rem;
    background-color: #00b4d8;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-input button:hover {
    background-color: #0096c7;
}

/* Editor styles */
#editor {
    flex: 1;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    background-color: #1e1e1e;
}

/* Button group */
.button-group {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.action-button {
    padding: 0.5rem 1rem;
    background-color: #2d2d2d;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.action-button:hover {
    background-color: #3c3c3c;
    border-color: #00b4d8;
}

/* Saved codes section */
.saved-codes {
    background-color: #252526;
    border-radius: 4px;
    padding: 1rem;
}

.saved-codes h3 {
    margin-bottom: 0.5rem;
    color: #00b4d8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#savedCodesList {
    list-style: none;
    max-height: 150px;
    overflow-y: auto;
}

#savedCodesList li {
    padding: 0.5rem;
    border-bottom: 1px solid #3c3c3c;
    cursor: pointer;
}

#savedCodesList li:hover {
    background-color: #2d2d2d;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #3c3c3c;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4c4c4c;
}

/* Chat message styles */
.chat-message {
    margin: 8px 0;
    padding: 8px;
    border-radius: 8px;
    max-width: 90%;
}

.user-message {
    margin-left: auto;
    background-color: #2d2d2d;
}

.ai-message {
    margin-right: auto;
    background-color: #1e3a5f;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message-icon {
    font-size: 1.2rem;
    min-width: 24px;
}

.message-content p {
    margin: 0;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-content pre {
    width: 200px;
}

/* Code block styling in chat */
.ai-message pre {
    background-color: #1e1e1e;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

.ai-message code {
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Improve chat container scrolling */
.chat-container {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-thumb {
    background-color: #4c4c4c;
    border-radius: 3px;
}

/* Enhance textarea */
.chat-input textarea {
    font-family: inherit;
    line-height: 1.4;
    padding: 8px 12px;
}

.chat-input textarea:focus {
    outline: none;
    border-color: #00b4d8;
}
