/* ============================================================
   WIDTH AI CHAT — Modern compliance assistant
   ============================================================ */

#wai-wrap { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }
#wai-wrap * { box-sizing: border-box; margin: 0; padding: 0; }

/* Toggle button */
#wai-btn {
  position: fixed; right: 24px; bottom: 24px; z-index: 99999;
  width: 56px; height: 56px; border: none; padding: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  background: #09090B; border-radius: 50%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
#wai-btn:hover { transform: scale(1.08); box-shadow: 0 6px 32px rgba(0,0,0,0.3); }
#wai-btn svg { width: 28px; height: 28px; }
#wai-badge {
  position: absolute; top: -2px; right: -2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #77614D; border: 2px solid #fff;
  display: none;
}

/* Panel */
#wai-panel {
  position: fixed; right: 24px; bottom: 92px; z-index: 99999;
  display: none; flex-direction: column;
  width: 380px; max-height: 560px;
  background: #fff; border-radius: 16px;
  border: 1px solid #E4E4E7;
  box-shadow: 0 16px 64px rgba(0,0,0,0.12);
  overflow: hidden;
  animation: waiSlide 0.25s ease;
}
@keyframes waiSlide {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
#wai-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: #09090B;
}
#wai-head-left { display: flex; align-items: center; gap: 12px; }
#wai-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: #77614D; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
#wai-title { font-size: 15px; font-weight: 600; color: #fff; }
#wai-status { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 1px; }
#wai-close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; transition: background 0.15s;
}
#wai-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Messages */
#wai-msgs {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 240px; max-height: 320px;
  scroll-behavior: smooth;
}
.wai-msg {
  max-width: 85%; padding: 12px 16px;
  border-radius: 16px; font-size: 13.5px; line-height: 1.6;
  word-break: break-word;
}
.wai-bot {
  align-self: flex-start;
  background: #F4F4F5; color: #09090B;
  border-bottom-left-radius: 4px;
}
.wai-user {
  align-self: flex-end;
  background: #09090B; color: #fff;
  border-bottom-right-radius: 4px;
}
.wai-link {
  color: #77614D; text-decoration: none; font-weight: 600;
}
.wai-link:hover { text-decoration: underline; }

/* Typing indicator */
.wai-typing-msg {
  display: flex; gap: 4px; align-items: center;
  padding: 14px 18px;
}
.wai-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #A1A1AA;
  animation: waiBounce 1s infinite;
}
.wai-dot:nth-child(2) { animation-delay: 0.15s; }
.wai-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes waiBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Suggestions */
#wai-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 16px 12px;
}
.wai-chip {
  padding: 6px 14px; border: 1px solid #E4E4E7;
  border-radius: 20px; background: #fff; color: #52525B;
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  font-family: inherit;
}
.wai-chip:hover { background: #F4F4F5; border-color: #77614D; color: #77614D; }

/* Input */
#wai-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-top: 1px solid #F4F4F5;
}
#wai-input {
  flex: 1; padding: 10px 16px;
  border: 1px solid #E4E4E7; border-radius: 24px;
  font-size: 13.5px; font-family: inherit;
  color: #09090B; background: #FAFAFA;
  outline: none; transition: border-color 0.15s;
}
#wai-input:focus { border-color: #77614D; }
#wai-input::placeholder { color: #A1A1AA; }
#wai-send {
  width: 40px; height: 40px; flex-shrink: 0;
  border: none; border-radius: 50%;
  background: #09090B; color: #fff;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
#wai-send:hover { background: #77614D; }

/* Mobile */
@media (max-width: 480px) {
  #wai-panel {
    right: 0; left: 0; bottom: 0;
    width: 100%; max-height: 75vh;
    border-radius: 16px 16px 0 0;
  }
  #wai-btn { right: 16px; bottom: 16px; width: 48px; height: 48px; }
  #wai-btn svg { width: 24px; height: 24px; }
}
