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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 800px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar svg {
    width: 28px;
    height: 28px;
}

.header-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
}

.status.online {
    background: #4caf50;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f5f5;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.message-avatar.user {
    background: #4caf50;
    color: white;
}

.message-avatar svg {
    width: 20px;
    height: 20px;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

/* 为包含产品容器的消息内容取消最大宽度限制 */
.message-content:has(.products-container) {
    max-width: 95%;
}

.message.ai .message-content {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.message-content p {
    line-height: 1.6;
    word-wrap: break-word;
}

.message-content .time {
    font-size: 11px;
    margin-top: 8px;
    opacity: 0.7;
}

.message-content .feedback-btn {
    margin-top: 8px;
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid currentColor;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.message-content .feedback-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.products-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.products-card h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
}

.product-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.3s ease;
}

.product-item:hover {
    background: #f5f5f5;
}

.product-item:last-child {
    border-bottom: none;
}

.product-item h5 {
    font-size: 13px;
    color: #667eea;
    margin-bottom: 4px;
}

.product-item p {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.product-item .price {
    font-weight: 600;
    color: #e74c3c;
}

/* 新产品卡片样式 */
.product-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #f0f0f0;
}

.product-header {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.product-thumb {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    background: #f5f5f5;
}

.product-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.product-model {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.product-content {
    margin-bottom: 12px;
}

.product-desc {
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
}

.product-features h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
}

.product-features ul {
    margin: 0;
    padding-left: 20px;
}

.product-features li {
    font-size: 13px;
    line-height: 1.4;
    color: #666;
    margin-bottom: 4px;
}

.product-link {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.product-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 产品容器样式 */
.products-container {
    margin-top: 16px;
}

.products-container h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
}

/* 产品网格布局 */
.products-grid {
    display: flex !important;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
}

.products-grid .product-card-grid {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    box-sizing: border-box;
    width: calc(33.333% - 12px);
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.products-grid .product-card-grid:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.products-grid .product-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.products-grid .product-thumb {
    width: 120px;
    height: 120px;
}

.products-grid .product-info h5 {
    margin: 0 0 4px 0;
    font-size: 14px;
}

.products-grid .product-link {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.products-grid .product-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 产品对比样式 */
.products-comparison {
    margin-top: 20px;
}

.products-comparison h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
}

.comparison-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #f0f0f0;
}

.comparison-row {
    display: grid;
    grid-template-columns: 120px repeat(auto-fit, minmax(150px, 1fr));
    border-bottom: 1px solid #eee;
}

.comparison-row:last-child {
    border-bottom: none;
}

.comparison-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
}

.comparison-cell {
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.comparison-cell.comparison-label {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    border-right: 1px solid #eee;
}

.comparison-cell ul {
    margin: 0;
    padding-left: 20px;
}

.comparison-cell li {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .product-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .product-thumb {
        width: 150px;
        height: 150px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison-row {
        grid-template-columns: 1fr;
    }
    
    .comparison-cell.comparison-label {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
}

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

.input-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.action-btn svg {
    width: 18px;
    height: 18px;
    color: #666;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease;
    max-height: 100px;
    min-height: 44px;
}

#messageInput:focus {
    border-color: #667eea;
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

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

.history-panel {
    position: fixed;
    right: -320px;
    top: 0;
    width: 320px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
}

.history-panel.active {
    right: 0;
}

.history-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.close-btn svg {
    width: 16px;
    height: 16px;
}

.history-list {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.history-item {
    padding: 15px;
    border-radius: 8px;
    background: #f5f5f5;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: #e0e0e0;
}

.history-item h4 {
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
}

.history-item p {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.history-item .time {
    font-size: 11px;
    color: #999;
}

.feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.feedback-modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.rating-stars {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.rating-stars span {
    font-size: 32px;
    cursor: pointer;
    color: #ddd;
    transition: color 0.3s ease;
}

.rating-stars span:hover,
.rating-stars span.active {
    color: #ffc107;
}

#feedbackComment {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 80px;
    margin-bottom: 20px;
}

#feedbackComment:focus {
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

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

@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .history-panel {
        width: 100%;
        right: -100%;
    }
}

/* 消息操作按钮 */
.message-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.message-actions .action-btn {
    width: auto;
    height: auto;
    border-radius: 16px;
    padding: 6px 12px;
    background-color: #f8f9fa;
    color: #666;
    font-size: 12px;
    gap: 5px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.message-actions .action-btn:hover {
    background-color: #e9ecef;
    transform: none;
    border-color: #667eea;
}

.message-actions .action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.message-actions .helpful-btn:hover {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.message-actions .unhelpful-btn:hover {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.message-actions .helpful-btn.selected {
    background-color: #c3e6cb;
    border-color: #28a745;
    color: #155724;
    font-weight: 500;
}

.message-actions .unhelpful-btn.selected {
    background-color: #f5c6cb;
    border-color: #dc3545;
    color: #721c24;
    font-weight: 500;
}

.feedback-success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    text-align: center;
    width: 100%;
}

/* 相关问题样式 */
.related-questions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.related-questions-title {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.related-questions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.related-question-btn {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    background-color: #f8f9fa;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.related-question-btn:hover {
    background-color: #e9ecef;
    border-color: #667eea;
    color: #667eea;
}