/* AI BOT Chatbot Styles */
:root {
    --ai-bot-primary-color: #007cba;
    --ai-bot-secondary-color: #f8f9fa;
    --ai-bot-text-color: #333;
    --ai-bot-border-color: #e1e5e9;
    --ai-bot-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --ai-bot-border-radius: 12px;
    --ai-bot-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container */
#ai-bot-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ai-bot-text-color);
}

/* Position variants */
#ai-bot-container.ai-bot-bottom-right {
    bottom: 20px;
    right: 20px;
}

#ai-bot-container.ai-bot-bottom-left {
    bottom: 20px;
    left: 20px;
}

#ai-bot-container.ai-bot-top-right {
    top: 20px;
    right: 20px;
}

#ai-bot-container.ai-bot-top-left {
    top: 20px;
    left: 20px;
}

/* Toggle button */
#ai-bot-toggle {
    width: 60px;
    height: 60px;
    background: var(--ai-bot-primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--ai-bot-shadow);
    transition: var(--ai-bot-transition);
    color: white;
}

#ai-bot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

#ai-bot-toggle svg {
    width: 24px;
    height: 24px;
}

/* Chat window */
#ai-bot-chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: var(--ai-bot-border-radius);
    box-shadow: var(--ai-bot-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--ai-bot-border-color);
}

#ai-bot-container.open #ai-bot-chat {
    display: flex;
}

/* Position adjustments for different positions */
#ai-bot-container.ai-bot-bottom-left #ai-bot-chat {
    right: auto;
    left: 0;
}

#ai-bot-container.ai-bot-top-right #ai-bot-chat {
    bottom: auto;
    top: 80px;
}

#ai-bot-container.ai-bot-top-left #ai-bot-chat {
    bottom: auto;
    top: 80px;
    right: auto;
    left: 0;
}

/* Header */
.ai-bot-header {
    background: var(--ai-bot-primary-color);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--ai-bot-border-radius) var(--ai-bot-border-radius) 0 0;
}

.ai-bot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#ai-bot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--ai-bot-transition);
}

#ai-bot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages area */
.ai-bot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--ai-bot-secondary-color);
}

.ai-bot-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-bot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-bot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Individual messages */
.ai-bot-message {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
    gap: 12px;
}

.ai-bot-message.ai-bot-user {
    flex-direction: row-reverse;
}

.ai-bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.ai-bot-bot .ai-bot-avatar {
    background: var(--ai-bot-primary-color);
    color: white;
}

.ai-bot-user .ai-bot-avatar {
    background: #6c757d;
    color: white;
}

.ai-bot-text {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 250px;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--ai-bot-border-color);
}

.ai-bot-user .ai-bot-text {
    background: var(--ai-bot-primary-color);
    color: white;
    border-color: var(--ai-bot-primary-color);
}

/* Typing indicator */
.ai-bot-message.typing .ai-bot-text {
    background: white;
    color: var(--ai-bot-text-color);
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ai-bot-primary-color);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.ai-bot-input {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--ai-bot-border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#ai-bot-message-input {
    flex: 1;
    border: 1px solid var(--ai-bot-border-color);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: var(--ai-bot-transition);
    min-height: 20px;
    max-height: 120px;
}

#ai-bot-message-input:focus {
    border-color: var(--ai-bot-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

#ai-bot-send {
    background: var(--ai-bot-primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ai-bot-transition);
    white-space: nowrap;
    flex-shrink: 0;
}

#ai-bot-send:hover {
    background: #005a87;
    transform: translateY(-1px);
}

#ai-bot-send:active {
    transform: translateY(0);
}

/* Error message styling */
.ai-bot-message.ai-bot-bot.error .ai-bot-text {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* Responsive design */
@media (max-width: 480px) {
    #ai-bot-chat {
        width: calc(100vw - 40px);
        right: -20px;
    }
    
    #ai-bot-container.ai-bot-bottom-left #ai-bot-chat {
        left: -20px;
        right: auto;
    }
    
    #ai-bot-container.ai-bot-top-right #ai-bot-chat {
        right: -20px;
    }
    
    #ai-bot-container.ai-bot-top-left #ai-bot-chat {
        left: -20px;
        right: auto;
    }
    
    .ai-bot-text {
        max-width: 200px;
    }
}

/* Animation for opening */
#ai-bot-chat {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Focus states for accessibility */
#ai-bot-toggle:focus,
#ai-bot-close:focus,
#ai-bot-send:focus {
    outline: 2px solid var(--ai-bot-primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #ai-bot-container {
        --ai-bot-border-color: #000;
        --ai-bot-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #ai-bot-container * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
