/* =====================================================================
   Live chat window (visitor side) — bottom-right button + chat panel
   Colours follow the site theme (Admin → Theme & colours).
   ===================================================================== */
.glc {
  --c-navy: var(--navy, #0D0E25);
  --c-gold: var(--gold, #BAA386);
  --c-gold-2: var(--gold-dark, #A8926F);
  --c-ink: #17192E;
  --c-muted: #8A90A0;
  --c-line: #E6E8EE;
  --c-bg: #F4F5F8;
  --c-ok: #34D399;
  position: fixed; right: 20px; bottom: 20px; z-index: 450;
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
}
.glc *, .glc *::before, .glc *::after { box-sizing: border-box; }
.glc button { font: inherit; cursor: pointer; }
.glc svg { display: block; }

/* ---------- Launcher ---------- */
.glc-launcher {
  position: relative; display: grid; place-items: center; width: 62px; height: 62px; padding: 0;
  border: 0; border-radius: 50%; color: var(--c-navy);
  background: radial-gradient(120% 120% at 30% 20%, #E4D3B9 0%, var(--c-gold) 45%, var(--c-gold-2) 100%);
  box-shadow: 0 14px 34px -10px rgba(13, 14, 37, .55), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1), box-shadow .3s;
}
.glc-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 20px 40px -12px rgba(13, 14, 37, .6), inset 0 1px 0 rgba(255, 255, 255, .45); }
.glc-launcher:active { transform: scale(.96); }
.glc-launcher:focus-visible { outline: 3px solid rgba(186, 163, 134, .55); outline-offset: 3px; }
.glc-launcher svg { position: absolute; width: 27px; height: 27px; transition: transform .4s cubic-bezier(.22, 1, .36, 1), opacity .25s; }
.glc-launcher .i-close { opacity: 0; transform: rotate(-90deg) scale(.5); width: 24px; height: 24px; }
.glc.is-open .glc-launcher .i-chat { opacity: 0; transform: rotate(90deg) scale(.5); }
.glc.is-open .glc-launcher .i-close { opacity: 1; transform: none; }
.glc-launcher::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--c-gold); opacity: 0; pointer-events: none; }
.glc.has-unread:not(.is-open) .glc-launcher::after { animation: glc-ring 2s cubic-bezier(.22, 1, .36, 1) infinite; }
@keyframes glc-ring { 0% { opacity: .7; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.35); } }
.glc-badge {
  position: absolute; top: -3px; right: -3px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: #E5484D; color: #fff; border: 2px solid #fff; font: 700 11.5px/18px var(--font-body, system-ui); text-align: center;
  transform: scale(0); transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.glc.has-unread .glc-badge { transform: scale(1); }

/* ---------- Greeting bubble ---------- */
.glc-greet {
  position: absolute; right: 0; bottom: 78px; display: flex; align-items: flex-start; gap: 10px; width: 270px; padding: 14px 34px 14px 14px;
  border-radius: 18px; background: #fff; color: var(--c-ink); box-shadow: 0 18px 50px -14px rgba(13, 14, 37, .4), 0 0 0 1px rgba(13, 14, 37, .05);
  font-size: 14px; line-height: 1.45; cursor: pointer;
  opacity: 0; transform: translateY(10px) scale(.96); transform-origin: bottom right; pointer-events: none; transition: opacity .35s, transform .45s cubic-bezier(.22, 1, .36, 1);
}
.glc-greet::after { content: ""; position: absolute; right: 24px; bottom: -6px; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); border-radius: 0 0 3px 0; box-shadow: 3px 3px 6px -3px rgba(13, 14, 37, .12); }
.glc-greet.show { opacity: 1; transform: none; pointer-events: auto; }
.glc-greet b { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 700; color: var(--c-muted); }
.glc-greet-x { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--c-muted); }
.glc-greet-x:hover { background: var(--c-bg); color: var(--c-ink); }
.glc-greet-x svg { width: 14px; height: 14px; }

