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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: #16213e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

header {
    padding: 16px 24px;
    background: #0f3460;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 { font-size: 1.2rem; }

#logout-btn {
    background: transparent;
    border: 1px solid #e94560;
    color: #e94560;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 80%;
    line-height: 1.5;
}

.message.user {
    background: #0f3460;
    margin-left: auto;
}

.message.assistant {
    background: #1a1a2e;
    border: 1px solid #333;
}

#typing-indicator {
    color: #888;
    font-style: italic;
    padding: 8px 0;
}

.hidden { display: none; }

#chat-form {
    display: flex;
    padding: 16px;
    gap: 12px;
    background: #0f3460;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: #1a1a2e;
    color: #eee;
    font-size: 1rem;
}

#user-input:focus { outline: 2px solid #e94560; }

#chat-form button {
    padding: 12px 24px;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

#chat-form button:hover { background: #c23152; }

/* Markdown rendering styles for assistant messages */

.message.assistant pre {
    background: #0d1117;
    border-radius: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    margin: 8px 0;
}

.message.assistant pre code {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    font-size: 0.9rem;
    color: #e6edf3;
    background: none;
    padding: 0;
}

.message.assistant code {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.message.assistant ul,
.message.assistant ol {
    padding-left: 24px;
    margin: 8px 0;
}

.message.assistant li {
    margin-bottom: 4px;
}

.message.assistant h1,
.message.assistant h2,
.message.assistant h3,
.message.assistant h4,
.message.assistant h5,
.message.assistant h6 {
    margin: 12px 0 8px;
    line-height: 1.3;
}

.message.assistant h1 { font-size: 1.4rem; }
.message.assistant h2 { font-size: 1.2rem; }
.message.assistant h3 { font-size: 1.1rem; }

.message.assistant a {
    color: #58a6ff;
    text-decoration: none;
}

.message.assistant a:hover {
    text-decoration: underline;
}

.message.assistant blockquote {
    border-left: 3px solid #e94560;
    padding-left: 12px;
    margin: 8px 0;
    color: #aaa;
}

.message.assistant p {
    margin: 8px 0;
}

.message.assistant p:first-child {
    margin-top: 0;
}

.message.assistant p:last-child {
    margin-bottom: 0;
}
