/* =========================================================
   TSignature — Live Chat widget
   Shares the Dark Premium design tokens from style.css
   ========================================================= */

/* ---------- Floating launcher ---------- */
.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #17171a;
  font-size: 1.5rem;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  transition: transform .2s ease, background .25s ease;
}
.chat-launcher:hover { transform: translateY(-3px); background: var(--gold-soft); }
.chat-launcher:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }

/* ---------- Widget panel ---------- */
.chat-widget {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 95;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100dvh - 120px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: chatIn .22s ease both;
}
.chat-widget[hidden],
.chat-start[hidden],
.chat-conversation[hidden],
.chat-composer[hidden] { display: none; }

@keyframes chatIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Header ---------- */
.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(201,169,97,.10), transparent);
  flex: 0 0 auto;
}
.chat-header-copy { flex: 1 1 auto; min-width: 0; }
.chat-admin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.chat-admin-avatar[hidden] { display: none !important; }
.chat-eyebrow {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .2em;
}
.chat-title { margin: 0; font-size: 1.08rem; font-weight: 700; }
.chat-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .72rem;
}
.chat-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5fbf7a;
  box-shadow: 0 0 0 3px rgba(95, 191, 122, .15);
}
.chat-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  transition: color .2s ease, border-color .2s ease;
}
.chat-close:hover { color: var(--gold); border-color: var(--gold); }

/* ---------- Body ---------- */
.chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* ---------- Start form ---------- */
.chat-start { display: flex; flex-direction: column; gap: 12px; }
.chat-field { display: flex; flex-direction: column; gap: 5px; }
.chat-field label { color: var(--muted); font-size: .78rem; font-weight: 600; }
.chat-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}
.chat-field input:focus,
.chat-composer textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 169, 97, .15);
}
.chat-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--gold);
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.55;
}
.chat-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: .77rem;
  line-height: 1.5;
}
.chat-consent input { margin-top: 3px; accent-color: var(--gold); flex: 0 0 auto; }
.chat-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.chat-start .btn { align-self: flex-start; }
.chat-error {
  min-height: 1em;
  margin: 0;
  color: #f0a9a9;
  font-size: .76rem;
}

/* ---------- Messages ---------- */
.chat-messages { display: flex; flex-direction: column; gap: 8px; }
.chat-bubble {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: .88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-bubble--visitor {
  align-self: flex-end;
  background: var(--gold);
  color: #17171a;
  border-bottom-right-radius: 3px;
}
.chat-bubble--admin {
  align-self: flex-start;
  background: var(--bg-alt);
  border: 1px solid var(--line-soft);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.chat-bubble--system {
  align-self: center;
  max-width: 100%;
  background: transparent;
  color: var(--muted);
  font-size: .74rem;
  text-align: center;
}
.chat-meta {
  display: block;
  margin-top: 4px;
  font-size: .62rem;
  opacity: .62;
}

/* ---------- Composer ---------- */
.chat-composer {
  flex: 0 0 auto;
  padding: 12px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-composer-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-composer textarea {
  flex: 1 1 auto;
  min-height: 42px;
  max-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  font-size: .88rem;
  resize: none;
}
.chat-send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--gold);
  color: #17171a;
  font-size: 1rem;
  transition: background .2s ease, opacity .2s ease;
}
.chat-send:hover { background: var(--gold-soft); }
.chat-send:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Mobile: full-screen widget ---------- */
@media (max-width: 520px) {
  .chat-widget {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .chat-launcher { right: 16px; bottom: 16px; }
}
