/* ── Toggle Button ─────────────────────────────────────────────────── */
#ai-chatbot-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 70px;
    height: 70px;
    cursor: pointer;
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    padding: 10px;
    z-index: 9999;
    transition: transform 0.2s;
}
#ai-chatbot-btn:hover { transform: scale(1.08); }
#ai-chatbot-icon { width: 100%; }

/* ── Chat Window ───────────────────────────────────────────────────── */
#ai-chatbot-window {
    position: fixed;
    bottom: 110px;
    right: 25px;
    width: 350px;
    height: 450px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
    display: none;          /* shown as flex when open */
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transition: width 0.3s, height 0.3s, bottom 0.3s, right 0.3s;
}

/* ── Header ────────────────────────────────────────────────────────── */
#ai-chatbot-header {
    background: linear-gradient(90deg, #0a84ff, #00c26f);
    color: white;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#ai-chatbot-title {
    font-weight: bold;
    font-size: 15px;
}
#ai-chatbot-controls {
    display: flex;
    gap: 6px;
}
.ctrl-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 14px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.4); }

/* ── Body ──────────────────────────────────────────────────────────── */
#ai-chatbot-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* ── Messages ──────────────────────────────────────────────────────── */
#ai-chatbot-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* User bubble */
.user-msg {
    text-align: right;
    background: #e2f0ff;
    padding: 9px 12px;
    margin: 5px 2px;
    border-radius: 14px 14px 2px 14px;
    font-size: 14px;
    display: inline-block;
    float: right;
    clear: both;
    max-width: 85%;
    word-wrap: break-word;
}

/* Bot bubble */
.bot-msg {
    text-align: left;
    background: #f0fff5;
    border: 1px solid #d4f0e0;
    padding: 10px 13px;
    margin: 5px 2px;
    border-radius: 14px 14px 14px 2px;
    font-size: 14px;
    float: left;
    clear: both;
    max-width: 92%;
    word-wrap: break-word;
    line-height: 1.5;
}
.bot-msg p { margin: 0 0 6px 0; }
.bot-msg p:last-child { margin-bottom: 0; }
.bot-msg ul {
    margin: 6px 0 0 0;
    padding-left: 18px;
}
.bot-msg ul li { margin-bottom: 3px; }

/* Welcome message */
.welcome-msg {
    background: linear-gradient(135deg, #eef9ff, #f0fff5);
    border: 1px solid #b8e8ff;
}

/* Error message */
.error-msg {
    background: #fff0f0;
    border: 1px solid #ffd0d0;
    color: #c0392b;
}

/* HCL-style numbered list */
.bot-list { margin-top: 6px; }
.bot-list-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: flex-start;
}
.bot-list-num {
    background: linear-gradient(135deg, #0a84ff, #00c26f);
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ── Typing Indicator ──────────────────────────────────────────────── */
.typing-indicator {
    display: flex !important;
    align-items: center;
    gap: 5px;
    padding: 12px 16px !important;
    width: fit-content;
}
.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #0a84ff;
    border-radius: 50%;
    animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

/* Clear floats after messages */
#ai-chatbot-messages::after {
    content: '';
    display: block;
    clear: both;
}

/* ── Input Bar ─────────────────────────────────────────────────────── */
#ai-chatbot-input {
    display: flex;
    border-top: 1px solid #e0e0e0;
    align-items: center;
    padding: 4px;
    background: #fafafa;
    flex-shrink: 0;
}
#ai-chatbot-text {
    flex: 1;
    padding: 9px 10px;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
}
#ai-chatbot-mic {
    padding: 8px 10px;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}
#ai-chatbot-mic:hover { background: #f0f0f0; }
#ai-chatbot-mic.mic-active { background: #ffe0e0; animation: pulse 0.8s infinite; }

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.15); }
}

#ai-chatbot-send {
    padding: 9px 14px;
    background: linear-gradient(90deg, #0a84ff, #00c26f);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: opacity 0.2s;
    margin: 2px;
}
#ai-chatbot-send:hover { opacity: 0.85; }

/* ── Scrollbar ─────────────────────────────────────────────────────── */
#ai-chatbot-messages::-webkit-scrollbar { width: 4px; }
#ai-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#ai-chatbot-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
