/* =============================================================
   Live support chat widget  —  fw-wizard.com premium dark theme
   All selectors prefixed .lc- to avoid collisions with site CSS.

   ISOLATION STRATEGY (v3):
   Every rule is scoped under .lc-root so specificity is (0,2,0),
   which beats both .guest-page button (0,1,1) and cabinet base
   styles (0,1,0). A defensive reset inside .lc-root neutralizes
   the specific host properties that bleed into buttons/textarea.
   .lc-root itself uses display:contents so it has NO box of its
   own — it vanishes from the box tree. Children with position:fixed
   still position against the viewport (fixed children are always
   removed from normal flow and fixed to the viewport, unaffected
   by display:contents on an ancestor).
   ============================================================= */

/* ── Root isolation wrapper ───────────────────────────────────
   display:contents = no box generated; children render as if
   the wrapper doesn't exist, but CSS selectors still match it.
   This means .lc-root does NOT create a stacking context,
   does NOT block pointer events, and does NOT shift layout.    */
.lc-root {
    display: contents;
}

/* ── Defensive reset — neutralize host properties that bleed in.
   We deliberately do NOT use "all: revert" (too nuclear — kills
   browser defaults like cursor:pointer too). Instead we reset
   only the specific props that guest.v3.css / cabinet CSS touch
   on interactive elements. This runs BEFORE our own styles so
   the cascade is: host rule → this reset (wins on specificity
   0,2,1) → our specific widget rules below (0,2,0 same sheet,
   lower in file → override the reset for the actual styles).   */
.lc-root button,
.lc-root textarea,
.lc-root input {
    box-sizing: border-box;
    border-radius: 0;       /* will be overridden per-element below */
    padding: 0;             /* will be overridden below */
    background: none;       /* will be overridden below */
    border: none;           /* will be overridden below */
    min-height: unset;      /* neutralize any host min-height */
    font: inherit;          /* keep inherited font, our rules set size/weight */
    color: inherit;
    margin: 0;
    line-height: normal;
    -webkit-appearance: none;
    appearance: none;
}

/* ── Launcher button ──────────────────────────────────────────── */
.lc-root .lc-btn {
    position: fixed;
    right: 20px;
    /* Raised above the bottom-right "players online" badge (.ost-float-counter,
       fixed right:18px bottom:18px, ~52px tall) so the chat launcher never
       covers the online count on the home page. On pages without the badge it
       simply sits slightly higher — standard for a support bubble. */
    bottom: 82px;
    z-index: 9998;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 52px;
    padding: 0 20px 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(212,175,55,.55);
    background: linear-gradient(160deg, #c9a84c 0%, #a8832c 60%, #8a6820 100%);
    color: #1a1000;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .02em;
    cursor: pointer;
    font-family: inherit;
    box-shadow:
        0 4px 16px rgba(0,0,0,.5),
        0 1px 0 rgba(255,230,120,.25) inset,
        0 0 0 3px rgba(212,175,55,.08);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    user-select: none;
    box-sizing: border-box;
}
.lc-root .lc-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow:
        0 8px 24px rgba(0,0,0,.55),
        0 1px 0 rgba(255,230,120,.3) inset,
        0 0 0 3px rgba(212,175,55,.15);
}
.lc-root .lc-btn:active {
    transform: translateY(0);
    filter: brightness(.97);
}

/* Icon wrapper — subtle glow ring around the SVG */
.lc-root .lc-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0,0,0,.18);
    box-shadow: 0 0 0 1px rgba(255,220,80,.3);
    flex-shrink: 0;
}
.lc-root .lc-btn__icon svg {
    display: block;
}

