/* =========================================================
   CHATBOT TOGGLE BUTTON
========================================================= */

/* =========================================================
   ENHANCED CHATBOT TOGGLE BUTTON
========================================================= */

.chatbot-toggle {
    position: fixed;
    right: 25px;
    bottom: 25px;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    
    /* Modern gradient background */
    background: linear-gradient(135deg, #111111 0%, #2c3e50 100%);
    color: #fff;
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Richer shadow with a subtle colored ring */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 
                0 0 0 0 rgba(163, 183, 113, 0.4);
                
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.3s ease,
                background 0.3s ease;
    
    /* Optional continuous pulse animation */
    animation: chatbotPulse 3s infinite;
}

/* Subtle attention-grabbing pulse */
@keyframes chatbotPulse {
    0% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(163, 183, 113, 0.4);
    }
    70% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 12px rgba(163, 183, 113, 0);
    }
    100% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(163, 183, 113, 0);
    }
}

.chatbot-toggle:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    background: linear-gradient(135deg, #000000 0%, #1a252f 100%);
    animation: none; /* Stop pulse on hover */
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle:focus {
    outline: none;
}

.chatbot-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

/* Slight icon spin/bounce effect on hover */
.chatbot-toggle:hover .chatbot-icon {
    transform: rotate(8deg);
}

.chatbot-icon svg {
    display: block;
}

/* =========================================================
   OPTIONAL: CHATBOT TOOLTIP BADGE (e.g., "Chat with us!")
========================================================= */
.chatbot-toggle::before {
    content: "Chat with us! 👋";
    position: absolute;
    right: 75px;
    background: #ffffff;
    color: #111111;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Show tooltip on hover */
.chatbot-toggle:hover::before {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 575px) {
    .chatbot-toggle {
        right: 15px;
        bottom: 15px;
        width: 56px;
        height: 56px;
    }
    /* Hide tooltip on small mobile screens to save space */
    .chatbot-toggle::before {
        display: none;
    }
}


/* =========================================================
   CHATBOT BOX
========================================================= */

.chatbot-box {

    position: fixed;

    right: 25px;
    bottom: 95px;

    width: 380px;

    max-width: calc(100vw - 30px);

    height: 550px;

    max-height: calc(100vh - 120px);

    background: #fff;

    border: 1px solid #eee;

    border-radius: 16px;

    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);

    z-index: 99998;

    display: none;

    flex-direction: column;

    overflow: hidden;

}


.chatbot-box.active {

    display: flex;

}


/* =========================================================
   HEADER
========================================================= */

.chatbot-header {

    background: #111;

    color: #fff;

    padding: 14px 15px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    flex-shrink: 0;

}


.chatbot-header-info {

    display: flex;

    align-items: center;

    gap: 10px;

}


/* =========================================================
   HEADER AVATAR
========================================================= */

.chatbot-avatar {

    width: 40px;
    height: 40px;

    min-width: 40px;

    background: #fff;

    color: #111;

    border-radius: 50%;

    display: flex;

    align-items: center;
    justify-content: center;

}


.chatbot-avatar svg {

    display: block;

}


/* =========================================================
   TITLE
========================================================= */

.chatbot-title {

    font-size: 15px;

    font-weight: 600;

    line-height: 20px;

}


/* =========================================================
   ONLINE STATUS
========================================================= */

.chatbot-status {

    display: flex;

    align-items: center;

    margin-top: 2px;

    font-size: 11px;

    line-height: 16px;

    color: #7cff7c;

}


.online-dot {

    width: 7px;
    height: 7px;

    margin-right: 5px;

    background: #22c55e;

    border-radius: 50%;

    display: inline-block;

}


/* =========================================================
   CLOSE BUTTON
========================================================= */

.chatbot-close {

    width: 34px;
    height: 34px;

    padding: 0;

    border: 0;

    border-radius: 50%;

    background: transparent;

    color: #fff;

    cursor: pointer;

    display: flex;

    align-items: center;
    justify-content: center;

    transition: background 0.2s ease;

}


.chatbot-close:hover {

    background: rgba(255, 255, 255, 0.12);

}


.chatbot-close:focus {

    outline: none;

}


.chatbot-close svg {

    display: block;

}


/* =========================================================
   MESSAGES AREA
========================================================= */

.chatbot-messages {

    flex: 1;

    min-height: 0;

    padding: 15px;

    overflow-y: auto;

    background: #f7f7f7;

    scrollbar-width: thin;

}


/* Chrome / Edge scrollbar */

.chatbot-messages::-webkit-scrollbar {

    width: 5px;

}


.chatbot-messages::-webkit-scrollbar-track {

    background: transparent;

}


.chatbot-messages::-webkit-scrollbar-thumb {

    background: #ccc;

    border-radius: 10px;

}


/* =========================================================
   MESSAGE
========================================================= */

.chatbot-message {

    display: flex;

    align-items: flex-start;

    gap: 8px;

    margin-bottom: 15px;

}


.message-avatar {

    width: 30px;
    height: 30px;

    min-width: 30px;

    border-radius: 50%;

    background: #111;

    color: #fff;

    display: flex;

    align-items: center;
    justify-content: center;

}


.message-avatar svg {

    display: block;

}


/* =========================================================
   MESSAGE CONTENT
========================================================= */

.message-content {

    max-width: 85%;

    min-width: 0;

}


.message-text {

    background: #fff;

    color: #222;

    padding: 10px 12px;

    border-radius: 4px 12px 12px 12px;

    font-size: 14px;

    line-height: 1.5;

    word-break: break-word;

    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);

}


