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

:root {
  --primary: #0066FF;
  --primary-dark: #0052CC;
  --primary-glow: rgba(0, 102, 255, 0.15);
  --bg: #050508;
  --bg2: #0A0A10;
  --bg3: #0F0F18;
  --surface: rgba(255,255,255,0.04);
  --surface2: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #F0F0F8;
  --text2: rgba(240,240,248,0.6);
  --text3: rgba(240,240,248,0.35);
  --radius: 12px;
  --groq: #FF6B35;
  --gemini: #4285F4;
  --mistral: #FF4B6E;
  --search: #00C48C;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ========= LANDING PAGE ========= */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,102,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,102,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.4;
}
.orb1 { width: 500px; height: 500px; background: rgba(0,102,255,0.2); top: -200px; right: -100px; animation: drift 12s ease-in-out infinite; }
.orb2 { width: 400px; height: 400px; background: rgba(255,75,110,0.12); bottom: -150px; left: -100px; animation: drift 16s ease-in-out infinite reverse; }
.orb3 { width: 300px; height: 300px; background: rgba(0,196,140,0.1); top: 50%; left: 40%; animation: drift 20s ease-in-out infinite 5s; }

@keyframes drift {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-20px) scale(1.05); }
  66% { transform: translate(-20px,30px) scale(0.95); }
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2.5rem;
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-badge {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 100px;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  z-index: 10;
}

.hero-tag {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-glow);
  border: 1px solid rgba(0,102,255,0.25);
  padding: 5px 16px;
  border-radius: 100px;
  margin-bottom: 2rem;
  animation: fadeUp 0.6s ease both;
}

.hero-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -3px;
  margin-bottom: 1.5rem;
  animation: fadeUp 0.6s ease 0.1s both;
}

.gradient-text {
  background: linear-gradient(135deg, #0066FF, #00C48C, #FF4B6E);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text2);
  max-width: 540px;
  line-height: 1.7;
  margin-bottom: 2.5rem;
  font-weight: 300;
  animation: fadeUp 0.6s ease 0.2s both;
}

.hero-actions {
  margin-bottom: 3rem;
  animation: fadeUp 0.6s ease 0.3s both;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1));
  opacity: 0;
  transition: opacity 0.2s;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,102,255,0.4); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(0); }

.model-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  animation: fadeUp 0.6s ease 0.4s both;
}

.pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  backdrop-filter: blur(10px);
}

.pill-dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-groq .pill-dot { background: var(--groq); }
.pill-gemini .pill-dot { background: var(--gemini); }
.pill-mistral .pill-dot { background: var(--mistral); }
.pill-search .pill-dot { background: var(--search); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========= CHAT WIDGET ========= */
.widget-container {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.widget {
  width: 680px;
  max-width: 95vw;
  height: 80vh;
  max-height: 700px;
  background: #0C0C14;
  border: 1px solid var(--border2);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: width 0.3s ease, height 0.3s ease, max-width 0.3s ease;
}

.widget.expanded {
  width: 90vw;
  max-width: 90vw;
  height: 90vh;
  max-height: 90vh;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

.widget-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.widget-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.widget-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.widget-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--text3);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--search);
  animation: pulse 2s ease infinite;
}

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

.widget-controls {
  display: flex;
  gap: 6px;
}

.ctrl-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  transition: all 0.15s;
}
.ctrl-btn:hover { background: var(--surface2); color: var(--text); }

/* Model Bar */
.model-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.model-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text3);
  transition: all 0.3s ease;
}

.model-chip.active {
  border-color: var(--primary);
  color: var(--text);
  background: var(--primary-glow);
}

.model-chip.used { border-color: var(--search); color: var(--search); }
.model-chip.skipped { border-color: var(--mistral); color: var(--mistral); opacity: 0.6; }

.chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text3);
  transition: background 0.3s;
}

.model-chip.active .chip-dot { background: var(--primary); animation: pulse 1s ease infinite; }
.model-chip.used .chip-dot { background: var(--search); }
.chip-search { background: var(--search) !important; }

.confidence-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(0,196,140,0.1);
  border: 1px solid rgba(0,196,140,0.25);
  color: var(--search);
}

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

.welcome-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem;
  gap: 0.75rem;
}

.welcome-icon {
  width: 52px;
  height: 52px;
  background: var(--primary-glow);
  border: 1px solid rgba(0,102,255,0.3);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.welcome-msg h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.welcome-msg p {
  font-size: 0.85rem;
  color: var(--text2);
  max-width: 380px;
  line-height: 1.6;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 0.5rem;
}

.suggestion {
  font-size: 0.78rem;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.suggestion:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }

/* Message Bubbles */
.msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: msgIn 0.3s ease both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user { align-items: flex-end; }
.msg.ai { align-items: flex-start; }

.msg-role {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 0 4px;
}

.msg-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.65;
  word-wrap: break-word;
}

.msg.user .msg-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.ai .msg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-meta {
  display: flex;
  gap: 8px;
  font-size: 0.65rem;
  color: var(--text3);
  padding: 0 4px;
}

.msg-model-tag {
  display: flex;
  gap: 4px;
}

.model-tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 0.6rem;
}

/* Processing Bar */
.processing-bar {
  padding: 10px 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(0,102,255,0.03);
  flex-shrink: 0;
}

.processing-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.proc-step {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.proc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border2);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.proc-dot.active {
  background: var(--primary);
  animation: pulse 0.8s ease infinite;
}

.proc-dot.done { background: var(--search); }

.proc-step span {
  font-size: 0.72rem;
  color: var(--text3);
  transition: color 0.3s;
}

.proc-step.active span { color: var(--text2); }
.proc-step.done span { color: var(--search); }

.proc-divider {
  width: 20px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* Sources */
.sources-panel {
  padding: 8px 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.sources-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  margin-bottom: 6px;
  font-weight: 500;
}

.sources-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.source-link {
  font-size: 0.72rem;
  color: var(--primary);
  text-decoration: none;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0,102,255,0.2);
  background: var(--primary-glow);
  transition: all 0.15s;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-link:hover { border-color: var(--primary); background: rgba(0,102,255,0.2); }

/* Input Area */
.input-area {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.image-preview {
  position: relative;
  margin-bottom: 8px;
  display: inline-flex;
}

.image-preview img {
  height: 60px;
  border-radius: 8px;
  border: 1px solid var(--border2);
}

.remove-img {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #333;
  border: none;
  color: white;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.input-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.input-btn:hover { background: var(--surface2); color: var(--text2); border-color: var(--border2); }
.input-btn.recording { color: var(--mistral); border-color: var(--mistral); background: rgba(255,75,110,0.1); animation: pulse 1s ease infinite; }

.query-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  resize: none;
  outline: none;
  min-height: 36px;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.query-input::placeholder { color: var(--text3); }
.query-input:focus { border-color: var(--border2); }

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.send-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 2px;
}

.footer-hint {
  font-size: 0.65rem;
  color: var(--text3);
}

.model-transparency {
  font-size: 0.65rem;
  color: var(--text3);
}

/* Float Button */
.float-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0,102,255,0.4);
  transition: all 0.2s ease;
  z-index: 999;
}
.float-btn:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 12px 40px rgba(0,102,255,0.5); }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text3);
  animation: typingBounce 1.2s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Image in message */
.msg-image {
  max-width: 200px;
  border-radius: 8px;
  margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 600px) {
  .widget { height: 95vh; max-height: 95vh; border-radius: 16px 16px 0 0; }
  .widget-container { align-items: flex-end; }
  .hero-title { font-size: 2.5rem; letter-spacing: -2px; }
}