/* ChatBot AI Widget - Default (bottom-right) */
#chatbot-widget {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === POSITION VARIANTS === */
.chatbot-pos-bottom-right {
    bottom: 20px;
    right: 20px;
}

.chatbot-pos-bottom-left {
    bottom: 20px;
    left: 20px;
}

.chatbot-pos-middle-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

.chatbot-pos-middle-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

/* Chat window alignment per position */
.chatbot-pos-bottom-right #chatbot-window {
    bottom: 75px;
    right: 0;
}

.chatbot-pos-bottom-left #chatbot-window {
    bottom: 75px;
    left: 0;
}

.chatbot-pos-middle-right #chatbot-window {
    bottom: auto;
    right: 0;
    top: auto;
    margin-top: -250px;
}

.chatbot-pos-middle-left #chatbot-window {
    bottom: auto;
    left: 0;
    top: auto;
    margin-top: -250px;
}

/* Toggle Button */
#chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2196F3;
    border: none;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.5);
}

/* Middle positions: don't interfere with parent translateY on hover */
.chatbot-pos-middle-right #chatbot-toggle:hover,
.chatbot-pos-middle-left #chatbot-toggle:hover {
    transform: scale(1.1);
}

/* Chat Window */
#chatbot-window {
    position: absolute;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatbot-slideUp 0.3s ease;
}

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

/* Header */
#chatbot-header {
    background: #2196F3;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#chatbot-header-dot {
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
    display: inline-block;
}

#chatbot-header-title {
    font-size: 16px;
    font-weight: 600;
}

#chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

#chatbot-close:hover {
    opacity: 1;
}

/* Messages Area */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f5f7fb;
}

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

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

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Messages */
.chatbot-msg {
    display: flex;
    max-width: 85%;
    animation: chatbot-fadeIn 0.3s ease;
}

@keyframes chatbot-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg-bot {
    align-self: flex-start;
}

.chatbot-msg-user {
    align-self: flex-end;
}

.chatbot-msg-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-msg-bot .chatbot-msg-content {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.chatbot-msg-user .chatbot-msg-content {
    background: #2196F3;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Links in bot messages */
.chatbot-msg-bot .chatbot-msg-content a {
    color: #1976D2;
    text-decoration: underline;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: #fff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

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

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

@keyframes chatbot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
#chatbot-input-area {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    border-top: 1px solid #e8e8e8;
    background: #fff;
    flex-shrink: 0;
}

#chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chatbot-input:focus {
    border-color: #2196F3;
}

#chatbot-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #2196F3;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

#chatbot-send:hover {
    background: #1976D2;
}

#chatbot-send:disabled {
    background: #bbb;
    cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #chatbot-widget {
        bottom: 10px !important;
        top: auto !important;
        transform: none !important;
    }

    .chatbot-pos-bottom-left,
    .chatbot-pos-middle-left {
        left: 10px !important;
        right: auto !important;
    }

    .chatbot-pos-bottom-right,
    .chatbot-pos-middle-right {
        right: 10px !important;
        left: auto !important;
    }

    #chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px !important;
        top: auto !important;
        margin-top: 0 !important;
        border-radius: 12px;
    }

    .chatbot-pos-bottom-left #chatbot-window,
    .chatbot-pos-middle-left #chatbot-window {
        left: 0 !important;
        right: auto !important;
    }

    .chatbot-pos-bottom-right #chatbot-window,
    .chatbot-pos-middle-right #chatbot-window {
        right: 0 !important;
        left: auto !important;
    }

    #chatbot-toggle {
        width: 52px;
        height: 52px;
    }
}
