@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600;700&family=Caveat:wght@600;700&display=swap');

/* CSS Styles for modular Ask Aii Financial Tutor widget */

:root {
  --aii-primary: #3b82f6;
  --aii-primary-rgb: 59, 130, 246;
  --aii-gold: #fbbf24;
  --aii-gold-rgb: 251, 191, 36;
  --aii-dark-bg: rgba(11, 15, 25, 0.85);
  --aii-light-bg: rgba(255, 255, 255, 0.85);
  --aii-border-dark: rgba(255, 255, 255, 0.08);
  --aii-border-light: rgba(0, 0, 0, 0.08);
  --aii-text-dark: #f3f4f6;
  --aii-text-light: #1f2937;
  --aii-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
  --aii-primary-glow: rgba(59, 130, 246, 0.08);
}

/* Floating Action Pill & Ark AI Launcher Widget — Completely Hidden */
.aii-launcher-btn,
.solark-thinking-widget {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
  height: auto;
  padding: 4px;
  border-radius: 30px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  z-index: 99999;
  transition: transform 0.25s ease;
  outline: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.aii-launcher-btn:focus,
.aii-launcher-btn:focus-visible,
.aii-launcher-btn:active {
  outline: none !important;
  outline-offset: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

body.light-theme .aii-launcher-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #0f172a;
}

body.light-theme .aii-launcher-btn:focus,
body.light-theme .aii-launcher-btn:focus-visible {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.aii-launcher-btn:hover {
  transform: translateY(-2px) scale(1.03);
  border: none !important;
  box-shadow: none !important;
}

/* Hide launcher on Askii.html page */
body.askii-page .aii-launcher-btn,
body.askii-page .aii-tooltip,
body.askii-page .solark-thinking-widget {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Solark AI Widget Structure with Askii Chatbox Siri Orb Animation */
.solark-thinking-widget {
  display: flex;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  height: auto !important;
}

.solark-siri-orb-box {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Scaled down Askii Siri Orb for Launcher Pill */
.solark-siri-orb-box .aii-siri-orb {
  width: 32px;
  height: 32px;
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.8), 0 0 30px rgba(56, 189, 248, 0.5), inset 0 0 12px rgba(255, 255, 255, 0.8);
}

.solark-siri-orb-box .aii-siri-orb-core {
  width: 12px;
  height: 12px;
}

.solark-siri-orb-box .aii-siri-orb-ring.ring-1 {
  inset: -4px;
}

.solark-siri-orb-box .aii-siri-orb-ring.ring-2 {
  inset: -7px;
}

.solark-siri-orb-box .aii-siri-orb-glow {
  inset: -8px;
}

/* Thinking & Stopped States for Launcher Siri Orb */
.aii-launcher-btn.is-thinking .aii-siri-orb,
.aii-launcher-btn.is-thinking .aii-siri-orb-plasma,
.aii-launcher-btn.is-thinking .aii-siri-orb-core,
.aii-launcher-btn.is-thinking .aii-siri-orb-sparkle,
.aii-launcher-btn.is-thinking .aii-siri-orb-glow,
.aii-launcher-btn.is-thinking .aii-siri-orb-ring,
.aii-launcher-btn.is-thinking .aii-siri-orb-wave {
  animation-play-state: running !important;
  opacity: 1 !important;
}

.aii-launcher-btn.is-stopped .aii-siri-orb,
.aii-launcher-btn.is-stopped .aii-siri-orb-plasma,
.aii-launcher-btn.is-stopped .aii-siri-orb-core,
.aii-launcher-btn.is-stopped .aii-siri-orb-sparkle,
.aii-launcher-btn.is-stopped .aii-siri-orb-glow,
.aii-launcher-btn.is-stopped .aii-siri-orb-ring,
.aii-launcher-btn.is-stopped .aii-siri-orb-wave {
  animation-play-state: paused !important;
  filter: hue-rotate(0deg) opacity(0.65) !important;
}

.solark-thinking-text-group {
  display: flex;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1.25 !important;
}

.solark-thinking-title {
  font-family: 'Dancing Script', 'Caveat', 'Brush Script MT', cursive !important;
  font-weight: 700 !important;
  font-size: 19px !important;
  letter-spacing: 0.4px !important;
  background: linear-gradient(90deg, #fbbf24 0%, #10b981 33%, #3b82f6 66%, #fbbf24 100%) !important;
  background-size: 200% auto !important;
  color: transparent !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  animation: textShimmer 3s infinite linear !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.ark-ai-sup {
  font-size: 0.55em !important;
  font-weight: 800 !important;
  vertical-align: super !important;
  line-height: 0 !important;
  margin-left: 2px !important;
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  background: linear-gradient(90deg, #3b82f6 0%, #818cf8 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  text-transform: none !important;
}

body.light-theme .solark-thinking-title {
  background: linear-gradient(90deg, #d97706 0%, #059669 33%, #2563eb 66%, #d97706 100%) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  animation: textShimmer 3s infinite linear !important;
}

.solark-thinking-status {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.2px;
  transition: all 0.3s ease;
}

body.light-theme .solark-thinking-status {
  color: #64748b;
}

.solark-thinking-dots {
  display: inline-flex;
  gap: 2px;
  transition: opacity 0.3s ease;
}

.solark-thinking-dots .dot {
  font-size: 12px;
  line-height: 1;
  color: #fbbf24;
  animation: solarkDotBounce 1.8s infinite ease-in-out;
}

.solark-thinking-dots .dot.d1 { animation-delay: 0s; }
.solark-thinking-dots .dot.d2 { animation-delay: 0.3s; }
.solark-thinking-dots .dot.d3 { animation-delay: 0.6s; }

@keyframes solarkDotBounce {
  0%, 80%, 100% {
    transform: translateY(0) scale(0.8);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-3px) scale(1.3);
    opacity: 1;
    color: #fbbf24;
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.9));
  }
}

.aii-launcher-btn:focus-visible {
  outline: 3px solid var(--aii-primary);
  outline-offset: 3px;
}

.aii-launcher-btn svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--aii-gold);
  stroke-width: 2;
  transition: transform 0.3s ease;
}

.aii-launcher-btn:hover svg {
  transform: rotate(10deg);
}

/* Pulse Glow Rings (Disabled to remove 3-second oval border pulse) */
.aii-launcher-btn::after,
.aii-launcher-btn::before {
  display: none !important;
  content: none !important;
  border: none !important;
  animation: none !important;
  opacity: 0 !important;
}

/* Unread Badge */
.aii-unread-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background-color: var(--aii-gold);
  border-radius: 50%;
  border: 2px solid #0b0f19;
  box-shadow: 0 0 8px var(--aii-gold);
  animation: aii-badge-glow 2s infinite alternate;
}

/* Tooltip / Caption Pill */
.aii-tooltip {
  position: fixed;
  bottom: 95px;
  right: 24px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #f3f4f6;
  padding: 8px 14px;
  border-radius: 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(251, 191, 36, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 99998;
  white-space: nowrap;
}

.aii-tooltip.solark-caption-visible,
.aii-launcher-btn:hover ~ .aii-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.aii-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 420px;
  height: 650px;
  max-height: calc(100vh - 120px);
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.9) translateY(40px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Inter', sans-serif;
  color: var(--aii-text-dark);
}

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

/* Light Theme overrides dynamically */
body.light-theme .aii-chat-window {
  background: rgba(255, 255, 255, 0.65) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: var(--aii-text-light);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.6) !important;
}

