:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #2e9cca;
    --background-color: #f5f7fa;
    --sidebar-color: #ffffff;
    --text-color: #333333;
    --light-text: #666666;
    --border-color: #e1e4e8;
    --message-user-bg: #e1f5fe;
    --message-bot-bg: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 300px;
    background-color: var(--sidebar-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.logo i {
    font-size: 24px;
    color: var(--primary-color);
    margin-right: 10px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.upload-section {
    margin-bottom: 30px;
}

.upload-section h2 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.file-input-container {
    margin-bottom: 15px;
}

.file-label {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--background-color);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    border-color: var(--accent-color);
}

.file-label i {
    margin-right: 10px;
    color: var(--primary-color);
}

#file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    font-size: 14px;
}

#upload-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#upload-btn:hover {
    background-color: var(--secondary-color);
}

#upload-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

#upload-btn i {
    margin-right: 8px;
}

.document-list h2 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-color);
}

#documents {
    list-style: none;
}

.document-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background-color: var(--background-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.document-item:hover {
    background-color: #e9f0f7;
}

.document-item.active {
    background-color: #e1f5fe;
    border-left: 3px solid var(--accent-color);
}

.document-item i {
    margin-right: 10px;
    color: var(--primary-color);
}

.document-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

/* Chat Container Styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--sidebar-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 600;
}

#active-document {
    font-size: 14px;
    color: var(--light-text);
    font-style: italic;
}

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

.welcome-message {
    text-align: center;
    margin: auto;
    max-width: 500px;
    padding: 30px;
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.welcome-message h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.welcome-message p {
    color: var(--light-text);
    line-height: 1.5;
}

.message {
    max-width: 80%;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    line-height: 1.5;
}

.user-message {
    align-self: flex-end;
    background-color: var(--message-user-bg);
    border-bottom-right-radius: 0;
}

.bot-message {
    align-self: flex-start;
    background-color: var(--message-bot-bg);
    border-bottom-left-radius: 0;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.message-header i {
    margin-right: 8px;
}

.user-message .message-header {
    color: var(--primary-color);
}

.bot-message .message-header {
    color: var(--secondary-color);
}

.message-content {
    font-size: 15px;
}

.loading {
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    margin: 0 3px;
    animation: loading 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loading {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.chat-input-container {
    display: flex;
    padding: 15px 20px;
    background-color: var(--sidebar-color);
    border-top: 1px solid var(--border-color);
}

#chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    resize: none;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s ease;
}

#chat-input:focus {
    border-color: var(--accent-color);
}

#chat-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

#send-btn {
    width: 50px;
    height: 50px;
    margin-left: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-btn:hover {
    background-color: var(--secondary-color);
}

#send-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

/* Responsive styles */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .chat-container {
        height: 60%;
    }
    
    .message {
        max-width: 90%;
    }
}