/* ── Panel ────────────────────────────────────────────────────── */
.lc-root .lc-panel {
    position: fixed;
    right: 20px;
    bottom: 144px;          /* sits just above the raised launcher (bottom:82px + 52px) */
    z-index: 9999;
    width: 350px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 170px);

    /* Hidden by default — JS adds .is-open */
    display: flex;
    flex-direction: column;
    visibility: hidden;
    opacity: 0;
    transform: translateY(12px) scale(.97);
    transform-origin: bottom right;
    pointer-events: none;
    transition:
        opacity .22s ease,
        transform .22s cubic-bezier(.22,.61,.36,1),
        visibility 0s linear .22s;

    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(180deg, #0e1726 0%, #0a1020 100%);
    border: 1px solid rgba(212,175,55,.18);
    box-shadow:
        0 24px 64px rgba(0,0,0,.7),
        0 0 0 1px rgba(255,255,255,.04) inset,
        0 1px 0 rgba(212,175,55,.12) inset;
    box-sizing: border-box;
}
.lc-root .lc-panel.is-open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    transition:
        opacity .22s ease,
        transform .22s cubic-bezier(.22,.61,.36,1),
        visibility 0s linear 0s;
}

/* ── Header ───────────────────────────────────────────────────── */
.lc-root .lc-head {
    padding: 12px 14px 11px;
    background: linear-gradient(135deg, rgba(212,175,55,.16) 0%, rgba(168,131,44,.08) 100%);
    border-bottom: 1px solid rgba(212,175,55,.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

/* Title group: avatar + status dot + text */
.lc-root .lc-head__title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

/* ── Brand avatar ─────────────────────────────────────────────── */
.lc-root .lc-head__avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
}
.lc-root .lc-head__avatar {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(212,175,55,.55);
    box-shadow:
        0 0 0 2px rgba(212,175,55,.12),
        0 2px 8px rgba(0,0,0,.45);
    background: rgba(212,175,55,.08);   /* fallback while loading */
}
/* Online status dot — overlaid on avatar bottom-right corner */
.lc-root .lc-head__avatar-dot {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    border: 1.5px solid #0e1726;        /* matches panel bg, creates cutout effect */
    box-shadow: 0 0 5px rgba(74,222,128,.55);
    animation: lc-pulse 2.4s ease infinite;
}

@keyframes lc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,.35), 0 0 5px rgba(74,222,128,.55); }
    50%       { box-shadow: 0 0 0 3px rgba(74,222,128,.0), 0 0 8px rgba(74,222,128,.7); }
}

/* Remove the old standalone status dot (kept in markup as lc-status-dot
   for any callers that might reference it; we just hide it since the
   avatar-dot now carries the online indicator) */
.lc-root .lc-status-dot {
    display: none;
}

.lc-root .lc-head__label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.lc-root .lc-head__name {
    color: #e8c876;
    font-weight: 700;
    font-size: 13.5px;
    letter-spacing: .01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lc-root .lc-head__sub {
    color: rgba(205,214,230,.55);
    font-size: 10.5px;
    margin-top: 1px;
}

/* Close button */
.lc-root .lc-close {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    color: rgba(205,214,230,.7);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .14s ease, color .14s ease;
    font-family: inherit;
    box-sizing: border-box;
}
.lc-root .lc-close:hover {
    background: rgba(255,255,255,.12);
    color: #e8c876;
}

/* ── Messages area ────────────────────────────────────────────── */
.lc-root .lc-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Custom scrollbar — dark themed */
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,.2) transparent;
}
.lc-root .lc-body::-webkit-scrollbar       { width: 4px; }
.lc-root .lc-body::-webkit-scrollbar-track { background: transparent; }
.lc-root .lc-body::-webkit-scrollbar-thumb {
    background: rgba(212,175,55,.22);
    border-radius: 99px;
}
.lc-root .lc-body::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,.38); }

/* Message bubbles */
.lc-root .lc-msg {
    max-width: 82%;
    padding: 8px 12px 7px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
    box-sizing: border-box;
}
.lc-root .lc-msg--visitor {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(212,175,55,.26) 0%, rgba(168,131,44,.18) 100%);
    border: 1px solid rgba(212,175,55,.22);
    color: #fff8e2;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.lc-root .lc-msg--admin {
    align-self: flex-start;
    background: rgba(255,255,255,.065);
    border: 1px solid rgba(255,255,255,.09);
    color: #dce7f8;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* Sender label */
