/* ================================================================
   Quantum Next Digital — AI Voice Assistant
   Premium AI Robot Trigger + Chat Panel
================================================================ */

/* ── FLOATING TRIGGER WRAPPER ── */
#qn-ai-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  border: none;
  cursor: pointer;
  background: transparent;
  padding: 0;
  outline: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
#qn-ai-trigger:hover { transform: translateY(-4px) scale(1.05); }

/* label hidden */

/* ── OUTER HALO RINGS ── */
.qn-ai-orb-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Spinning orbital ring 1 */
.qn-ai-orb-wrap::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  background:
    linear-gradient(#060915, #060915) padding-box,
    conic-gradient(from 0deg, #0066ff, transparent 60%, #7c3aed, transparent 80%, #06b6d4, transparent) border-box;
  animation: qn-ring-spin 3s linear infinite;
}
/* Spinning orbital ring 2 (counter) */
.qn-ai-orb-wrap::after {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px solid transparent;
  background:
    linear-gradient(#060915, #060915) padding-box,
    conic-gradient(from 180deg, #7c3aed, transparent 50%, #06b6d4, transparent) border-box;
  animation: qn-ring-spin 6s linear infinite reverse;
  opacity: 0.6;
}
@keyframes qn-ring-spin {
  to { transform: rotate(360deg); }
}

/* ── MAIN ORB BODY ── */
.qn-ai-orb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #1a2560, #060915 70%);
  border: 2px solid rgba(0,102,255,0.35);
  box-shadow:
    0 0 30px 8px rgba(0,102,255,0.35),
    0 0 60px 16px rgba(124,58,237,0.2),
    inset 0 0 20px rgba(0,102,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  animation: qn-orb-glow 3s ease-in-out infinite;
}
@keyframes qn-orb-glow {
  0%,100% {
    box-shadow: 0 0 30px 8px rgba(0,102,255,0.35), 0 0 60px 16px rgba(124,58,237,0.2), inset 0 0 20px rgba(0,102,255,0.15);
    border-color: rgba(0,102,255,0.35);
  }
  50% {
    box-shadow: 0 0 40px 12px rgba(0,102,255,0.5), 0 0 80px 24px rgba(124,58,237,0.3), inset 0 0 30px rgba(0,102,255,0.25);
    border-color: rgba(124,58,237,0.6);
  }
}

/* ── AI ROBOT FACE SVG ── */
.qn-ai-robot-face {
  position: relative;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qn-ai-robot-face svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 6px rgba(0,102,255,0.8));
}

/* Robot eye glow animation */
.qn-robot-eye {
  animation: qn-eye-glow 2s ease-in-out infinite;
}
.qn-robot-eye-r { animation-delay: 0.3s; }
@keyframes qn-eye-glow {
  0%,100% { opacity: 1; filter: url(#qn-eye-blur); }
  50%      { opacity: 0.6; filter: url(#qn-eye-blur) brightness(1.5); }
}

/* Scanning line inside orb */
.qn-scan-line {
  position: absolute;
  left: 8px; right: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,200,255,0.8), transparent);
  animation: qn-scan 2.5s ease-in-out infinite;
  z-index: 3;
  border-radius: 1px;
}
@keyframes qn-scan {
  0%   { top: 14px; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 44px; opacity: 0; }
}

/* ── LISTENING STATE ── */
.qn-ai-orb.listening {
  animation: qn-orb-glow 0.8s ease-in-out infinite;
  border-color: rgba(239,68,68,0.6);
}
.qn-ai-orb.listening .qn-scan-line {
  background: linear-gradient(90deg, transparent, rgba(239,68,68,0.8), transparent);
  animation: qn-scan 1s ease-in-out infinite;
}

/* keep old keyframe for backwards compat */
@keyframes qn-orb-spin { to { filter: hue-rotate(360deg); } }
@keyframes qn-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,102,255,0.6), 0 0 24px 8px rgba(0,102,255,0.45); }
  50%      { box-shadow: 0 0 0 18px rgba(0,102,255,0), 0 0 40px 12px rgba(124,58,237,0.4); }
}

/* ── TRIGGER HIDDEN WHEN PANEL OPEN ── */
#qn-ai-trigger.panel-open {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

/* ── CHAT PANEL ── */
#qn-ai-panel {
  position: fixed;
  top: 80px;
  bottom: 16px;
  right: 16px;
  z-index: 10000;
  width: 420px;
  max-width: calc(100vw - 24px);
  height: auto;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #080b18;
  border: 1px solid rgba(0,102,255,0.25);
  box-shadow:
    0 24px 70px rgba(0,0,0,0.85),
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 0 80px -10px rgba(0,102,255,0.2);
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
}
#qn-ai-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header — cinematic gradient border */
.qn-ai-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,102,255,0.15);
  position: relative;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(0,102,255,0.08) 0%, rgba(124,58,237,0.06) 100%);
}
.qn-ai-header-orb {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0066ff22, #7c3aed22);
  border: 1px solid rgba(0,102,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(0,102,255,0.3);
}
.qn-ai-header-orb::before { display: none; }
.qn-ai-header-info { flex: 1; min-width: 0; }
.qn-ai-header-info strong {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
}
.qn-ai-header-info span {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  display: flex;
  align-items: center;
  gap: 5px;
}
.qn-ai-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: qn-blink 2s ease-in-out infinite;
}
@keyframes qn-blink { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.qn-ai-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  font-size: 15px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.qn-ai-close:hover { background: rgba(239,68,68,0.2); color: #f87171; border-color: rgba(239,68,68,0.3); }

/* Messages — flex-grows to fill all remaining space */
.qn-ai-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,102,255,0.2) transparent;
}
.qn-ai-messages::-webkit-scrollbar { width: 4px; }
.qn-ai-messages::-webkit-scrollbar-thumb { background: rgba(0,102,255,0.25); border-radius: 2px; }

