﻿/* ==========================================================================
   1. Dynamic Layout (Powered by PHP CSS Variables)
   ========================================================================== */
:root {
    --footer-h: 64px;
}

.site-frame-wrap {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: #fff;
}

.site-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

#chatToggleBtn {
    position: fixed;
    bottom: var(--chat-offset-bottom, 102px);
    right: var(--chat-offset-right, 33px);
    width: var(--chat-btn-size, 75px);
    height: var(--chat-btn-size, 75px);
    border-radius: 50%;
    background-color: rgba(var(--bs-Chatbots-background-rgb, 255, 255, 255));
    color: #fff;
    z-index: 10000;
    font-size: 28px;
    border: none;
    padding: 0;
}

#chatPopup {
    position: fixed; 
    bottom: var(--chat-offset-bottom, 20px);
    right: var(--chat-offset-right, 20px);
    z-index: 9999;
    background: #fff;
    width: min(460px, calc(100vw - 24px));
    max-height: min(700px, calc(100dvh - 40px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-bubble-tip {
    position: fixed;
    bottom: var(--chat-bubble-tip-bottom, 196px);
    right: var(--chat-offset-right, 20px);
    display: none;
    z-index: 9999;
    background: #ffffff;
    color: #000;
    font-size: 12px;
    border-radius: 18px;
    padding: 10px 14px;
    transform: translateY(8px) scale(0.95);
}

.chat-bubble-tip::after {
    content: "";
    position: absolute;
    bottom: -8px;
    right: 45px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
}


/* ==========================================================================
   2. Chat Widget Core Styles
   ========================================================================== */

.chat-body {
    padding-bottom: 24px;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.chat-body.input-open {
    padding-bottom: 140px;
}

.chat-header {
    padding-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto; 
}

.chat-header h6 {
    margin: 0;
    font-weight: bold;
}

.chat-header .text-green {
    color: rgba(var(--bs-success-rgb));
    font-size: 20px;
    font-style: normal;
    font-weight: 700;
    line-height: 20px;
}

.chatmessage {
    margin-bottom: 30px;
}

.userTitel {
    color: black;
    font-size: 12px;
    font-style: normal;
    font-weight: 500;
    line-height: 20px;
}

.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-btn {
    background-color: #1e1e1e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 15px;
    cursor: pointer;
    margin-right: 5px;
    margin-top: 5px;
}

.chat-btn:hover {
    color: #111;
}

.messageContent {
    display: block;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 5px;
}

.UserContainer {
    color: black;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 37px;
    flex: 0 0 30px;
}

.user-info small {
    color: #646464;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
}

.MessageBox {
    background-color: rgba(var(--bs-Chatbots-rgb));
    width: fit-content;
    color: rgba(var(--ms-box-color-rgb));
    border-radius: 1px 18px 18px 18px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin: 6px 0;
    font-weight: 400;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    overflow: visible;
}

.MessageBox::before {
    content: "";
    position: absolute;
    left: -8px;
    top: -2px;
    transform: rotate(29deg);
    filter: none;
    pointer-events: none;
    z-index: -1;
}

.MessageBox::after {
    content: "";
    position: absolute;
    left: -6px;
    top: -3px;
    border-top: 13px solid rgba(var(--bs-Chatbots-rgb));
    border-left: 11px solid transparent;
    transform: rotate(29deg);
}

.MessageBox.UserMessage {
    background-color: #fff;
    color: #000;
    box-shadow: 0 1px 2px rgba(7, 7, 7, 0.41);
    text-align: right;
    border-radius: 18px 1px 18px 18px;
}

.user-message-row {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
}

.user-message-row .user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.user-message-row .message-wrap {
    padding-left: 0 !important;
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.MessageBox.UserMessage::before {
    content: "";
    position: absolute;
    right: -10px;
    left: unset;
    top: -2px;
    border-top: 16px solid rgb(0 0 0 / 12%);
    border-left: 29px solid rgb(0 0 0 / 6%);
    border-right: 11px solid transparent;
    transform: rotate(328deg);
    filter: blur(2px);
    pointer-events: none;
}

.MessageBox.UserMessage::after {
    content: "";
    position: absolute;
    right: -7px;
    left: unset;
    top: -7px;
    border-top: 13px solid #ffffff;
    border-right: 11px solid transparent;
    transform: rotate(328deg);
}

.btn-green {
    border-radius: 6px;
    border: 1px solid #6FB203;
    background: #6FB203;
    width: auto;
    height: 28px;
    color: #FFF;
    font-family: Poppins, sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: 500;
    line-height: 20px;
}

.btn-green:hover {
    background-color: #5ba000;
    color: white;
}

.chat-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.chat-input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    border-radius: 5px;
}

.chat-input-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.hrClass {
    margin: 6px;
    stroke-width: 1px;
    stroke: rgba(30, 30, 30, 0.50);
    color: inherit;
    background-color: rgb(142 142 142);
    border: 0;
}

.floating-chat-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: white;
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.floating-chat-btn:hover {
    background-color: white;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    vertical-align: middle;
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: white;
    animation: dotPulse 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: .15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: .4;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.wa-options {
    margin-top: .25rem;
    padding-left: 38px;
}

.wa-btn {
    appearance: none;
    border: 1px solid #E6E6E6;
    background: #ffffff;
    color: #111;
    border-radius: 999px;
    padding: .4rem .9rem;
    font-size: 0.92rem;
    line-height: 1.1;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .05s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
    box-shadow: 0 1px 0 rgb(0 0 0 / 85%);
}

.wa-btn:hover {
    background: #EEF0F1;
    border-color: #DCDCDC;
}

.wa-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,140,251,.15);
}

.wa-btn:active {
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}

.wa-options .wa-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.wa-btn[data-link]::after {
    content: "›";
    font-weight: 700;
    opacity: .6;
}

@media (max-width: 768px) {
    #chatPopup {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        padding: 0;
    }

    .chat-header {
        padding: 12px 16px;
    }

     .chat-body {
        padding-bottom: 80px;
    }

    .chat-body.input-open {
        padding-bottom: 160px;
    }

    .chat-body {
        flex: 1 1 auto;
        overflow-y: auto;
        min-height: 0;
        padding-bottom: 0;
        overscroll-behavior: contain;
        padding-bottom: 80px;
    }

    .chat-footer {
        padding: 10px 12px;
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid #eee;
        z-index: 10;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .chat-input {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        height: 44px;
        font-size: 16px !important;
    }

    .chat-input-btn {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        font-size: 16px !important;
    }

    body.chat-open {
        overflow: hidden;
        width: 100%;
        overscroll-behavior: contain;
    }
}

@media (max-width: 576px) {
    .wa-btn {
        padding: .55rem 1rem;
        font-size: 1rem;
        white-space: normal;
    }

    .MessageBox {
        max-width: 100%;
    }

    .wa-options {
        padding-left: 0;
    }
}

/* The 'more jiggle' movement */
@keyframes jiggle {
  0%   { transform: rotate(0deg) scale(1); }
  15%  { transform: rotate(-10deg) scale(1.1); }
  30%  { transform: rotate(10deg) scale(1.1); }
  45%  { transform: rotate(-10deg) scale(1.1); }
  60%  { transform: rotate(10deg) scale(1.1); }
  75%  { transform: rotate(-5deg) scale(1.05); } 
  100% { transform: rotate(0deg) scale(1); }
}

.jiggle-animation {
  animation: jiggle 0.5s ease-in-out; 
}

#chatPopup .btn:focus, 
#chatPopup .form-control:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
  outline: none;
}