* {
    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: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.config-panel {
    background: #f8fafc;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.config-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.config-row label {
    font-weight: 600;
    color: #374151;
    min-width: 100px;
}

.config-row input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.config-row input:focus {
    outline: none;
    border-color: #4f46e5;
}

.config-row button {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.config-row button:hover {
    background: #4338ca;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

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

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 20px;
    line-height: 1.5;
}

.bot-message .message-content {
    background: #f1f5f9;
    color: #374151;
    border-bottom-left-radius: 5px;
}

.user-message .message-content {
    background: #4f46e5;
    color: white;
    border-bottom-right-radius: 5px;
}

.status-bar {
    padding: 10px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #6b7280;
}

.progress-hidden {
    display: none;
}

.progress-visible {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-container {
    display: flex;
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

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

.input-container input:focus {
    border-color: #4f46e5;
}

.input-container button {
    margin-left: 10px;
    padding: 15px 30px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 90px;
    justify-content: center;
}

.input-container button:hover:not(:disabled) {
    background: #4338ca;
}

.input-container button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.hidden {
    display: none;
}

.info-panel {
    background: #f8fafc;
    padding: 25px;
    border-top: 1px solid #e2e8f0;
}

.info-panel h3 {
    color: #374151;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.info-panel ol {
    color: #6b7280;
    padding-left: 20px;
    line-height: 1.6;
}

.info-panel li {
    margin-bottom: 8px;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .config-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .config-row label {
        min-width: auto;
    }
    
    .chat-container {
        height: 400px;
    }
    
    .message-content {
        max-width: 90%;
    }
}

/* Markdown content styling in bot messages */
.bot-message .message-content h1,
.bot-message .message-content h2,
.bot-message .message-content h3,
.bot-message .message-content h4,
.bot-message .message-content h5,
.bot-message .message-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: #2c3e50;
}

.bot-message .message-content h1 { font-size: 1.5em; }
.bot-message .message-content h2 { font-size: 1.3em; }
.bot-message .message-content h3 { font-size: 1.1em; }

.bot-message .message-content p {
    margin: 8px 0;
    line-height: 1.5;
}

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

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

.bot-message .message-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.bot-message .message-content em {
    font-style: italic;
    color: #5d4037;
}

.bot-message .message-content code {
    background: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #e91e63;
}

.bot-message .message-content pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    border-left: 4px solid #4caf50;
}

.bot-message .message-content pre code {
    background: none;
    padding: 0;
    color: #333;
}

.bot-message .message-content blockquote {
    border-left: 4px solid #ccc;
    margin: 8px 0;
    padding-left: 12px;
    color: #666;
    font-style: italic;
}

.bot-message .message-content a {
    color: #4caf50;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom-color 0.2s;
}

.bot-message .message-content a:hover {
    border-bottom-color: #4caf50;
}

.bot-message .message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}

.bot-message .message-content th,
.bot-message .message-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.bot-message .message-content th {
    background-color: #f5f5f5;
    font-weight: 600;
}