/* Lighthouse live chat — visitor widget. Every rule is scoped to .cfc so neither site theme leaks in or out. */
.cfc {
  --cfc-ink: #0f1729;
  --cfc-ink-2: #1f2b45;
  --cfc-paper: #f5f3ee;
  --cfc-text: #0e1424;
  --cfc-muted: #7d8598;
  --cfc-line: rgba(14, 20, 36, .1);
  --cfc-gold: #f0b54a;
  --cfc-gold-2: #ffd88f;
  --cfc-ok: #3ccf91;
  --cfc-edge: max(18px, env(safe-area-inset-right));
  --cfc-floor: max(18px, env(safe-area-inset-bottom));
  position: fixed;
  right: var(--cfc-edge);
  bottom: var(--cfc-floor);
  z-index: 44;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--cfc-text);
  letter-spacing: normal;
  text-transform: none;
}
.cfc *, .cfc *::before, .cfc *::after { box-sizing: border-box; }
.cfc button, .cfc input, .cfc textarea { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; margin: 0; }
.cfc svg { display: block; flex: none; }
.cfc [hidden] { display: none !important; }

/* Launcher */
.cfc-launch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 54px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--cfc-gold-2), var(--cfc-gold));
  color: #1a1204;
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 14px 32px -10px rgba(240, 181, 74, .7), 0 2px 8px rgba(5, 8, 15, .22);
  transition: transform .2s ease, box-shadow .2s ease;
}
.cfc-launch:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -10px rgba(240, 181, 74, .8), 0 3px 10px rgba(5, 8, 15, .25); }
.cfc-launch:focus-visible, .cfc-close:focus-visible, .cfc-send:focus-visible, .cfc-topic:focus-visible, .cfc-ask button:focus-visible { outline: 2px solid #4c8bc9; outline-offset: 3px; }
.cfc-badge {
  position: absolute;
  top: -5px;
  right: -3px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #e5484d;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.cfc.is-open .cfc-launch { display: none; }
/* An open conversation sits above sticky site headers and menus (mcmod.site's header is z-index 100+). */
.cfc.is-open { z-index: 9990; }

/* Panel */
.cfc-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 380px;
  height: min(620px, calc(100vh - 36px));
  height: min(620px, calc(100dvh - 36px));
  overflow: hidden;
  border-radius: 22px;
  background: var(--cfc-paper);
  box-shadow: 0 30px 80px -20px rgba(5, 8, 15, .55), 0 0 0 1px rgba(5, 8, 15, .06);
  animation: cfc-in .22s ease-out;
}
@keyframes cfc-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.cfc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 16px 18px;
  background: linear-gradient(135deg, var(--cfc-ink), var(--cfc-ink-2));
  color: #eef1f7;
}
/* Studio logo; the URL is relative to this file, so mcmod.site gets it from the store too. */
.cfc-avatar {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #dce8f1 url(logo.png) center / cover no-repeat;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), 0 4px 12px -4px rgba(0, 0, 0, .45);
  flex: none;
}
.cfc-head-text { flex: 1; min-width: 0; }
.cfc .cfc-title { margin: 0; padding: 0; font-size: 16px; font-weight: 800; line-height: 1.3; color: #fff; letter-spacing: normal; }
.cfc .cfc-status { display: flex; align-items: center; gap: 7px; margin: 3px 0 0; font-size: 12.5px; line-height: 1.4; color: rgba(238, 241, 247, .7); }
.cfc-status i { width: 8px; height: 8px; border-radius: 50%; background: rgba(238, 241, 247, .4); flex: none; }
.cfc-status.is-online i { background: var(--cfc-ok); box-shadow: 0 0 0 3px rgba(60, 207, 145, .22); }
.cfc-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: #eef1f7;
  cursor: pointer;
}
.cfc-close:hover { background: rgba(255, 255, 255, .16); }

