/**
 * AI Chatbot Frontend Styles
 */

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

/* Toggle Button */
#ai-chatbot-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(67, 97, 238, 0.4);
    transition: all 0.3s ease;
    animation: ai-chatbot-pulse 2s infinite;
    border: none;
}

#ai-chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(67, 97, 238, 0.5);
}

/* Notification Dot */
#ai-chatbot-notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ff4757;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
    animation: ai-chatbot-bounce 1s infinite;
}

/* Chatbot Box */
#ai-chatbot-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(67, 97, 238, 0.1);
    animation: ai-chatbot-scaleIn 0.3s ease-out;
}

/* Header */
#ai-chatbot-header {
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#ai-chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

#ai-chatbot-close {
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    border: none;
    background: transparent;
    color: white;
    font-size: 16px;
}

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

/* Messages Container */
#ai-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(135deg, #f8fffe, #f0f4ff);
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 350px;
    min-height: 350px;
}

/* Custom Scrollbar */
#ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

#ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(67, 97, 238, 0.3);
    border-radius: 3px;
}

#ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(67, 97, 238, 0.5);
}

/* Message Styling */
.ai-chatbot-message {
    margin-bottom: 12px;
    animation: ai-chatbot-fadeInUp 0.3s ease-out;
}

.ai-chatbot-bot-message {
    display: flex;
    justify-content: flex-start;
}

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

.ai-chatbot-bot-message-content {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #333;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-chatbot-user-message-content {
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-right-radius: 6px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

/* Typing Indicator */
.ai-chatbot-typing-message {
    display: flex;
    justify-content: flex-start;
}

.ai-chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f1f3f4;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    width: fit-content;
}

.ai-chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #4361ee;
    border-radius: 50%;
    animation: ai-chatbot-typing 1.4s infinite ease-in-out;
}

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

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

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

/* Quick Actions */
.ai-chatbot-quick-actions-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.ai-chatbot-quick-action-button {
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.ai-chatbot-quick-action-button:hover {
    background: linear-gradient(135deg, #3f37c9, #4361ee);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.4);
}

/* Success Message */
#ai-chatbot-success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px 20px;
    margin: 10px 20px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    display: none;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Input Container */
#ai-chatbot-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

#ai-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

#ai-chatbot-input:focus {
    border-color: #4361ee;
    background: white;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

#ai-chatbot-input:disabled {
    background: #f1f1f1;
    cursor: not-allowed;
    color: #6c757d;
}

#ai-chatbot-submit {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
    font-size: 16px;
}

#ai-chatbot-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #3f37c9, #4361ee);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.4);
}

#ai-chatbot-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Animations */
@keyframes ai-chatbot-pulse {
    0% { 
        box-shadow: 0 4px 20px rgba(67, 97, 238, 0.4); 
    }
    50% { 
        box-shadow: 0 4px 20px rgba(67, 97, 238, 0.6), 0 0 0 10px rgba(67, 97, 238, 0.1); 
    }
    100% { 
        box-shadow: 0 4px 20px rgba(67, 97, 238, 0.4); 
    }
}

@keyframes ai-chatbot-bounce {
    0%, 20%, 50%, 80%, 100% { 
        transform: translateY(0); 
    }
    40% { 
        transform: translateY(-5px); 
    }
    60% { 
        transform: translateY(-3px); 
    }
}

@keyframes ai-chatbot-scaleIn {
    from { 
        transform: scale(0.8); 
        opacity: 0; 
    }
    to { 
        transform: scale(1); 
        opacity: 1; 
    }
}

@keyframes ai-chatbot-fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes ai-chatbot-typing {
    0%, 60%, 100% { 
        transform: scale(0.8); 
        opacity: 0.5; 
    }
    30% { 
        transform: scale(1.2); 
        opacity: 1; 
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #ai-chatbot-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    #ai-chatbot-box {
        width: 100%;
        height: calc(100vh - 100px);
        bottom: 70px;
        right: 0;
        border-radius: 16px 16px 0 0;
    }
    
    #ai-chatbot-messages {
        max-height: calc(100vh - 250px);
        min-height: calc(100vh - 250px);
    }
    
    .ai-chatbot-bot-message-content,
    .ai-chatbot-user-message-content {
        max-width: 90%;
        font-size: 16px;
        padding: 14px 18px;
    }
    
    .ai-chatbot-quick-action-button {
        padding: 12px 16px;
        font-size: 16px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #ai-chatbot-box {
        background: #2d3748;
        border: 1px solid #4a5568;
    }
    
    #ai-chatbot-messages {
        background: linear-gradient(135deg, #2d3748, #1a202c);
    }
    
    .ai-chatbot-bot-message-content {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    #ai-chatbot-input-container {
        background: #2d3748;
        border-top: 1px solid #4a5568;
    }
    
    #ai-chatbot-input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    #ai-chatbot-success-message {
        background: #2d5f3f;
        color: #9ae6b4;
        border-left-color: #48bb78;
    }
}

/* Loading States */
.ai-chatbot-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error States */
.ai-chatbot-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 4px;
}

/* Hidden by default */
#ai-chatbot-container {
    display: none;
}

/* Show when initialized */
#ai-chatbot-container.ai-chatbot-initialized {
    display: block;
}