.message-text strong {

    font-weight: 600;

}


/* =========================================================
   USER MESSAGE
========================================================= */

.user-message {

    justify-content: flex-end;

}


.user-message .message-content {

    max-width: 85%;

}


.user-message .message-text {

    background: #111;

    color: #fff;

    border-radius: 12px 4px 12px 12px;

}


/* =========================================================
   CHATBOT PRODUCTS
========================================================= */

.chatbot-products {

    display: flex;

    flex-direction: column;

    gap: 10px;

    margin-top: 10px;

}


/* =========================================================
   PRODUCT CARD
========================================================= */

.chatbot-product-card {

    display: flex;

    align-items: flex-start;

    gap: 10px;

    padding: 9px;

    background: #fff;

    border: 1px solid #e5e5e5;

    border-radius: 10px;

    transition: box-shadow 0.2s ease,
                transform 0.2s ease;

}


.chatbot-product-card:hover {

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);

    transform: translateY(-1px);

}


/* =========================================================
   PRODUCT IMAGE
========================================================= */

.chatbot-product-image {

    width: 85px;
    min-width: 85px;

    height: 85px;

    display: flex;

    align-items: center;
    justify-content: center;

    background: #fff;

    border-radius: 8px;

    overflow: hidden;

}


.chatbot-product-image img {

    width: 100%;
    height: 100%;

    object-fit: contain;

    display: block;

}


/* =========================================================
   PRODUCT INFO
========================================================= */

.chatbot-product-info {

    flex: 1;

    min-width: 0;

}


/* =========================================================
   PRODUCT TITLE
========================================================= */

.chatbot-product-title {

    display: -webkit-box;

    color: #222;

    font-size: 13px;

    font-weight: 600;

    line-height: 1.4;

    text-decoration: none;

    -webkit-line-clamp: 2;

    -webkit-box-orient: vertical;

    overflow: hidden;

}


.chatbot-product-title:hover {

    color: #a3b771;

}


/* =========================================================
   PRODUCT PRICE
========================================================= */

.chatbot-product-price {

    margin-top: 6px;

    color: #222;

    font-size: 15px;

    font-weight: 700;

    line-height: 20px;

}


/* =========================================================
   PRODUCT STOCK
========================================================= */

.chatbot-product-stock {

    margin-top: 4px;

    color: #198754;

    font-size: 11px;

    line-height: 16px;

}


/* =========================================================
   VIEW PRODUCT BUTTON
========================================================= */

