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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.header p {
    opacity: 0.9;
}

.status {
    margin-top: 10px;
    font-size: 0.9em;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-indicator.online {
    background: #4caf50;
}

.status-indicator.offline {
    background: #f44336;
}

/* Chat container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

/* Messages */
.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 20px;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 5px;
    white-space: pre-wrap;
}

.message.user .message-bubble code {
    background: rgba(255,255,255,0.2);
}

.message.assistant .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
}

.sources {
    margin-top: 10px;
    font-size: 0.85em;
    color: #666;
}

.sources-list {
    margin: 5px 0 0 0;
    padding-left: 1.25em;
}

.sources-list li {
    margin-bottom: 2px;
    word-break: break-word;
}

.sources-list a {
    color: #667eea;
    text-decoration: none;
}

.sources-list a:hover {
    text-decoration: underline;
}

.error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 10px;
}

/* Markdown content styling */
.message-bubble p {
    margin-bottom: 0.75em;
}

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

.message-bubble ul,
.message-bubble ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message-bubble li {
    margin-bottom: 0.25em;
}

.message-bubble code {
    background: #f0f0f0;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.message-bubble pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.75em 0;
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

.message-bubble strong {
    font-weight: 600;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin: 0.75em 0 0.5em 0;
    font-weight: 600;
}

.message-bubble h1 { font-size: 1.3em; }
.message-bubble h2 { font-size: 1.15em; }
.message-bubble h3 { font-size: 1em; }

/* Input area */
.input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.input-area input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.input-area input:focus {
    border-color: #667eea;
}

.input-area button {
    padding: 15px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.input-area button:hover {
    background: #5568d3;
}

.input-area button:disabled {
    background: #ccc;
    cursor: not-allowed;
}