.qn-msg {
  display: flex;
  gap: 8px;
  animation: qn-msg-in 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes qn-msg-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.qn-msg.user { flex-direction: row-reverse; }

.qn-msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
  font-family: 'DM Sans', sans-serif;
  position: relative;
  word-break: break-word;
}
.qn-msg.ai .qn-msg-bubble {
  background: rgba(0,102,255,0.12);
  border: 1px solid rgba(0,102,255,0.2);
  color: rgba(255,255,255,0.9);
  border-bottom-left-radius: 4px;
}
.qn-msg.user .qn-msg-bubble {
  background: linear-gradient(135deg, #0066ff, #7c3aed);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.qn-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 4px;
}
.qn-msg.ai .qn-msg-avatar {
  background: rgba(0,102,255,0.12);
  border: 1px solid rgba(0,102,255,0.3);
  box-shadow: 0 0 10px rgba(0,102,255,0.2);
}
.qn-msg.user .qn-msg-avatar {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
}

/* Typing indicator */
.qn-typing .qn-msg-bubble {
  padding: 12px 16px;
}
.qn-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.qn-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0,102,255,0.7);
  animation: qn-dot-bounce 1.2s ease-in-out infinite;
}
.qn-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.qn-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes qn-dot-bounce {
  0%,80%,100% { transform: scale(0.7); opacity: 0.5; }
  40%          { transform: scale(1);   opacity: 1; }
}

/* Welcome hero */
.qn-ai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 20px 8px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(0,102,255,0.05) 0%, transparent 100%);
}
.qn-ai-welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0,102,255,0.18), rgba(124,58,237,0.18));
  border: 1px solid rgba(0,102,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 0 40px rgba(0,102,255,0.25), 0 0 80px rgba(124,58,237,0.1);
  animation: qn-orb-glow 3s ease-in-out infinite;
}
.qn-ai-welcome h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(90deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 0 6px;
}
.qn-ai-welcome p {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.5);
  margin: 0;
}

