:root {
    --bg-dark: #212121;
    --sidebar-bg: #171717;
    --sidebar-hover: #2f2f2f;
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --accent-color: #ffffff;
    --message-bot: #212121;
    --message-user: #2f2f2f;
    --input-bg: #2f2f2f;
    --border-color: rgba(255,255,255,0.1);
    --font-family: 'Inter', sans-serif;
}

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

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

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

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

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.new-chat-btn:hover {
    background-color: var(--sidebar-hover);
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    margin-top: 1rem;
}

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

.sidebar-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.sidebar-action:hover {
    background-color: var(--sidebar-hover);
}

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

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.mobile-header button {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* Messages */
.messages-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 10rem; /* Space for input */
}

/* Scrollbar */
.messages-container::-webkit-scrollbar {
    width: 8px;
}
.messages-container::-webkit-scrollbar-track {
    background: transparent;
}
.messages-container::-webkit-scrollbar-thumb {
    background-color: var(--sidebar-hover);
    border-radius: 4px;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    text-align: center;
}

.welcome-logo {
    font-size: 3rem;
    background: #fff;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.welcome-screen h1 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 3rem;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

.suggestion-card {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary);
}

.suggestion-card:hover {
    background: var(--sidebar-hover);
}

.suggestion-title {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.suggestion-desc {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Chat Bubbles */
.chat-row {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.chat-row.user-row {
    /* User background can be same as dark or slightly different */
}

.chat-row.bot-row {
    /* No distinct background for ChatGPT style, just padding */
}

.chat-content {
    width: 100%;
    max-width: 800px;
    display: flex;
    gap: 1rem;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.user-avatar {
    background-color: #ec4899;
}

.bot-avatar {
    background-color: #10b981;
}

.message-text {
    flex-grow: 1;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-wrap: break-word;
    min-height: 30px;
    padding-top: 3px;
}

.message-text pre {
    background: #000;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: monospace;
    font-size: 0.9rem;
}

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

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

/* Input Area */
.input-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, transparent, var(--bg-dark) 20%);
    padding: 2rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-container {
    width: 100%;
    max-width: 800px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    display: flex;
    align-items: flex-end;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.input-container:focus-within {
    border-color: rgba(255,255,255,0.3);
}

#chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    resize: none;
    padding: 0.5rem 0;
    max-height: 200px;
    outline: none;
    line-height: 1.5;
}

.send-btn {
    background: #fff;
    color: #000;
    border: none;
    border-radius: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 0.5rem;
    margin-bottom: 2px;
}

.send-btn:hover:not(:disabled) {
    background: #d4d4d4;
}

.send-btn:disabled {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.3);
    cursor: not-allowed;
}

.send-btn svg {
    width: 16px;
    height: 16px;
}

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

/* Typing Indicator */
.typing {
    display: flex;
    gap: 4px;
    padding-top: 8px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    background: 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; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

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

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.code-block {
    background: #000;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: #a78bfa;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .mobile-header {
        display: flex;
    }
    .suggestion-grid {
        grid-template-columns: 1fr;
    }
}