/* Conversation */
.cfc-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cfc-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; }
.cfc-msg--visitor { align-self: flex-end; align-items: flex-end; }
.cfc .cfc-bubble {
  margin: 0;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  border: 1px solid var(--cfc-line);
  color: var(--cfc-text);
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cfc .cfc-msg--visitor .cfc-bubble { border-radius: 18px 18px 6px 18px; background: var(--cfc-ink); border-color: var(--cfc-ink); color: #fff; }
.cfc-msg.is-pending { opacity: .55; }
/* AI assistant replies: same side as the studio, tinted so visitors can tell them apart. */
.cfc .cfc-msg--ai .cfc-bubble { background: #fffaf0; border-color: rgba(201, 138, 31, .32); }
.cfc .cfc-typing .cfc-bubble { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.cfc-typing i { width: 7px; height: 7px; border-radius: 50%; background: #c98a1f; opacity: .35; animation: cfc-dot 1.2s infinite ease-in-out; }
.cfc-typing i:nth-child(2) { animation-delay: .15s; }
.cfc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cfc-dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.cfc-meta { margin-top: 4px; padding: 0 4px; font-size: 11.5px; line-height: 1.3; color: var(--cfc-muted); }
.cfc-meta:empty { display: none; }
.cfc-hello { max-width: 92%; }
.cfc-topics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cfc-topic {
  padding: 7px 13px;
  border: 1px solid rgba(201, 138, 31, .35);
  border-radius: 999px;
  background: rgba(240, 181, 74, .12);
  color: #6b4a0e;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.cfc-topic:hover { background: rgba(240, 181, 74, .22); }
.cfc.has-messages .cfc-topics { display: none; }

.cfc-ask {
  align-self: stretch;
  margin: 2px 0 0;
  padding: 13px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px dashed rgba(201, 138, 31, .45);
}
.cfc .cfc-ask p { margin: 0; font-size: 13px; line-height: 1.5; color: #4b5468; }
.cfc-ask.is-done { border-style: solid; border-color: rgba(60, 207, 145, .4); background: rgba(60, 207, 145, .08); }
.cfc-ask-row { display: flex; gap: 8px; margin-top: 10px; }
.cfc .cfc-ask input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--cfc-line);
  border-radius: 12px;
  background: var(--cfc-paper);
  font-size: 14px;
  box-shadow: none;
}
.cfc .cfc-ask input:focus { outline: 2px solid rgba(76, 139, 201, .5); outline-offset: 0; border-color: transparent; }
.cfc-ask button {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--cfc-ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.cfc-ask button:disabled { opacity: .5; cursor: default; }
.cfc .cfc-ask-error { margin-top: 6px; color: #c0392b; }

.cfc .cfc-error { margin: 0; padding: 8px 16px; background: #fdecea; color: #a12b20; font-size: 13px; line-height: 1.45; }

/* Composer */
.cfc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
  padding: 10px 10px 10px 16px;
  border-top: 1px solid var(--cfc-line);
  background: #fff;
}
.cfc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.cfc .cfc-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  min-height: 0;
  max-height: 128px;
  padding: 8px 0;
  overflow-y: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
  resize: none;
  font-size: 15px;
  line-height: 1.45;
  color: var(--cfc-text);
}
.cfc .cfc-input:focus { outline: none; box-shadow: none; }
.cfc .cfc-input::placeholder { color: var(--cfc-muted); opacity: 1; }
.cfc-send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--cfc-gold-2), var(--cfc-gold));
  color: #1a1204;
  cursor: pointer;
  flex: none;
}
.cfc .cfc-foot { margin: 0; padding: 0 14px 10px; background: #fff; font-size: 11.5px; line-height: 1.4; color: var(--cfc-muted); text-align: center; }
.cfc .cfc-foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Phones: round launcher, full-screen conversation */
@media (max-width: 640px) {
  .cfc { --cfc-edge: max(14px, env(safe-area-inset-right)); --cfc-floor: max(14px, env(safe-area-inset-bottom)); }
  .cfc-launch { width: 56px; height: 56px; padding: 0; justify-content: center; }
  .cfc-launch-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cfc.is-open { inset: 0; }
  .cfc-panel { position: fixed; inset: 0; width: auto; height: 100%; border-radius: 0; animation: none; }
  .cfc-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .cfc .cfc-input { font-size: 16px; }
  .cfc .cfc-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
html.cfc-lock, html.cfc-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .cfc-launch, .cfc-panel, .cfc-typing i { transition: none; animation: none; }
}
@media print { .cfc { display: none; } }