body.light-theme .aii-launcher-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 244, 248, 0.95) 100%);
  box-shadow: 0 4px 20px rgba(0, 114, 255, 0.15), 0 0 10px rgba(251, 191, 36, 0.15);
  border-color: var(--aii-primary);
}

body.light-theme .aii-launcher-btn svg {
  stroke: var(--aii-primary);
}

body.light-theme .aii-launcher-btn::after {
  border-color: var(--aii-primary);
}

body.light-theme .aii-tooltip {
  background: var(--aii-light-bg);
  border-color: var(--aii-border-light);
  color: var(--aii-text-light);
}

/* Chat Header */
.aii-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  background: rgba(15, 23, 42, 0.3);
}

body.light-theme .aii-header {
  border-bottom-color: rgba(0, 0, 0, 0.05);
  background: rgba(241, 245, 249, 0.5);
}

.aii-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.aii-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.aii-action-btn:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.4);
  color: #38bdf8;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

body.light-theme .aii-action-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #475569;
}

body.light-theme .aii-action-btn:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.3);
  color: #2563eb;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.15);
}

.aii-avatar-container {
  position: relative;
  width: 40px;
  height: 40px;
}

.aii-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  border: 1.5px solid var(--aii-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.aii-avatar.typing-pulse {
  animation: aii-avatar-pulse 1.5s infinite ease-in-out;
}

.aii-avatar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
}

.aii-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background-color: #10b981;
  border-radius: 50%;
  border: 2px solid #0f172a;
}

body.light-theme .aii-status-dot {
  border-color: #fff;
}

.aii-header-info {
  display: flex;
  flex-direction: column;
}

.aii-header-title,
.shining-ai-badge {
  font-family: 'Dancing Script', 'Caveat', 'Brush Script MT', cursive !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  margin: 0;
  line-height: 1.2;
}

.aii-header-title.ark-header {
  font-family: 'Outfit', sans-serif !important;
  font-size: 14.5px !important;
  font-weight: 900 !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.04em !important;
  background: rgba(0, 225, 255, 0.08) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 225, 255, 0.35) !important;
  border-radius: 50px !important;
  padding: 6px 14px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 12px rgba(0, 225, 255, 0.2) !important;
  white-space: nowrap;
  line-height: 1.3;
}

body.light-theme .aii-header-title.ark-header {
  background: rgba(37, 99, 235, 0.08) !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1) !important;
}

.shining-ai-sup {
  color: #10b981 !important;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  font-size: 0.62em !important;
  font-weight: 900 !important;
  margin-left: 1.5px;
  vertical-align: super;
  top: -0.4em;
  text-transform: lowercase !important;
}

.aii-header-actions,
.aii-chat-header-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  width: auto !important;
}
.aii-header-actions .aii-action-btn,
.aii-chat-header-actions .aii-action-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

/* Header bottom animated gradient line removed for cleaner flow */
.aii-header::after {
  display: none !important;
}

/* Chat History / Scrollable Area */
.aii-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Scrollbar styles */
.aii-chat-body::-webkit-scrollbar {
  width: 5px;
}

.aii-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.aii-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

body.light-theme .aii-chat-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

/* Welcome Screen */
.aii-welcome-screen {
  text-align: center;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.aii-welcome-emoji {
  font-size: 32px;
  animation: aii-wave 2s infinite alternate;
  transform-origin: 70% 70%;
}

.aii-welcome-text h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
}

.aii-welcome-text p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  max-width: 90%;
}

/* Suggestion Chips */
.aii-chips-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--aii-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 10px;
  margin-bottom: 2px;
}