/* Arrow quick links */
.qn-ai-quicklinks {
  padding: 8px 16px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.qn-sugg-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  padding: 11px 4px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  transition: color 0.2s, background 0.2s, padding-left 0.2s;
  border-radius: 0;
}
.qn-sugg-btn::before {
  content: '↗';
  font-size: 0.9rem;
  color: rgba(96,165,250,0.7);
  flex-shrink: 0;
  transition: color 0.2s;
}
.qn-sugg-btn:last-child { border-bottom: none; }
.qn-sugg-btn:hover {
  color: #fff;
  background: rgba(0,102,255,0.06);
  padding-left: 8px;
  border-radius: 6px;
}
.qn-sugg-btn:hover::before { color: #60a5fa; }

/* Category pills */
.qn-ai-cats {
  display: flex;
  gap: 6px;
  padding: 10px 16px 4px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.qn-ai-cats::-webkit-scrollbar { display: none; }
.qn-cat-pill {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.qn-cat-pill.active {
  border-color: #0066ff;
  color: #60a5fa;
  background: rgba(0,102,255,0.12);
  box-shadow: 0 0 10px rgba(0,102,255,0.2);
}
.qn-cat-pill:hover {
  border-color: rgba(0,102,255,0.4);
  color: #a5b4fc;
  background: rgba(0,102,255,0.08);
}

/* ── INPUT BAR — flat flex row like ChatGPT/Hostinger ── */
.qn-ai-input-bar {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(0,102,255,0.12);
  background: linear-gradient(0deg, rgba(0,102,255,0.05) 0%, transparent 100%);
  flex-shrink: 0;
}

/* Outer container acts as the bordered input box */
.qn-ai-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(0,102,255,0.22);
  border-radius: 10px;
  padding: 8px 8px 8px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.qn-ai-input-wrap:focus-within {
  border-color: rgba(0,102,255,0.55);
  box-shadow: 0 0 0 3px rgba(0,102,255,0.08), 0 0 20px rgba(0,102,255,0.08);
}

/* Textarea — no border, transparent, grows */
#qn-ai-input {
  flex: 1;
  min-height: 24px;
  max-height: 120px;
  background: transparent;
  border: none;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  outline: none;
  resize: none;
  padding: 2px 0;
  box-sizing: border-box;
  display: block;
  overflow-y: auto;
  scrollbar-width: none;
  align-self: center;
}
#qn-ai-input::-webkit-scrollbar { display: none; }
#qn-ai-input::placeholder { color: rgba(255,255,255,0.28); }

/* Mic button — clean SVG style like ChatGPT */
.qn-ai-voice-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  color: rgba(255,255,255,0.55);
}
.qn-ai-voice-btn:hover {
  background: rgba(0,102,255,0.12);
  border-color: rgba(0,102,255,0.4);
  color: #60a5fa;
  transform: scale(1.05);
}
.qn-ai-voice-btn.recording {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.5);
  color: #f87171;
  animation: qn-pulse-red 0.8s ease-in-out infinite;
}
.qn-ai-voice-btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
@keyframes qn-pulse-red {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* Send button — solid circle with arrow, right of mic */
.qn-ai-send-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0066ff, #7c3aed);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,102,255,0.4);
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}
.qn-ai-send-btn:hover {
  opacity: 0.9;
  transform: scale(1.06);
  box-shadow: 0 4px 18px rgba(0,102,255,0.5);
}

/* ── WAVEFORM VISUALISER (shown while speaking) ── */
.qn-wave-bar {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  margin-left: 6px;
  vertical-align: middle;
}
.qn-wave-bar span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(to top, #0066ff, #06b6d4);
}
.qn-wave-bar span:nth-child(1) { animation: qn-wave 1.0s ease-in-out infinite; height: 6px; }
.qn-wave-bar span:nth-child(2) { animation: qn-wave 1.0s ease-in-out 0.12s infinite; height: 10px; }
.qn-wave-bar span:nth-child(3) { animation: qn-wave 1.0s ease-in-out 0.24s infinite; height: 14px; }
.qn-wave-bar span:nth-child(4) { animation: qn-wave 1.0s ease-in-out 0.36s infinite; height: 10px; }
.qn-wave-bar span:nth-child(5) { animation: qn-wave 1.0s ease-in-out 0.48s infinite; height: 6px; }
@keyframes qn-wave {
  0%,100% { transform: scaleY(0.5); opacity: 0.6; }
  50%      { transform: scaleY(1.4); opacity: 1; }
}

/* Chat bubble tweaks */
.qn-msg.ai .qn-msg-bubble {
  background: linear-gradient(135deg, rgba(0,102,255,0.1), rgba(124,58,237,0.08));
  border: 1px solid rgba(0,102,255,0.18);
  color: rgba(255,255,255,0.92);
  border-bottom-left-radius: 3px;
  border-radius: 10px;
  border-bottom-left-radius: 3px;
}
.qn-msg.user .qn-msg-bubble {
  background: linear-gradient(135deg, #0052cc, #6d28d9);
  color: #fff;
  border-radius: 10px;
  border-bottom-right-radius: 3px;
}

/* ── MOBILE ── */
@media (max-width: 540px) {
  #qn-ai-panel {
    right: 0; left: 0;
    top: 0; bottom: 0;
    width: 100%; max-width: 100%;
    border-radius: 0;
  }
  #qn-ai-trigger { right: 16px; bottom: 20px; }
  .qn-ai-orb, .qn-ai-orb-wrap { width: 52px; height: 52px; }
  .qn-ai-robot-face { width: 28px; height: 28px; }
}
