/* ==============================================================
   CHAT STYLES – fully dynamic with CSS variables
   Variables are set in :root from config.php
   ============================================================== */

html {
    scroll-behavior: smooth;
}

/* ----- Chat open/close buttons ----- */
#chat-square {
    right: 50px;
    background-image: url("/assets/img/chatbot/priya.webp");
    background-position: center center;
    background-size: cover;
    width: 60px;
    height: 60px;
    color: #fff;
    cursor: pointer;
    z-index: 1100;
    background-repeat: no-repeat;
    border-radius: 7px;
    box-shadow: 0 0 8px 4px rgb(0 0 0 / 16%);
    position: fixed;
    bottom: 50px;
    right: 30px;
}

.close-img {
    background-image: url("/assets/img/chatbot/closebtn3.svg");
    padding: 11px;
    background-position: center center;
    background-size: cover;
    position: absolute;
    top: 18px;
    left: 18px;
}

#chat-close {
    right: 30px;
    background-position: center center;
    background-size: cover;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 1100;
    position: fixed;
    bottom: 50px;
    display: none;
    background-color: var(--colorPrimary);
    border-radius: 7px;
    box-shadow: 0 0 8px 4px rgb(0 0 0 / 16%);
}

@media (max-width: 767px) {
    .chat-footer {
        bottom: 10px !important;
        position: fixed !important;
    }
    #chat-close {
        right: 0px;
        z-index: 9999;
        top: -5px;
        box-shadow: none;
        background: transparent;
    }
    #chat-square {
        bottom: 100px !important;
    }
}

/* ----- Chat wrapper ----- */
.chat-wrapper {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 365px;
    max-width: 85vw;
    display: none;
    background: #efefef;
    border-radius: 6px;
    box-shadow: 0px 3px 6px #0000004B;
    z-index: 1100;
    height: 79%;
    max-height: 602px;
}

/* ----- Header ----- */
.chat-header {
    background: var(--colorPrimary);
    height: 48px;
    color: #fff;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.chat-header-photo {
    float: left;
    background-image: url("/assets/img/chatbot/priya.webp");
    background-position: center center;
    background-size: cover;
    width: 33px;
    height: 33px;
    border-radius: 50%;
    margin-right: 14px;
    border: 2px solid #fff;
    margin-left: 5px;
    position: relative;
}

.chat-header-name {
    float: left;
    line-height: 19px;
    font-size: 14px;
}

/* ----- Body & containers ----- */
.chat-box-body {
    width: 100%;
    height: calc(100% - 48px);
    position: relative;
    border: 1px solid #fcfcfc;
    overflow: hidden;
    background-color: #fcfcfc;
    border-radius: 0px 0px 6px 6px;
}

.chat-box-body:after {
    content: "";
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    height: 100%;
    position: absolute;
    z-index: -1;
    background-color: #fcfcfc;
}

.chat-logs {
    height: calc(100% - 48px);
    font-size: 14px;
    background: #FCFCFC;
    overflow-y: auto;
}

.chat-container {
    background-color: #fcfcfc;
    padding: 0px 18px 12px;
}

#hb-chat-bot {
    height: 100%;
}

/* ----- Messages ----- */
.hb-message {
    min-height: 30px;
    margin-top: 6px;
    position: relative;
    margin: 5px 0;
    min-height: 20px;
    padding: 0px 0px 0px 40px;
}
.hb-message:after {
    display: block;
    content: "";
    clear: both;
    margin-bottom: -10px;
}
.hb-message.human {
    text-align: right;
}

.hb-message-content {
    padding: 8px 12px;
    color: #3D454A;
    background-color: #F2F2F2;
    border-radius: 6px;
    letter-spacing: -0.07px;
    line-height: 17px;
    width: auto;
    max-width: 80%;
    display: inline-block;
    margin-top: 15px;
}
.hb-message-content.human {
    color: #fff;
    background-color: var(--colorPrimary);
    border: 1px solid var(--colorPrimary);
}
.hb-message-content.loading {
    background-color: transparent !important;
    line-height: 1.3;
    text-align: center;
    border: 0px;
}

/* Typing dots */
.hb-message-content .dot {
    width: 4px;
    height: 4px;
    border-radius: 0.5rem;
    display: inline-block;
    background-color: #333;
    margin-left: 0.2rem;
}
.hb-message-content .dot:nth-last-child(5) { animation: 0.6s linear 0.1s infinite loading; }
.hb-message-content .dot:nth-last-child(4) { animation: 0.6s linear 0.2s infinite loading; }
.hb-message-content .dot:nth-last-child(3) { animation: 0.6s linear 0.3s infinite loading; }
.hb-message-content .dot:nth-last-child(2) { animation: 0.6s linear 0.4s infinite loading; }
.hb-message-content .dot:nth-last-child(1) { animation: 0.6s linear 0.5s infinite loading; }