.aii-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 95%;
  margin-bottom: 10px;
}

.aii-chip {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
  padding: 10px 16px !important;
  border-radius: 16px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  white-space: normal;
  text-align: center;
  line-height: 1.35;
}

.aii-chip:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.15) 100%) !important;
  border-color: rgba(251, 191, 36, 0.6) !important;
  color: #fbbf24 !important;
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow: 0 8px 25px rgba(251, 191, 36, 0.25) !important;
}

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

@keyframes aiiEmojiBounce {
  0% {
    transform: translateY(0) scale(1) rotate(0deg);
    filter: drop-shadow(0 4px 10px rgba(251,191,36,0.3));
  }
  50% {
    transform: translateY(-8px) scale(1.08) rotate(5deg);
    filter: drop-shadow(0 12px 24px rgba(251,191,36,0.5));
  }
  100% {
    transform: translateY(0) scale(1) rotate(-3deg);
    filter: drop-shadow(0 4px 10px rgba(251,191,36,0.3));
  }
}

body.light-theme .aii-chip {
  background: rgba(0, 0, 0, 0.02);
  border-color: var(--aii-border-light);
}

body.light-theme .aii-chip:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--aii-primary);
}

/* Date Separator */
.aii-date-separator {
  text-align: center;
  position: relative;
  margin: 10px 0;
}

.aii-date-separator::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--aii-border-dark);
  z-index: 1;
}

body.light-theme .aii-date-separator::before {
  background: var(--aii-border-light);
}

.aii-date-text {
  position: relative;
  background: #0b0f19;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 12px;
  border: 1px solid var(--aii-border-dark);
  display: inline-block;
  z-index: 2;
}

body.light-theme .aii-date-text {
  background: #fff;
  border-color: var(--aii-border-light);
}

/* Messages */
.aii-message-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.aii-message-row.user {
  justify-content: flex-end;
}

.aii-message-row.ai {
  justify-content: flex-start;
}

.aii-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--aii-primary);
  border: 1px solid var(--aii-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.aii-msg-avatar svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.2;
}

.aii-msg-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  animation: aii-bubble-in 0.25s ease-out;
  word-wrap: break-word;
}

.aii-message-row.user .aii-msg-bubble {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #ffffff;
  border-radius: 50px 50px 8px 50px;
  padding: 9px 18px;
  width: fit-content;
  max-width: 82%;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.32);
}

.aii-message-row.ai .aii-msg-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--aii-border-dark);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

body.light-theme .aii-message-row.ai .aii-msg-bubble {
  background: rgba(0, 0, 0, 0.03);
  border-color: var(--aii-border-light);
}

/* Markdown Rendering inside bubble */
.aii-msg-bubble p {
  margin: 0 0 10px;
}

.aii-msg-bubble p:last-child {
  margin-bottom: 0;
}

.aii-msg-bubble strong {
  color: var(--aii-gold);
}

body.light-theme .aii-message-row.user .aii-msg-bubble strong {
  color: #fff;
}

body.light-theme .aii-message-row.ai .aii-msg-bubble strong {
  color: var(--aii-primary);
  font-weight: 700;
}

.aii-msg-bubble ul, .aii-msg-bubble ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.aii-msg-bubble li {
  margin-bottom: 5px;
}

.aii-msg-bubble pre {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 10px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 12px;
  margin: 10px 0;
  border: 1px solid var(--aii-border-dark);
}

.aii-msg-bubble code {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
}

body.light-theme .aii-msg-bubble code {
  background: rgba(0, 0, 0, 0.06);
}

/* Rich Markdown Typography & Elements inside Askii AI Chat Bubble */
.aii-md-h1, .aii-md-h2, .aii-md-h3 {
  margin: 12px 0 6px 0;
  font-weight: 800;
  line-height: 1.3;
}

.aii-md-h1 {
  font-size: 16px;
  color: #60a5fa;
}

.aii-md-h2 {
  font-size: 15px;
  color: #3b82f6;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  padding-bottom: 4px;
}

.aii-md-h3 {
  font-size: 14px;
  color: #60a5fa;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.light-theme .aii-md-h1 { color: #1e40af; }
body.light-theme .aii-md-h2 { color: #1d4ed8; border-bottom-color: rgba(37, 99, 235, 0.15); }
body.light-theme .aii-md-h3 { color: #2563eb; }

.aii-md-hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
  margin: 12px 0;
}
body.light-theme .aii-md-hr {
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.2), transparent);
}

/* Scrollable Glassmorphic Markdown Table */
.aii-table-wrapper {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
body.light-theme .aii-table-wrapper {
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.aii-md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.aii-md-table th {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}
body.light-theme .aii-md-table th {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.aii-md-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
body.light-theme .aii-md-table td {
  border-bottom-color: rgba(0, 0, 0, 0.04);
  color: #1e293b;
}

.aii-md-table tr:last-child td {
  border-bottom: none;
}

.aii-msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}

.aii-msg-bubble th, .aii-msg-bubble td {
  border: 1px solid var(--aii-border-dark);
  padding: 6px 10px;
  text-align: left;
}

body.light-theme .aii-msg-bubble th, body.light-theme .aii-msg-bubble td {
  border-color: var(--aii-border-light);
}

.aii-msg-bubble th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
}

body.light-theme .aii-msg-bubble th {
  background: rgba(0, 0, 0, 0.03);
}

.aii-msg-bubble a {
  color: var(--aii-gold);
  text-decoration: underline;
}

body.light-theme .aii-msg-bubble a {
  color: var(--aii-primary);
}

/* Local Article Match card style */
.aii-local-match-card {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aii-local-match-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--aii-primary);
  text-transform: uppercase;
}

