#af-widget-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Bubble button */
#af-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--af-primary, #c8a456);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

#af-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,0.3);
}

#af-bubble svg {
  width: 28px;
  height: 28px;
  fill: white;
}

/* Chat window */
#af-chat-window {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
}

#af-chat-window.af-open {
  display: flex;
  animation: afSlideUp 0.3s ease;
}

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

/* Header */
#af-header {
  background: var(--af-primary, #c8a456);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#af-header-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

#af-header-info h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

#af-header-info p {
  margin: 2px 0 0;
  font-size: 11px;
  opacity: 0.85;
}

#af-close {
  margin-left: auto;
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

#af-close:hover { opacity: 1; }

/* Messages */
#af-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9f9f7;
}

.af-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.af-msg-bot {
  background: white;
  color: #1a1a1a;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.af-msg-user {
  background: var(--af-primary, #c8a456);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.af-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.af-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ccc;
  animation: afBounce 1.2s ease-in-out infinite;
}

.af-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.af-typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Input */
#af-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: white;
  flex-shrink: 0;
}

#af-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  resize: none;
  max-height: 80px;
}

#af-input:focus { border-color: var(--af-primary, #c8a456); }
#af-input::placeholder { color: #bbb; }

#af-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--af-primary, #c8a456);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

#af-send:hover { opacity: 0.85; }

#af-send svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* Powered by */
#af-powered {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: #bbb;
  background: white;
}

#af-powered a {
  color: #999;
  text-decoration: none;
}

/* Mobile */
@media (max-width: 480px) {
  #af-chat-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}
