:root {
    --bg-primary: #343541;
    --bg-secondary: #202123;
    --bg-tertiary: #444654;
    --text-primary: #ececf1;
    --text-secondary: #c5c5d2;
    --accent-color: #10a37f;
    --accent-hover: #1a7f64;
    --border-color: rgba(255, 255, 255, 0.1);
    --user-msg-bg: #343541;
    --bot-msg-bg: #444654;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

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

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    padding: 8px;
    transition: transform 0.3s ease;
    z-index: 100;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 20px;
}

.new-chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.history-list {
    flex: 1;
    overflow-y: auto;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.settings-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: transparent;
    color: var(--text-primary);
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s;
}

.settings-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Main Chat Area Styles */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.mobile-header {
    display: none;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.menu-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 16px;
}

.chat-wrapper {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chat-messages {
    display: flex;
    flex-direction: column;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    animation: fadeIn 0.5s ease-out;
}

.welcome-screen h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.welcome-screen p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Messages */
.message {
    padding: 24px 20%;
    border-bottom: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease-out;
}

.message.user {
    background-color: var(--user-msg-bg);
}

.message.bot {
    background-color: var(--bot-msg-bg);
}

.message-content {
    display: flex;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-weight: 600;
}

.avatar.user-avatar {
    background-color: #5436DA;
}

.avatar.bot-avatar {
    background-color: var(--accent-color);
}

.text-content {
    flex: 1;
    overflow-x: auto;
}

.text-content p {
    margin-bottom: 8px;
}

.text-content pre {
    background-color: #000;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 12px 0;
}

.text-content code {
    font-family: monospace;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}

.text-content pre code {
    background-color: transparent;
    padding: 0;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 24px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

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

/* Input Area */
.input-area {
    padding: 24px 20%;
    background-image: linear-gradient(180deg, rgba(53, 55, 64, 0), var(--bg-primary) 58.85%);
    position: relative;
    padding-bottom: 12px;
}

.input-container {
    position: relative;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-end;
    padding: 12px 16px;
    max-width: 800px;
    margin: 0 auto;
}

.input-container:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    resize: none;
    max-height: 200px;
    outline: none;
    padding-right: 40px;
    line-height: 1.5;
}

#messageInput::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.send-btn:hover:not(:disabled) {
    background-color: var(--accent-hover);
}

.send-btn:disabled {
    background: transparent;
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

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

.modal-header h3 {
    font-weight: 500;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.4;
}

.primary-btn {
    width: 100%;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.primary-btn:hover {
    background-color: var(--accent-hover);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .message {
        padding: 16px;
    }

    .input-area {
        padding: 16px;
    }

    .welcome-screen h1 {
        font-size: 2rem;
    }
}