.aii-local-match-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--aii-gold) !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body.light-theme .aii-local-match-link {
  color: var(--aii-primary) !important;
}

/* Expandable Definition Cards */
.aii-def-card {
  margin-top: 10px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.15);
  border-radius: 12px;
  overflow: hidden;
}

.aii-def-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--aii-gold);
}

body.light-theme .aii-def-header {
  color: #c29d00;
}

.aii-def-icon {
  transition: transform 0.2s ease;
}

.aii-def-card.expanded .aii-def-icon {
  transform: rotate(180deg);
}

.aii-def-body {
  padding: 0 14px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  display: none;
  border-top: 1px dashed rgba(251, 191, 36, 0.1);
}

.aii-def-card.expanded .aii-def-body {
  display: block;
}

/* Typing Indicator Bubble */
.aii-typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 6px;
}

.aii-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  opacity: 0.6;
  animation: aii-typing-bounce 1.4s infinite ease-in-out both;
}

.aii-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.aii-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* Sticky bottom controls + input container */
.aii-bottom-container {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.light-theme .aii-bottom-container {
  border-top-color: rgba(0, 0, 0, 0.05);
  background: rgba(248, 250, 252, 0.8);
}

/* Quick Actions shortcuts */
.aii-quick-actions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

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

.aii-action-pill {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--aii-border-dark);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.aii-action-pill:hover {
  border-color: var(--aii-gold);
  color: var(--aii-gold);
  background: rgba(251, 191, 36, 0.05);
}

body.light-theme .aii-action-pill {
  background: rgba(0, 0, 0, 0.01);
  border-color: var(--aii-border-light);
}

body.light-theme .aii-action-pill:hover {
  border-color: var(--aii-primary);
  color: var(--aii-primary);
  background: rgba(59, 130, 246, 0.05);
}

/* Input Form block */
.aii-input-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  position: relative;
}

.aii-textarea-wrapper {
  flex: 1;
  position: relative;
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  display: flex;
  align-items: flex-end;
  padding: 5px 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.light-theme .aii-textarea-wrapper {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.aii-textarea-wrapper:focus-within {
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25), inset 0 0 6px rgba(245, 158, 11, 0.08);
}

body.light-theme .aii-textarea-wrapper:focus-within {
  border-color: rgba(245, 158, 11, 0.75);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.22);
}

.aii-input-form textarea,
.aii-input-form textarea:focus,
.aii-input-form textarea:focus-visible,
.aii-input-form textarea:active {
  width: 100%;
  border: none !important;
  background: transparent !important;
  color: var(--aii-text-dark);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.1px;
  max-height: 120px;
  min-height: 26px;
  resize: none;
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  padding: 6px 0;
  box-sizing: border-box;
}

body.light-theme .aii-input-form textarea {
  color: var(--aii-text-light);
}

.aii-input-form textarea::placeholder {
  color: rgba(156, 163, 175, 0.75);
  font-weight: 400;
}

body.light-theme .aii-input-form textarea::placeholder {
  color: rgba(100, 116, 139, 0.75);
  font-weight: 400;
}

.aii-char-counter {
  position: absolute;
  right: 14px;
  bottom: -15px;
  font-size: 9px;
  color: var(--text-secondary);
  opacity: 0.7;
}

.aii-input-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.aii-input-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--aii-gold);
}

body.light-theme .aii-input-icon-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.aii-send-btn {
  background: var(--aii-primary);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
  margin-bottom: 2px;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
}

.aii-send-btn:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.aii-send-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

body.light-theme .aii-send-btn:disabled {
  background: rgba(0, 0, 0, 0.05);
}

.aii-send-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  transform: translate(1px, -0.5px);
}

/* Disclaimer notice */
.aii-disclaimer-bubble {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.85;
  text-align: center;
  line-height: 1.3;
  margin-top: 2px;
}

/* Animations */
@keyframes aii-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes aii-pulse-ring {
  0% { transform: scale(0.95); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 0; }
}

@keyframes aii-badge-glow {
  0% { opacity: 0.7; box-shadow: 0 0 4px var(--aii-gold); }
  100% { opacity: 1; box-shadow: 0 0 12px var(--aii-gold); }
}

@keyframes aii-gradient-slide {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

@keyframes aii-avatar-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(251, 191, 36, 0.3); transform: scale(1); }
  50% { box-shadow: 0 0 16px rgba(251, 191, 36, 0.6); transform: scale(1.03); }
}

