/* =========================================================================
   LIVE CHAT WIDGET
   -------------------------------------------------------------------------
   Launcher bottom-right, panel above it. Built by assets/js/chat.js, so none
   of this applies unless the script decides to run.
   ========================================================================= */

.mc-launch {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147482000;          /* under the lead popup, over the page */
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #9039e4;
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    box-shadow: 0 8px 26px rgba(144, 57, 228, .42);
    transition: transform .22s cubic-bezier(.22, 1, .36, 1), background .18s;
}

.mc-launch:hover  { background: #7a2ec4; transform: translateY(-2px) scale(1.04); }
.mc-launch:active { transform: translateY(0) scale(.98); }
.mc-launch:focus-visible { outline: 3px solid #c084fc; outline-offset: 3px; }

/* Unread pip */
.mc-launch b {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 21px;
    box-shadow: 0 0 0 3px #fff;
}

/* ---- Panel ------------------------------------------------------------- */
.mc-panel {
    position: fixed;
    right: 22px;
    bottom: 92px;
    z-index: 2147482001;
    width: min(376px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 130px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(30, 20, 60, .30);
    opacity: 0;
    transform: translateY(14px) scale(.98);
    transform-origin: 100% 100%;
    pointer-events: none;
    transition: opacity .22s ease, transform .28s cubic-bezier(.22, 1, .36, 1);
}

.mc-panel.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.mc-head {
    padding: 16px 18px;
    background: #9039e4;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 11px;
}

.mc-head-t     { flex: 1; min-width: 0; }
.mc-head strong{ display: block; font-size: .97rem; font-weight: 700; line-height: 1.25; }
.mc-head span  { display: block; font-size: .76rem; opacity: .82; margin-top: 2px; }

.mc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    flex: 0 0 8px;
}

.mc-x {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background .18s;
}
.mc-x:hover { background: rgba(255, 255, 255, .3); }

/* ---- Message log ------------------------------------------------------- */
.mc-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #faf9ff;
    display: flex;
    flex-direction: column;
    gap: 9px;
    scroll-behavior: smooth;
}

.mc-intro {
    text-align: center;
    padding: 20px 12px;
    color: #6f6a8c;
    font-size: .85rem;
    line-height: 1.6;
}
.mc-intro i {
    display: block;
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(144, 57, 228, .10);
    color: #9039e4;
    font-size: 1.2rem;
    line-height: 46px;
    font-style: normal;
}

.mc-msg {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: .875rem;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;      /* keep the visitor's line breaks */
}

.mc-msg.them {
    align-self: flex-start;
    background: #fff;
    color: #1e1b3a;
    border: 1px solid #ece8f8;
    border-bottom-left-radius: 5px;
}

.mc-msg.me {
    align-self: flex-end;
    background: #9039e4;
    color: #fff;
    border-bottom-right-radius: 5px;
}

.mc-time {
    display: block;
    margin-top: 4px;
    font-size: .68rem;
    opacity: .58;
}

/* ---- Pre-chat identity form ------------------------------------------- */
.mc-ident {
    padding: 14px 16px;
    border-top: 1px solid #ece8f8;
    background: #fff;
}
.mc-ident p {
    margin: 0 0 9px;
    font-size: .78rem;
    color: #6f6a8c;
    line-height: 1.5;
}
.mc-ident input {
    width: 100%;
    margin-bottom: 7px;
    padding: 9px 12px;
    border: 1.5px solid #e5e0f5;
    border-radius: 9px;
    font: inherit;
    font-size: .84rem;
}
.mc-ident input:focus {
    outline: none;
    border-color: #9039e4;
    box-shadow: 0 0 0 3px rgba(144, 57, 228, .12);
}
.mc-ident button {
    width: 100%;
    padding: 9px;
    border: 0;
    border-radius: 9px;
    background: #9039e4;
    color: #fff;
    font: inherit;
    font-size: .84rem;
    font-weight: 700;
    cursor: pointer;
}
.mc-ident button:hover { background: #7a2ec4; }

/* ---- Composer ---------------------------------------------------------- */
.mc-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 11px 12px;
    border-top: 1px solid #ece8f8;
    background: #fff;
}

.mc-form textarea {
    flex: 1;
    max-height: 96px;
    min-height: 40px;
    padding: 10px 12px;
    border: 1.5px solid #e5e0f5;
    border-radius: 11px;
    font: inherit;
    font-size: .87rem;
    line-height: 1.45;
    resize: none;
    color: #1e1b3a;
}
.mc-form textarea:focus {
    outline: none;
    border-color: #9039e4;
    box-shadow: 0 0 0 3px rgba(144, 57, 228, .12);
}

.mc-send {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 0;
    border-radius: 11px;
    background: #9039e4;
    color: #fff;
    font-size: .95rem;
    cursor: pointer;
    transition: background .18s, opacity .18s;
}
.mc-send:hover:not(:disabled) { background: #7a2ec4; }
.mc-send:disabled { opacity: .45; cursor: default; }

.mc-note {
    padding: 0 14px 10px;
    font-size: .68rem;
    color: #a09ab8;
    text-align: center;
    background: #fff;
}

@media (max-width: 480px) {
    .mc-launch { right: 16px; bottom: 16px; width: 52px; height: 52px; }
    .mc-panel  { right: 12px; left: 12px; bottom: 78px; width: auto;
                 height: min(70vh, calc(100vh - 110px)); }
}

@media (prefers-reduced-motion: reduce) {
    .mc-launch, .mc-panel { transition: none; }
    .mc-log { scroll-behavior: auto; }
}
