/* ============================================
   MathGenius AI — styles.css
   ============================================ */

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

/* Grid overlay */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(167,139,250,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167,139,250,0.035) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* Glow orbs */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(124,58,237,0.18) 0%, transparent 70%);
  top: -100px; left: -150px;
  animation: orbDrift1 18s ease-in-out infinite;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(34,211,238,0.12) 0%, transparent 70%);
  bottom: 0; right: -100px;
  animation: orbDrift2 22s ease-in-out infinite;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(244,114,182,0.1) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: orbDrift3 26s ease-in-out infinite;
}
@keyframes orbDrift1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(60px, 40px); } }
@keyframes orbDrift2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-50px, -30px); } }
@keyframes orbDrift3 { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.3); } }

/* Stars canvas */
#starsCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Header glass */
.glass-header {
  background: rgba(5,5,15,0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(167,139,250,0.1);
}

/* Input bar glass */
.input-bar-glass {
  background: rgba(5,5,15,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(167,139,250,0.1);
}

/* Text gradient */
.text-gradient-title {
  background: linear-gradient(135deg, #a78bfa 0%, #22d3ee 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Orbit rings */
.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(167,139,250,0.3);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: orbitSpin 20s linear infinite;
}
.ring-1 { width: 140px; height: 140px; }
.ring-2 { width: 175px; height: 175px; animation-duration: 32s; animation-direction: reverse; border-color: rgba(34,211,238,0.2); }
@keyframes orbitSpin { from { transform: translate(-50%,-50%) rotate(0deg); } to { transform: translate(-50%,-50%) rotate(360deg); } }

/* Topic chips */
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.2);
  color: #c4b5fd;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.chip-btn:hover {
  background: rgba(167,139,250,0.18);
  border-color: rgba(167,139,250,0.5);
  color: #e9d5ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.25);
}
.chip-btn:active { transform: translateY(0); }

/* Send button */
.send-btn {
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(124,58,237,0.4);
  transition: all 0.2s;
}
.send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 30px rgba(124,58,237,0.6);
}
.send-btn:active { transform: scale(0.97); }
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Textarea auto-grow */
textarea#userInput {
  font-family: 'Poppins', sans-serif;
  background: rgba(15,15,40,0.9);
}
textarea#userInput:focus {
  background: rgba(20,20,60,0.95);
}

/* Message bubbles */
.msg-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  opacity: 0;
  animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) forwards;
}
.msg-row.user { flex-direction: row-reverse; }

/* Avatars */
.msg-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
}

.msg-bubble {
  max-width: 72%;
  border-radius: 20px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 400;
}

.msg-bubble.bot {
  background: rgba(15,15,40,0.9);
  border: 1px solid rgba(167,139,250,0.15);
  border-top-left-radius: 6px;
  color: #e2e8f0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.msg-bubble.user {
  background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(34,211,238,0.2));
  border: 1px solid rgba(167,139,250,0.25);
  border-top-right-radius: 6px;
  color: #e9d5ff;
}

/* Math step blocks */
.math-step {
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.2);
  border-left: 3px solid #7c3aed;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #c4b5fd;
}

/* Math callout */
.math-callout {
  background: rgba(34,211,238,0.07);
  border: 1px solid rgba(34,211,238,0.2);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 10px 0;
  font-size: 13.5px;
  color: #a5f3fc;
}

/* Answer highlight box */
.answer-box {
  background: linear-gradient(135deg, rgba(74,222,128,0.1), rgba(34,211,238,0.1));
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: #86efac;
}

/* Thinking dots */
.thinking-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
}
.dot {
  width: 8px; height: 8px;
  background: #a78bfa;
  border-radius: 50%;
}
.dot:nth-child(1) { animation: thinking 1.4s ease-in-out 0s infinite; }
.dot:nth-child(2) { animation: thinking 1.4s ease-in-out 0.2s infinite; }
.dot:nth-child(3) { animation: thinking 1.4s ease-in-out 0.4s infinite; }
@keyframes thinking {
  0%,100% { opacity: 0.2; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* Toast popups */
.toast {
  pointer-events: all;
  background: rgba(15,15,40,0.95);
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 20px rgba(124,58,237,0.15);
  animation: slideInRight 0.4s cubic-bezier(0.16,1,0.3,1) forwards;
  backdrop-filter: blur(20px);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.toast:hover {
  transform: scale(1.02) translateX(-4px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 28px rgba(124,58,237,0.25);
}
.toast.dismissing {
  animation: slideOutRight 0.3s ease-in forwards;
}
.toast-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  font-family: 'Poppins', sans-serif;
}
.toast-body {
  font-size: 12px;
  color: #94a3b8;
  font-family: 'Poppins', sans-serif;
  margin-top: 2px;
  line-height: 1.5;
}

/* Formatted content in bot messages */
.msg-bubble.bot h3 {
  font-size: 14px;
  font-weight: 700;
  color: #c4b5fd;
  margin: 12px 0 6px;
}
.msg-bubble.bot strong {
  color: #ddd6fe;
  font-weight: 600;
}
.msg-bubble.bot em {
  color: #67e8f9;
  font-style: normal;
  font-weight: 500;
}

/* Timestamp */
.msg-time {
  font-size: 10px;
  color: #475569;
  margin-top: 4px;
  font-family: 'Poppins', sans-serif;
}
.msg-row.user .msg-time { text-align: right; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(167,139,250,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(167,139,250,0.4); }

/* Fade up keyframe (used with Tailwind animate-fade-up) */
@keyframes fadeUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}
@keyframes popIn {
  0% { transform: scale(0.7); opacity: 0; }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 600px) {
  .msg-bubble { max-width: 88%; font-size: 13px; }
  .ring-1 { width: 120px; height: 120px; }
  .ring-2 { width: 150px; height: 150px; }
}
