/* ================================================================
   AI HENG - 样式文件
   设计理念：简洁、现代、专业、有温度
   ================================================================ */

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

:root {
    /* CO2Lion品牌色（根据Logo调整） */
    --primary-green: #2d8659;      /* 盾牌的绿色 */
    --primary-green-dark: #1e5a3d;
    --primary-green-light: #e8f5ee;
    
    /* 保持原有的辅助色 */
    --blue: #3b82f6;
    --gray-50: #f9fafb;
    /* ... */
}
    
    /* 辅助色 */
    --blue: #3b82f6;
    --blue-dark: #2563eb;
    
    /* 中性色 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    
    /* 渐变背景 */
    --bg-gradient: linear-gradient(135deg, #f0fdf4 0%, #ffffff 50%, #eff6ff 100%);
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", 
                 "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--gray-800);
    line-height: 1.6;
}

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

/* ================ 头部样式 ================ */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 48px;           /* 从40px增加到48px */
    height: 48px;
    background: white;     /* 改为白色背景，让Logo更清晰 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;          /* 给Logo一些呼吸空间 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* 添加阴影，更有层次 */
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
}

.subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.status-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.turn-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.conversion-badge {
    padding: 0.25rem 0.75rem;
    background: var(--primary-green-light);
    color: var(--primary-green-dark);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ================ 聊天区域 ================ */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.messages-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 欢迎界面 */
.welcome-screen {
    text-align: center;
    padding: 3rem 1.5rem;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #34d399, var(--primary-green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
}

.welcome-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.welcome-text {
    color: var(--gray-600);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.quick-questions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
    max-width: 800px;
    margin: 0 auto;
}

.quick-btn {
    padding: 0.875rem 1.25rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    text-align: left;
    color: var(--gray-700);
}

.quick-btn:hover {
    border-color: var(--primary-green);
    background: var(--primary-green-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 消息气泡 */
.message-wrapper {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease-in;
}

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

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

.message-wrapper.assistant {
    justify-content: flex-start;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 500;
}

.avatar.assistant {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: white;
}

.avatar.user {
    background: var(--blue);
    color: white;
}

.message-bubble {
    max-width: 65%;
    padding: 0.875rem 1.25rem;
    border-radius: 1.25rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}

.message-bubble.user {
    background: var(--blue);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message-bubble.assistant {
    background: white;
    border: 1px solid var(--gray-200);
    color: var(--gray-800);
    border-bottom-left-radius: 0.25rem;
    box-shadow: var(--shadow-sm);
}

/* 加载动画 */
.loading-wrapper {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.loading-bubble {
    background: white;
    border: 1px solid var(--gray-200);
    padding: 0.875rem 1.25rem;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.loading-dots {
    display: flex;
    gap: 0.25rem;
}

.loading-dot {
    width: 6px;
    height: 6px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ================ 输入区域 ================ */
.input-area {
    background: white;
    border-top: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    position: sticky;
    bottom: 0;
}

.input-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.message-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s;
}

.message-input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.message-input:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.send-btn {
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: white;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.footer-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-500);
    padding: 0.5rem 0 1rem;
}

/* ================ 响应式设计 ================ */
@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 1rem;
    }
    
    .title {
        font-size: 1.125rem;
    }
    
    .status-section {
        font-size: 0.75rem;
    }
    
    .chat-area {
        padding: 1rem;
    }
    
    .quick-questions {
        grid-template-columns: 1fr;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .input-container {
        padding: 0.75rem 1rem;
    }
}

/* ================ 滚动条美化 ================ */
.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.chat-area::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}