/* Chat Toggle Button */
#aipi-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #1e73be;
    color: #fff;
    font-size: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
}

/* Chat Window */
#aipi-chatbot {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: 90vw;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Hidden State */
.aipi-hidden {
    display: none !important;
}

/* Header */
#aipi-chat-header {
    background: linear-gradient(135deg, #1e73be, #00458a);
    color: #fff;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

#aipi-chat-header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#aipi-chat-header-title .aipi-title {
    font-size: 14px;
    font-weight: 600;
}

#aipi-chat-header-title .aipi-subtitle {
    font-size: 11px;
    opacity: 0.85;
}

#aipi-chat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

/* Messages */
#aipi-chat-messages {
    height: 260px;
    overflow-y: auto;
    padding: 12px;
    background: #f5f7fb;
}

/* Input */
#aipi-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

#aipi-chat-input input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    font-size: 13px;
}

#aipi-chat-input button {
    padding: 8px 14px;
    background: #1e73be;
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

/* Messages */
.aipi-msg {
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.5;
}

.aipi-msg.user,
.aipi-msg.bot {
    display: flex;
}

.aipi-msg.user {
    justify-content: flex-end;
}

.aipi-msg.bot {
    justify-content: flex-start;
}

.aipi-msg-bubble {
    max-width: 85%;
    padding: 8px 10px;
    border-radius: 10px;
}

.aipi-msg.user .aipi-msg-bubble {
    background: #1e73be;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.aipi-msg.bot .aipi-msg-bubble {
    background: #ffffff;
    color: #111827;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

/* Typography inside bot messages (HTML from Answer Generator) */
.aipi-msg.bot .aipi-msg-bubble h1,
.aipi-msg.bot .aipi-msg-bubble h2,
.aipi-msg.bot .aipi-msg-bubble h3,
.aipi-msg.bot .aipi-msg-bubble h4 {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
}

.aipi-msg.bot .aipi-msg-bubble p {
    margin: 0 0 6px;
}

.aipi-msg.bot .aipi-msg-bubble ul,
.aipi-msg.bot .aipi-msg-bubble ol {
    margin: 0 0 6px 18px;
    padding: 0;
}

.aipi-msg.bot .aipi-msg-bubble li {
    margin-bottom: 2px;
}

.aipi-msg.bot .aipi-msg-bubble a {
    color: #1e73be;
    text-decoration: none;
}

.aipi-msg.bot .aipi-msg-bubble a:hover {
    text-decoration: underline;
}

/* Product Links */
.aipi-product {
    margin-top: 6px;
}

.aipi-product a {
    color: #1e73be;
    font-weight: bold;
    text-decoration: none;
}
