.float-widget {
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.float-widget-btn {
    width: 120px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    user-select: none;
}

.float-widget-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.float-widget-btn:active {
    transform: translateY(0);
}

.float-widget-btn.feedback-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.float-widget-btn.feedback-btn:hover {
    box-shadow: 0 6px 16px rgba(245, 87, 108, 0.5);
}

.float-widget-btn i {
    font-size: 18px;
}

.ai-chat-dialog {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 400px;
    height: 600px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-dialog.show {
    display: flex;
}

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

.ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chat-close {
    cursor: pointer;
    font-size: 20px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-chat-close:hover {
    opacity: 1;
}

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

.ai-message, .user-message {
    margin-bottom: 16px;
    display: flex;
}

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

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

.message-bubble {
    max-width: 85%;
    padding: 16px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.7;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.ai-message .message-bubble {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 1px solid #e8ecf4;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
}

.ai-message .message-bubble strong {
    color: #2d3748;
    font-weight: 700;
}

.ai-message .message-bubble .ai-heading {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 18px 0 12px 0;
    padding: 10px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    line-height: 1.4;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.25);
    letter-spacing: 0.5px;
}

.ai-message .message-bubble .ai-heading:first-child {
    margin-top: 0;
}

.ai-message .message-bubble .ai-heading h3,
.ai-message .message-bubble .ai-heading h4 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.ai-message .message-bubble .ai-section {
    margin: 14px 0;
    padding: 12px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
}

.ai-message .message-bubble .ai-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #e2e8f0;
}

.ai-message .message-bubble .ai-list-item {
    padding: 8px 12px 8px 28px;
    position: relative;
    margin: 6px 0;
    line-height: 1.6;
    background: #fafbff;
    border-radius: 8px;
    transition: background 0.2s;
}

.ai-message .message-bubble .ai-list-item:hover {
    background: #f0f4ff;
}

.ai-message .message-bubble .ai-list-item::before {
    content: '●';
    position: absolute;
    left: 10px;
    top: 8px;
    color: #667eea;
    font-size: 10px;
}

.ai-message .message-bubble .ai-list-item .item-number {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
    vertical-align: middle;
}

.ai-message .message-bubble .ai-code-block {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    margin: 10px 0;
    white-space: pre-wrap;
    color: #e2e8f0;
}

.ai-message .message-bubble .ai-inline-code {
    background: #f0f4ff;
    padding: 3px 8px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #667eea;
    border: 1px solid #e0e7ff;
}

.ai-message .message-bubble p {
    margin: 8px 0;
    color: #4a5568;
}

.ai-message .message-bubble p:first-child {
    margin-top: 0;
}

.ai-message .message-bubble p:last-child {
    margin-bottom: 0;
}

.ai-message .message-bubble .ai-data-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin: 8px 6px;
    min-width: 100px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-message .message-bubble .ai-data-card .card-value {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.ai-message .message-bubble .ai-data-card .card-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 4px;
}

.ai-message .message-bubble .ai-data-card.card-green {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.ai-message .message-bubble .ai-data-card.card-orange {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.3);
}

.ai-message .message-bubble .ai-data-card.card-red {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

.ai-message .message-bubble .ai-data-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
    justify-content: center;
}

.ai-message .message-bubble .ai-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e2e8f0 50%, transparent 100%);
    margin: 16px 0;
}

.ai-message .message-bubble .ai-highlight {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    color: #92400e;
}

.ai-message .message-bubble .ai-tip {
    background: #ecfdf5;
    border-left: 3px solid #10b981;
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    margin: 10px 0;
    color: #065f46;
}

.ai-message .message-bubble .ai-tip::before {
    content: '💡 ';
}

.ai-message .message-bubble .ai-warning {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    margin: 10px 0;
    color: #991b1b;
}

.ai-message .message-bubble .ai-warning::before {
    content: '⚠️ ';
}

.user-message .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-top-right-radius: 4px;
}

.ai-chat-input {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 10px;
}

.ai-chat-input input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.ai-chat-input input:focus {
    border-color: #667eea;
}

.ai-chat-send {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.ai-chat-send:hover {
    opacity: 0.9;
}

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

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

.feedback-dialog-content {
    padding: 20px;
}

.feedback-dialog-content .layui-form-item {
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .ai-chat-dialog {
        width: 100%;
        height: 100%;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
    
    .float-widget {
        right: 10px;
        bottom: 80px;
    }
    
    .float-widget-btn {
        width: 100px;
        height: 45px;
        font-size: 13px;
    }
}
