/* ==========================================================================
   VIVPAK — Live Chat (front-end, site-wide via cm_footer)
   Reference: FreshFlex live-chat pattern; restyled to VIVPAK's light glass
   system. Launcher matches the .to-top button (46x46) on the opposite corner.
   ========================================================================== */

:root {
    --lc-ink: #0E3B2E;
    --lc-green: #209B68;
    --lc-green-2: #3ECF8E;
    --lc-line: rgba(12, 46, 35, .10);
    --lc-shadow: 0 26px 70px -22px rgba(8, 38, 28, .42), 0 6px 20px -8px rgba(8, 38, 28, .16);
}

/* ---------- Launcher ---------------------------------------------------- */
.lc-launch {
    position: fixed;
    left: 26px;
    bottom: 26px;
    z-index: 810;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(145deg, var(--lc-green-2), var(--lc-green));
    box-shadow: 0 10px 26px -8px rgba(32, 155, 104, .62), 0 2px 8px rgba(8, 38, 28, .18);
    transition: transform .3s var(--ease, ease), box-shadow .3s var(--ease, ease), opacity .3s;
}
.lc-launch::after {
    content: '';
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1px solid rgba(62, 207, 142, .42);
    animation: lcPulse 2.8s ease-out infinite;
    pointer-events: none;
}
@keyframes lcPulse {
    0%   { transform: scale(.86); opacity: .8; }
    70%  { transform: scale(1.14); opacity: 0; }
    100% { transform: scale(1.14); opacity: 0; }
}
.lc-launch:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 16px 32px -8px rgba(32, 155, 104, .7); }
.lc-launch svg { width: 21px; height: 21px; }
.lc-launch .lc-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px var(--lc-green);
}
.lc-root.is-open .lc-launch { opacity: 0; pointer-events: none; transform: scale(.7); }

/* ---------- Panel ------------------------------------------------------- */
.lc-panel {
    position: fixed;
    left: 26px;
    bottom: 84px;
    z-index: 811;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: saturate(180%) blur(22px);
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 18px;
    box-shadow: var(--lc-shadow);
    overflow: hidden;
    transform-origin: bottom left;
    transform: translateY(14px) scale(.96);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .28s, visibility .28s;
}
.lc-root.is-open .lc-panel {
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lc-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 18px;
    color: #fff;
    background: linear-gradient(110deg, #0B3326 0%, var(--lc-ink) 46%, #157A52 100%);
}
.lc-head-title { font-size: .9375rem; font-weight: 650; letter-spacing: .01em; }
.lc-head-title small { display: block; font-size: .6875rem; font-weight: 400; opacity: .72; margin-top: 2px; }
.lc-close {
    width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .24);
    background: rgba(255, 255, 255, .10); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
    transition: background .2s;
}
.lc-close:hover { background: rgba(255, 255, 255, .24); }
.lc-close svg { width: 15px; height: 15px; }

/* ---------- Messages ---------------------------------------------------- */
.lc-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 18px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(14, 59, 46, .22) transparent;
    background:
        radial-gradient(560px 220px at 100% 0%, rgba(62, 207, 142, .07), transparent 70%),
        #FBFCFB;
}
.lc-msg {
    max-width: 86%;
    padding: 13px 15px;
    border-radius: 14px;
    font-size: .875rem;
    line-height: 1.68;
    color: #243A32;
    word-wrap: break-word;
    animation: lcIn .34s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes lcIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.lc-msg-in {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--lc-line);
    border-bottom-left-radius: 5px;
    box-shadow: 0 4px 14px -8px rgba(8, 38, 28, .28);
}
.lc-msg-out {
    align-self: flex-end;
    background: linear-gradient(145deg, var(--lc-green), #178256);
    color: #fff;
    border-bottom-right-radius: 5px;
    box-shadow: 0 8px 20px -10px rgba(32, 155, 104, .8);
}
.lc-msg-meta {
    align-self: flex-end;
    font-size: .6875rem;
    color: #7C938A;
    letter-spacing: .01em;
    padding-right: 4px;
    margin-top: -6px;
}
.lc-link {
    color: var(--lc-green);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    font-weight: 600;
}
.lc-msg-out .lc-link { color: #fff; }
.lc-error { align-self: center; font-size: .75rem; color: #B45309; background: #FFF6E4; border-radius: 8px; padding: 7px 12px; }

/* ---------- Composer ---------------------------------------------------- */
.lc-compose {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 16px;
    border-top: 1px solid var(--lc-line);
    background: #fff;
}
.lc-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 16px;
    border: 1.5px solid rgba(32, 155, 104, .55);
    border-radius: 999px;
    font: inherit;
    font-size: .875rem;
    color: #1B332A;
    outline: none;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.lc-input:focus { border-color: var(--lc-green); box-shadow: 0 0 0 4px rgba(62, 207, 142, .16); }
.lc-input::placeholder { color: #9AAEA5; }
.lc-send {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(145deg, var(--lc-green-2), var(--lc-green));
    color: #fff;
    font: inherit;
    font-size: .875rem;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 8px 18px -8px rgba(32, 155, 104, .8);
    transition: transform .2s, opacity .2s;
}
.lc-send:hover:not(:disabled) { transform: translateY(-2px); }
.lc-send:disabled { opacity: .55; cursor: default; }

@media (max-width: 760px) {
    .lc-launch { left: 16px; bottom: 16px; }
    .lc-panel { left: 16px; bottom: 74px; width: calc(100vw - 32px); height: min(520px, calc(100vh - 110px)); }
    .lc-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
    .lc-launch::after { animation: none; }
    .lc-msg, .lc-panel { animation: none; transition: none; }
}

/* ---------- Dark theme --------------------------------------------------- */
html[data-theme="dark"] .lc-panel {
    background: rgba(17, 31, 24, .97);
    border-color: rgba(255,255,255,.12);
}
html[data-theme="dark"] .lc-body {
    background:
        radial-gradient(560px 220px at 100% 0%, rgba(62, 207, 142, .07), transparent 70%),
        #101D17;
}
html[data-theme="dark"] .lc-msg { color: #D9E9E1; }
html[data-theme="dark"] .lc-msg-in {
    background: #1B2F25;
    border-color: rgba(255,255,255,.12);
}
html[data-theme="dark"] .lc-msg-meta { color: #7E9A8D; }
html[data-theme="dark"] .lc-compose { background: #14251D; border-top-color: rgba(255,255,255,.10); }
html[data-theme="dark"] .lc-input { background: #0F1D16; color: #EDF6F1; }
html[data-theme="dark"] .lc-input::placeholder { color: #769084; }
