#medigood-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #ffffff;
    color: #bb5e98;
    font-weight: bold;
    border: 3px solid #bb5e98;
    border-radius: 40px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
    gap: 15px;
}

#medigood-chat-toggle img {
    width: 40px;
}

.medigood-chat-box {
    position: fixed;
    bottom: 105px;
    right: 25px;
    width: 380px;
    height: 600px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

.medigood-chat-header {
display: flex;
align-items: center;
background-color: #bb5e98;
padding: 10px 15px;
border-bottom: 1px solid #ddd;
color: #fff;
align-content: stretch;
flex-wrap: nowrap;
}
.medigood-chat-close {
position: absolute;
left: 20px;
top: 8px;
font-weight: 700;
cursor: pointer;
font-size: 20px;
color: #fff;
}

/* New chat icon next to close button */
.medigood-chat-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    opacity: 0.95;
}
span.medigood-chat-new img{
        width: 40px;
    height: 30px;
}
.medigood-chat-new:hover { opacity: 1; }

.medigood-chat-close:hover {
color: #e4e4e4;
}

/* Core fix: make chat wrap a flex column with scrollable log */
.medigood-chat-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* allow child to become scrollable without forcing outer scroll */
}

.medigood-chat-log {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #f4f4f4;
    scroll-behavior: smooth;
    min-height: 0; /* play nice with flexbox */
}

.chatbot-message {
    margin: 10px 0;
    padding: 10px 14px;
    border-radius: 20px;
    max-width: 80%;
    clear: both;
}

.chatbot-message.user {
    background: #c8e6c9;
    float: right;
}

.chatbot-message.bot {
    background: #e0f7fa;
    float: left;
}

/* Keep the input form always fixed to bottom inside chat */
    .medigood-chat-form {
        display: flex;
        padding: 10px;
        border-top: 1px solid #ccc;
        background: #fff;
        flex-shrink: 0;
    }

.medigood-chat-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px !important;
}

.medigood-chat-form button {
    margin-right: 8px;
    padding: 10px 16px;
    background-color: #bb5e98;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

.medigood-chat-form button:hover {
    background-color: #a34d86;
}

.medigood-chat-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.md-user {
    align-self: flex-end;
    background: #fbf4eb;
    border-radius: 14px 14px 2px 14px;
    padding: 10px 14px;
    max-width: 80%;
    font-size: 14px;
}

.md-assistant {
    color: #4a4068;
    align-self: flex-start;
    background: #DECED8;
    border-radius: 14px 14px 14px 2px;
    padding: 10px 14px;
    margin-top: 6px;
    max-width: 80%;
    font-size: 14px;
}


@media (max-width:767px) {
    #medigood-chat-toggle {
        bottom: 10px;
        right: 10px;
        padding: 5px 10px;
    }
    #medigood-chat-toggle img {
        width: 30px;
    }
    .medigood-chat-box {
        bottom: 70px;
        right: 10px;
        height: calc(100% - 80px);
    }
}

@media (max-width:480px) { 
    .medigood-chat-box {
        width: calc(100% - 20px);
    }
}

/* Floating New Chat icon inside chat box */
.md-new-chat-btn-container {
  position: absolute;
  left: 12px;
  bottom: 80px; /* matches your JS change; adjust if you prefer */
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none; /* only the button receives clicks */
}

.md-new-chat-btn {
  width: 60px;
  height: 60px;
  border-radius: 100%;
  background-color: #bb5e98;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  border: none;
  cursor: pointer;
  pointer-events: auto; /* clickable */
  background-repeat: no-repeat;
  background-size: 80%;
}
.md-new-chat-btn:hover{
    opacity: 0.8;
    cursor: pointer;
}

/* Optional fallback if JS dynamic URL fails (relative from assets/css/) */
/*
.md-new-chat-btn {
  background-image: url('../../images/startnewchaticon.svg');
}
*/

.md-new-chat-btn:hover {
  filter: brightness(0.95);
}