/* AN-RISE STUDIO — AI Chat Widget */

#ar-fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 56px; height: 56px; border-radius: 50%;
  background: #fff; border: 2px solid #2D2B6B; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(45,43,107,0.25);
  z-index: 99999; transition: transform 0.15s; padding: 0; overflow: hidden;
}
#ar-fab:hover { transform: scale(1.06); }
#ar-fab .ar-fab-logo { width: 40px; height: 40px; object-fit: contain; }
#ar-fab .ar-fab-close { color: #2D2B6B; font-size: 24px; display: none; align-items: center; justify-content: center; }
#ar-fab.open .ar-fab-logo { display: none; }
#ar-fab.open .ar-fab-close { display: flex; }

#ar-window {
  position: fixed; bottom: 96px; right: 28px; width: 310px;
  border-radius: 14px; overflow: visible;
  box-shadow: 0 8px 32px rgba(45,43,107,0.2);
  display: none; flex-direction: column;
  z-index: 99998; background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#ar-window.ar-open { display: flex; }

/* Header */
.ar-hd { background: #2D2B6B; padding: 13px 14px; display: flex; align-items: center; gap: 10px; border-radius: 14px 14px 0 0; position: relative; }
.ar-hd-back { background: none; border: none; cursor: pointer; color: rgba(255,255,255,0.8); display: flex; align-items: center; padding: 0; }
.ar-hd-back:hover { color: #fff; }
.ar-hd-back i { font-size: 18px; }
.ar-hd-logo { width: 32px; height: 32px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.ar-hd-logo img { width: 24px; height: 24px; object-fit: contain; }
.ar-hd-title { flex: 1; font-size: 14px; font-weight: 600; color: #fff; }
.ar-hd-menu { background: none; border: none; cursor: pointer; color: rgba(255,255,255,0.8); padding: 4px; display: flex; align-items: center; }
.ar-hd-menu:hover { color: #fff; }
.ar-hd-menu i { font-size: 18px; }

/* Menu dropdown */
#ar-menu-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(45,43,107,0.18);
  padding: 6px 0;
  min-width: 155px;
  z-index: 100001;
  border: 0.5px solid #e8e7f5;
}
#ar-menu-panel.ar-menu-open { display: flex; }
.ar-menu-item {
  background: none; border: none; cursor: pointer;
  padding: 10px 16px; font-size: 13px;
  color: #2D2B6B; display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; transition: background 0.1s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.ar-menu-item:hover { background: #f7f7fb; }
.ar-menu-item i { font-size: 15px; }

/* Body */
.ar-bd { background: #f7f7fb; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; min-height: 260px; max-height: 300px; overflow-y: auto; }

.ar-agent-row { display: flex; align-items: flex-start; gap: 9px; }
.ar-agent-av { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 2px solid #e8e7f5; box-shadow: 0 2px 6px rgba(45,43,107,0.12); overflow: hidden; }
.ar-agent-av img { width: 28px; height: 28px; object-fit: contain; }
.ar-agent-info { display: flex; flex-direction: column; gap: 4px; }
.ar-agent-name { font-size: 11px; color: #2D2B6B; font-weight: 600; letter-spacing: 0.02em; }
.ar-agent-bubble { background: #2D2B6B; color: #fff; font-size: 13px; line-height: 1.55; padding: 10px 13px; border-radius: 4px 12px 12px 12px; max-width: 220px; }

.ar-msg { display: flex; gap: 7px; align-items: flex-start; }
.ar-msg.ar-user { flex-direction: row-reverse; }
.ar-msg-av { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; overflow: hidden; background: #fff; border: 1.5px solid #e8e7f5; }
.ar-msg-av img { width: 20px; height: 20px; object-fit: contain; }
.ar-user-av { background: #2D2B6B !important; color: #fff; font-size: 10px; font-weight: 600; border: none !important; }
.ar-bubble { font-size: 13px; line-height: 1.6; padding: 9px 12px; max-width: 75%; word-break: break-word; }
.ar-msg.ar-ai .ar-bubble { background: #2D2B6B; color: #fff; border-radius: 4px 12px 12px 12px; }
.ar-msg.ar-ai .ar-bubble a { color: #a8d8ff; text-decoration: underline; }
.ar-msg.ar-ai .ar-bubble strong { font-weight: 700; }
.ar-msg.ar-user .ar-bubble { background: #fff; color: #1a1a2e; border: 0.5px solid #d8d7ee; border-radius: 12px 4px 12px 12px; }

/* AI col + copy */
.ar-ai-col { display: flex; flex-direction: column; gap: 4px; max-width: 75%; }
.ar-copy-btn { background: none; border: none; cursor: pointer; color: rgba(45,43,107,0.35); font-size: 13px; padding: 2px 4px; display: flex; align-items: center; transition: color 0.15s, transform 0.15s; }
.ar-copy-btn:hover { color: #2D2B6B; transform: scale(1.15); }
.ar-copy-btn.ar-copied { color: #1a9e6e; }

/* Typing */
.ar-typing { display:flex; gap:4px; align-items:center; padding:9px 12px; background:#2D2B6B; border-radius:4px 12px 12px 12px; width:fit-content; }
.ar-typing span { width:6px; height:6px; border-radius:50%; background:rgba(255,255,255,0.6); animation:ar-bounce 1.2s infinite; }
.ar-typing span:nth-child(2){animation-delay:.2s}
.ar-typing span:nth-child(3){animation-delay:.4s}
@keyframes ar-bounce{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}

/* Chips */
.ar-chips { display: flex; flex-direction: column; gap: 7px; align-items: flex-end; padding: 0 2px; }
.ar-chip { font-size: 12.5px; padding: 8px 14px; border-radius: 20px; border: 1.5px solid #2D2B6B; background: #fff; color: #2D2B6B; cursor: pointer; transition: all 0.15s; font-weight: 500; }
.ar-chip:hover { background: #2D2B6B; color: #fff; }

/* Emoji picker */
#ar-emoji-picker {
  display: none;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px; padding: 10px 12px;
  background: #2D2B6B;
  border-top: 0.5px solid rgba(255,255,255,0.1);
}
#ar-emoji-picker.ar-emoji-open { display: grid; }
.ar-emoji-btn { background: none; border: none; cursor: pointer; font-size: 18px; padding: 3px; border-radius: 6px; transition: background 0.1s; line-height: 1; }
.ar-emoji-btn:hover { background: rgba(255,255,255,0.15); }

/* Footer */
.ar-ft { background: #2D2B6B; border-top: 0.5px solid #3d3b7a; padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.ar-ft-wrap { flex: 1; position: relative; display: flex; align-items: center; }
#ar-placeholder { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-size: 13px; color: rgba(255,255,255,0.55); pointer-events: none; white-space: nowrap; z-index: 0; }
#ar-input { flex: 1; width: 100%; border: none !important; outline: none !important; font-size: 13px !important; background: transparent !important; color: #ffffff !important; caret-color: #ffffff !important; position: relative; z-index: 1; -webkit-text-fill-color: #ffffff !important; box-shadow: none !important; -webkit-appearance: none !important; }
#ar-input:focus { color: #ffffff !important; -webkit-text-fill-color: #ffffff !important; outline: none !important; border: none !important; box-shadow: none !important; }
#ar-input::placeholder { color: transparent !important; -webkit-text-fill-color: transparent !important; }
#ar-input:-webkit-autofill { -webkit-text-fill-color: #fff !important; -webkit-box-shadow: 0 0 0px 1000px #2D2B6B inset !important; }
.ar-ft-icons { display: flex; gap: 8px; align-items: center; }
.ar-ft-icons i { font-size: 17px; color: rgba(255,255,255,0.5); cursor: pointer; transition: color 0.15s; }
.ar-ft-icons i:hover { color: #fff; }

/* Powered */
.ar-powered { background: #2D2B6B; text-align: center; padding: 6px; font-size: 10.5px; color: rgba(255,255,255,0.4); border-top: 0.5px solid rgba(255,255,255,0.1); border-radius: 0 0 14px 14px; }
.ar-powered span { color: rgba(255,255,255,0.8); font-weight: 600; }