/* ─────────────────────────────────────────────────────────────────────────────
   GROQ AI CHAT  —  STYLESHEET
   Theme: Deep Cosmos  |  Purple × Cyan gradient accents
───────────────────────────────────────────────────────────────────────────── */

/* ── Custom Properties ───────────────────────────────────────────────────── */
:root {
  --bg:           #06060f;
  --bg2:          #0c0c1e;
  --surface:      rgba(255, 255, 255, 0.04);
  --surface-hi:   rgba(255, 255, 255, 0.07);
  --border:       rgba(255, 255, 255, 0.08);
  --border-focus: rgba(139, 92, 246, 0.5);

  --purple:       #7c3aed;
  --purple-mid:   #8b5cf6;
  --purple-light: #a78bfa;
  --cyan:         #06b6d4;
  --cyan-light:   #22d3ee;
  --pink:         #ec4899;

  --text:         #f0f0ff;
  --text-2:       rgba(240, 240, 255, 0.65);
  --text-3:       rgba(240, 240, 255, 0.35);

  --grad:         linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --grad-soft:    linear-gradient(135deg, rgba(124,58,237,.15) 0%, rgba(6,182,212,.15) 100%);

  --glow-p:       0 0 24px rgba(124, 58, 237, 0.45);
  --glow-c:       0 0 24px rgba(6, 182, 212, 0.45);

  --font:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --t:            0.45s;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input  { font-family: inherit; }

/* ── Aurora background ───────────────────────────────────────────────────── */
#aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 20% 50%, #0d0025 0%, var(--bg) 60%);
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  will-change: transform;
}

.aurora-1 {
  width: 70vw; height: 70vh;
  background: var(--purple);
  top: -20vh; left: -20vw;
  animation: drift1 18s ease-in-out infinite alternate;
}

.aurora-2 {
  width: 55vw; height: 55vh;
  background: var(--cyan);
  bottom: -15vh; right: -15vw;
  animation: drift2 14s ease-in-out infinite alternate;
}

.aurora-3 {
  width: 40vw; height: 40vh;
  background: var(--pink);
  top: 40vh; left: 50vw;
  opacity: 0.05;
  animation: drift3 22s ease-in-out infinite alternate;
}

@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(8vw, 6vh) scale(1.12); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-6vw, -8vh) scale(1.08); }
}
@keyframes drift3 {
  from { transform: translate(0, 0); }
  to   { transform: translate(-10vw, 5vh) scale(1.15); }
}

/* ── Particle canvas ─────────────────────────────────────────────────────── */
#particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ── App layout ──────────────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 6, 15, 0.7);
  backdrop-filter: blur(20px);
}

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

.logo-orb {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--grad);
  position: relative;
  animation: orb-breathe 4s ease-in-out infinite;
  box-shadow: var(--glow-p);
}

.logo-orb-inner {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, rgba(255,255,255,0.35) 0%, transparent 65%);
}

@keyframes orb-breathe {
  0%, 100% { box-shadow: 0 0 20px rgba(124,58,237,.5), 0 0 40px rgba(124,58,237,.15); }
  50%       { box-shadow: 0 0 30px rgba(6,182,212,.5), 0 0 60px rgba(6,182,212,.15); }
}

.logo-labels { display: flex; flex-direction: column; }

.app-title {
  font-size: 17px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.app-sub {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.5px;
}

.model-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text-2);
}

.model-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: .5; transform: scale(1); }
  50%       { opacity: 1;  transform: scale(1.4); }
}

/* ── Stage (full remaining height, one window visible) ───────────────────── */
#stage {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ── Chat Window (shared base) ───────────────────────────────────────────── */
.chat-window {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
}

/* ── Window Card (shared glass panel) ───────────────────────────────────── */
.window-card {
  width: 100%;
  max-width: 800px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow:
    0 4px 6px rgba(0,0,0,.25),
    0 24px 80px rgba(0,0,0,.45),
    inset 0 1px 0 rgba(255,255,255,.08);
  overflow: hidden;
}

/* ── Welcome card ────────────────────────────────────────────────────────── */
.welcome-card {
  padding: 56px 44px 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* Welcome orb */
.welcome-orb-wrap {
  position: relative;
  width: 130px; height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-orb {
  position: relative;
  width: 110px; height: 110px;
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.wo-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid;
}

.wo-ring-outer {
  inset: -14px;
  border-color: rgba(124, 58, 237, 0.25);
  animation: spin 10s linear infinite;
}

.wo-ring-mid {
  inset: -4px;
  border-color: rgba(6, 182, 212, 0.3);
  animation: spin 7s linear infinite reverse;
}

@keyframes spin { to { transform: rotate(360deg); } }

.wo-core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,
    #c4b5fd 0%,
    #7c3aed 35%,
    #312e81 65%,
    #0a0a2e 100%
  );
  box-shadow:
    inset -5px -5px 20px rgba(0,0,0,.35),
    inset  5px  5px 20px rgba(196,181,253,.15),
    0 0 50px rgba(124,58,237,.4),
    0 0 100px rgba(124,58,237,.15);
}

