/* 聊天容器 - 现代化设计 */
.chat-container {
    display: flex;
    height: calc(100vh - 20px);
    background: var(--card-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    margin: 10px;
}

/* 机器人选择侧边栏 */
.chat-sidebar {
    width: 280px;
    background: linear-gradient(145deg, var(--sidebar-bg), var(--card-color));
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sidebar-header-chat {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(46, 66, 72, 0.05);
}

.sidebar-header-chat h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header-chat .icon {
    font-size: 1.2rem;
}

.bot-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.bot-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bot-item {
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.bot-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.bot-item:hover::before {
    left: 100%;
}

.bot-item:hover {
    background: rgba(74, 157, 156, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 157, 156, 0.15);
}

.bot-item.active {
    background: linear-gradient(135deg, var(--accent-color), rgba(74, 157, 156, 0.8));
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 16px rgba(74, 157, 156, 0.3);
}

.bot-item .bot-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.bot-item .bot-personality {
    font-size: 0.8rem;
    opacity: 0.8;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 聊天主界面 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--background-color);
    position: relative;
}

/* 聊天头部 */
.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 2px 8px rgba(74, 157, 156, 0.3);
}

.bot-details h2 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--primary-color);
    font-weight: 600;
}

.bot-status {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.action-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* 欢迎消息 */
.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    border-radius: 20px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin: auto;
    max-width: 500px;
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.welcome-message h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.welcome-message p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.feature-list {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    min-width: 100px;
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.7);
}

.feature-icon {
    font-size: 1.5rem;
}

.feature-item span:last-child {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 消息气泡 */
.message {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    margin-bottom: 0.5rem;
    line-height: 1.5;
    font-size: 0.95rem;
    position: relative;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: messageSlideIn 0.3s ease-out;
}

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

.message.user {
    background: linear-gradient(135deg, var(--accent-color), rgba(74, 157, 156, 0.9));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 12px rgba(74, 157, 156, 0.3);
}

.message.user::before {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid var(--accent-color);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.message.bot {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.message.bot::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid rgba(255, 255, 255, 0.9);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.message.loading {
    background: linear-gradient(135deg, rgba(184, 207, 214, 0.3), rgba(184, 207, 214, 0.1));
    color: var(--text-secondary);
    font-style: italic;
    align-self: flex-start;
    border: 1px solid var(--border-color);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* 输入区域 */
.chat-input-container {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px rgba(74, 157, 156, 0.15);
}

#chat-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--text-color);
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
    padding: 0;
}

#chat-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

#chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), rgba(74, 157, 156, 0.8));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(74, 157, 156, 0.3);
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.send-btn:hover:not(:disabled)::before {
    left: 100%;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(74, 157, 156, 0.4);
}

.send-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.send-icon {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.send-btn:hover:not(:disabled) .send-icon {
    transform: translateX(2px);
}

/* 输入区域底部 */
.input-footer {
    margin-top: 0.75rem;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    animation: typingDots 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDots {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: calc(100vh - 140px);
    }
    
    .chat-sidebar {
        width: 100%;
        max-height: 150px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .bot-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .bot-item {
        min-width: 200px;
        flex-shrink: 0;
    }
    
    .feature-list {
        gap: 1rem;
    }
    
    .feature-item {
        min-width: 80px;
        padding: 0.75rem;
    }
    
    .message {
        max-width: 85%;
    }
}
