/**
 * AI商机顾问Widget样式
 * Business Advisor Widget Styles
 */

/* Widget Container */
.ba-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Toggle Button */
.ba-toggle-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ba-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.ba-toggle-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.ba-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Chat Box */
.ba-chat-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ba-widget.open .ba-chat-box {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.ba-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.ba-header-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.ba-header-title span {
    font-size: 12px;
    opacity: 0.9;
}

.ba-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.ba-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ba-close-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Messages Container */
.ba-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.ba-messages::-webkit-scrollbar {
    width: 6px;
}

.ba-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ba-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.ba-messages::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Welcome Section */
.ba-welcome {
    text-align: center;
    padding: 30px 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
}

.ba-welcome h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.ba-welcome p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Quick Questions */
.ba-quick-questions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.ba-quick-question {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #333;
    text-align: left;
}

.ba-quick-question:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

/* Message Styles */
.ba-message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ba-message-user {
    flex-direction: row-reverse;
}

.ba-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ba-message-bot .ba-message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-right: 10px;
}

.ba-message-user .ba-message-avatar {
    background: #e0e0e0;
    margin-left: 10px;
}

.ba-message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ba-message-bot .ba-message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

.ba-message-user .ba-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ba-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* Opportunities Section */
.ba-opportunities {
    margin-top: 20px;
}

.ba-opportunities-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    text-align: center;
}

.ba-opportunity-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    transition: all 0.2s;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ba-opportunity-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.ba-opportunity-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.ba-opportunity-content {
    flex: 1;
}

.ba-opportunity-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.ba-opportunity-details {
    margin-bottom: 12px;
}

.ba-opportunity-reason {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 8px;
}

.ba-opportunity-score {
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
}

.ba-connect-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.ba-connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Typing Indicator */
.ba-typing {
    display: none;
    padding: 12px;
    background: white;
    border-radius: 12px;
    width: fit-content;
}

.ba-typing-active {
    display: flex;
    gap: 4px;
}

.ba-typing-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.ba-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.ba-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Input Area */
.ba-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ba-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

.ba-input:focus {
    border-color: #667eea;
}

.ba-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ba-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.ba-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ba-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Responsive Design */
@media (max-width: 480px) {
    .ba-widget {
        bottom: 10px;
        right: 10px;
    }

    .ba-chat-box {
        width: calc(100vw - 40px);
        max-width: 380px;
        height: calc(100vh - 120px);
    }

    .ba-toggle-btn {
        width: 50px;
        height: 50px;
    }

    .ba-toggle-btn svg {
        width: 24px;
        height: 24px;
    }
}
