/* AlphaBlueprint Chatbot Widget — chatbot.css */

/* ─── Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600&display=swap');

/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  --ab-black:       #0a0a0a;
  --ab-surface:     #111111;
  --ab-card:        #1a1a1a;
  --ab-border:      #2a2a2a;
  --ab-gold-start:  #c9a84c;
  --ab-gold-end:    #d4a030;
  --ab-gold:        #c9a84c;
  --ab-white:       #f0f0f0;
  --ab-muted:       #888888;
  --ab-red:         #e03535;
  --ab-radius:      4px;
  --ab-shadow:      0 24px 64px rgba(0,0,0,0.7), 0 4px 16px rgba(0,0,0,0.5);
  --ab-font-display:'Bebas Neue', sans-serif;
  --ab-font-body:   'Inter', sans-serif;
}

/* ─── Trigger Button ─────────────────────────────────────── */
#ab-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ab-black);
  border: 2px solid var(--ab-gold);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(201,168,76,0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#ab-chat-trigger:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(201,168,76,0.4);
}

#ab-chat-trigger:active {
  transform: scale(0.96);
}

#ab-chat-trigger .ab-trigger-label {
  font-family: var(--ab-font-display);
  font-size: 20px;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--ab-gold-start), var(--ab-gold-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

/* ─── Unread Badge ───────────────────────────────────────── */
#ab-chat-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ab-red);
  border: 2px solid var(--ab-black);
  display: none;
  z-index: 1;
}

#ab-chat-badge.ab-visible {
  display: block;
}

/* ─── Chat Panel ─────────────────────────────────────────── */
#ab-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 350px;
  height: 520px;
  background: var(--ab-surface);
  border: 1px solid var(--ab-border);
  border-radius: 6px;
  box-shadow: var(--ab-shadow);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.22s ease;
  font-family: var(--ab-font-body);
}

#ab-chat-panel.ab-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ─── Panel Header ───────────────────────────────────────── */
#ab-chat-header {
  background: var(--ab-black);
  border-bottom: 1px solid var(--ab-border);
  padding: 14px 18px 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#ab-chat-header .ab-header-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

#ab-chat-header .ab-brand {
  font-family: var(--ab-font-display);
  font-size: 22px;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--ab-gold-start), var(--ab-gold-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

#ab-chat-header .ab-subline {
  font-family: var(--ab-font-body);
  font-size: 11px;
  font-weight: 400;
  color: var(--ab-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

#ab-chat-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ab-muted);
  padding: 4px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: color 0.15s;
  outline: none;
}

#ab-chat-close:hover {
  color: var(--ab-white);
}

#ab-chat-close svg {
  width: 16px;
  height: 16px;
}

/* ─── Messages Area ──────────────────────────────────────── */
#ab-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#ab-chat-messages::-webkit-scrollbar {
  width: 4px;
}

#ab-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#ab-chat-messages::-webkit-scrollbar-thumb {
  background: var(--ab-border);
  border-radius: 2px;
}

/* ─── Message Bubbles ────────────────────────────────────── */
.ab-msg {
  max-width: 85%;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 10px 13px;
  border-radius: var(--ab-radius);
  animation: ab-msg-in 0.22s ease forwards;
  word-break: break-word;
}

@keyframes ab-msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bot message */
.ab-msg-bot {
  align-self: flex-start;
  background: var(--ab-card);
  color: var(--ab-white);
  border: 1px solid var(--ab-border);
  border-bottom-left-radius: 1px;
}

/* User message */
.ab-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--ab-gold-start), var(--ab-gold-end));
  color: var(--ab-black);
  font-weight: 600;
  border-bottom-right-radius: 1px;
}

/* ─── Typing Indicator ───────────────────────────────────── */
.ab-typing {
  align-self: flex-start;
  background: var(--ab-card);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius);
  border-bottom-left-radius: 1px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
  animation: ab-msg-in 0.22s ease forwards;
}

.ab-typing span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ab-gold);
  animation: ab-dot 1.2s ease-in-out infinite;
  opacity: 0.5;
}

.ab-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ab-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ab-dot {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ─── Quick Replies ──────────────────────────────────────── */
.ab-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 0 4px 0;
  align-self: flex-start;
  max-width: 100%;
  animation: ab-msg-in 0.28s ease forwards;
}

.ab-qr-btn {
  font-family: var(--ab-font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  color: var(--ab-gold);
  background: var(--ab-black);
  border: 1px solid var(--ab-gold);
  border-radius: var(--ab-radius);
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  outline: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.ab-qr-btn:hover {
  background: var(--ab-gold);
  color: var(--ab-black);
}

.ab-qr-btn:active {
  opacity: 0.85;
}

/* ─── Input Area ─────────────────────────────────────────── */
#ab-chat-input-row {
  border-top: 1px solid var(--ab-border);
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  background: var(--ab-black);
}

#ab-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ab-white);
  font-family: var(--ab-font-body);
  font-size: 13px;
  padding: 12px 14px;
  caret-color: var(--ab-gold);
}

#ab-chat-input::placeholder {
  color: var(--ab-muted);
}

#ab-chat-send {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ab-gold);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  outline: none;
}

#ab-chat-send:hover {
  opacity: 0.75;
}

#ab-chat-send svg {
  width: 16px;
  height: 16px;
}

/* ─── Footer ─────────────────────────────────────────────── */
#ab-chat-footer {
  text-align: center;
  padding: 5px 0 6px;
  background: var(--ab-black);
  border-top: 1px solid var(--ab-border);
  flex-shrink: 0;
}

#ab-chat-footer span {
  font-family: var(--ab-font-body);
  font-size: 10px;
  font-weight: 400;
  color: #3a3a3a;
  letter-spacing: 0.3px;
}

/* ─── Mobile Responsive ──────────────────────────────────── */
@media (max-width: 480px) {
  #ab-chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 80%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  #ab-chat-trigger {
    bottom: 16px;
    right: 16px;
  }
}

/* ─── Accessibility: reduced motion ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #ab-chat-panel {
    transition: opacity 0.15s ease;
  }

  .ab-msg,
  .ab-quick-replies {
    animation: none;
  }

  .ab-typing span {
    animation: none;
    opacity: 0.6;
  }
}
