/* EarnDesk chat widget — model: temp-mail AI chat widget (same layout,
   position and behaviour), recoloured to EarnDesk's brand: green #047857,
   amber #b45309, white background, system font stack. Scripted bot, $0,
   no API keys, no network calls. The bot logic lives in /js/chat.js.

   Close-bug lesson (from temp-mail): the panel MUST load hidden and the
   close button must fully hide it. A plain `.hidden` rule loses to
   `.chat-panel`'s own `display: flex` (same specificity, later in the
   file), so the higher-specificity `.chat-panel.hidden` rule below is
   required — and it must stay AFTER the `.chat-panel` rule. */
.chat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #047857, #065f46);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(4, 120, 87, 0.45);
  z-index: 1000;
  padding: 0;
}
.chat-toggle:hover { filter: brightness(1.12); }
.chat-toggle svg { width: 28px; height: 28px; }
.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(17, 24, 39, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Higher-specificity hide — see the note at the top of this file. */
.chat-panel.hidden { display: none; }
.chat-header {
  background: linear-gradient(90deg, #047857, #065f46);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.chat-header strong { display: block; font-size: 1rem; }
.chat-subtitle { font-size: 0.82rem; opacity: 0.9; }
.chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f9fafb;
}
.chat-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-msg.bot {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg.bot a { color: #047857; }
.chat-msg.user {
  background: linear-gradient(135deg, #047857, #065f46);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.typing { color: #6b7280; }
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}
.chat-chip {
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid #047857;
  background: transparent;
  color: #047857;
  border-radius: 999px;
  padding: 5px 11px;
}
.chat-chip:hover { background: #ecfdf5; }
/* Small arrow toggle for the 4 quick-reply chips (owner, 26 Nov 2026):
   the chips slide away after the visitor asks something, leaving just
   this arrow — tap it to bring the chips back up, tap again to hide. */
.chat-chips-toggle {
  display: block;
  width: 100%;
  padding: 4px 0;
  border: none;
  background: #ffffff;
  color: #047857;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  text-align: center;
}
.chat-chips-toggle:hover { background: #f9fafb; }
.chat-chips.collapsed { display: none; }
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: #111827;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 10px;
}
.chat-form input::placeholder { color: #9ca3af; }
.chat-form input:focus { outline: 2px solid #047857; outline-offset: -1px; }
.chat-send {
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: #047857;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.chat-send:hover { background: #065f46; }
@media (max-width: 480px) {
  .chat-panel { right: 12px; bottom: 84px; }
  .chat-toggle { right: 12px; bottom: 12px; }
}