.lc-root .lc-msg__who {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    margin-bottom: 3px;
    opacity: .55;
}
.lc-root .lc-msg--visitor .lc-msg__who { color: #e8c876; }
.lc-root .lc-msg--admin   .lc-msg__who { color: #9eb8e0; }

/* System note (greeting / errors) */
.lc-root .lc-note {
    align-self: center;
    font-size: 11.5px;
    color: rgba(205,214,230,.5);
    text-align: center;
    padding: 5px 12px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 99px;
    line-height: 1.4;
    max-width: 88%;
}

/* ── Footer / input area ──────────────────────────────────────── */
.lc-root .lc-foot {
    padding: 10px;
    border-top: 1px solid rgba(212,175,55,.1);
    background: rgba(0,0,0,.18);
    display: flex;
    align-items: flex-end;
    gap: 7px;
    flex-shrink: 0;
}

/* Textarea — compact, auto-grows via JS (rows="1") */
.lc-root .lc-input {
    flex: 1;
    resize: none;
    min-height: 38px;
    max-height: 100px;
    height: 38px;         /* JS may grow this via scrollHeight logic if wired */
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid rgba(212,175,55,.18);
    background: rgba(255,255,255,.05);
    color: #eef3ff;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,.2) transparent;
    transition: border-color .15s ease, background .15s ease;
    box-sizing: border-box;
}
.lc-root .lc-input::placeholder { color: rgba(205,214,230,.35); }
.lc-root .lc-input:focus {
    border-color: rgba(212,175,55,.42);
    background: rgba(255,255,255,.07);
}

/* Send button — matches launcher aesthetic */
.lc-root .lc-send {
    flex-shrink: 0;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(212,175,55,.45);
    background: linear-gradient(160deg, #c9a84c, #a8832c);
    color: #1a1000;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .02em;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,.3), 0 1px 0 rgba(255,220,80,.2) inset;
    transition: filter .14s ease, transform .1s ease;
    white-space: nowrap;
    box-sizing: border-box;
}
.lc-root .lc-send:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.lc-root .lc-send:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(.95);
}
.lc-root .lc-send:disabled {
    opacity: .45;
    cursor: default;
    transform: none;
}

/* ── Honeypot — visually hidden, must stay in DOM ─────────────── */
.lc-root .lc-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ── Mobile  ≤ 480px ──────────────────────────────────────────── */
@media (max-width: 480px) {
    .lc-root .lc-panel {
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
        bottom: 128px;
        transform-origin: bottom right;
    }
    .lc-root .lc-btn {
        right: 14px;
        /* clear the mobile online badge (right:12px bottom:12px, ~36px tall) */
        bottom: 64px;
    }
}

/* ── Unread alert — standalone red "!" floating just ABOVE the launcher (v8) ──
   position:fixed (relative to the viewport) → immune to any clipping or
   containing-block quirks of the launcher / cabinet layout that hid the v7
   left-of-button placement. It floats in the dark area above the pill's right
   end, clearly separated (no blending with the gold button). Mirrors the
   launcher's responsive offsets. JS toggles .is-on. */
.lc-root .lc-badge {
    display: none;
    position: fixed;
    right: 24px;
    bottom: 140px;                 /* launcher bottom:82 + 52 height = top@134 → ~6px above */
    width: 30px;
    height: 30px;
    box-sizing: border-box;
    border-radius: 50%;
    background: #ef3b30;
    color: #fff;
    font-size: 19px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    border: 2px solid #0b1322;
    box-shadow: 0 3px 12px rgba(0,0,0,.55);
    z-index: 9999;                 /* above the launcher (9998) */
    pointer-events: none;
}
.lc-root .lc-badge.is-on {
    display: flex;
    align-items: center;
    justify-content: center;
    animation:
        lc-badge-pop .3s cubic-bezier(.22,.61,.36,1),
        lc-badge-ring 1.6s ease infinite .3s;
}
@keyframes lc-badge-pop {
    0%   { transform: scale(0); }
    65%  { transform: scale(1.28); }
    100% { transform: scale(1); }
}
@keyframes lc-badge-ring {
    0%, 100% { box-shadow: 0 3px 12px rgba(0,0,0,.55), 0 0 0 0   rgba(239,59,48,.6); }
    50%      { box-shadow: 0 3px 12px rgba(0,0,0,.55), 0 0 0 11px rgba(239,59,48,0); }
}
@media (max-width: 480px) {
    .lc-root .lc-badge { right: 18px; bottom: 120px; }   /* mobile launcher bottom:64 + 52 = 116 → ~4px above */
}
