/* ==========================================================
   LAW KNOT — Chat assistant widget
   Uses the site palette tokens from style.css
   ========================================================== */
.lk { font-family: var(--font-body); }

.lk-sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Launcher ---------- */
.lk-launcher {
  position: fixed;
  right: 32px; bottom: 32px;
  width: 62px; height: 62px;
  border: none; border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-gold-light), var(--clr-gold-dark));
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(234,88,12,0.4);
  transition: transform var(--transition), box-shadow var(--transition);
}
.lk-launcher::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--clr-gold);
  animation: lkPulse 2.4s ease-out infinite;
}
.lk-open .lk-launcher::after { animation: none; opacity: 0; }
.lk-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 36px rgba(234,88,12,0.5); }

.lk-launcher i { position: absolute; transition: transform 0.3s ease, opacity 0.3s ease; }
.lk-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.lk-open .lk-icon-open  { opacity: 0; transform: rotate(90deg) scale(0.6); }
.lk-open .lk-icon-close { opacity: 1; transform: none; }

.lk-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 20px; height: 20px;
  border-radius: 10px;
  background: #1c1917; color: #fff;
  font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.lk-badge[hidden] { display: none; }

@keyframes lkPulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* ---------- Panel ---------- */
.lk-panel {
  position: fixed;
  right: 32px; bottom: 108px;
  width: 380px;
  height: min(600px, calc(100vh - 140px));
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(28,25,23,0.18);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 1100;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.lk-panel[hidden] { display: none; }
.lk-open .lk-panel { opacity: 1; transform: none; }

.lk-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--clr-gold-light), var(--clr-gold-dark));
  color: #fff;
}
.lk-avatar {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.lk-head-text { display: flex; flex-direction: column; line-height: 1.25; flex: 1; }
.lk-head-text strong { font-family: var(--font-heading); font-size: 1.1rem; }
.lk-head-text span { font-size: 0.75rem; opacity: 0.9; }
.lk-head-text span i { color: #86efac; font-size: 0.5rem; vertical-align: middle; margin-right: 3px; }
.lk-close {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  font-size: 1rem; transition: background var(--transition);
}
.lk-close:hover { background: rgba(255,255,255,0.3); }

/* ---------- Messages ---------- */
.lk-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--clr-dark-alt);
}
.lk-msg {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  animation: lkIn 0.25s ease both;
  word-wrap: break-word;
}
.lk-msg--bot {
  align-self: flex-start;
  background: #fff;
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
  border-bottom-left-radius: 4px;
}
.lk-msg--bot strong { color: var(--clr-white); }
.lk-msg--bot a { color: var(--clr-gold); font-weight: 600; text-decoration: underline; }
.lk-msg--user {
  align-self: flex-end;
  background: var(--clr-gold);
  color: #fff;
  border-bottom-right-radius: 4px;
}
@keyframes lkIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.lk-book {
  margin-top: 10px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--clr-gold); color: #fff;
  border: none; border-radius: 8px;
  padding: 8px 14px;
  font: 600 0.82rem var(--font-body);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.lk-book:hover { background: var(--clr-gold-dark); transform: translateY(-1px); }

/* Typing indicator */
.lk-dots { display: inline-flex; gap: 4px; padding: 3px 0; }
.lk-dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--clr-gold-light);
  animation: lkDot 1s ease-in-out infinite;
}
.lk-dots i:nth-child(2) { animation-delay: 0.15s; }
.lk-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes lkDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Quick replies ---------- */
.lk-quick {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 14px;
  background: var(--clr-dark-alt);
}
.lk-quick:empty { display: none; }
.lk-chip {
  background: #fff;
  border: 1px solid rgba(234,88,12,0.35);
  color: var(--clr-gold-dark);
  border-radius: 100px;
  padding: 6px 12px;
  font: 500 0.78rem var(--font-body);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.lk-chip:hover { background: var(--clr-gold); color: #fff; border-color: var(--clr-gold); }

/* ---------- Input ---------- */
.lk-form {
  display: flex; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--clr-border);
  background: #fff;
}
.lk-input {
  flex: 1;
  border: 1.5px solid rgba(28,25,23,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  font: 0.9rem var(--font-body);
  color: var(--clr-white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.lk-input:focus { border-color: var(--clr-gold); box-shadow: 0 0 0 3px rgba(234,88,12,0.12); }
.lk-send {
  width: 44px; flex-shrink: 0;
  border: none; border-radius: 10px;
  background: var(--clr-gold); color: #fff;
  cursor: pointer; font-size: 0.95rem;
  transition: background var(--transition);
}
.lk-send:hover { background: var(--clr-gold-dark); }

.lk-disclaimer {
  font-size: 0.68rem;
  color: var(--clr-text-muted);
  text-align: center;
  padding: 0 14px 10px;
  background: #fff;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .lk-launcher { right: 20px; bottom: 20px; width: 56px; height: 56px; font-size: 1.3rem; }
  .lk-panel {
    right: 12px; left: 12px; bottom: 88px;
    width: auto;
    height: calc(100vh - 110px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lk-launcher::after, .lk-dots i, .lk-msg { animation: none; }
}
