* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    background: #f0f2f5;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: #2c394b;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    font-size: 1.5rem;
}

.header-text h1 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.header-text p {
    font-size: 0.875rem;
    opacity: 0.8;
}

.clear-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease-out;
    max-width: 70%;
}

.message.assistant {
    align-self: flex-start;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.avatar {
    width: 40px;
    height: 40px;
    background: #e1e5ea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.message.user .avatar {
    background: #007aff;
    color: white;
}

.message-content {
    background: #f2f2f2;
    padding: 1rem;
    border-radius: 12px;
    max-width: 100%;
    min-width: 200px;
}

.message.user .message-content {
    background: #0084ff;
    color: white;
    margin-left: 1rem;
}

.example-queries {
    margin-top: 1rem;
    font-size: 0.9rem;
    max-width: 600px;
}

.example-queries ul {
    list-style: none;
    margin: 0.5rem 0;
}

.example-queries li {
    margin: 0.25rem 0;
    color: #2c394b;
    cursor: pointer;
    transition: color 0.2s;
}

.example-queries li:hover {
    color: #007aff;
}

.input-container {
    border-top: 1px solid #e1e5ea;
    padding: 1rem;
    background: white;
}

.mode-selector {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: background 0.2s;
}

.radio-label:hover {
    background: #f0f2f5;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-label span {
    font-size: 0.9rem;
    color: #666;
}

.radio-label input[type="radio"]:checked + span {
    color: #007aff;
    font-weight: 600;
}

.input-row {
    display: flex;
    gap: 1rem;
}

#userInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #e1e5ea;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#userInput:focus {
    border-color: #007aff;
}

#sendButton {
    background: #007aff;
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

#sendButton:hover {
    background: #0056b3;
}

.typing-indicator {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: #666;
    font-style: italic;
}

.typing-indicator .dots {
    display: flex;
    gap: 0.25rem;
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background: #666;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

/* Ensure list bullets render inside the chat bubble */
.message .message-content ul,
.message .message-content ol {
    margin: 0.5rem 0 0.5rem 0;
    padding-left: 1.25rem;
    list-style-position: inside;
}

.message .message-content li {
    margin: 0.25rem 0;
}

/* Improve readability of paragraphs and headings inside messages */
.message .message-content p {
    margin: 0.25rem 0;
}
.message .message-content h1,
.message .message-content h2,
.message .message-content h3,
.message .message-content h4,
.message .message-content h5,
.message .message-content h6 {
    margin: 0.5rem 0 0.25rem;
}

/* Code styling */
.message .message-content pre {
    background: #f7f7f7;
    padding: 0.75rem;
    border-radius: 8px;
    overflow: auto;
}
.message.user .message-content pre {
    background: rgba(255,255,255,0.2);
}
.message .message-content code {
    background: #f7f7f7;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}
.message.user .message-content code {
    background: rgba(255,255,255,0.2);
}

/* Ensure long words and URLs wrap within the bubble */
.message .message-content {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
