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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    height: 100vh;
    overflow: hidden;
}

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

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
}

.btn-link {
    color: white;
    text-decoration: none;
    padding: 8px 20px;
    border: 2px solid white;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-link:hover {
    background: white;
    color: #667eea;
}

/* Chat Container */
.chat-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.chat-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

.sidebar-header h3 {
    color: #667eea;
}

.sidebar-content {
    padding: 20px;
}

.tip-card {
    background: #f9f9fb;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 3px solid #667eea;
}

.tip-card h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.tip-card p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 8px;
}

.tip-card ul {
    font-size: 0.85rem;
    color: #666;
    padding-left: 20px;
}

.tip-card li {
    margin-bottom: 5px;
    line-height: 1.4;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

/* Messages */
.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease;
}

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

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

.message-ai {
    justify-content: flex-start;
}

.avatar-user,
.avatar-ai {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.avatar-user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-left: 12px;
}

.avatar-ai {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    margin-right: 12px;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 12px;
    line-height: 1.6;
}

.message-user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-ai .message-content {
    background: white;
    color: #1d1d1f;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.welcome-message {
    display: flex;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.welcome-message .message-content {
    max-width: none;
    padding: 0;
    margin-left: 15px;
}

.hint {
    color: #999;
    font-size: 0.9rem;
    margin-top: 10px;
    font-style: italic;
}

/* Tool Call Messages */
.tool-call {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 8px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
}

.tool-call .tool-name {
    font-weight: bold;
    color: #856404;
}

.tool-result {
    background: #d4edda;
    border-left: 4px solid #28a745;
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 8px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #155724;
}

.thinking {
    background: #e7f3ff;
    border-left: 4px solid #2196f3;
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #0d47a1;
    font-style: italic;
}

.error-message {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 8px;
    color: #721c24;
}

/* Input Container */
.input-container {
    background: white;
    border-top: 1px solid #e5e5e5;
    padding: 20px;
}

#chat-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.3s;
}

#user-input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-ready {
    color: #28a745;
}

.status-thinking {
    color: #ffc107;
}

.status-error {
    color: #dc3545;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Scrollbar */
.messages-container::-webkit-scrollbar {
    width: 8px;
}

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

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

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

/* Responsive */
@media (max-width: 768px) {
    .chat-sidebar {
        display: none;
    }

    .message-content {
        max-width: 85%;
    }

    header {
        flex-direction: column;
        gap: 10px;
    }
}
