/* HANUMAN PANEL AI ASSISTANT — Violet Theme */

:root {
  --v-bg: #0c0614;
  --v-card: rgba(28, 12, 48, 0.92);
  --v-violet: #a855f7;
  --v-violet2: #7c3aed;
  --v-violet3: #c084fc;
  --v-deep: #4c1d95;
  --v-text: #f3e8ff;
  --v-muted: #b8a0d4;
  --v-border: rgba(168, 85, 247, 0.35);
  --v-user: linear-gradient(135deg, #7c3aed, #a855f7);
}

/* Floating button */
#hanuman-ai-btn {
  position: fixed;
  bottom: 90px;
  right: 16px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2.5px solid var(--v-violet);
  background: #0c0614;
  cursor: pointer;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.5);
  animation: vPulse 2.5s infinite;
  transition: transform 0.2s;
}
#hanuman-ai-btn:hover { transform: scale(1.08); }
#hanuman-ai-btn .hanuman-btn-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
@keyframes vPulse {
  0% { box-shadow: 0 0 0 0 rgba(168,85,247,0.55); }
  70% { box-shadow: 0 0 0 16px rgba(168,85,247,0); }
  100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); }
}

/* Chat */
#hanuman-ai-chat {
  position: fixed;
  bottom: 160px;
  right: 12px;
  width: 400px;
  max-width: calc(100vw - 24px);
  height: 640px;
  max-height: calc(100vh - 170px);
  background: var(--v-bg);
  border-radius: 22px;
  border: 1.5px solid var(--v-border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 40px rgba(124,58,237,0.15);
  z-index: 2147482999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
#hanuman-ai-chat.open {
  display: flex;
  animation: vIn 0.28s ease;
}
@keyframes vIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.hanuman-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 50%, #a855f7 100%);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.hanuman-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hanuman-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #f0abfc;
  overflow: hidden;
  background: #1a0a2e;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(240,171,252,0.4);
}
.hanuman-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hanuman-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}
.hanuman-status {
  font-size: 11px;
  color: rgba(255,255,255,0.9);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.hanuman-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 6px #4ade80;
}
.hanuman-header-actions {
  display: flex;
  gap: 6px;
}
.hanuman-header-actions button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Brand */
.mx-brand {
  text-align: center;
  padding: 12px 12px 8px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(76,29,149,0.35) 0%, transparent 100%);
}
.mx-brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--v-violet3);
  object-fit: cover;
  box-shadow: 0 0 16px rgba(168,85,247,0.45);
  margin-bottom: 6px;
}
.mx-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
}
.mx-brand h1 span.x {
  color: var(--v-violet3);
  background: linear-gradient(90deg, #e9d5ff, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mx-brand .sub {
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--v-muted);
  margin-top: 4px;
  text-transform: uppercase;
}

/* Language */
.hanuman-lang {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(168,85,247,0.15);
}
.hanuman-lang button {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: 16px;
  border: 1px solid rgba(168,85,247,0.25);
  background: transparent;
  color: var(--v-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.hanuman-lang button.active {
  background: rgba(168,85,247,0.25);
  border-color: var(--v-violet);
  color: #fff;
  box-shadow: 0 0 10px rgba(168,85,247,0.3);
}

/* Messages — NO background image, solid violet dark */
.hanuman-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--v-bg);
}
.hanuman-messages::-webkit-scrollbar { width: 3px; }
.hanuman-messages::-webkit-scrollbar-thumb {
  background: rgba(168,85,247,0.35);
  border-radius: 4px;
}

.msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 92%;
}
.msg-row.bot { align-self: flex-start; }
.msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--v-violet);
  background: #1a0a2e;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(168,85,247,0.35);
}
.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.msg-avatar.user-av {
  border-color: #c084fc;
}

.msg {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
  max-width: 100%;
}
.msg.bot {
  background: var(--v-card);
  color: var(--v-text);
  border: 1px solid rgba(168,85,247,0.2);
  border-bottom-left-radius: 4px;
}
.msg.bot .bot-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--v-violet3);
  margin-bottom: 4px;
}
.msg.user {
  background: var(--v-user);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(124,58,237,0.4);
}
.msg .msg-time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 5px;
  text-align: right;
}
.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.msg-actions button {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--v-muted);
  font-size: 11px;
  cursor: pointer;
}

/* Quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.qa-btn {
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid rgba(168,85,247,0.22);
  background: rgba(28, 12, 48, 0.85);
  color: var(--v-text);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
  transition: 0.15s;
}
.qa-btn:hover {
  border-color: var(--v-violet);
  color: var(--v-violet3);
  background: rgba(76,29,149,0.4);
}

/* Input */
.hanuman-input-area {
  padding: 10px 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(20, 8, 36, 0.98);
  border-top: 1px solid var(--v-border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  z-index: 5;
}
.hanuman-input-area input {
  flex: 1;
  background: rgba(12, 6, 20, 0.95);
  border: 1.5px solid rgba(168,85,247,0.25);
  border-radius: 24px;
  padding: 12px 16px;
  color: #fff;
  font-size: 16px;
  outline: none;
  min-width: 0;
}
.hanuman-input-area input:focus {
  border-color: var(--v-violet);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.2);
}
.hanuman-input-area input::placeholder {
  color: var(--v-muted);
  font-size: 13px;
}
.hanuman-send {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(168,85,247,0.5);
  touch-action: manipulation;
}
.hanuman-send:active { transform: scale(0.93); }
.hanuman-send svg { width: 18px; height: 18px; fill: currentColor; }

/* Footer */
.mx-footer {
  text-align: center;
  padding: 6px 10px 8px;
  font-size: 11px;
  color: var(--v-violet3);
  letter-spacing: 1.5px;
  background: rgba(12, 6, 20, 0.98);
  border-top: 1px solid rgba(168,85,247,0.12);
  flex-shrink: 0;
  font-weight: 600;
}

/* Typing */
.typing {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--v-card);
  border-radius: 14px;
  border: 1px solid rgba(168,85,247,0.2);
}
.typing span {
  width: 6px;
  height: 6px;
  background: var(--v-violet);
  border-radius: 50%;
  animation: bounce 1.3s infinite ease-in-out both;
}
.typing span:nth-child(1) { animation-delay: -0.28s; }
.typing span:nth-child(2) { animation-delay: -0.14s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.back-btn {
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(168,85,247,0.35);
  color: var(--v-violet3);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 4px;
  display: inline-flex;
  align-self: flex-start;
}

@media (max-width: 480px) {
  #hanuman-ai-chat {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0;
    border: none;
  }
  #hanuman-ai-btn {
    bottom: 88px;
    right: 14px;
  }
  .hanuman-input-area {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .hanuman-send {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }
}
