/* Poker Athlete support chat widget */

.pa-chat-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font-body);
  color: var(--ink);
}

.pa-chat-trigger {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(200, 162, 74, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.pa-chat-trigger:hover {
  background: var(--bg-soft);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(200, 162, 74, 0.25);
}
.pa-chat-trigger:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.pa-chat-root[data-state="open"] .pa-chat-trigger {
  transform: scale(0.88);
  opacity: 0.65;
}

.pa-chat-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.pa-chat-root[data-state="open"] .pa-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.pa-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  flex: 0 0 auto;
}
.pa-chat-title {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.pa-chat-close {
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.pa-chat-close:hover { color: var(--ink); background: var(--line); }
.pa-chat-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.pa-chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.pa-chat-log::-webkit-scrollbar { width: 6px; }
.pa-chat-log::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.pa-chat-log::-webkit-scrollbar-track { background: transparent; }

.pa-msg { display: flex; }
.pa-msg-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: var(--fs-sm);
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.pa-msg-assistant { justify-content: flex-start; }
.pa-msg-assistant .pa-msg-bubble {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.pa-msg-user { justify-content: flex-end; }
.pa-msg-user .pa-msg-bubble {
  background: var(--gold);
  color: #1a1206;
  border-bottom-right-radius: 4px;
}
.pa-msg-system { justify-content: center; }
.pa-msg-system .pa-msg-bubble {
  background: rgba(217, 106, 74, 0.12);
  border: 1px solid rgba(217, 106, 74, 0.32);
  color: var(--danger);
  font-size: var(--fs-xs);
  max-width: 90%;
  text-align: center;
}

.pa-msg-typing .pa-msg-bubble {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}
.pa-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-mute);
  display: inline-block;
  animation: pa-bounce 1.2s infinite ease-in-out;
}
.pa-dot:nth-child(2) { animation-delay: 0.15s; }
.pa-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes pa-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.pa-chat-input-row {
  display: flex;
  align-items: center;
  padding: 10px;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  flex: 0 0 auto;
}
.pa-chat-input {
  flex: 1 1 auto;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-sm);
  outline: none;
  transition: border-color 0.15s ease;
  min-width: 0;
}
.pa-chat-input::placeholder { color: var(--ink-mute); }
.pa-chat-input:focus { border-color: var(--gold); }
.pa-chat-input:disabled { opacity: 0.5; cursor: not-allowed; }

.pa-chat-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--gold);
  color: #1a1206;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.pa-chat-send:hover:not(:disabled) { background: var(--gold-hi); }
.pa-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.pa-chat-send:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 480px) {
  .pa-chat-root { bottom: 16px; right: 16px; }
  .pa-chat-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 96px);
    max-height: 600px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pa-chat-trigger,
  .pa-chat-panel,
  .pa-dot { transition: none; animation: none; }
}