.chatbot-view-product {

    display: inline-block;

    margin-top: 7px;

    padding: 5px 10px;

    background: #a3b771;

    color: #fff !important;

    border-radius: 5px;

    font-size: 11px;

    font-weight: 600;

    line-height: 16px;

    text-decoration: none;

    transition: background 0.2s ease;

}


.chatbot-view-product:hover {

    background: #8fa45f;

    color: #fff !important;

}


/* =========================================================
   OLD PRODUCT BUTTON SUPPORT
========================================================= */

.chatbot-product-button {

    display: inline-block;

    width: 100%;

    padding: 8px;

    text-align: center;

    text-decoration: none;

    background: #111;

    color: #fff !important;

    border-radius: 5px;

    font-size: 13px;

}


.chatbot-product-button:hover {

    background: #333;

    color: #fff !important;

}


/* =========================================================
   TYPING INDICATOR
========================================================= */

.chatbot-typing {

    display: none;

    align-items: center;

    gap: 4px;

    padding: 8px 15px;

    background: #f7f7f7;

}


.chatbot-typing.active {

    display: flex;

}


.chatbot-typing span {

    width: 7px;
    height: 7px;

    background: #777;

    border-radius: 50%;

    display: inline-block;

    animation: chatbotTyping 1.2s 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 chatbotTyping {

    0%,
    60%,
    100% {

        transform: translateY(0);

        opacity: 0.5;

    }

    30% {

        transform: translateY(-5px);

        opacity: 1;

    }

}


/* =========================================================
   INPUT AREA
========================================================= */

.chatbot-input-area {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 10px;

    border-top: 1px solid #ddd;

    background: #fff;

    flex-shrink: 0;

}


/* =========================================================
   INPUT
========================================================= */

.chatbot-input {

    flex: 1;

    min-width: 0;

    height: 42px;

    border: 1px solid #ddd;

    border-radius: 21px;

    padding: 0 13px;

    background: #fff;

    color: #222;

    font-size: 14px;

    outline: none;

}


.chatbot-input::placeholder {

    color: #999;

}


.chatbot-input:focus {

    border-color: #111;

    box-shadow: none;

}


/* =========================================================
   SEND BUTTON
========================================================= */

.chatbot-send {

    width: 42px;
    height: 42px;

    min-width: 42px;

    margin: 0;

    padding: 0;

    border: 0;

    border-radius: 50%;

    background: #111;

    color: #fff;

    cursor: pointer;

    display: flex;

    align-items: center;
    justify-content: center;

    transition: transform 0.2s ease,
                background 0.2s ease;

}


.chatbot-send:hover {

    background: #333;

    transform: scale(1.05);

}


.chatbot-send:focus {

    outline: none;

}


.chatbot-send svg {

    display: block;

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 575px) {

    .chatbot-toggle {

        right: 15px;

        bottom: 15px;

        width: 56px;
        height: 56px;

    }


    .chatbot-box {

        right: 10px;

        bottom: 80px;

        width: calc(100vw - 20px);

        height: 70vh;

        max-height: calc(100vh - 95px);

        border-radius: 14px;

    }


    .chatbot-messages {

        padding: 12px;

    }


    .message-content {

        max-width: calc(100% - 38px);

    }


    .message-text {

        font-size: 13px;

    }


    .chatbot-product-card {

        gap: 8px;

        padding: 8px;

    }


    .chatbot-product-image {

        width: 70px;

        min-width: 70px;

        height: 70px;

    }


    .chatbot-product-title {

        font-size: 12px;

    }


    .chatbot-product-price {

        font-size: 14px;

    }


    .chatbot-view-product {

        font-size: 10px;

        padding: 4px 8px;

    }

}


/* =========================================================
   VERY SMALL MOBILE
========================================================= */

@media (max-width: 360px) {

    .chatbot-box {

        right: 5px;

        width: calc(100vw - 10px);

    }


    .chatbot-product-image {

        width: 60px;

        min-width: 60px;

        height: 60px;

    }


    .chatbot-product-title {

        font-size: 11px;

    }


    .chatbot-product-price {

        font-size: 13px;

    }

}
.chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}