/**
 * ============================================================================
 * ANANYA AI CHATBOT — ULTRA-PREMIUM GLASSMORPHIC DESIGN SYSTEM
 * Brand Palette:
 *   - Royal Purple / Deep Violet: #20082E / #3A1450 / #531C70
 *   - Lotus Magenta / Neon Accent: #D8267E / #F43F5E
 *   - Gold / Amber Sparkle: #F59E0B / #FEF3C7
 *   - Emerald Pulse: #10B981
 *   - Clean Snow Card: #FFFFFF / #FAF5F8
 * ============================================================================
 */

:root {
  --ananya-primary: #3A1450;
  --ananya-primary-dark: #20082E;
  --ananya-primary-light: #5A1B7A;
  --ananya-accent: #D8267E;
  --ananya-accent-hover: #F43F5E;
  --ananya-gold: #F59E0B;
  --ananya-gold-light: #FEF3C7;
  --ananya-bg-soft: #FAF5F8;
  --ananya-bg-card: #FFFFFF;
  --ananya-text-dark: #1F0829;
  --ananya-text-muted: #6B5E70;
  --ananya-border: #ECDDE6;
  --ananya-shadow: 0 16px 45px rgba(32, 8, 46, 0.28);
  --ananya-glow: 0 0 25px rgba(216, 38, 126, 0.45);
  --ananya-radius: 22px;
}

/* ==========================================================================
   Floating Launcher Widget
   ========================================================================== */
#ananya-widget-container {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 999999;
  font-family: 'Syne', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Launcher Button */
.ananya-launcher-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #20082E 0%, #4D1254 50%, #D8267E 100%);
  color: #ffffff;
  padding: 8px 18px 8px 8px;
  border-radius: 50px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 32px rgba(32, 8, 46, 0.4), 0 0 20px rgba(216, 38, 126, 0.45);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.ananya-launcher-btn:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 16px 42px rgba(32, 8, 46, 0.55), 0 0 30px rgba(216, 38, 126, 0.65);
  border-color: rgba(255, 255, 255, 0.7);
}

.ananya-launcher-avatar-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(45deg, #F59E0B, #D8267E, #FFFFFF);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.ananya-launcher-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.ananya-online-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  background-color: #10B981;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.ananya-launcher-text-box {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

.ananya-launcher-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ananya-launcher-subtitle {
  font-size: 11.5px;
  color: #FCE7F3;
  font-weight: 500;
  opacity: 0.95;
}

/* Callout Tooltip Bubble */
.ananya-callout-bubble {
  position: absolute;
  bottom: 74px;
  right: 0;
  background: #ffffff;
  color: var(--ananya-text-dark);
  padding: 12px 18px;
  border-radius: 16px;
  box-shadow: 0 12px 35px rgba(32, 8, 46, 0.22);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  border: 1px solid var(--ananya-border);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  animation: ananya-bounce-in 0.5s ease-out;
}

.ananya-callout-bubble.is-hiding {
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  pointer-events: none;
}

.ananya-callout-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 28px;
  border-width: 8px 8px 0;
  border-style: solid;
  border-color: #ffffff transparent;
  display: block;
}

.ananya-callout-close {
  background: none;
  border: none;
  color: var(--ananya-text-muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}

.ananya-callout-close:hover {
  color: var(--ananya-accent);
}

/* ==========================================================================
   Main Chatbot Window
   ========================================================================== */
.ananya-chat-window {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 440px;
  height: 680px;
  max-width: calc(100vw - 30px);
  max-height: calc(100vh - 40px);
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: var(--ananya-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid rgba(216, 38, 126, 0.22);
  opacity: 0;
  transform: scale(0.85) translateY(20px);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000000;
}

.ananya-chat-window.is-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Header Area */
.ananya-chat-header {
  background: linear-gradient(135deg, #1C0729 0%, #3A1450 50%, #68154D 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
}

.ananya-header-bg-glow {
  position: absolute;
  top: -40px;
  right: -30px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(216, 38, 126, 0.45) 0%, transparent 70%);
  pointer-events: none;
}

.ananya-header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.ananya-header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ananya-header-avatar {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(45deg, #F59E0B, #D8267E, #FFFFFF);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.ananya-header-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.ananya-header-status-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background-color: #10B981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.ananya-header-info h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ananya-badge-verified {
  font-size: 10px;
  background: rgba(216, 38, 126, 0.35);
  border: 1px solid rgba(216, 38, 126, 0.6);
  color: #FFD2EB;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.ananya-header-info p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #E2D3E9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ananya-pulse-green {
  width: 7px;
  height: 7px;
  background-color: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10B981;
  animation: ananya-blink 1.8s infinite;
}

.ananya-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ananya-btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.ananya-btn-icon:hover {
  background: rgba(216, 38, 126, 0.5);
  border-color: #D8267E;
  transform: scale(1.08);
}

.ananya-btn-icon.is-active {
  background: #D8267E;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(216, 38, 126, 0.6);
}

/* Header Substrip (Language Switcher & Quick WhatsApp) */
.ananya-header-substrip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  position: relative;
  z-index: 1;
}

.ananya-lang-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 2px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.ananya-lang-btn {
  background: none;
  border: none;
  color: #E2D3E9;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.ananya-lang-btn.is-active {
  background: #D8267E;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(216, 38, 126, 0.4);
}

.ananya-wa-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #25D366;
  color: #ffffff !important;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(37, 211, 102, 0.35);
  transition: all 0.25s ease;
}

.ananya-wa-header-btn:hover {
  transform: translateY(-2px);
  background: #20BA5A;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.5);
}

/* Category Mode Selector Chips */
.ananya-modes-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: #F4ECF2;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--ananya-border);
}

