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

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

.chat-container {
    width: 90%;
    max-width: 800px;
    height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.chat-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.chat-header p {
    opacity: 0.9;
    font-size: 14px;
}

/* Streaming toggle styles */
.settings-toggle {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.streaming-toggle,
.websearch-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
}

.model-selector {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    color: white;
    font-size: 14px;
}

.model-selector select {
    min-width: 180px;
    border-radius: 6px;
    border: none;
    padding: 6px 10px;
    font-size: 14px;
    color: #333;
}

.streaming-toggle input[type="checkbox"],
.websearch-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    transition: background-color 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.streaming-toggle input[type="checkbox"]:checked + .toggle-slider,
.websearch-toggle input[type="checkbox"]:checked + .toggle-slider {
    background-color: rgba(255, 255, 255, 0.6);
}

.streaming-toggle input[type="checkbox"]:checked + .toggle-slider::before,
.websearch-toggle input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(26px);
}

.toggle-label {
    color: white;
    font-size: 14px;
    opacity: 0.9;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 70%;
    word-wrap: break-word;
}

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

.user-message .message-content {
    background: #667eea;
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
}

.ai-message {
    align-self: flex-start;
}

.ai-message .message-content {
    background: #f1f1f1;
    color: #333;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    line-height: 1.5;
}

/* Markdown styling for AI messages */
.ai-message .message-content strong {
    font-weight: 600;
    color: #222;
}

.ai-message .message-content em {
    font-style: italic;
    color: #555;
}

.ai-message .message-content code {
    background-color: #e8e8e8;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #d63384;
}

.ai-message .message-content ul,
.ai-message .message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message .message-content li {
    margin: 4px 0;
    line-height: 1.4;
}

.ai-message .message-content ul li {
    list-style-type: disc;
}

.ai-message .message-content ol li {
    list-style-type: decimal;
}

.ai-message .message-content br {
    line-height: 1.8;
}

/* Special styling for status messages */
.ai-message .message-content:has(> :first-child:is(span)):first-child::before {
    content: '';
}

.loading-message {
    align-self: flex-start;
}

.loading-message .message-content {
    background: #e3f2fd;
    color: #1976d2;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    font-style: italic;
}

.input-container {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-upload-area {
    position: relative;
}

.attach-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.attach-btn:hover {
    background-color: #f0f0f0;
}

.message-input-area {
    flex: 1;
    display: flex;
    gap: 10px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
}

#messageInput:focus {
    border-color: #667eea;
}

#messageInput:disabled {
    background-color: #f5f5f5;
    color: #999;
}

.send-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

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

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* File counter display */
.file-status {
    font-size: 12px;
    color: #666;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 12px;
    white-space: nowrap;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .message {
        max-width: 85%;
    }
    
    .input-container {
        padding: 15px;
    }
    
    .attach-btn {
        font-size: 18px;
    }
}