@keyframes aii-bubble-in {
  0% { transform: scale(0.96) translateY(5px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes aii-typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@keyframes aii-wave {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(15deg); }
}

/* Accessibility / Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .aii-launcher-btn, .aii-chat-window, .aii-welcome-emoji, .aii-avatar, .aii-send-btn, .aii-typing-dot {
    animation: none !important;
    transition: none !important;
  }
}

/* Mobile Responsive Layout overrides */
@media (max-width: 768px) {
  .aii-launcher-btn {
    position: fixed !important;
    bottom: 20px !important;
    right: 18px !important;
    width: auto !important;
    height: auto !important;
    padding: 8px 12px !important;
    border-radius: 20px !important;
    background: rgba(11, 15, 25, 0.75) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    z-index: 99999 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
  }
  
  body.light-theme .aii-launcher-btn {
    background: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
  }

  .aii-tooltip {
    position: fixed !important;
    bottom: 86px !important;
    right: 18px !important;
    font-size: 12px !important;
    z-index: 99998 !important;
  }
  .aii-chat-window {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
  }
  .aii-chat-body {
    padding: 16px 14px !important;
    flex: 1 !important;
  }
  .aii-bottom-container {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    position: sticky !important;
    bottom: 0 !important;
    background: rgba(11, 15, 25, 0.95) !important;
  }
  .aii-msg-content-wrapper {
    max-width: 88% !important;
  }
}

/* Content wrapper styling to separate answer bubble and cards/suggestions */
.aii-msg-content-wrapper {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aii-msg-content-wrapper .aii-msg-bubble {
  max-width: 100%;
}

/* Suggestion link buttons inside chatbox */
.aii-suggestion-link {
  display: inline-block;
  margin: 4px 2px;
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 20px;
  color: var(--aii-gold) !important;
  text-decoration: none !important;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.aii-suggestion-link:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--aii-gold);
}
body.light-theme .aii-suggestion-link {
  color: var(--aii-primary) !important;
  background: rgba(0, 0, 0, 0.03);
}
body.light-theme .aii-suggestion-link:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Right Panel Insights & Smart Follow-ups Professional Card Styling */
.right-insight-block {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-bottom: 20px !important;
  width: 100% !important;
}

.right-insight-header {
  font-family: 'Outfit', sans-serif !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.6px !important;
  text-transform: uppercase !important;
  color: #64748b !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-bottom: 4px !important;
}
body.light-theme .right-insight-header {
  color: #475569 !important;
}

.right-insight-buttons {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  width: 100% !important;
}

.right-insight-btn {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  width: 100% !important;
  padding: 12px 16px !important;
  border-radius: 12px !important;
  font-family: 'Outfit', 'Inter', sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.45 !important;
  text-align: left !important;
  color: #0f172a !important;
  background: rgba(59, 130, 246, 0.06) !important;
  border: 1px solid rgba(59, 130, 246, 0.16) !important;
  cursor: pointer !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02) !important;
  box-sizing: border-box !important;
  word-break: break-word !important;
}

.right-insight-btn:hover {
  background: rgba(59, 130, 246, 0.14) !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
  color: #2563eb !important;
  transform: translateY(-1px) translateX(2px) !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.14) !important;
}

.right-insight-btn span {
  font-size: 14px !important;
  flex-shrink: 0 !important;
  margin-top: 1px !important;
}

/* Dark mode right-insight-btn */
body:not(.light-theme) .right-insight-btn,
.dark-theme .right-insight-btn {
  background: rgba(30, 41, 59, 0.6) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

body:not(.light-theme) .right-insight-btn:hover,
.dark-theme .right-insight-btn:hover {
  background: rgba(59, 130, 246, 0.22) !important;
  border-color: rgba(59, 130, 246, 0.45) !important;
  color: #60a5fa !important;
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.25) !important;
}

/* ─── Stock Level Pill Grid ──────────────────────────────── */
.aii-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 14px 0 4px;
  padding: 0 4px;
}

.aii-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 50px;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none !important;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.18s cubic-bezier(0.16,1,0.3,1),
              box-shadow 0.18s ease,
              background 0.18s ease,
              border-color 0.18s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.aii-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.18s ease;
  background: rgba(255,255,255,0.08);
}
.aii-pill:hover::before { opacity: 1; }
.aii-pill:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 22px rgba(0,0,0,0.28);
}
.aii-pill:active { transform: translateY(0) scale(0.98); }

.aii-pill-sub {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.78;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.18);
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 2px;
}