.ananya-modes-bar::-webkit-scrollbar {
  display: none;
}

.ananya-mode-chip {
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid var(--ananya-border);
  color: var(--ananya-text-dark);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ananya-mode-chip:hover {
  border-color: var(--ananya-accent);
  color: var(--ananya-accent);
}

.ananya-mode-chip.is-active {
  background: var(--ananya-primary);
  border-color: var(--ananya-primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(58, 20, 80, 0.25);
}

/* Speaking Visualizer Bar */
.ananya-speaking-indicator {
  display: none;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, #D8267E, #F59E0B);
  color: #ffffff;
  padding: 6px 16px;
  font-size: 11.5px;
  font-weight: 600;
}

.ananya-speaking-indicator.is-speaking {
  display: flex;
}

.ananya-audio-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 14px;
}

.ananya-audio-bar {
  width: 3px;
  height: 100%;
  background: #ffffff;
  border-radius: 2px;
  animation: ananya-audio-dance 1s infinite ease-in-out;
}

.ananya-audio-bar:nth-child(2) { animation-delay: 0.15s; }
.ananya-audio-bar:nth-child(3) { animation-delay: 0.3s; }
.ananya-audio-bar:nth-child(4) { animation-delay: 0.45s; }
.ananya-audio-bar:nth-child(5) { animation-delay: 0.6s; }

/* Chat Body */
.ananya-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #FAF5F8;
  scroll-behavior: smooth;
}

.ananya-chat-body::-webkit-scrollbar {
  width: 5px;
}

.ananya-chat-body::-webkit-scrollbar-thumb {
  background: #D8BDD0;
  border-radius: 10px;
}

/* Message Rows */
.ananya-msg-row {
  display: flex;
  gap: 10px;
  max-width: 88%;
}

.ananya-msg-row.is-bot {
  align-self: flex-start;
}

.ananya-msg-row.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ananya-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--ananya-accent);
  padding: 1px;
}

.ananya-msg-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.ananya-msg-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ananya-msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ananya-text-dark);
  box-shadow: 0 4px 15px rgba(32, 8, 46, 0.06);
  word-wrap: break-word;
}

.ananya-msg-row.is-bot .ananya-msg-bubble {
  background: #ffffff;
  border: 1px solid var(--ananya-border);
  border-top-left-radius: 4px;
}

