/* ============================================================================
 *  Live chat widget — the public website only.
 *
 *  A headset button sits in the bottom right. When somebody is actually at the
 *  panel it gains a slow aura, so "we are online" is something you can see
 *  from across the page rather than a label you have to read. When nobody is
 *  there the button stays, quietly, because a message left out of hours is
 *  still worth having.
 *
 *  Sized and stacked so it never covers the page's own content: the panel is
 *  a fixed card on a desk and a full sheet on a phone.
 * ==========================================================================*/

:root{
  --chat-z: 9000;
}

/* ------------------------------------------------------------- launcher --- */
.lc-launcher{
  position: fixed; right: 22px; bottom: 22px; z-index: var(--chat-z);
  width: 60px; height: 60px; border-radius: 50%;
  border: 0; cursor: pointer; padding: 0;
  display: grid; place-items: center;
  background: var(--plum, #1D0328);
  color: var(--cream-brand, #EFE5CA);
  box-shadow: 0 10px 30px rgba(10, 2, 13, .38);
  transition: transform var(--dur-fast, .12s) var(--ease, ease),
              box-shadow var(--dur, .2s) var(--ease, ease);
}
.lc-launcher:hover{ transform: translateY(-2px) scale(1.04); }
.lc-launcher:active{ transform: none; }
.lc-launcher svg{ width: 27px; height: 27px; fill: none; stroke: currentColor;
                  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* The aura. Two rings breathing outward, only while an agent is online —
   the animation IS the status, so it never runs when nobody is there. */
.lc-launcher::before,
.lc-launcher::after{
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--lc-aura, #4ADE80);
  opacity: 0; pointer-events: none;
}
.lc-launcher.is-online::before{ animation: lc-aura 2.4s ease-out infinite; }
.lc-launcher.is-online::after { animation: lc-aura 2.4s ease-out infinite 1.2s; }

@keyframes lc-aura{
  0%   { transform: scale(1);    opacity: .65; }
  70%  { transform: scale(1.85); opacity: 0; }
  100% { transform: scale(1.85); opacity: 0; }
}

/* A solid dot as well as the aura, so the state is legible to anyone who
   cannot see motion — and to anyone with reduced motion turned on. */
.lc-dot{
  position: absolute; right: 2px; top: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #8B7A94; border: 2.5px solid var(--plum, #1D0328);
}
.lc-launcher.is-online .lc-dot{ background: #4ADE80; }

.lc-badge{
  position: absolute; left: -4px; top: -4px; min-width: 22px; height: 22px;
  padding: 0 6px; border-radius: 999px;
  background: #E4572E; color: #fff;
  font: 700 11px/22px var(--font-brand, system-ui); text-align: center;
}

/* ---------------------------------------------------------------- panel --- */
.lc-panel{
  position: fixed; right: 22px; bottom: 94px; z-index: var(--chat-z);
  width: 370px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 130px);
  display: none; flex-direction: column; overflow: hidden;
  background: var(--surface, #fff);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(10, 2, 13, .34);
  font-family: var(--font-brand, system-ui);
}
.lc-panel.is-open{ display: flex; }

@media (max-width: 520px){
  .lc-panel{
    right: 0; bottom: 0; width: 100vw; max-width: 100vw;
    height: 100dvh; max-height: 100dvh; border-radius: 0;
  }
  .lc-launcher{ right: 16px; bottom: 16px; }
}

.lc-head{
  background: var(--grad-plum, #1D0328); color: var(--cream-brand, #EFE5CA);
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
.lc-head .lc-title{ font-weight: 700; font-size: 15px; line-height: 1.2; }
.lc-head .lc-sub{ font-size: 11.5px; opacity: .72; margin-top: 2px; }
.lc-head .lc-spacer{ flex: 1; }
.lc-head button{
  border: 0; background: transparent; cursor: pointer; padding: 6px;
  color: inherit; border-radius: 8px; line-height: 0;
}
.lc-head button:hover{ background: rgba(255,255,255,.14); }
.lc-head svg{ width: 18px; height: 18px; fill: none; stroke: currentColor;
              stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.lc-status-dot{
  width: 9px; height: 9px; border-radius: 50%; background: #8B7A94; flex: none;
}
.lc-panel.agent-online .lc-status-dot{ background: #4ADE80; }

/* ----------------------------------------------------------------- body --- */
.lc-body{ flex: 1; overflow-y: auto; padding: 16px; background: #FBF8F1; }

.lc-intro{ padding: 4px 2px 14px; }
.lc-intro h4{ margin: 0 0 6px; font-size: 15px; color: var(--plum, #1D0328); }
.lc-intro p{ margin: 0; font-size: 13px; color: #5C4A66; line-height: 1.5; }

.lc-field{ margin-bottom: 12px; }
.lc-field label{
  display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: #1A0A22;
}
.lc-field input{
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1.5px solid #CFC1A6; border-radius: 10px;
  font-family: inherit; background: #fff; color: #1A0A22;
}
.lc-field input:focus{ outline: none; border-color: var(--plum, #1D0328); }
.lc-field.bad input{ border-color: #A6342B; }
.lc-field .err{ font-size: 11.5px; color: #A6342B; margin-top: 4px; }

/* --------------------------------------------------------------- bubbles -- */
.lc-msg{ display: flex; margin-bottom: 10px; }
.lc-msg.from-visitor{ justify-content: flex-end; }

.lc-bubble{
  max-width: 78%; padding: 9px 13px; border-radius: 16px;
  font-size: 14px; line-height: 1.45; word-wrap: break-word;
}
.lc-msg.from-agent .lc-bubble{
  background: #fff; color: #1A0A22; border-bottom-left-radius: 5px;
  box-shadow: 0 1px 2px rgba(16,24,40,.08);
}
.lc-msg.from-visitor .lc-bubble{
  background: var(--plum, #1D0328); color: var(--cream-brand, #EFE5CA);
  border-bottom-right-radius: 5px;
}
.lc-msg.from-system{ justify-content: center; }
.lc-msg.from-system .lc-bubble{
  background: #EDE4D3; color: #5C4A66; font-size: 12.5px;
  text-align: center; max-width: 92%; border-radius: 12px;
}

.lc-bubble img{
  display: block; max-width: 100%; border-radius: 10px; margin: 2px 0;
  cursor: zoom-in;
}

.lc-meta{
  font-size: 10.5px; margin-top: 3px; opacity: .62;
  display: flex; align-items: center; gap: 4px; justify-content: flex-end;
}
.lc-msg.from-agent .lc-meta{ justify-content: flex-start; color: #8B7A94; }

/* ---------------------------------------------------------------- input --- */
.lc-foot{
  border-top: 1px solid #E4DAC6; padding: 10px; background: #fff;
  display: flex; align-items: flex-end; gap: 8px;
}
.lc-foot textarea{
  flex: 1; resize: none; border: 1.5px solid #E4DAC6; border-radius: 12px;
  padding: 10px 12px; font-family: inherit; font-size: 15px; line-height: 1.4;
  max-height: 110px; color: #1A0A22; background: #fff;
}
.lc-foot textarea:focus{ outline: none; border-color: var(--plum, #1D0328); }
.lc-foot button{
  border: 0; cursor: pointer; border-radius: 50%; flex: none;
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--plum, #1D0328); color: var(--cream-brand, #EFE5CA);
}
.lc-foot button.ghost{ background: #F5EFE3; color: var(--plum, #1D0328); }
.lc-foot button:disabled{ opacity: .5; cursor: default; }
.lc-foot svg{ width: 19px; height: 19px; fill: none; stroke: currentColor;
              stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lc-foot input[type=file]{ display: none; }

.lc-note{
  padding: 10px 14px; font-size: 12.5px; text-align: center;
  color: #5C4A66; background: #F5EFE3; border-top: 1px solid #E4DAC6;
}
.lc-note button{
  border: 0; background: transparent; color: var(--plum, #1D0328);
  font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline;
}

.lc-err{
  margin: 0 16px 10px; padding: 9px 12px; border-radius: 10px;
  background: #FBE9E6; color: #A6342B; font-size: 12.5px;
}

@media (prefers-reduced-motion: reduce){
  .lc-launcher::before, .lc-launcher::after{ animation: none !important; }
  .lc-launcher:hover{ transform: none; }
}