/* Green — Conservative */
.aii-pill-green {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: rgba(16,185,129,0.5);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(16,185,129,0.30);
}
.aii-pill-green:hover { box-shadow: 0 6px 22px rgba(16,185,129,0.45); border-color: #10b981; }

/* Blue — Moderate */
.aii-pill-blue {
  background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
  border-color: rgba(96,165,250,0.5);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(37,99,235,0.30);
}
.aii-pill-blue:hover { box-shadow: 0 6px 22px rgba(37,99,235,0.45); border-color: #60a5fa; }

/* Orange — Aggressive */
.aii-pill-orange {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  border-color: rgba(245,158,11,0.5);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(217,119,6,0.30);
}
.aii-pill-orange:hover { box-shadow: 0 6px 22px rgba(217,119,6,0.45); border-color: #f59e0b; }

/* Red — Stop Loss */
.aii-pill-red {
  background: linear-gradient(135deg, #dc2626 0%, #f87171 100%);
  border-color: rgba(248,113,113,0.5);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(220,38,38,0.30);
}
.aii-pill-red:hover { box-shadow: 0 6px 22px rgba(220,38,38,0.45); border-color: #f87171; }

/* Purple — Show All */
.aii-pill-purple {
  background: linear-gradient(135deg, #7c3aed 0%, #c084fc 100%);
  border-color: rgba(192,132,252,0.5);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(124,58,237,0.30);
}
.aii-pill-purple:hover { box-shadow: 0 6px 22px rgba(124,58,237,0.45); border-color: #c084fc; }

/* Gray / Slate — Another Stock */
.aii-pill-gray {
  background: linear-gradient(135deg, #475569 0%, #64748b 100%);
  border-color: rgba(148,163,184,0.5);
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(71,85,105,0.30);
}
.aii-pill-gray:hover { box-shadow: 0 6px 22px rgba(71,85,105,0.45); border-color: #94a3b8; }

/* Light theme — pills stay vivid, just slightly adjusted shadow */
body.light-theme .aii-pill-green  { box-shadow: 0 3px 14px rgba(16,185,129,0.25); }
body.light-theme .aii-pill-blue   { box-shadow: 0 3px 14px rgba(37,99,235,0.25); }
body.light-theme .aii-pill-orange { box-shadow: 0 3px 14px rgba(217,119,6,0.25); }
body.light-theme .aii-pill-red    { box-shadow: 0 3px 14px rgba(220,38,38,0.25); }
body.light-theme .aii-pill-purple { box-shadow: 0 3px 14px rgba(124,58,237,0.25); }
body.light-theme .aii-pill-gray   { box-shadow: 0 3px 14px rgba(71,85,105,0.25); }

body.light-theme .aii-pill-green:hover  { box-shadow: 0 6px 22px rgba(16,185,129,0.38); }
body.light-theme .aii-pill-blue:hover   { box-shadow: 0 6px 22px rgba(37,99,235,0.38); }
body.light-theme .aii-pill-orange:hover { box-shadow: 0 6px 22px rgba(217,119,6,0.38); }
body.light-theme .aii-pill-red:hover    { box-shadow: 0 6px 22px rgba(220,38,38,0.38); }
body.light-theme .aii-pill-purple:hover { box-shadow: 0 6px 22px rgba(124,58,237,0.38); }
body.light-theme .aii-pill-gray:hover   { box-shadow: 0 6px 22px rgba(71,85,105,0.38); }

@media (max-width: 480px) {
  .aii-pill-grid { gap: 8px; }
  .aii-pill { padding: 9px 16px; font-size: 12.5px; }
  .aii-pill-sub { font-size: 9px; padding: 2px 5px; }
}

/* ─── Skeleton Shimmer (image-generation waiting state) ─── */
.aii-pill-skeleton-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin: 14px 0 4px;
  padding: 0 4px;
}

.aii-pill-skeleton {
  height: 44px;
  width: min(220px, 80%);
  border-radius: 50px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.13) 40%,
    rgba(255,255,255,0.04) 80%
  );
  background-size: 300% 100%;
  animation: aii-shimmer 1.6s ease-in-out infinite;
}

body.light-theme .aii-pill-skeleton {
  background: linear-gradient(
    90deg,
    rgba(0,0,0,0.05) 0%,
    rgba(0,0,0,0.13) 40%,
    rgba(0,0,0,0.05) 80%
  );
  background-size: 300% 100%;
  animation: aii-shimmer 1.6s ease-in-out infinite;
}

/* Stagger each skeleton's shimmer */
.aii-pill-skeleton:nth-child(2) { animation-delay: 0.15s; width: min(195px, 73%); }
.aii-pill-skeleton:nth-child(3) { animation-delay: 0.30s; width: min(210px, 78%); }
.aii-pill-skeleton:nth-child(4) { animation-delay: 0.45s; width: min(180px, 68%); }
.aii-pill-skeleton:nth-child(5) { animation-delay: 0.60s; width: min(200px, 76%); }

.aii-pill-gen-label {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
  margin-top: 6px;
  animation: aii-gen-pulse 1.8s ease-in-out infinite;
}
body.light-theme .aii-pill-gen-label {
  color: rgba(0,0,0,0.2);
}

@keyframes aii-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes aii-gen-pulse {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 1; }
}

/* ─── Pixel / blur reveal when real pills appear ─── */
.aii-pill-grid-reveal {
  animation: aii-grid-reveal 0.6s cubic-bezier(0.16,1,0.3,1) forwards;
}

.aii-pill-grid-reveal .aii-pill {
  animation: aii-pill-pop 0.55s cubic-bezier(0.16,1,0.3,1) both;
  animation-fill-mode: both;
}
.aii-pill-grid-reveal .aii-pill:nth-child(1) { animation-delay: 0.00s; }
.aii-pill-grid-reveal .aii-pill:nth-child(2) { animation-delay: 0.07s; }
.aii-pill-grid-reveal .aii-pill:nth-child(3) { animation-delay: 0.14s; }
.aii-pill-grid-reveal .aii-pill:nth-child(4) { animation-delay: 0.21s; }
.aii-pill-grid-reveal .aii-pill:nth-child(5) { animation-delay: 0.28s; }

@keyframes aii-grid-reveal {
  0%   { filter: blur(18px) saturate(0); opacity: 0; transform: scale(0.92); }
  50%  { filter: blur(5px) saturate(0.5); opacity: 0.8; transform: scale(0.98); }
  100% { filter: blur(0)  saturate(1);   opacity: 1; transform: scale(1); }
}

@keyframes aii-pill-pop {
  0%   { transform: scale(0.55) translateY(10px); opacity: 0; filter: blur(10px); }
  65%  { transform: scale(1.06) translateY(-3px); opacity: 1; filter: blur(0); }
  100% { transform: scale(1)    translateY(0);    opacity: 1; filter: blur(0); }
}

/* Dynamic Suggestion Autocomplete Chips */
.aii-suggestion-chip {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(251, 191, 36, 0.08);
  border: 1.5px solid rgba(251, 191, 36, 0.3);
  border-radius: 16px;
  color: #fbbf24;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.aii-suggestion-chip:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: #fbbf24;
  transform: translateY(-1px);
}

body.light-theme .aii-suggestion-chip {
  background: rgba(180, 83, 9, 0.05);
  border-color: rgba(180, 83, 9, 0.25);
  color: #b45309;
}

body.light-theme .aii-suggestion-chip:hover {
  background: rgba(180, 83, 9, 0.1);
  border-color: #b45309;
}

/* Siri-like Advanced Liquid Plasma Orb Above Search Box */
.aii-siri-orb-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 12px;
  animation: siri-fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.aii-siri-orb {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #38bdf8 0%, #818cf8 25%, #c084fc 50%, #f472b6 75%, #fbbf24 100%);
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.45);
  animation: siri-orb-morph 4s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate, siri-orb-hue 8s linear infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

/* Inner Plasma Fluid Swirl */
.aii-siri-orb-plasma {
  position: absolute;
  inset: 2px;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  background: conic-gradient(from 0deg, #38bdf8, #818cf8, #f472b6, #fbbf24, #10b981, #38bdf8);
  mix-blend-mode: overlay;
  opacity: 0.85;
  animation: siri-plasma-rotate 3s linear infinite;
  transform: translateZ(0);
  will-change: transform;
}

/* Outer Orbital Liquid Rings */
.aii-siri-orb-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  pointer-events: none;
  transform: translateZ(0);
}

.aii-siri-orb-ring.ring-1 {
  border-top-color: rgba(56, 189, 248, 0.9);
  border-right-color: rgba(244, 114, 182, 0.9);
  animation: siri-ring-spin-1 2.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

.aii-siri-orb-ring.ring-2 {
  inset: -10px;
  border-bottom-color: rgba(251, 191, 36, 0.85);
  border-left-color: rgba(192, 132, 252, 0.85);
  animation: siri-ring-spin-2 3.8s ease-in-out infinite reverse;
  box-shadow: 0 0 6px rgba(192, 132, 252, 0.4);
}

/* Glowing Pulsing Core */
.aii-siri-orb-core {
  position: relative;
  z-index: 3;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, rgba(255, 255, 255, 0.95) 45%, rgba(244, 114, 182, 0.6) 80%, transparent 100%);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  animation: siri-core-pulse 1.6s ease-in-out infinite alternate;
}

/* Sparkling Star Rays Effect */
.aii-siri-orb-sparkle {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.aii-siri-orb-sparkle::before,
.aii-siri-orb-sparkle::after {
  content: '';
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px #ffffff;
  animation: siri-sparkle-flash 1.8s ease-in-out infinite alternate;
}

.aii-siri-orb-sparkle::before {
  width: 2px;
  height: 26px;
}

.aii-siri-orb-sparkle::after {
  width: 26px;
  height: 2px;
}

/* Ambient Backlight Glow */
.aii-siri-orb-glow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.35) 0%, rgba(129, 140, 248, 0.25) 45%, rgba(56, 189, 248, 0.1) 75%, transparent 100%);
  animation: siri-glow-pulse 2.2s ease-in-out infinite alternate;
}

/* Shockwave Ripples */
.aii-siri-orb-wave {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(192, 132, 252, 0.7);
  opacity: 0;
  animation: siri-wave-expand 2.4s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.aii-siri-orb-wave.wave-2 {
  animation-delay: 0.8s;
  border-color: rgba(56, 189, 248, 0.7);
}

.aii-siri-orb-wave.wave-3 {
  animation-delay: 1.6s;
  border-color: rgba(244, 114, 182, 0.7);
}

/* Pause animations when Siri Orb is not actively thinking */
.aii-siri-orb,
.aii-siri-orb-plasma,
.aii-siri-orb-core,
.aii-siri-orb-glow,
.aii-siri-orb-ring,
.aii-siri-orb-wave,
.aii-siri-orb-sparkle::before,
.aii-siri-orb-sparkle::after {
  animation-play-state: paused !important;
}

.aii-siri-orb-wrapper.is-thinking .aii-siri-orb,
.aii-siri-orb-wrapper.is-thinking .aii-siri-orb-plasma,
.aii-siri-orb-wrapper.is-thinking .aii-siri-orb-core,
.aii-siri-orb-wrapper.is-thinking .aii-siri-orb-glow,
.aii-siri-orb-wrapper.is-thinking .aii-siri-orb-ring,
.aii-siri-orb-wrapper.is-thinking .aii-siri-orb-wave,
.aii-siri-orb-wrapper.is-thinking .aii-siri-orb-sparkle::before,
.aii-siri-orb-wrapper.is-thinking .aii-siri-orb-sparkle::after {
  animation-play-state: running !important;
}

.aii-siri-status-text {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #c084fc, #f472b6, #fbbf24, #38bdf8);
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: siri-text-shine 2.2s linear infinite;
  text-shadow: 0 0 12px rgba(192, 132, 252, 0.2);
}

@keyframes siri-orb-morph {
  0% { transform: scale(0.9) rotate(0deg); border-radius: 42% 58% 65% 35% / 45% 55% 45% 55%; }
  33% { transform: scale(1.08) rotate(120deg); border-radius: 65% 35% 45% 55% / 55% 45% 60% 40%; }
  66% { transform: scale(0.96) rotate(240deg); border-radius: 50% 50% 35% 65% / 40% 60% 50% 50%; }
  100% { transform: scale(1.04) rotate(360deg); border-radius: 58% 42% 55% 45% / 50% 45% 55% 50%; }
}

@keyframes siri-orb-hue {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

@keyframes siri-plasma-rotate {
  0% { transform: rotate(0deg) scale(0.95); }
  50% { transform: rotate(180deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(0.95); }
}

@keyframes siri-ring-spin-1 {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes siri-ring-spin-2 {
  0% { transform: rotate(0deg) scale(1.05); }
  50% { transform: rotate(-180deg) scale(0.95); }
  100% { transform: rotate(-360deg) scale(1.05); }
}

@keyframes siri-core-pulse {
  0% { transform: scale(0.75); opacity: 0.7; box-shadow: 0 0 10px #ffffff; }
  100% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 22px #ffffff, 0 0 30px #f472b6; }
}

@keyframes siri-sparkle-flash {
  0% { opacity: 0.3; transform: rotate(0deg) scale(0.7); }
  100% { opacity: 1; transform: rotate(90deg) scale(1.2); }
}

@keyframes siri-glow-pulse {
  0% { opacity: 0.35; transform: scale(0.85); }
  100% { opacity: 0.9; transform: scale(1.2); }
}

@keyframes siri-wave-expand {
  0% { transform: scale(0.7); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}

@keyframes siri-text-shine {
  0% { background-position: 0% 50%; }
  100% { background-position: 250% 50%; }
}

@keyframes siri-text-shine {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@keyframes siri-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Welcome Screen Theme-Responsive Colors */
.aii-welcome-title {
  color: #fbbf24 !important;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

body.light-theme .aii-welcome-title {
  color: #d97706 !important;
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.aii-welcome-desc {
  color: #94a3b8 !important;
}

body.light-theme .aii-welcome-desc {
  color: #475569 !important;
}

/* Premium Price Edit Card Styles */
.aii-price-edit-card {
  background: rgba(30, 41, 59, 0.45) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
  padding: 18px 20px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  margin-top: 10px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

body.light-theme .aii-price-edit-card {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06) !important;
}

.aii-price-edit-card-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #f1f5f9 !important;
  text-align: center !important;
  font-family: 'Outfit', sans-serif !important;
  letter-spacing: 0.2px !important;
}

body.light-theme .aii-price-edit-card-title {
  color: #0f172a !important;
}

/* Price Box & Slider Section */
.aii-price-section {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
  gap: 6px !important;
}

.aii-price-input-row {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
}

.aii-price-edit-label {
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: #94a3b8 !important;
}

body.light-theme .aii-price-edit-label {
  color: #475569 !important;
}

.aii-price-edit-input {
  background: rgba(251, 191, 36, 0.06) !important;
  border: 1.5px solid rgba(251, 191, 36, 0.3) !important;
  border-radius: 50px !important;
  padding: 6px 16px !important;
  color: #fbbf24 !important;
  min-width: 90px !important;
  max-width: 220px !important;
  width: auto !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  text-align: center !important;
  outline: none !important;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1) !important;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.1) !important;
  font-family: 'Outfit', sans-serif !important;
}

body.light-theme .aii-price-edit-input {
  background: rgba(180, 83, 9, 0.04) !important;
  border-color: rgba(180, 83, 9, 0.25) !important;
  color: #b45309 !important;
  box-shadow: 0 0 12px rgba(180, 83, 9, 0.06) !important;
}

.aii-price-slider-row {
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
}

.aii-price-slider {
  min-width: 90px !important;
  max-width: 220px !important;
  width: 100% !important;
  height: 6px !important;
  border-radius: 4px !important;
  background: rgba(16, 185, 129, 0.25) !important;
  outline: none !important;
  cursor: pointer !important;
  accent-color: #10b981 !important;
  transition: all 0.2s ease !important;
}

body.light-theme .aii-price-slider {
  background: rgba(5, 150, 105, 0.2) !important;
  accent-color: #059669 !important;
}

/* Trade Mode Selection Buttons */
.aii-trade-mode-row {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  margin: 6px 0 !important;
}

.aii-trade-mode-btn {
  flex: 0 1 auto !important;
  padding: 8px 18px !important;
  border-radius: 50px !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: center !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.65) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  max-width: max-content !important;
  transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.aii-trade-mode-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.aii-trade-mode-btn.active {
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1.5px solid #10b981 !important;
  color: #10b981 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25) !important;
  font-weight: 700 !important;
}

body.light-theme .aii-trade-mode-btn {
  background: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  color: #4b5563 !important;
}

body.light-theme .aii-trade-mode-btn:hover {
  background: rgba(0, 0, 0, 0.06) !important;
  color: #111827 !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
}

body.light-theme .aii-trade-mode-btn.active {
  background: rgba(5, 150, 105, 0.1) !important;
  border: 1.5px solid #059669 !important;
  color: #059669 !important;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.2) !important;
  font-weight: 700 !important;
}

/* Disclaimer Text */
.aii-price-edit-disclaimer {
  font-size: 10.5px !important;
  color: #64748b !important;
  text-align: justify !important;
  width: 100% !important;
  margin: 2px 0 !important;
  line-height: 1.45 !important;
  font-style: italic !important;
  font-family: 'Inter', sans-serif !important;
}

body.light-theme .aii-price-edit-disclaimer {
  color: #64748b !important;
}

/* Action Buttons BUY / SELL */
.aii-price-action-btn-row {
  display: flex !important;
  gap: 12px !important;
  width: 100% !important;
}

.aii-price-action-btn {
  flex: 1 !important;
  padding: 10px !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1) !important;
  font-family: 'Outfit', sans-serif !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.aii-price-action-btn.buy {
  background: rgba(16, 185, 129, 0.1) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  color: #10b981 !important;
}

.aii-price-action-btn.buy:hover:not(:disabled) {
  background: #10b981 !important;
  color: #fff !important;
  border-color: #10b981 !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4) !important;
  transform: translateY(-1px) !important;
}

.aii-price-action-btn.sell {
  background: rgba(239, 68, 68, 0.1) !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  color: #ef4444 !important;
}

.aii-price-action-btn.sell:hover:not(:disabled) {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4) !important;
  transform: translateY(-1px) !important;
}
