/* QAH Live Chat Widget - navy #1E1B4B + amber #F59E0B */
#qah-chat-widget { position: fixed; bottom: 24px; right: 24px; z-index: 99990; font-family: Inter, system-ui, sans-serif; }
#qah-chat-bubble { position: relative; width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #1E1B4B, #3730A3); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(30,27,75,.45); transition: transform .2s ease, box-shadow .2s ease; }
#qah-chat-bubble:hover { transform: scale(1.07); box-shadow: 0 10px 32px rgba(30,27,75,.55); }
#qah-chat-bubble::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #F59E0B;
  opacity: 0; animation: qah-chat-pulse 2.4s ease-out infinite; }
@keyframes qah-chat-pulse { 0% { transform: scale(.85); opacity: .7; } 70% { transform: scale(1.12); opacity: 0; } 100% { opacity: 0; } }
.qah-chat-unread { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px;
  background: #F59E0B; color: #1E1B4B; font-size: 12px; font-weight: 800; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }

#qah-chat-window { position: absolute; bottom: 76px; right: 0; width: 360px; max-width: calc(100vw - 48px);
  height: 500px; max-height: calc(100vh - 140px); background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(30,27,75,.35); display: flex; flex-direction: column;
  animation: qah-chat-slide .25s ease-out; transform-origin: bottom right; }
@keyframes qah-chat-slide { from { transform: scale(.9) translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.qah-chat-header { background: linear-gradient(135deg, #1E1B4B, #312E81); color: #fff; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; }
.qah-chat-header-info { display: flex; align-items: center; gap: 10px; }
.qah-chat-avatar { width: 38px; height: 38px; border-radius: 50%; background: #F59E0B; color: #1E1B4B;
  font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.qah-chat-header strong { display: block; font-size: 15px; }
.qah-chat-header small { color: #C7D2FE; font-size: 12px; }
.qah-chat-header small .qah-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34D399; margin-right: 4px; }
.qah-chat-header-actions button { background: rgba(255,255,255,.12); border: none; color: #fff; width: 28px; height: 28px;
  border-radius: 8px; cursor: pointer; font-size: 16px; margin-left: 6px; }
.qah-chat-header-actions button:hover { background: rgba(255,255,255,.25); }

.qah-chat-body { flex: 1; overflow-y: auto; padding: 16px; background: #F8FAFC; display: flex; flex-direction: column; gap: 10px; }
.qah-chat-welcome { background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; padding: 12px; font-size: 14px; margin: 0 0 8px; }
#qah-chat-preform input { width: 100%; box-sizing: border-box; padding: 10px 12px; margin-bottom: 10px; border: 1px solid #D1D5DB;
  border-radius: 10px; font-size: 14px; }
.qah-chat-btn { width: 100%; padding: 12px; background: #F59E0B; color: #1E1B4B; border: none; border-radius: 10px;
  font-weight: 800; font-size: 15px; cursor: pointer; }
.qah-chat-btn:hover { background: #D97706; color: #fff; }
.qah-chat-privacy { font-size: 11px; color: #9CA3AF; text-align: center; }

.qah-msg { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.qah-msg .qah-msg-time { display: block; font-size: 10px; opacity: .6; margin-top: 4px; }
.qah-msg.visitor { align-self: flex-end; background: #1E1B4B; color: #fff; border-bottom-right-radius: 4px; }
.qah-msg.staff { align-self: flex-start; background: #fff; color: #111827; border: 1px solid #E5E7EB; border-bottom-left-radius: 4px; }
.qah-msg.staff .qah-msg-name { display: block; font-size: 11px; font-weight: 700; color: #F59E0B; margin-bottom: 2px; }
.qah-chat-sys { align-self: center; font-size: 12px; color: #6B7280; background: #EEF2FF; padding: 6px 12px; border-radius: 20px; }

.qah-chat-typing { align-self: flex-start; background: #fff; border: 1px solid #E5E7EB; border-radius: 14px;
  padding: 8px 14px; font-size: 12px; color: #6B7280; display: flex; gap: 4px; align-items: center; }
.qah-chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: #F59E0B; animation: qah-typing 1.2s infinite; }
.qah-chat-typing span:nth-child(2) { animation-delay: .2s; } .qah-chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes qah-typing { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.qah-chat-footer { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid #E5E7EB; background: #fff; position: relative; }
#qah-chat-input { flex: 1; padding: 10px 12px; border: 1px solid #D1D5DB; border-radius: 20px; font-size: 14px; outline: none; }
#qah-chat-input:focus { border-color: #F59E0B; }
#qah-chat-send { width: 40px; height: 40px; border-radius: 50%; border: none; background: #F59E0B; color: #1E1B4B;
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#qah-chat-send:hover { background: #D97706; color: #fff; }
#qah-chat-emoji-btn { background: none; border: none; font-size: 20px; cursor: pointer; flex-shrink: 0; }
#qah-chat-emoji-panel { position: absolute; bottom: 56px; left: 12px; background: #fff; border: 1px solid #E5E7EB;
  border-radius: 12px; padding: 10px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 2; }
.qah-chat-emoji { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; border-radius: 6px; }
.qah-chat-emoji:hover { background: #F3F4F6; }

@media (max-width: 480px) {
  #qah-chat-widget { bottom: 16px; right: 16px; }
  #qah-chat-window { width: calc(100vw - 32px); bottom: 72px; height: calc(100vh - 180px); max-height: 560px; }
}

/* Sending state */
.qah-msg.pending { opacity: .7; }
.qah-msg .qah-sending {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; opacity: .7; margin-top: 4px; font-style: italic;
}
.qah-spinner {
  width: 12px; height: 12px; border: 2px solid rgba(0,0,0,.15);
  border-top-color: #6366F1; border-radius: 50%;
  animation: qah-spin .7s linear infinite; display: inline-block; flex-shrink: 0;
}
.qah-msg.staff .qah-spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
@keyframes qah-spin { to { transform: rotate(360deg); } }
.qah-msg.failed .qah-sending { color: #DC2626; font-style: normal; }
