/* Conversational AI Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    font-family: 'Inter', '-apple-system', 'BlinkMacSystemFont', sans-serif;
}

/* Chat Toggle Button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.chatbot-toggle i {
    color: white;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.chatbot-container.active .chatbot-toggle i {
    transform: rotate(180deg);
}

/* Chat Notification */
.chat-notification {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 1;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-notification::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(0, 0, 0, 0.9);
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 32px;
    width: 380px;
    height: 500px;
    background: var(--bg-primary, #1a1a2e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chatbot-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.chatbot-info {
    flex: 1;
}

.chatbot-info h4 {
    margin: 0;
    color: var(--text-primary, #ffffff);
    font-size: 16px;
    font-weight: 600;
}

.status {
    font-size: 12px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    display: flex;
    align-items: center;
    gap: 6px;
}

.status.online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.chatbot-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease-out;
}

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

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

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: 40px;
}

.bot-message .message-content {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #ffffff);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 40px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden; /* Ensure the image doesn't spill out of the circular container */
}

.bot-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure the image covers the container properly */
    border-radius: 50%;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 280px;
    word-wrap: break-word;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 0 20px 10px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

/* Input Area */
.chatbot-input-area {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

#chatbotInput {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 12px 20px;
    color: var(--text-primary, #ffffff);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

#chatbotInput::placeholder {
    color: var(--text-secondary, rgba(255, 255, 255, 0.5));
}

#chatbotInput:focus {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

#chatbotSend {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
}

#chatbotSend:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#chatbotSend:active {
    transform: scale(0.95);
}

/* Light Theme Support */
body.light-theme .chatbot-window {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .chatbot-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .chatbot-info h4 {
    color: #1a1a2e;
}

body.light-theme .status {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .chatbot-close {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .bot-message .message-content {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme #chatbotInput {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}

body.light-theme #chatbotInput::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

body.light-theme #chatbotInput:focus {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .chat-notification {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .chat-notification::after {
    border-left-color: rgba(255, 255, 255, 0.95);
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    .chatbot-container {
        bottom: 90px;
        left: 15px;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }
    
    .chatbot-toggle i {
        font-size: 20px;
    }
    
    .chatbot-window {
        width: calc(100vw - 30px);
        height: 70vh;
        bottom: 70px;
        right: -15px;
    }
    
    .chat-notification {
        right: 60px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .message-content {
        max-width: 220px;
    }
}

@media screen and (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: 75vh;
        right: -10px;
    }
    
    .chatbot-header {
        padding: 15px;
    }
    
    .chatbot-messages {
        padding: 15px;
    }
    
    .chatbot-input-area {
        padding: 15px;
    }
    
    .message-content {
        max-width: 200px;
        font-size: 13px;
    }
}

/* Smooth animations for better UX */
* {
    -webkit-tap-highlight-color: transparent;
}

.chatbot-container * {
    box-sizing: border-box;
}

/* Enhanced focus states for accessibility */
#chatbotInput:focus,
#chatbotSend:focus,
.chatbot-close:focus,
.chatbot-toggle:focus {
    outline: 2px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Prevent text selection on UI elements */
.chatbot-toggle,
.chatbot-close,
#chatbotSend,
.chatbot-avatar,
.message-avatar {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}