/* ---------- Avatar ---------- */
.glc-ava { position: relative; flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--c-navy); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.glc-ava img { width: 62%; height: 62%; object-fit: contain; }
.glc-ava.sm { width: 28px; height: 28px; }
.glc-ava.lg { width: 46px; height: 46px; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.glc-ava .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #9AA0AE; border: 2.5px solid #12142F; transition: background .3s; }
.glc.is-online .glc-ava .dot { background: var(--c-ok); }

/* ---------- Panel ---------- */
.glc-panel {
  position: absolute; right: 0; bottom: 78px; display: flex; flex-direction: column; overflow: hidden;
  width: 384px; height: min(660px, calc(100vh - 120px)); border-radius: 26px; background: var(--c-bg);
  box-shadow: 0 40px 90px -24px rgba(13, 14, 37, .6), 0 0 0 1px rgba(13, 14, 37, .06);
  opacity: 0; visibility: hidden; transform: translateY(18px) scale(.95); transform-origin: bottom right; pointer-events: none;
  transition: opacity .28s, transform .45s cubic-bezier(.22, 1, .36, 1), visibility 0s .45s;
}
.glc.is-open .glc-panel { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition: opacity .28s, transform .45s cubic-bezier(.22, 1, .36, 1), visibility 0s; }
body.has-adminbar .glc-panel { height: min(660px, calc(100vh - 160px)); }

.glc-head {
  position: relative; flex: none; padding: 18px 18px 20px; color: #fff; overflow: hidden;
  background: radial-gradient(130% 160% at 100% 0%, rgba(186, 163, 134, .38) 0%, transparent 55%), linear-gradient(140deg, #0D0E25 0%, #1A1C44 100%);
}
.glc-head::after { content: ""; position: absolute; left: -40px; bottom: -70px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .07), transparent 70%); pointer-events: none; }
.glc-head-row { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.glc-head-txt { min-width: 0; flex: 1; }
.glc-title { font-family: var(--font-head, inherit); font-size: 16.5px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.glc-status { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12.5px; color: rgba(255, 255, 255, .68); }
.glc-status i { width: 7px; height: 7px; border-radius: 50%; background: #9AA0AE; }
.glc.is-online .glc-status i { background: var(--c-ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .22); }
.glc-sub { position: relative; z-index: 1; margin-top: 14px; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, .72); }
.glc-iconbtn { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: rgba(255, 255, 255, .1); transition: background .2s; }
.glc-iconbtn:hover { background: rgba(255, 255, 255, .2); }
.glc-iconbtn svg { width: 18px; height: 18px; }

/* ---------- Messages ---------- */
.glc-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 10px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: #D5D8DF transparent; }
.glc-body::-webkit-scrollbar { width: 6px; } .glc-body::-webkit-scrollbar-thumb { background: #D5D8DF; border-radius: 6px; }
.glc-day { display: table; margin: 4px auto 14px; padding: 4px 11px; border-radius: 999px; background: #E8EAF0; color: #7C8293; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.glc-who { margin: 0 0 5px 38px; font-size: 11.5px; font-weight: 600; color: #6E7486; }
.glc-row { display: flex; align-items: flex-end; gap: 8px; margin: 3px 0; animation: glc-in .35s cubic-bezier(.22, 1, .36, 1) both; }
.glc-row.me { justify-content: flex-end; }
.glc-row .glc-ava.sm.ghost { visibility: hidden; }
@keyframes glc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.glc-bubble { max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.glc-row.them .glc-bubble { background: #fff; color: var(--c-ink); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(13, 14, 37, .05), 0 6px 18px -10px rgba(13, 14, 37, .18); }
.glc-row.me .glc-bubble { background: linear-gradient(135deg, #CDBBA0 0%, var(--c-gold) 100%); color: #15172C; border-bottom-right-radius: 6px; box-shadow: 0 6px 16px -10px rgba(168, 146, 111, .9); }
.glc-row.them + .glc-row.them .glc-bubble { border-top-left-radius: 6px; }
.glc-row.me + .glc-row.me .glc-bubble { border-top-right-radius: 6px; }
.glc-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.glc-row.pending .glc-bubble { opacity: .6; }
.glc-row.failed .glc-bubble { box-shadow: 0 0 0 1.5px #E5484D; }
.glc-meta { display: flex; align-items: center; gap: 5px; margin: 4px 4px 12px 40px; font-size: 11px; color: #9AA0AE; }
.glc-meta.me { justify-content: flex-end; margin-left: 0; }
.glc-meta svg { width: 14px; height: 14px; color: var(--c-gold-2); }
.glc-meta .err { color: #E5484D; font-weight: 600; cursor: pointer; text-decoration: underline; }
.glc-note { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0 12px; padding: 11px 13px; border-radius: 14px; background: #FFF8EC; border: 1px solid #F1E0C2; color: #6F5530; font-size: 12.5px; line-height: 1.5; }
.glc-note svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.glc-sys { display: table; margin: 8px auto 12px; padding: 6px 12px; border-radius: 10px; background: #ECEEF3; color: #6E7486; font-size: 12px; text-align: center; }

/* typing */
.glc-typing .glc-bubble { display: flex; gap: 4px; align-items: center; padding: 13px 15px; }
.glc-typing i { width: 7px; height: 7px; border-radius: 50%; background: #A3A9B7; animation: glc-dot 1.2s infinite ease-in-out; }
.glc-typing i:nth-child(2) { animation-delay: .15s; } .glc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes glc-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* intro card (name / email) */
.glc-card { margin: 8px 0 14px 36px; padding: 14px; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(13, 14, 37, .05), 0 8px 22px -14px rgba(13, 14, 37, .25); animation: glc-in .4s cubic-bezier(.22, 1, .36, 1) both; }
.glc-card h4 { margin: 0 0 2px; font-family: var(--font-head, inherit); font-size: 13.5px; font-weight: 700; color: var(--c-ink); }
.glc-card p { margin: 0 0 10px; font-size: 12.5px; color: var(--c-muted); }
.glc-field { display: block; margin-top: 8px; }
.glc-field span { display: block; margin-bottom: 4px; font-size: 11.5px; font-weight: 600; color: #5E6477; }
.glc-field input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--c-line); border-radius: 11px; background: #FAFBFC; color: var(--c-ink); font: 14px var(--font-body, system-ui); transition: border-color .2s, box-shadow .2s, background .2s; }
.glc-field input:focus { outline: none; border-color: var(--c-gold); background: #fff; box-shadow: 0 0 0 3px rgba(186, 163, 134, .22); }
.glc-field.bad input { border-color: #E5484D; box-shadow: 0 0 0 3px rgba(229, 72, 77, .15); }
.glc-card .glc-mini { margin-top: 10px; height: 34px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--c-navy); color: #fff; font-size: 13px; font-weight: 600; }
.glc-card .glc-mini.ghost { margin-left: 6px; background: transparent; color: var(--c-muted); }

/* ---------- Composer ---------- */
.glc-compose { flex: none; padding: 10px 12px 12px; background: #fff; border-top: 1px solid #ECEEF2; }
.glc-form { display: flex; align-items: flex-end; gap: 8px; }
.glc-input { flex: 1; min-height: 46px; max-height: 128px; padding: 12px 16px; border: 1px solid var(--c-line); border-radius: 23px; background: #F7F8FA; color: var(--c-ink); font: 14.5px/1.45 var(--font-body, system-ui); resize: none; transition: border-color .2s, box-shadow .2s, background .2s; }
.glc-input::placeholder { color: #A2A7B4; }
.glc-input:focus { outline: none; border-color: var(--c-gold); background: #fff; box-shadow: 0 0 0 3px rgba(186, 163, 134, .2); }
.glc-send { flex: none; display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; background: var(--c-navy); color: #fff; transition: transform .2s, background .2s, opacity .2s; }
.glc-send svg { width: 19px; height: 19px; transform: translateX(1px); }
.glc-send:hover:not(:disabled) { background: var(--c-gold); color: var(--c-navy); transform: scale(1.05); }
.glc-send:disabled { opacity: .3; cursor: default; }
.glc-foot { margin-top: 8px; text-align: center; font-size: 11px; color: #A9AEBA; }
.glc-err { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; background: #FDECEC; color: #B42318; font-size: 12.5px; font-weight: 600; }

/* ---------- Phones ---------- */
@media (max-width: 520px) {
  .glc { right: 16px; bottom: 16px; }
  .glc-panel { position: fixed; inset: 0; width: auto; height: 100%; border-radius: 0; transform: translateY(24px); }
  body.has-adminbar .glc-panel { top: 40px; height: auto; }
  .glc-head { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .glc-compose { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .glc.is-open .glc-launcher { opacity: 0; pointer-events: none; transform: scale(.6); }
  .glc-greet { width: min(270px, calc(100vw - 40px)); }
  .glc-input { font-size: 16px; } /* stops iOS zooming into the field */
}
@media (prefers-reduced-motion: reduce) {
  .glc *, .glc *::before, .glc *::after { animation: none !important; transition-duration: .01ms !important; }
}
