/* Chatbot Module Styles */
/* Self-contained styles for the chatbot component */

.chatbot-container {
    position: fixed;
    bottom: -100%;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    opacity: 0;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.chatbot-container.chatbot-open {
    bottom: 20px;
    opacity: 1;
}

/* Initial state - instant positioning without animation */
.chatbot-container.chatbot-initial {
    transition: none !important;
    animation: none !important;
}

.chatbot-container.chatbot-initial.chatbot-open {
    bottom: 20px !important;
    opacity: 1 !important;
    transition: none !important;
}

/* Header */
.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    font-weight: bold;
    color: white;
    margin: 0 auto 16px;
    border: 3px solid rgba(102, 126, 234, 0.2);
}

.chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

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

.chatbot-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
    /* Hide by default to prevent flicker on page load */
    visibility: hidden;
}

/* Show messages once chatbot is ready */
.chatbot-ready .chatbot-messages {
    visibility: visible;
}

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

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

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Welcome Message */
.chatbot-welcome {
    text-align: center;
    padding: 40px 20px;
    color: #333;
}

.chatbot-welcome h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
}

.chatbot-welcome p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Message Bubbles */
.chatbot-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: messageSlideIn 0.3s ease;
}

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

.chatbot-message-user {
    align-items: flex-end;
}

.chatbot-message-assistant {
    align-items: flex-start;
}

.chatbot-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message-user .chatbot-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message-assistant .chatbot-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chatbot-timestamp {
    font-size: 11px;
    color: #999;
    padding: 0 8px;
}

/* Typing Indicator */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-indicator .typing-text {
    font-size: 14px;
    color: #666;
    margin-right: 4px;
}

.typing-indicator .typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

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

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

.typing-indicator .typing-dot:nth-child(4) {
    animation-delay: 0.6s;
}

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

/* Input Container */
.chatbot-input-container {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 16px 16px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease;
    outline: none;
}

.chatbot-input:focus {
    border-color: #667eea;
}

.chatbot-send {
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-send:active {
    transform: translateY(0);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-container {
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        bottom: -100%;
    }

    .chatbot-container.chatbot-open {
        bottom: 0;
    }

    .chatbot-header {
        border-radius: 0;
    }

    .chatbot-input-container {
        border-radius: 0;
    }
}

/* Dark theme compatibility */
[data-theme="night"] .chatbot-container {
    background: rgba(20, 20, 30, 0.98);
}

[data-theme="night"] .chatbot-messages {
    background: #1a1a2e;
}

[data-theme="night"] .chatbot-welcome {
    color: #e0e0e0;
}

[data-theme="night"] .chatbot-welcome h4 {
    color: #8b9bea;
}

[data-theme="night"] .chatbot-welcome p {
    color: #999;
}

[data-theme="night"] .chatbot-message-assistant .chatbot-bubble {
    background: #2a2a3e;
    color: #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="night"] .chatbot-input-container {
    background: #1a1a2e;
    border-top-color: #2a2a3e;
}

[data-theme="night"] .chatbot-input {
    background: #2a2a3e;
    border-color: #3a3a4e;
    color: #e0e0e0;
}

[data-theme="night"] .chatbot-input:focus {
    border-color: #8b9bea;
}

[data-theme="night"] .typing-indicator {
    background: #2a2a3e;
}

[data-theme="night"] .typing-indicator .typing-text {
    color: #999;
}