.wo-glint {
  position: absolute;
  top: 14%; left: 22%;
  width: 28%; height: 18%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  filter: blur(3px);
  transform: rotate(-30deg);
}

/* Welcome text */
.welcome-heading {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--text);
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-desc {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.7;
  max-width: 460px;
  margin: 0 auto;
}

/* Hint chips */
.hint-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}

.hint-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 24px;
  background: rgba(124, 58, 237, 0.1);
  color: var(--purple-light);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s var(--ease);
}

.hint-chip:hover {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(139, 92, 246, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.2);
}

.hint-chip:active { transform: translateY(0); }

.hint-icon { font-size: 15px; }

/* ── Q&A card ────────────────────────────────────────────────────────────── */
.qa-card {
  padding: 36px 40px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.qa-card::-webkit-scrollbar       { width: 4px; }
.qa-card::-webkit-scrollbar-track  { background: transparent; }
.qa-card::-webkit-scrollbar-thumb  { background: rgba(255,255,255,.12); border-radius: 2px; }

/* User question row */
.q-row {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 28px;
  animation: fadeUp .35s var(--ease) both;
}

.user-avatar {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(124,58,237,.18);
  border: 1px solid rgba(124,58,237,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple-light);
}

.user-avatar svg { width: 19px; height: 19px; }

.q-bubble {
  max-width: 80%;
  padding: 14px 20px;
  background: rgba(124, 58, 237, 0.18);
  border: 1px solid rgba(124, 58, 237, 0.28);
  border-radius: 20px 4px 20px 20px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}

/* Divider */
.qa-sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 30%, var(--border) 70%, transparent);
  margin: 0 0 24px;
}

/* AI answer row */
.a-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  animation: fadeUp .35s .08s var(--ease) both;
}

.ai-avatar {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--grad);
  position: relative;
  box-shadow: var(--glow-p);
}

.ai-avatar::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, rgba(255,255,255,.3), transparent 60%);
}

.a-body { flex: 1; min-width: 0; padding-top: 6px; }

/* Thinking dots */
.thinking {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 0;
}

.thinking span {
  display: block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--purple-mid);
  animation: bounce 1.3s ease-in-out infinite;
}

.thinking span:nth-child(1) { animation-delay: 0s; }
.thinking span:nth-child(2) { animation-delay: .18s; }
.thinking span:nth-child(3) { animation-delay: .36s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: .4; }
  30%            { transform: translateY(-7px); opacity: 1;  }
}

.thinking.hidden { display: none; }

/* Answer text */
.a-text {
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.a-text code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13.5px;
  padding: 2px 7px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--cyan-light);
}

.a-text strong { color: var(--cyan-light); font-weight: 600; }
.a-text em     { color: var(--purple-light); }

/* Typing cursor */
.cursor {
  display: inline-block;
  width: 2px; height: 17px;
  background: var(--cyan);
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: blink .75s step-end infinite;
}

.cursor.hidden { display: none; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Input bar ───────────────────────────────────────────────────────────── */
#input-bar {
  flex-shrink: 0;
  padding: 14px 20px 22px;
  background: rgba(6, 6, 15, 0.7);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}

.input-wrap { max-width: 800px; margin: 0 auto; }

.input-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 5px 5px 5px 22px;
  transition: border-color .2s, box-shadow .2s;
}

.input-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

#q-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15.5px;
  color: var(--text);
  padding: 11px 0;
  caret-color: var(--cyan);
}

#q-input::placeholder { color: var(--text-3); }
#q-input:disabled { opacity: .45; cursor: not-allowed; }

#send-btn {
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all .2s var(--ease);
  box-shadow: var(--glow-p);
}

#send-btn:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 0 30px rgba(124,58,237,.65);
}

#send-btn:active:not(:disabled) { transform: scale(.96); }

#send-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
}

.input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 0 4px;
}

.key-hint {
  font-size: 12px;
  color: var(--text-3);
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  background: rgba(255,255,255,.06);
}

.session-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

/* ── Error ───────────────────────────────────────────────────────────────── */
.err-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(239, 68, 68, .35);
  border-radius: 12px;
  background: rgba(239, 68, 68, .08);
  color: #fca5a5;
  font-size: 14px;
}

.err-box svg { flex-shrink: 0; opacity: .8; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .welcome-card { padding: 40px 24px 36px; }
  .welcome-heading { font-size: 24px; }
  .qa-card { padding: 24px 20px; }
  .app-header { padding: 12px 18px; }
  .model-badge { display: none; }
}
