/**
 * AI Chat Styles
 * WordPress Plugin Version
 */

/* Chat Container */
.ai-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Toggle Button */
.ai-chat-toggle {
    background: var(--ai-chat-button-color, #0073aa);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.ai-chat-toggle:hover {
    background: var(--ai-chat-button-hover-color, #005a87);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Chat Window */
.ai-chat-window {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--ai-chat-window-background, #ffffff);
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Header */
.ai-chat-header {
    background: var(--ai-chat-header-color, #0073aa);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.ai-chat-controls {
    display: flex;
    gap: 10px;
}

.ai-chat-clear,
.ai-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

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

/* Messages Container */
.ai-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: var(--ai-chat-messages-background, #f8f9fa);
}

.ai-chat-message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
}

.ai-chat-message-user {
    background: var(--ai-chat-user-message-color, #0073aa);
    color: white;
    margin-left: auto;
    text-align: right;
}

.ai-chat-message-ai {
    background: var(--ai-chat-ai-message-color, #ffffff);
    color: var(--ai-chat-text-color, #333333);
    border: 1px solid #e1e5e9;
    margin-right: auto;
}

.ai-chat-typing {
    font-style: italic;
    color: #666;
    position: relative;
}

.ai-chat-typing::after {
    content: '...';
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Input Container */
.ai-chat-input-container {
    padding: 15px;
    background: var(--ai-chat-window-background, #ffffff);
    border-top: 1px solid #e1e5e9;
    display: flex;
    gap: 10px;
}

.ai-chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    background: var(--ai-chat-input-background, #ffffff);
    color: var(--ai-chat-text-color, #333333);
}

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

.ai-chat-send {
    background: var(--ai-chat-send-button-color, #0073aa);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.ai-chat-send:hover:not(:disabled) {
    background: var(--ai-chat-button-hover-color, #005a87);
}

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

/* Error Display */
.ai-chat-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    margin: 10px 15px;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
    font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-chat-container {
        bottom: 10px;
        right: 10px;
    }
    
    .ai-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 50px;
        right: -10px;
        border-radius: 10px 10px 0 0;
    }
    
    .ai-chat-message {
        max-width: 90%;
    }
}

/* Widget Position Variations */
.ai-chat-container[data-position="bottom-left"] {
    right: auto;
    left: 20px;
}

.ai-chat-container[data-position="top-right"] {
    bottom: auto;
    top: 20px;
}

.ai-chat-container[data-position="top-left"] {
    bottom: auto;
    top: 20px;
    right: auto;
    left: 20px;
}

.ai-chat-container[data-position="top-right"] .ai-chat-window,
.ai-chat-container[data-position="top-left"] .ai-chat-window {
    bottom: auto;
    top: 60px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ai-chat-window {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .ai-chat-messages {
        background: #1a202c;
    }
    
    .ai-chat-message-ai {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .ai-chat-input-container {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .ai-chat-input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .ai-chat-input:focus {
        border-color: #0073aa;
    }
}

/* Accessibility */
.ai-chat-toggle:focus,
.ai-chat-send:focus,
.ai-chat-input:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Animation for opening/closing */
.ai-chat-window {
    animation: slideUp 0.3s ease-out;
}

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