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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: #fafbff;
    color: #0a0a0a;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    background: #ffffff;
    padding: 20px 32px;
    border-bottom: 1px solid #e5e5e5;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header .logo {
    height: 32px;
    width: auto;
    flex-shrink: 0;
}

.header-subtitle {
    font-size: 14px;
    color: #737373;
    margin: 0;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: #fafafa;
}

.message {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 15px;
}

.message.user {
    background: linear-gradient(135deg, #6B4FFF 0%, #8B5FFF 100%);
    margin-left: auto;
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 12px rgba(107, 79, 255, 0.2);
}

.message.agent {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    color: #0a0a0a;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.agent-response-wrapper {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tools-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-step {
    margin: 4px 0;
    opacity: 0;
    animation: fadeInSlide 0.4s ease forwards;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #e5e5e5;
    border-top: 2px solid #6B4FFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.streaming-cursor {
    color: #6B4FFF;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Input Area */
.input-area {
    display: flex;
    gap: 12px;
    padding: 24px 32px;
    background: #ffffff;
    border-top: 1px solid #e5e5e5;
}

#messageInput {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background: #fafafa;
    color: #0a0a0a;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}

#messageInput:focus {
    border-color: #6B4FFF;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(107, 79, 255, 0.1);
}

#sendBtn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #6B4FFF 0%, #8B5FFF 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(107, 79, 255, 0.2);
}

#sendBtn:hover {
    background: linear-gradient(135deg, #5B3FEF 0%, #7B4FEF 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(107, 79, 255, 0.3);
}

#sendBtn:disabled {
    background: #e5e5e5;
    color: #a3a3a3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Side Panel */
.side-panel {
    width: 0;
    background: #ffffff;
    border-left: 1px solid #e5e5e5;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.side-panel.open {
    width: 480px;
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: linear-gradient(135deg, #6B4FFF 0%, #8B5FFF 100%);
    border-bottom: 1px solid rgba(107, 79, 255, 0.1);
}

.side-panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: all 0.2s;
}

.close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.side-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: #ffffff;
}

.execution-stream {
    background: #fafafa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.7;
    border: 1px solid #e5e5e5;
    border-left: 4px solid #6B4FFF;
}

.execution-stream h3 {
    font-size: 16px;
    font-weight: 600;
    color: #6B4FFF;
    margin-bottom: 12px;
}

/* Auth Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-modal-content {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #e5e5e5;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease;
}

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

.auth-modal-header {
    padding: 28px 28px 20px 28px;
    background: linear-gradient(135deg, #6B4FFF 0%, #8B5FFF 100%);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
}

.auth-modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: #ffffff;
}

.auth-modal-body {
    padding: 28px;
    text-align: center;
}

.auth-modal-body p {
    color: #525252;
    line-height: 1.6;
}

.auth-modal-button {
    display: inline-block;
    background: linear-gradient(135deg, #6B4FFF 0%, #8B5FFF 100%);
    color: #ffffff;
    padding: 14px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(107, 79, 255, 0.2);
}

.auth-modal-button:hover {
    background: linear-gradient(135deg, #5B3FEF 0%, #7B4FEF 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(107, 79, 255, 0.3);
}

.auth-modal-footer {
    padding: 20px 28px;
    border-top: 1px solid #f5f5f5;
    text-align: right;
}

.auth-modal-close {
    background: #f5f5f5;
    color: #0a0a0a;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 14px;
}

.auth-modal-close:hover {
    background: #e5e5e5;
}

/* Scrollbar styling */
.messages::-webkit-scrollbar,
.side-panel-content::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track,
.side-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb,
.side-panel-content::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover,
.side-panel-content::-webkit-scrollbar-thumb:hover {
    background: #a3a3a3;
}

/* Toggle button for collapsible side panel */
.toggle-panel-btn {
    position: fixed;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #6B4FFF 0%, #8B5FFF 100%);
    color: #ffffff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(107, 79, 255, 0.3);
    transition: all 0.2s;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
}

.toggle-panel-btn.visible {
    opacity: 1;
    pointer-events: all;
}

.toggle-panel-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(107, 79, 255, 0.4);
}

.side-panel.open ~ .toggle-panel-btn {
    right: 512px;
}

/* Code blocks in side panel */
.side-panel-content pre,
.side-panel-content code {
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 2px 6px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
}

.side-panel-content pre {
    padding: 16px;
    overflow-x: auto;
    line-height: 1.6;
}

/* Success/info messages in side panel */
.side-panel-content .success {
    color: #6B4FFF;
    font-weight: 600;
}

.side-panel-content .error {
    color: #ef4444;
    font-weight: 600;
}
