/**
 * AI Chat Widget CSS
 * Main styles for the chat widget UI
 */

/* Container */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

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

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

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

.ai-chat-toggle-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    padding: 8px;
    transition: opacity 0.2s;
}

.ai-chat-toggle-btn:hover {
    opacity: 0.8;
}

.ai-chat-toggle-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Message Area */
.ai-chat-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f7f7;
}

/* Message Styles */
.ai-chat-message {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease-out;
}

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

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

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

.ai-chat-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.ai-chat-message.user .ai-chat-message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chat-message.assistant .ai-chat-message-content {
    background: #e8e8e8;
    color: #333;
    border-bottom-left-radius: 4px;
}

.ai-chat-message-time {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* Loading indicator */
.ai-chat-message.loading .ai-chat-message-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-chat-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #666;
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

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

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

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

@keyframes bounce {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Input Area */
.ai-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.ai-chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.ai-chat-send-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.ai-chat-send-btn:hover {
    background: #5568d3;
}

.ai-chat-send-btn:active {
    transform: scale(0.95);
}

.ai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.ai-chat-send-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Shortcode version */
.ai-chat-shortcode {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-chat-shortcode .ai-chat-messages {
    height: 400px;
    background: #f7f7f7;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #e0e0e0;
}

.ai-chat-shortcode .ai-chat-input-area {
    gap: 8px;
    padding: 0;
    border: none;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .ai-chat-message-content {
        max-width: 85%;
    }

    .ai-chat-shortcode .ai-chat-messages {
        height: 300px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ai-chat-widget {
        background: #2d2d2d;
        color: #fff;
    }

    .ai-chat-messages {
        background: #1a1a1a !important;
    }

    .ai-chat-message.assistant .ai-chat-message-content {
        background: #404040;
        color: #e0e0e0;
    }

    .ai-chat-input {
        background: #3d3d3d;
        color: #fff;
        border-color: #555;
    }

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

/* Utility classes */
.ai-chat-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ai-chat-error {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 12px;
    border-radius: 6px;
    margin: 8px 0;
}

.ai-chat-success {
    color: #388e3c;
    background-color: #e8f5e9;
    padding: 12px;
    border-radius: 6px;
    margin: 8px 0;
}

