/* Ads Manager — Support / Sales Chat Widget */

#supportChatRoot {
  --support-primary: #ea0029;
  --support-primary-dark: #b8001f;
  --support-surface: #ffffff;
  --support-text: #0f172a;
  --support-muted: #64748b;
  --support-border: rgba(15, 23, 42, 0.08);
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 999998;
  font-family: Inter, system-ui, sans-serif;
}

#supportChatRoot.support-theme-app {
  --support-primary: #4f46e5;
  --support-primary-dark: #4338ca;
}

#supportChatFab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--support-primary), var(--support-primary-dark));
  box-shadow: 0 8px 28px rgba(234, 0, 41, 0.35), 0 0 0 3px #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#supportChatRoot.support-theme-app #supportChatFab {
  box-shadow: 0 8px 28px rgba(79, 70, 229, 0.35), 0 0 0 3px #fff;
}

#supportChatFab:hover { transform: scale(1.08); }
#supportChatFab.support-fab-hidden { transform: scale(0); opacity: 0; pointer-events: none; }

#supportChatPanel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: min(400px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  background: var(--support-surface);
  border-radius: 18px;
  border: 1px solid var(--support-border);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#supportChatPanel.support-chat-closed {
  opacity: 0;
  transform: scale(0.92) translateY(12px);
  pointer-events: none;
}

#supportChatPanel.support-chat-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.support-chat-header {
  background: linear-gradient(135deg, var(--support-primary), var(--support-primary-dark));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.support-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.support-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.support-chat-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.support-chat-subtitle {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

.support-chat-header-actions {
  display: flex;
  gap: 4px;
}

.support-chat-header-actions button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
}

.support-chat-header-actions button:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

#supportChatMessages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.support-msg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 92%;
}

.support-msg-user { align-self: flex-end; align-items: flex-end; }
.support-msg-assistant { align-self: flex-start; align-items: flex-start; }

.support-msg-in { animation: supportMsgIn 0.28s ease both; }

@keyframes supportMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.support-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.support-bubble-user {
  background: var(--support-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.support-bubble-bot {
  background: #fff;
  color: var(--support-text);
  border: 1px solid var(--support-border);
  border-bottom-left-radius: 4px;
}

.support-bubble-bot strong { color: var(--support-text); }
.support-bubble-bot ul { margin: 6px 0; padding-left: 18px; }
.support-bubble-bot code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.support-chat-link {
  color: var(--support-primary);
  text-decoration: underline;
}

.support-msg-time {
  font-size: 10px;
  color: var(--support-muted);
  padding: 0 4px;
}

.support-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.support-quick-chips button {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--support-border);
  background: #fff;
  color: var(--support-text);
  cursor: pointer;
}

.support-quick-chips button:hover {
  border-color: var(--support-primary);
  color: var(--support-primary);
}

.support-chat-footer {
  border-top: 1px solid var(--support-border);
  padding: 12px;
  background: #fff;
}

.support-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#supportChatInput {
  flex: 1;
  border: 1px solid var(--support-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  outline: none;
  font-family: inherit;
}

#supportChatInput:focus {
  border-color: var(--support-primary);
  box-shadow: 0 0 0 3px rgba(234, 0, 41, 0.12);
}

#supportChatRoot.support-theme-app #supportChatInput:focus {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

#supportChatSend {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: var(--support-primary);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

#supportChatSend:disabled { opacity: 0.5; cursor: not-allowed; }

#supportChatTyping {
  display: flex;
  gap: 4px;
  padding: 4px 0 0 4px;
}

#supportChatTyping.hidden { display: none; }

.support-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--support-primary);
  animation: supportTyping 1.2s infinite ease-in-out;
}

.support-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.support-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes supportTyping {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

.support-chat-powered {
  text-align: center;
  font-size: 10px;
  color: var(--support-muted);
  margin-top: 6px;
}

.support-chat-powered a {
  color: var(--support-primary, #EA0029);
  font-weight: 600;
  text-decoration: none;
}

.support-chat-powered a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  #supportChatRoot { right: 12px; bottom: 12px; }
  #supportChatPanel {
    width: calc(100vw - 24px);
    height: min(70vh, 520px);
  }
}
