/* WP AI Agent Frontend Styles */

.wp-ai-agent-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ai-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0073aa, #005177);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.ai-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 115, 170, 0.4);
}

.ai-chat-toggle:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.ai-chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

.ai-chat-panel.active {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, #0073aa, #005177);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

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

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

.ai-message .message-avatar {
    background: #0073aa;
    color: white;
}

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

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

.ai-message .message-content {
    background: white;
    border: 1px solid #e1e5e9;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: #0073aa;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 5px;
    text-align: center;
}

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

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

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    min-height: 20px;
    max-height: 80px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0073aa;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-send:hover {
    background: #005177;
}

.chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.typing-indicator {
    display: none;
    padding: 10px 15px;
    color: #6c757d;
    font-size: 13px;
    font-style: italic;
}

.typing-indicator.active {
    display: block;
}

.typing-dots {
    display: inline-block;
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 60%, 100% { opacity: 0; }
    30% { opacity: 1; }
}

/* Quick Actions */
.quick-actions {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.quick-actions-title {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 600;
}

.quick-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-action {
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #495057;
}

.quick-action:hover {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wp-ai-agent-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .ai-chat-panel {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        max-width: 350px;
        max-height: 500px;
    }
    
    .ai-chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .ai-chat-panel {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 70px;
        right: -10px;
        max-width: none;
        max-height: none;
    }
}

/* Accessibility */
.wp-ai-agent-widget *:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Animation for panel opening */
.ai-chat-panel {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s ease;
}

.ai-chat-panel.active {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ai-chat-panel {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .chat-messages {
        background: #34495e;
    }
    
    .ai-message .message-content {
        background: #3c4f66;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .chat-input-container {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .chat-input {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .quick-actions {
        background: #34495e;
        border-color: #4a5f7a;
    }
    
    .quick-action {
        background: #3c4f66;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
}