* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f7f7f8;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    gap: 0;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #f7f7f8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid #e5e5e5;
}

.sidebar-header {
    padding: 12px;
    background: #f7f7f8;
    color: #202123;
}

.btn-new-chat {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid #c4c4c4;
    border-radius: 6px;
    color: #202123;
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.btn-new-chat:hover {
    background: #ececec;
}

.btn-new-chat span {
    font-size: 18px;
    font-weight: 300;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    color: #202123;
}

.conversation-item:hover {
    background: #ececec;
}

.conversation-item.active {
    background: #e5e5e5;
    border-color: #c4c4c4;
}

.conversation-title {
    font-weight: 400;
    font-size: 14px;
    color: #202123;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 12px;
    color: #6e6e80;
}

/* Main content */
.main-content {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 16px 20px;
    background: white;
    color: #202123;
    border-bottom: 1px solid #e5e5e5;
}

.header-info {
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-info h1 {
    font-size: 16px;
    font-weight: 600;
    color: #202123;
}

/* Remove unused styles */
.connection-status,
.status-dot,
.status-text,
.auth-section,
.token-input,
.btn-save-token {
    display: none;
}

.user-id-section {
    display: none;
    padding: 0;
    background: transparent;
    border: none;
    gap: 0;
}

.user-id-section label {
    display: none;
}

.user-id-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #c4c4c4;
    background: white;
    border-radius: 6px;
    font-size: 13px;
    color: #202123;
    transition: all 0.2s;
}

.user-id-input::placeholder {
    color: #6e6e80;
}

.user-id-input:focus {
    outline: none;
    border-color: #a0a0a0;
    background: white;
}

/* Chat messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #202123;
    max-width: 800px;
    margin: 0 auto;
}

.welcome-message h2 {
    margin-bottom: 20px;
    color: #202123;
    font-size: 28px;
    font-weight: 400;
}

.welcome-message p {
    margin-bottom: 20px;
    font-size: 16px;
    color: #6e6e80;
}

.instructions {
    background: transparent;
    padding: 0;
    border-radius: 0;
    text-align: center;
    max-width: 100%;
    margin: 0 auto;
    box-shadow: none;
}

.instructions h3 {
    display: none;
}

.instructions ol {
    display: none;
}

.message {
    display: flex;
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

.message.user .message-content {
    background: #f7f7f8;
    color: #202123;
    border: 1px solid #e5e5e5;
}

.message.assistant .message-content {
    background: white;
    color: #202123;
}

.message-text {
    line-height: 1.6;
    word-wrap: break-word;
    color: #202123;
}

/* Markdown styling */
.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
    background: white;
}

.message-text table th,
.message-text table td {
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    text-align: left;
}

.message-text table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #111827;
}

.message-text table tr:nth-child(even) {
    background: #f9fafb;
}

.message-text code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #1f2937;
}

.message-text pre {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-text pre code {
    background: none;
    padding: 0;
}

.message-text ul,
.message-text ol {
    padding-left: 24px;
    margin: 10px 0;
}

.message-text li {
    margin: 4px 0;
}

.message-text p {
    margin: 8px 0;
}

.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 {
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.message-text blockquote {
    border-left: 4px solid #d1d5db;
    padding-left: 12px;
    margin: 10px 0;
    color: #6b7280;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 5px;
    color: #6e6e80;
}

.message.loading .message-content {
    background: white;
}

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6e6e80;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Input area */
.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e5e5;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #c4c4c4;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

#messageInput {
    flex: 1;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    color: #202123;
}

#messageInput::placeholder {
    color: #6e6e80;
}

#messageInput:focus {
    outline: none;
}

.btn-send {
    width: 32px;
    height: 32px;
    padding: 0;
    background: #19c37d;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    background: #1a9f6a;
}

.btn-send:active {
    transform: scale(0.95);
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #e5e5e5;
}

.send-icon {
    font-size: 18px;
    font-weight: bold;
}

.input-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 12px;
    color: #6e6e80;
    padding-left: 12px;
}

.current-conversation {
    font-weight: 400;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f7f7f8;
}

::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Loading state */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error message */
.error-message {
    background: #f44336;
    border-left: 4px solid #c62828;
    padding: 12px 16px;
    margin: 10px auto;
    border-radius: 6px;
    color: white;
    max-width: 70%;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 10px;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
    }
    
    .message-content {
        max-width: 85%;
    }
}
