:root {
  --pa-chat-accent: #c5a572;
  --pa-chat-ink: #dcdcdc;
  --pa-chat-ink-dim: #a9a9a9;
  --pa-chat-ink-muted: #8a8a8a;
}

.support-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100010;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(197, 165, 114, 0.45);
  background: linear-gradient(135deg, rgba(197, 165, 114, 0.35), rgba(197, 165, 114, 0.12));
  color: var(--pa-chat-ink, var(--ink, #dcdcdc));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.support-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.support-chat-fab.is-suppressed {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.support-chat-fab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.support-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100011;
  width: min(360px, calc(100vw - 32px));
  height: min(480px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(197, 165, 114, 0.28);
  background: rgba(14, 14, 15, 0.96);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 32px rgba(197, 165, 114, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.support-chat[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.support-chat.is-open,
.support-chat[data-open='true'] {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
  z-index: 100011 !important;
}

.support-chat.is-dragging {
  transition: none;
  user-select: none;
}

.support-chat.is-resizing {
  transition: none;
  user-select: none;
}

.support-chat.is-minimizing {
  transition:
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease,
    border-radius 0.32s ease;
  pointer-events: none;
}

.support-chat.is-minimizing.is-minimizing-active {
  transform: scale(0.14) !important;
  opacity: 0 !important;
  border-radius: 50% !important;
}

.support-chat.is-restoring {
  transition:
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease;
  transform: scale(0.14) !important;
  opacity: 0.35 !important;
  pointer-events: none !important;
}

.support-chat.is-restoring.is-restoring-active {
  transform: scale(1) !important;
  opacity: 1 !important;
}

.support-chat-bubble {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100011;
  display: none;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(197, 165, 114, 0.45);
  background: linear-gradient(135deg, rgba(197, 165, 114, 0.35), rgba(197, 165, 114, 0.12));
  color: var(--pa-chat-ink, var(--ink, #dcdcdc));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  cursor: grab;
  touch-action: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.support-chat-bubble.is-visible {
  display: inline-flex !important;
}

.support-chat-bubble.is-dragging {
  cursor: grabbing;
  transition: none;
  transform: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.support-chat-bubble.is-pop-in {
  animation: support-chat-bubble-in 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.support-chat-bubble.is-pop-out {
  animation: support-chat-bubble-out 0.18s ease forwards;
  pointer-events: none;
}

@keyframes support-chat-bubble-in {
  from {
    transform: scale(0.55);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes support-chat-bubble-out {
  from {
    transform: scale(1);
    opacity: 1;
  }

  to {
    transform: scale(0.55);
    opacity: 0;
  }
}

.support-chat-bubble:hover:not(.is-dragging):not(.is-pop-out) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.support-chat-bubble svg {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .support-chat,
  .support-chat-bubble,
  .support-chat-fab {
    transition: none !important;
  }

  .support-chat.is-minimizing,
  .support-chat.is-restoring {
    transition: none !important;
  }

  .support-chat-bubble.is-pop-in,
  .support-chat-bubble.is-pop-out {
    animation: none !important;
  }
}

.support-chat__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 1rem 0.85rem;
  background: rgba(197, 165, 114, 0.1);
  border-bottom: 1px solid rgba(197, 165, 114, 0.2);
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

.support-chat.is-dragging .support-chat__header {
  cursor: grabbing;
}

.support-chat__header-bar {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  width: 100%;
}

.support-chat__title {
  margin: 0;
  grid-column: 2;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--pa-chat-accent, var(--accent, #c5a572));
}

.support-chat__subtitle {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  color: var(--pa-chat-ink-muted, var(--ink-muted, #8a8a8a));
}

.support-chat__minimize,
.support-chat__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--pa-chat-ink-dim, var(--ink-dim, #a9a9a9));
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  padding: 0;
}

.support-chat__minimize {
  grid-column: 1;
  font-size: 1.25rem;
  font-weight: 700;
}

.support-chat__close {
  grid-column: 3;
}

.support-chat__minimize:hover,
.support-chat__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--pa-chat-ink, var(--ink, #dcdcdc));
}

.support-chat__resize-handle {
  position: absolute;
  z-index: 3;
  touch-action: none;
}

.support-chat__resize-handle--n {
  top: 0;
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: n-resize;
}

.support-chat__resize-handle--s {
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: s-resize;
}

.support-chat__resize-handle--e {
  top: 10px;
  right: 0;
  bottom: 10px;
  width: 8px;
  cursor: e-resize;
}

.support-chat__resize-handle--w {
  top: 10px;
  left: 0;
  bottom: 10px;
  width: 8px;
  cursor: w-resize;
}

.support-chat__resize-handle--ne {
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  cursor: ne-resize;
}

.support-chat__resize-handle--nw {
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: nw-resize;
}

.support-chat__resize-handle--se {
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  cursor: se-resize;
}

.support-chat__resize-handle--sw {
  bottom: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: sw-resize;
}

.support-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(197, 165, 114, 0.35) transparent;
}

.support-chat__msg {
  max-width: 88%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.support-chat__msg p {
  margin: 0.2rem 0 0;
  color: var(--pa-chat-ink, var(--ink, #dcdcdc));
}

.support-chat__msg-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pa-chat-ink-muted, var(--ink-muted, #8a8a8a));
}

.support-chat__msg--support {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.support-chat__msg--user {
  align-self: flex-end;
  background: rgba(197, 165, 114, 0.14);
  border: 1px solid rgba(197, 165, 114, 0.28);
}

.support-chat__msg--user .support-chat__msg-label {
  color: rgba(197, 165, 114, 0.85);
}

.support-chat__user-typing,
.support-chat__support-typing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem 0.65rem;
  font-size: 0.75rem;
  color: var(--pa-chat-ink-muted, var(--ink-muted, #8a8a8a));
}

.support-chat__user-typing {
  justify-content: flex-end;
}

.support-chat__support-typing {
  justify-content: flex-start;
}

.support-chat__typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.support-chat__typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pa-chat-accent, var(--accent, #c5a572));
  opacity: 0.35;
  animation: supportChatDot 1.2s ease-in-out infinite;
}

.support-chat__typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.support-chat__typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes supportChatDot {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.support-chat__composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
}

.support-chat__input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--pa-chat-ink, var(--ink, #dcdcdc));
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.support-chat__input::placeholder {
  color: var(--pa-chat-ink-muted, var(--ink-muted, #8a8a8a));
}

.support-chat__input:focus {
  border-color: rgba(197, 165, 114, 0.45);
  box-shadow: 0 0 0 3px rgba(197, 165, 114, 0.12);
}

.support-chat__send {
  flex-shrink: 0;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(197, 165, 114, 0.45);
  background: rgba(197, 165, 114, 0.18);
  color: var(--pa-chat-ink, var(--ink, #dcdcdc));
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.support-chat__send:hover {
  background: rgba(197, 165, 114, 0.28);
  transform: translateY(-1px);
}
