* {
    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%);
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.footer-content a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-content a:hover {
    color: #5568d3;
    text-decoration: underline;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.header h1 {
    font-size: 1.5rem;
    color: #333;
    font-weight: 600;
}

.btn-reset {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-reset:hover {
    background: #ff5252;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
    min-height: 0; /* Allow flexbox to shrink */
}

/* Chat Panel (Left) */
.chat-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f8f9fa;
}

.welcome-message {
    text-align: center;
    color: #666;
    padding: 2rem;
}

.welcome-message h2 {
    color: #333;
    margin-bottom: 1rem;
}

.welcome-message ul {
    text-align: left;
    max-width: 500px;
    margin: 1rem auto;
    list-style: none;
}

.welcome-message li {
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: white;
    border-left: 3px solid #667eea;
    border-radius: 4px;
}

.message {
    margin-bottom: 1rem;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-user {
    text-align: right;
}

.message-user .message-content {
    background: #667eea;
    color: white;
    display: inline-block;
    padding: 0.75rem 1rem;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    word-wrap: break-word;
}

.message-assistant {
    text-align: left;
}

.message-assistant .message-content {
    background: white;
    color: #333;
    display: inline-block;
    padding: 0.75rem 1rem;
    border-radius: 18px 18px 18px 4px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Markdown styling */
.markdown-content {
    line-height: 1.6;
}

.markdown-content p {
    margin: 0.5rem 0;
}

.markdown-content p:first-child {
    margin-top: 0;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.2;
}

.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.3rem; }
.markdown-content h3 { font-size: 1.1rem; }

.markdown-content ul,
.markdown-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin: 0.25rem 0;
}

.markdown-content code {
    background: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: #f4f4f4;
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 3px solid #667eea;
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: #666;
    font-style: italic;
}

.markdown-content a {
    color: #667eea;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.markdown-content table th,
.markdown-content table td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: left;
}

.markdown-content table th {
    background: #f4f4f4;
    font-weight: 600;
}

.message-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

.chat-input-container {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-form {
    display: flex;
    gap: 0.5rem;
}

.message-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.btn-send {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 24px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s;
    min-width: 100px;
}

.btn-send:hover:not(:disabled) {
    background: #5568d3;
}

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

/* Logs Panel (Right) */
.logs-panel {
    flex: 1;
    background: #1e1e1e;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.logs-header {
    background: #2d2d2d;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #404040;
}

.logs-header h2 {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-clear {
    background: #444;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-clear:hover {
    background: #555;
}

.logs-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.log-placeholder {
    color: #888;
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.log-entry {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid;
    background: #252525;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.log-entry.user_message {
    border-left-color: #4CAF50;
    background: #1e3a1e;
}

.log-entry.agent_reasoning {
    border-left-color: #2196F3;
    background: #1e2a3a;
}

.log-entry.openai_call {
    border-left-color: #9C27B0;
    background: #2e1e3a;
}

.log-entry.tool_selection {
    border-left-color: #FF9800;
    background: #3a2e1e;
}

.log-entry.tool_call {
    border-left-color: #FF5722;
    background: #3a1e1e;
}

.log-entry.tool_result {
    border-left-color: #00BCD4;
    background: #1e2a3a;
}

.log-entry.final_response {
    border-left-color: #4CAF50;
    background: #1e3a1e;
}

.log-entry.error {
    border-left-color: #f44336;
    background: #3a1e1e;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.log-type {
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.log-time {
    color: #888;
    font-size: 0.7rem;
}

.log-description {
    color: #e0e0e0;
    margin-bottom: 0.5rem;
}

.log-details {
    background: #1a1a1a;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    color: #bbb;
    font-size: 0.8rem;
    overflow-x: auto;
}

.log-details pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar,
.logs-content::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.logs-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.logs-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.logs-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.logs-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .logs-panel {
        max-height: 40vh;
    }
    
}