@keyframes loading {
    0%, 50% { transform: translate(0, 0); background-color: #ababab; }
    25% { transform: translate(0, -3px); }
    75% { transform: translate(0, 3px); }
    100% { transform: translate(0, 0); }
}

/* ----- Action buttons ----- */
.hb-actions-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    width: 225px;
    float: right;
    margin-top: 16px;
}
.hb-actions-buttons-button {
    border: 1px solid var(--colorPrimary);
    color: var(--colorPrimary) !important;
    line-height: 1;
    cursor: pointer;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    background: #fff;
    box-shadow: 2px 3px 4px 0 rgb(174 174 174 / 25%);
    overflow: hidden;
    margin-top: 10px;
    margin-bottom: 10px;
    box-shadow: 0px 3px 3px #ddd !important;
}
button.hb-actions-buttons-button:not(:first-child) {
    margin-left: 8px;
}
.hb-actions-buttons-button:active {
    box-shadow: 0px 0px !important;
    transform: translateY(3px);
}
.hb-actions-buttons-button:hover {
    background: var(--colorPrimary);
    color: #fff !important;
}

/* ----- Text input & send button ----- */
.hb-actions-text-submit {
    color: #fff;
    width: 40px;
    padding: 5px;
    height: 40px;
    line-height: 1;
    border-radius: 50%;
    border: 1px solid var(--colorPrimary);
    background: var(--colorPrimary);
    display: inline-block;
    cursor: pointer;
    right: -6px;
}

.chat-elements {
    display: inline-block;
    height: 40px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #818181;
    padding-left: 16px;
    padding-right: 10px;
    border-radius: 6px;
    margin: 10px 9px 10px 0px;
    width: 84%;
}
.chat-elements:focus-visible {
    outline: none;
}

/* ----- Timestamps ----- */
.hb_message_time {
    opacity: 0;
    font-size: 10px;
    color: #353f45;
    transition: all 0.3s ease;
    transition-delay: 0.35s;
    top: 56%;
    position: absolute;
    padding: 0 6px;
    white-space: nowrap;
}
.human .hb_message_time {
    left: 0;
}
.hb-message:hover .hb_message_time {
    opacity: 1;
}

/* ----- Footer (input area) ----- */
.chat-footer {
    position: absolute;
    bottom: 0;
    width: 90%;
    color: #000;
    left: 5%;
    background: #fcfcfc;
}

/* ----- Small popup ----- */
.chat-pop-sm {
    display: none;
    position: fixed;
    bottom: 120px;
    right: 30px;
    z-index: 10000;
    background: #fff;
    height: 135px;
    width: 235px;
    text-align: center;
    padding: 15px 20px 10px;
    border-radius: 5px;
    box-shadow: 0 0 8px 4px rgb(0 0 0 / 16%);
    letter-spacing: normal;
    font-size: 15px;
}
button.chat-pop-sm-btn {
    font-size: 15px;
    font-weight: bold;
    padding: 9px 13px;
    background-color: var(--colorPrimary);
    border: 1px solid var(--colorSecondary);
    border-radius: 26px;
    width: 160px;
    margin-top: 9px;
    color: #fff;
}
button.chat-pop-sm-btn:hover {
    background-color: var(--colorSecondary);
    color: #fff;
}

/* ----- Mobile overrides ----- */
@media (max-width: 767px) {
    .chat-wrapper {
        position: fixed;
        top: 0;
        bottom: 0;
        right: 0;
        display: none;
        background: #efefef;
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        box-shadow: none;
        height: auto;
        padding: 0;
        margin: 0;
    }
    .chat-box-body {
        height: calc(100vh - 48px - 80px);
        min-height: calc(100vh - 48px - 80px);
    }
}

/* ----- Misc helpers ----- */
.active-circle {
    width: 12px;
    display: block;
    height: 12px;
    border-radius: 50%;
    background: green;
    position: absolute;
    right: -2px;
    bottom: 0;
    border: 2px solid;
}
.display_none { display: none; }

/* ----- Legacy classes for agent avatar & name ----- */
.start::before {
    content: "Pooja Agarwal";  /* This will be overridden by dynamic content from JS */
    display: block;
    font-size: 10px;
    line-height: 13px;
    margin: 18px 0px -5px 0px;
    color: #3D454A;
    letter-spacing: 0px;
}
.end::after {
    content: "";
    margin-bottom: 12px;
    background-image: url("/assets/img/chatbot/priya.webp");
    background-position: center center;
    background-size: cover;
    width: 33px;
    height: 33px;
    border-radius: 50%;
    display: block;
    position: absolute;
    left: 0px;
    bottom: -10px;
}