
/* When chat is open → show X */
#chat-bubble[data-x="1"]::after {
    content: "✖";          /* The X */
    font-size: 26px;
    color: white;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;  /* ensures clicks still toggle */
}

/* Hide the IMG while chat is open */
#chat-bubble[data-x="1"] img {
    display: none !important;
}


/* Floating Bubble */
#chat-bubble {
    position: fixed;
    bottom: 25px;
    width: 60px;
    height: 60px;
    background: #e65727;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 999999;
    transition: 0.3s;
}
#chat-bubble.chat-position-left { left: 25px; right: auto; }
#chat-bubble.chat-position-right { right: 25px; left: auto; }
#chat-bubble:hover { transform: scale(1.1); background: #c9451f; }

/* Chat Window */
#chat-window {
    position: fixed;
    min-height: 0;
    bottom: 100px;
    width: 360px;
    height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    font-family: 'Inter', sans-serif;
}
#chat-window.chat-position-left { left: 25px; right: auto; }
#chat-window.chat-position-right { right: 25px; left: auto; }

#chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto !important;
    min-height: 0;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg-user {
    background: #ffe7e1;
    padding: 10px;
    border-radius: 10px;
    align-self: flex-end;
    max-width: 80%;
}

.msg-user p {
    font-size: 14px;
    line-height: 24px;
    margin-bottom: 10px;
}

.msg-user p:last-of-type {
    margin-bottom: 0;
}

.msg-bot-container {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;      /* ⭐ Change from 90% → 100% */
}


.msg-bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.msg-bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-bot {
    background: #f7f7f7;
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 80%;        /* ⭐ Add this */
    word-wrap: break-word; /* ⭐ Force wrap */
    overflow-wrap: break-word;
}

.msg-bot p {
    font-size: 14px;
    line-height: 24px;
    margin-bottom: 10px;
}

.msg-bot p:last-of-type {
    margin-bottom: 0;
}

.quick-replies {
    display: flex;
    flex-wrap: wrap;        /* allow multiple per row */
    gap: 8px;
    margin-top: 12px;
}


.quick-reply-btn {
    display: inline-block;     /* shrink to fit content */
    width: auto;               /* no full width */
    padding: 8px 12px;
    border-radius: 18px;
    cursor: pointer;
    background: #f1f1f1;
    border: 1px solid #ddd;
    font-size: 12px;
    white-space: nowrap;       /* prevent forced wrapping */
    max-width: 100%;           /* but still responsive */
    transition: 0.2s;
}


.quick-reply-btn:hover {
    background: #e65727;
    color: white;
    border-color: #e65727;
}



/* Product Cards */
.product-cards {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.product-card {
    width: 150px;
    background: white;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: black;
    display: block;
}
.product-title {
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0%,100% { opacity: 0.2; }
    20% { opacity: 1; }
}

/* Input Box */
#chat-input-box {
    display: flex;
    align-items: flex-start;  /* IMPORTANT FIX */
}
#chat-input {
    flex: 1;
    padding: 12px;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
    min-height: 40px;      /* starting small */
    height: auto;          /* allow expansion */
    max-height: 160px;     /* stop expanding here */
    font-size: 14px;
    line-height: 20px;
    box-sizing: border-box;
}

#chat-send {
    width: 80px;
    height: 48px;      /* fixed height */
    background: #e65727;
    color: white;
    border: none;
    cursor: pointer;
    flex-shrink: 0;    /* do not grow with input area */
    align-self: flex-end;
}
#chat-send:hover { background: #c9451f; }
