/**
 * WP AI Search Chatbot Styles
 * 
 * Floating chatbot widget with modern, clean design
 */

/* Chatbot Container */
#wp-ai-search-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Chatbot Bubble Button */
.wp-ai-chatbot-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    position: relative;
}

.wp-ai-chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.wp-ai-chatbot-bubble svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Notification Badge */
.wp-ai-chatbot-bubble .chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: white;
    border: 2px solid white;
}

/* Chatbot Window */
.wp-ai-chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.wp-ai-chatbot-window.active {
    display: flex;
}

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

/* Chatbot Header */
.wp-ai-chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.wp-ai-chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wp-ai-chatbot-header .chatbot-status {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

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

.wp-ai-chatbot-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.wp-ai-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
.wp-ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wp-ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.wp-ai-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wp-ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.wp-ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Message Bubble */
.chatbot-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.chatbot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

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

.chatbot-message.user .chatbot-message-avatar {
    background: #6b7280;
    color: white;
}

.chatbot-message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.6;
}

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

.chatbot-message-content p {
    margin: 0 0 10px 0;
}

.chatbot-message-content p:last-child {
    margin-bottom: 0;
}

.chatbot-message-content a {
    color: #667eea;
    text-decoration: underline;
}

.chatbot-message.user .chatbot-message-content a {
    color: white;
    text-decoration: underline;
}

/* Loading Animation */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Suggestions */
.chatbot-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 20px;
}

.chatbot-suggestion {
    background: white;
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    text-align: left;
    color: #374151;
}

.chatbot-suggestion:hover {
    background: #f9fafb;
    border-color: #667eea;
    transform: translateX(4px);
}

/* Input Container */
.wp-ai-chatbot-input {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.wp-ai-chatbot-input textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    transition: border-color 0.2s;
}

.wp-ai-chatbot-input textarea:focus {
    outline: none;
    border-color: #667eea;
}

.wp-ai-chatbot-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
}

.wp-ai-chatbot-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.wp-ai-chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wp-ai-chatbot-send svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Sources */
.chatbot-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.chatbot-sources-title {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
}

.chatbot-source-item {
    display: block;
    font-size: 12px;
    color: #667eea;
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.2s;
}

.chatbot-source-item:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #wp-ai-search-chatbot {
        bottom: 10px;
        right: 10px;
    }
    
    .wp-ai-chatbot-window {
        bottom: 80px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        height: calc(100vh - 100px);
    }
    
    .chatbot-message {
        max-width: 90%;
    }
}
