/* ═══════════════════════════════════════════════════════
   DEEPLUAU — Ghost Fiber Theme + Border Glow Effects
   Inspired by ReactBits.dev visual components
   ═══════════════════════════════════════════════════════ */

/* ── Base Reset ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.5);
}

::selection {
  background: rgba(168, 85, 247, 0.4);
  color: white;
}

body {
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Ghost Text Effect ───────────────────────────────── */
.ghost-text {
  background: linear-gradient(135deg, #e2e8f0, #a855f7, #e2e8f0, #7c3aed);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: ghostShimmer 4s ease-in-out infinite;
}

.ghost-text-hero {
  background: linear-gradient(135deg, #ffffff, #d8b4fe, #ffffff, #c084fc);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: ghostShimmer 3s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.3));
}

@keyframes ghostShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ── Fiber Loader ────────────────────────────────────── */
.fiber-loader {
  width: 120px;
  height: 3px;
  background: rgba(168, 85, 247, 0.1);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.fiber-loader::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #a855f7, #c084fc, transparent);
  border-radius: 3px;
  animation: fiberSlide 1.5s ease-in-out infinite;
}
@keyframes fiberSlide {
  0% { left: -50%; }
  100% { left: 100%; }
}

/* ── Aurora Background ───────────────────────────────── */
.aurora-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 40% 80%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
  animation: auroraDrift 20s ease-in-out infinite;
}
@keyframes auroraDrift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(5%, -3%) rotate(1deg); }
  50% { transform: translate(-3%, 5%) rotate(-1deg); }
  75% { transform: translate(3%, 2%) rotate(0.5deg); }
}

/* ── Glass Effects ───────────────────────────────────── */
.glass-nav {
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-card {
  background: rgba(15, 15, 25, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ── Border Glow Effect ──────────────────────────────── */
.border-glow {
  position: relative;
  box-shadow: 
    0 0 15px rgba(168, 85, 247, 0.2),
    inset 0 0 15px rgba(168, 85, 247, 0.05);
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.border-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), transparent 40%, transparent 60%, rgba(124, 58, 237, 0.4));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1px;
  pointer-events: none;
}

.border-glow-subtle {
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.1);
}

/* ── Glow Card ───────────────────────────────────────── */
.glow-card {
  background: rgba(15, 15, 25, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
.glow-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.5), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.glow-card:hover::before {
  opacity: 1;
}
.glow-card:hover {
  border-color: rgba(168, 85, 247, 0.15);
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.05);
}

/* ── Glow Button ─────────────────────────────────────── */
.glow-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}
.glow-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.glow-btn:hover::before {
  opacity: 1;
}
.glow-btn:hover {
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.4), 0 4px 20px rgba(168, 85, 247, 0.2);
  transform: translateY(-1px);
}
.glow-btn:active {
  transform: translateY(0);
}
.glow-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.glow-btn:disabled:hover {
  box-shadow: none;
}

/* ── Ghost Button ────────────────────────────────────── */
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: transparent;
  color: #d8b4fe;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}
.ghost-btn:hover {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
}

.ghost-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #9ca3af;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ghost-btn-sm:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border-color: rgba(255, 255, 255, 0.15);
}

/* ── Ghost Input ─────────────────────────────────────── */
.ghost-input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  color: white;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}
.ghost-input:focus {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1), 0 0 20px rgba(168, 85, 247, 0.05);
  background: rgba(255, 255, 255, 0.05);
}
.ghost-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

/* ── Ghost Select ────────────────────────────────────── */
.ghost-select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 28px 6px 10px;
  color: white;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}
.ghost-select:focus {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.1);
}
.ghost-select option {
  background: #1a1a2e;
  color: white;
}

/* ── Navigation Pills ────────────────────────────────── */
.nav-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #9ca3af;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.nav-pill:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}
.nav-pill.active {
  color: #d8b4fe;
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.2);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.1);
}

/* ── Mobile Nav Button ───────────────────────────────── */
.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  font-family: 'Inter', sans-serif;
}
.mobile-nav-btn.active {
  color: #a855f7;
}

