* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #1a1a1a;
    color: #e4e4e4;
}

.maindiv {
    height: calc( 100dvh - 46px );
    padding: 0;
}

/* Sidebar */
.sidebar {
    background-color: #212121;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    height: calc( 100dvh - 46px );;
    position: relative;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 8px;
    color: #e4e4e4;
    text-decoration: none;
    transition: background-color 0.2s;
}

.chat-item:hover {
    background-color: #2a2a2a;
    color: #fff;
}

.chat-item.active {
    background-color: #2a2a2a;
}

.chat-item i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #2a2a2a;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info i {
    font-size: 1.5rem;
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc( 100dvh - 46px );;
    background-color: #1a1a1a;
    position: relative;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1rem;
    scroll-behavior: smooth;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.welcome-message h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background-color: #2563eb;
    color: white;
}

.assistant-message .message-avatar {
    background-color: #16a34a;
    color: white;
}

.message-content {
    flex: 1;
    line-height: 1.6;
}

.message-content strong {
    font-weight: 600;
}

.message-content code {
    background-color: #2a2a2a;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.code-block {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #0d1117;
    border: 1px solid #2a2a2a;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #161b22;
    border-bottom: 1px solid #2a2a2a;
}

.code-header span {
    font-size: 0.85rem;
    color: #8b949e;
    text-transform: uppercase;
}

.copy-btn {
    background: none;
    border: 1px solid #2a2a2a;
    color: #e4e4e4;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background-color: #2a2a2a;
    border-color: #3a3a3a;
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    background-color: #0d1117;
}

.code-block code {
    background: none;
    padding: 0;
    color: #e4e4e4;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Artifact Reference */
.artifact-reference {
    display: block;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 0.9rem;
    position: relative;
    padding-right: 54px;
}
.artifact-reference > .btn {
  position: absolute;
  right: 6px;
  top: 50%; /* For vertical centering */
  transform: translateY(-50%); /* For vertical centering */
}
.artifact-reference i {
    color: #2563eb;
}

/* Artifact Panel */
.artifact-panel {
    background-color: #212121;
    border-left: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    height: calc( 100dvh - 46px );;
    overflow: hidden;
}

.artifact-panel-header {
    padding: 1rem;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.artifact-panel-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.artifact-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.artifact-viewer {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.artifact-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #161b22;
    border-bottom: 1px solid #2a2a2a;
    gap: 0.5rem;
}

.artifact-language {
    font-size: 0.85rem;
    color: #8b949e;
    text-transform: uppercase;
    flex: 1;
}

.artifact-viewer pre {
    flex: 1;
    margin: 0;
    padding: 1rem;
    overflow: auto;
    background-color: #0d1117;
}

.artifact-viewer code {
    background: none;
    padding: 0;
    color: #e4e4e4;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Input Container */
.input-container {
    padding: 1rem;
    border-top: 1px solid #2a2a2a;
    background-color: #1a1a1a;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #e4e4e4;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    resize: none;
    max-height: 200px;
    font-size: 1rem;
    line-height: 1.5;
}

#messageInput:focus {
    outline: none;
    border-color: #2563eb;
    background-color: #2a2a2a;
}

#sendBtn {
    background-color: #2563eb;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0;
}

#sendBtn:hover {
    background-color: #1d4ed8;
}

#sendBtn:disabled {
    background-color: #3a3a3a;
    cursor: not-allowed;
}

#sendBtn i {
    font-size: 1.5rem;
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        width: 80%;
        max-width: 300px;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.show {
        left: 0;
    }

    .artifact-panel {
        position: fixed;
        right: -100%;
        width: 100%;
        z-index: 999;
        transition: right 0.3s ease;
    }

    .artifact-panel:not(.d-none) {
        right: 0;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Button Styling */
.btn-primary {
    background-color: #2563eb;
    border: none;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-outline-primary {
    border-color: #2563eb;
    color: #2563eb;
}

.btn-outline-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

.btn-outline-light {
    border-color: #3a3a3a;
    color: #e4e4e4;
}

.btn-outline-light:hover {
    background-color: #2a2a2a;
    border-color: #3a3a3a;
    color: #fff;
}

/* Highlight.js theme adjustments */
.hljs {
    background: #0d1117 !important;
    color: #e4e4e4 !important;
}