.ananya-msg-row.is-user .ananya-msg-bubble {
  background: linear-gradient(135deg, #3A1450 0%, #7E1C59 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
}

.ananya-msg-bubble strong {
  color: var(--ananya-primary);
  font-weight: 700;
}

.ananya-msg-row.is-user .ananya-msg-bubble strong {
  color: #FFD2EB;
}

.ananya-msg-bubble ul, .ananya-msg-bubble ol {
  margin: 8px 0;
  padding-left: 18px;
}

.ananya-msg-bubble li {
  margin-bottom: 4px;
}

.ananya-msg-bubble a {
  color: var(--ananya-accent);
  font-weight: 600;
  text-decoration: underline;
}

.ananya-msg-time {
  font-size: 10.5px;
  color: #8C7B90;
  padding: 0 4px;
}

.ananya-msg-row.is-user .ananya-msg-time {
  text-align: right;
}

/* Inline Actions & TTS Listen */
.ananya-bubble-actions-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ananya-tts-inline-btn {
  background: #F4ECF2;
  border: 1px solid #ECDDE6;
  color: var(--ananya-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.ananya-tts-inline-btn:hover {
  background: var(--ananya-accent);
  color: #ffffff;
  border-color: var(--ananya-accent);
}

.ananya-inline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ananya-action-chip {
  background: #ffffff;
  border: 1px solid #DFCCD9;
  color: var(--ananya-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(58, 20, 80, 0.05);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ananya-action-chip:hover {
  background: var(--ananya-accent);
  color: #ffffff;
  border-color: var(--ananya-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(216, 38, 126, 0.3);
}

/* Typing Indicator */
.ananya-typing-row {
  margin-top: 4px;
}

.ananya-typing-bubble {
  background: #ffffff;
  border: 1px solid var(--ananya-border);
  padding: 10px 16px;
  border-radius: 18px;
  border-top-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ananya-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--ananya-accent);
  border-radius: 50%;
  animation: ananya-typing-bounce 1.4s infinite ease-in-out;
}

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

/* Interactive Tools Card (Calculator & Quiz) */
.ananya-tool-card {
  background: #FFFFFF;
  border: 1.5px solid #ECDDE6;
  border-radius: 16px;
  margin-top: 10px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(58, 20, 80, 0.08);
}

.ananya-tool-header {
  background: linear-gradient(135deg, #3A1450 0%, #68154D 100%);
  color: #ffffff;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ananya-tool-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ananya-tool-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ananya-text-dark);
  margin-bottom: 4px;
}

.ananya-tool-select, .ananya-tool-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--ananya-border);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ananya-text-dark);
  background: #FAF5F8;
  outline: none;
}

.ananya-tool-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ananya-text-dark);
  margin-bottom: 4px;
}

.ananya-tool-slider {
  width: 100%;
  accent-color: var(--ananya-accent);
}

.ananya-tool-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.ananya-calc-res-item {
  background: #FAF5F8;
  border: 1px solid #ECDDE6;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}

.ananya-calc-res-item span {
  display: block;
  font-size: 10.5px;
  color: var(--ananya-text-muted);
}

.ananya-calc-res-item strong {
  font-size: 13px;
  color: var(--ananya-primary);
}

.ananya-calc-res-item.is-highlight {
  background: #FDF2F8;
  border-color: var(--ananya-accent);
}

.ananya-calc-res-item.is-highlight strong {
  color: var(--ananya-accent);
}

.ananya-tool-action-btn {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #ffffff;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
  transition: all 0.2s ease;
}

.ananya-tool-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.45);
}

/* Quiz UI */
.ananya-quiz-q {
  font-size: 13px;
  font-weight: 700;
  color: var(--ananya-primary);
  margin-bottom: 8px;
}

.ananya-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ananya-quiz-opt {
  background: #FAF5F8;
  border: 1px solid #ECDDE6;
  border-radius: 8px;
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ananya-text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ananya-quiz-opt:hover {
  background: #FDF2F8;
  border-color: var(--ananya-accent);
  color: var(--ananya-accent);
  transform: translateX(4px);
}

/* Footer & Input Row */
.ananya-quick-actions-bar {
  display: flex;
  gap: 6px;
  padding: 6px 14px;
  background: #FAF5F8;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--ananya-border);
}

.ananya-quick-actions-bar::-webkit-scrollbar {
  display: none;
}

.ananya-chat-footer {
  background: #FFFFFF;
  border-top: 1px solid var(--ananya-border);
  padding: 10px 14px;
}

.ananya-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FAF5F8;
  border: 1.5px solid #ECDDE6;
  border-radius: 30px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s ease;
}

.ananya-input-row:focus-within {
  border-color: var(--ananya-accent);
  background: #FFFFFF;
}

.ananya-chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: var(--ananya-text-dark);
}

.ananya-mic-btn, .ananya-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ananya-mic-btn {
  background: none;
  color: var(--ananya-text-muted);
  font-size: 15px;
}

.ananya-mic-btn:hover {
  color: var(--ananya-accent);
}

.ananya-mic-btn.is-recording {
  background: #F43F5E;
  color: #ffffff;
  animation: ananya-mic-pulse 1.2s infinite;
}

.ananya-send-btn {
  background: var(--ananya-accent);
  color: #ffffff;
  font-size: 14px;
}

.ananya-send-btn:hover {
  background: var(--ananya-primary);
  transform: scale(1.06);
}

.ananya-footer-note {
  text-align: center;
  font-size: 10.5px;
  color: var(--ananya-text-muted);
  margin-top: 6px;
}

/* Animations */
@keyframes ananya-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes ananya-audio-dance {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

@keyframes ananya-typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

@keyframes ananya-mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

@keyframes ananya-bounce-in {
  0% { transform: scale(0.8) translateY(10px); opacity: 0; }
  60% { transform: scale(1.05) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .ananya-chat-window {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    bottom: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
  }
}