/* ── Feature Card ────────────────────────────────────── */
.feature-card {
  background: rgba(15, 15, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.05), transparent);
  opacity: 0;
  transition: opacity 0.4s;
}
.feature-card:hover::before {
  opacity: 1;
}
.feature-card:hover {
  border-color: rgba(168, 85, 247, 0.2);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(168, 85, 247, 0.1);
}
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: white;
}

/* ── Tags ────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 0.6875rem;
  color: #9ca3af;
}

/* ── Model Cards ─────────────────────────────────────── */
.model-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(15, 15, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  font-size: 0.75rem;
  color: #d1d5db;
  transition: all 0.2s;
}
.model-card:hover {
  border-color: rgba(118, 185, 0, 0.3);
  background: rgba(118, 185, 0, 0.05);
}
.model-card.groq:hover {
  border-color: rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.05);
}
.model-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(135deg, #76b900, #4a7a00);
  flex-shrink: 0;
}
.model-icon.nvidia {
  background: linear-gradient(135deg, #76b900, #4a7a00);
}
.model-icon.groq-icon {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

/* ── Chat Styles ─────────────────────────────────────── */
.chat-message {
  max-width: 85%;
  animation: msgSlideUp 0.3s ease;
}
.chat-message.user-msg {
  margin-left: auto;
}
.chat-message.assistant-msg {
  margin-right: auto;
}
.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.6;
  position: relative;
  overflow: hidden;
}
.chat-bubble.user {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  border-bottom-left-radius: 4px;
}
.chat-bubble.assistant code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
}
.chat-bubble.assistant pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
  line-height: 1.5;
}

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

/* ── Conversation List Item ──────────────────────────── */
.convo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.8125rem;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
}
.convo-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: white;
}
.convo-item.active {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
}

/* ── Project List Item ───────────────────────────────── */
.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.8125rem;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
}
.project-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: white;
}
.project-item.active {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
}

/* ── Luau Template Button ────────────────────────────── */
.luau-template-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  color: #9ca3af;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: 'Inter', sans-serif;
}
.luau-template-btn:hover {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
}

/* ── Loading Dots ────────────────────────────────────── */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}
.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a855f7;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Typing Indicator ────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px;
}
.typing-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a855f7;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* ── Toast Animation ─────────────────────────────────── */
#toast {
  animation: toastSlide 0.3s ease;
}
@keyframes toastSlide {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Code Block Syntax Colors ────────────────────────── */
.code-keyword { color: #c084fc; }
.code-string { color: #34d399; }
.code-comment { color: #6b7280; font-style: italic; }
.code-number { color: #f59e0b; }
.code-function { color: #60a5fa; }
.code-type { color: #f472b6; }

/* ── Responsive Adjustments ──────────────────────────── */
@media (max-width: 768px) {
  .ghost-text-hero {
    filter: drop-shadow(0 0 15px rgba(168, 85, 247, 0.2));
  }
  .feature-card:hover {
    transform: none;
  }
}

/* ── Page Transitions ────────────────────────────────── */
.page {
  animation: pageIn 0.3s ease;
}
@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Spinning Animation ──────────────────────────────── */
.animate-spin-slow {
  animation: spin 3s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Markdown rendering in chat ──────────────────────── */
.chat-bubble.assistant h1,
.chat-bubble.assistant h2,
.chat-bubble.assistant h3 {
  font-weight: 700;
  margin: 12px 0 6px 0;
  color: white;
}
.chat-bubble.assistant h1 { font-size: 1.25em; }
.chat-bubble.assistant h2 { font-size: 1.1em; }
.chat-bubble.assistant h3 { font-size: 1em; }

.chat-bubble.assistant ul,
.chat-bubble.assistant ol {
  padding-left: 20px;
  margin: 8px 0;
}
.chat-bubble.assistant li {
  margin-bottom: 4px;
}

.chat-bubble.assistant strong {
  color: #d8b4fe;
}

.chat-bubble.assistant a {
  color: #60a5fa;
  text-decoration: underline;
}

.chat-bubble.assistant blockquote {
  border-left: 3px solid rgba(168, 85, 247, 0.5);
  padding-left: 12px;
  margin: 8px 0;
  color: #9ca3af;
}
