/* ============================================================
   Cove Parish — Built-in chatbot widget
   Floating trigger (bottom-right) + slide-up panel.
   Answers common questions; looks up ChurchSuite events live.
   ============================================================ */

/* ── Floating trigger ─────────────────────────────────────── */
.cove-chat-trigger {
  position: fixed;
  right: clamp(12px, 2vw, 24px);
  bottom: clamp(12px, 2vw, 24px);
  z-index: 9996;

  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  padding: 0;

  background: var(--py, #E4BF45);
  color: var(--db, #1E3A52);
  cursor: pointer;

  display: grid;
  place-items: center;

  box-shadow:
    0 2px 6px  rgba(30,58,82,.15),
    0 8px 18px rgba(30,58,82,.22),
    0 18px 36px rgba(30,58,82,.18);

  transition:
    transform .35s cubic-bezier(.34,1.56,.64,1),
    box-shadow .35s ease,
    background .2s ease;
}

.cove-chat-trigger:hover,
.cove-chat-trigger:focus-visible {
  background: #d4af3a;
  transform: translateY(-2px) scale(1.06);
  box-shadow:
    0 4px 10px  rgba(30,58,82,.2),
    0 14px 28px rgba(30,58,82,.28),
    0 26px 48px rgba(30,58,82,.22);
}

.cove-chat-trigger:focus-visible {
  outline: 3px solid var(--pb, #34587C);
  outline-offset: 3px;
}

.cove-chat-trigger:active { transform: translateY(0) scale(.97); }

.cove-chat-trigger__icon {
  font-size: 24px;
  line-height: 1;
  transition: transform .3s ease;
}

/* Rotate icon when open */
.cove-chat-trigger[aria-expanded="true"] .cove-chat-trigger__icon {
  transform: scale(.85);
}

/* Badge — shows "1" when there's an unread greeting */
.cove-chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e04040;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--wh, #fff);
  animation: cove-chat-badge-in .4s cubic-bezier(.34,1.4,.64,1);
}
.cove-chat-badge[hidden] { display: none; }
@keyframes cove-chat-badge-in {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Panel ────────────────────────────────────────────────── */
.cove-chat-panel {
  position: fixed;
  right: clamp(12px, 2vw, 24px);
  bottom: calc(clamp(12px, 2vw, 24px) + 68px);
  z-index: 9996;

  width: min(360px, calc(100vw - 24px));
  max-height: min(520px, calc(100dvh - 120px));

  background: var(--wh, #fff);
  border-radius: 20px;
  box-shadow:
    0 8px 24px  rgba(30,58,82,.18),
    0 28px 56px rgba(30,58,82,.22);

  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Hidden state */
  opacity: 0;
  transform: translateY(14px) scale(.97);
  pointer-events: none;
  transition:
    opacity .25s ease,
    transform .3s cubic-bezier(.34,1.2,.64,1);
}

.cove-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Panel header ─────────────────────────────────────────── */
.cove-chat-hd {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  background: var(--db, #1E3A52);
  color: var(--wh, #fff);
}

.cove-chat-hd-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--py, #E4BF45);
  color: var(--db, #1E3A52);
  display: grid;
  place-items: center;
  font-size: 19px;
  flex-shrink: 0;
}

.cove-chat-hd-text { flex: 1; min-width: 0; }

.cove-chat-hd-name {
  display: block;
  font-family: 'League Gothic', 'Arial Narrow', sans-serif;
  font-size: 19px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.1;
}

.cove-chat-hd-sub {
  display: block;
  font-size: 11px;
  opacity: .65;
  margin-top: 1px;
}

.cove-chat-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 0;
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  transition: background .2s ease;
}
.cove-chat-close:hover { background: rgba(255,255,255,.24); }
.cove-chat-close:focus-visible {
  outline: 2px solid var(--py, #E4BF45);
  outline-offset: 2px;
}

/* ── Messages ─────────────────────────────────────────────── */
.cove-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
}

.cove-chat-msg {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
}

.cove-chat-msg a {
  color: var(--pb, #34587C);
  font-weight: 600;
  text-underline-offset: 2px;
}
.cove-chat-msg--bot a:hover { color: var(--db, #1E3A52); }

.cove-chat-msg--bot {
  background: var(--cr, #F5F0E8);
  color: var(--ch, #2A2A2A);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.cove-chat-msg--user {
  background: var(--pb, #34587C);
  color: var(--wh, #fff);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Thinking / loading dots */
.cove-chat-thinking {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
  width: 58px;
}
.cove-chat-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sb, #4A7399);
  animation: cove-chat-dot 1.1s ease-in-out infinite;
}
.cove-chat-thinking span:nth-child(2) { animation-delay: .18s; }
.cove-chat-thinking span:nth-child(3) { animation-delay: .36s; }

@keyframes cove-chat-dot {
  0%, 60%, 100% { transform: translateY(0);    opacity: .4; }
  30%            { transform: translateY(-6px); opacity: 1;  }
}

/* ── Suggestion chips ─────────────────────────────────────── */
.cove-chat-chips {
  padding: 4px 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cove-chat-chip {
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--pb, #34587C);
  background: rgba(52,88,124,.07);
  border: 1.5px solid rgba(52,88,124,.18);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.cove-chat-chip:hover {
  background: var(--pb, #34587C);
  color: var(--wh, #fff);
  border-color: var(--pb, #34587C);
}

.cove-chat-chip:focus-visible {
  outline: 2px solid var(--py, #E4BF45);
  outline-offset: 2px;
}

/* ── Input bar ────────────────────────────────────────────── */
.cove-chat-form {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(30,58,82,.07);
  background: var(--wh, #fff);
}

.cove-chat-input {
  flex: 1;
  min-height: 40px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ch, #2A2A2A);
  background: var(--cr, #F5F0E8);
  border: 1.5px solid transparent;
  border-radius: 20px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.cove-chat-input:focus {
  outline: 0;
  border-color: var(--pb, #34587C);
  box-shadow: 0 0 0 3px rgba(52,88,124,.14);
}

.cove-chat-input::placeholder {
  color: var(--sb, #4A7399);
  opacity: .7;
}

.cove-chat-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--pb, #34587C);
  color: var(--wh, #fff);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s ease, transform .2s ease;
}

.cove-chat-send:hover {
  background: var(--db, #1E3A52);
  transform: scale(1.06);
}

.cove-chat-send:focus-visible {
  outline: 2px solid var(--py, #E4BF45);
  outline-offset: 2px;
}

.cove-chat-send svg {
  width: 16px;
  height: 16px;
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cove-chat-trigger,
  .cove-chat-panel,
  .cove-chat-chip,
  .cove-chat-send    { transition: none; }
  .cove-chat-thinking span { animation: none; opacity: .6; }
  .cove-chat-badge   { animation: none; }
}

/* ── Forced colours ───────────────────────────────────────── */
@media (forced-colors: active) {
  .cove-chat-trigger,
  .cove-chat-send { border: 2px solid CanvasText; }
}
