/* NEXUS — Multi-Agent AI OS */
/* Futuristic glassmorphism + neon design system */

* { -webkit-tap-highlight-color: transparent; }

html, body { background: #0B1020; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(143, 0, 255, 0.25); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(143, 0, 255, 0.5); }

/* Glass panels */
.glass {
  background: linear-gradient(135deg, rgba(17, 22, 52, 0.7) 0%, rgba(17, 22, 52, 0.4) 100%);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(143, 0, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.glass-strong {
  background: linear-gradient(135deg, rgba(17, 22, 52, 0.92) 0%, rgba(11, 16, 32, 0.85) 100%);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(143, 0, 255, 0.18);
}

/* Neon borders */
.neon-border {
  position: relative;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.neon-border::before {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, #8F00FF, #FF7A00);
  z-index: -1;
  opacity: 0.5;
}

/* Gradient text */
.text-gradient {
  background: linear-gradient(135deg, #8F00FF 0%, #FF7A00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.text-gradient-purple {
  background: linear-gradient(135deg, #A855F7 0%, #8F00FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Gradient backgrounds */
.bg-gradient-nexus { background: linear-gradient(135deg, #8F00FF 0%, #FF7A00 100%); }
.bg-gradient-purple { background: linear-gradient(135deg, #6A0DAD 0%, #8F00FF 100%); }
.bg-gradient-orange { background: linear-gradient(135deg, #FF7A00 0%, #FFA94D 100%); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: 0.625rem;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.18s ease;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #8F00FF 0%, #FF7A00 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(143, 0, 255, 0.4);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(143, 0, 255, 0.6);
}
.btn-secondary {
  background: rgba(143, 0, 255, 0.1);
  color: #E9D5FF;
  border: 1px solid rgba(143, 0, 255, 0.3);
}
.btn-secondary:hover:not(:disabled) { background: rgba(143, 0, 255, 0.18); border-color: rgba(143, 0, 255, 0.5); }
.btn-ghost {
  background: transparent; color: #CBD5E1;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); color: #fff; }
.btn-danger {
  background: rgba(239, 68, 68, 0.15); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  background: rgba(11, 16, 32, 0.6);
  border: 1px solid rgba(143, 0, 255, 0.18);
  border-radius: 0.625rem;
  padding: 0.625rem 0.875rem;
  color: #F1F5F9;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(143, 0, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(143, 0, 255, 0.15);
  background: rgba(11, 16, 32, 0.85);
}
.input::placeholder, .textarea::placeholder { color: #64748B; }
.select { 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='%238F00FF'%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 0.75rem center; background-size: 1rem; padding-right: 2.25rem; }
.textarea { min-height: 6rem; resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; }

/* Card hover */
.card { transition: all 0.22s ease; }
.card:hover { transform: translateY(-2px); border-color: rgba(143, 0, 255, 0.3); }

/* Pulse indicator */
.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; }
.pulse-dot::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; opacity: 0.6;
  animation: pulse-ring 1.6s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
.pulse-dot.healthy { background: #10b981; }
.pulse-dot.healthy::before { background: #10b981; }
.pulse-dot.warn { background: #f59e0b; }
.pulse-dot.warn::before { background: #f59e0b; }
.pulse-dot.crit { background: #ef4444; }
.pulse-dot.crit::before { background: #ef4444; }
.pulse-dot.idle { background: #64748b; }
.pulse-dot.idle::before { background: #64748b; opacity: 0.2; }
@keyframes pulse-ring {
  0% { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}

/* Loading spinner */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(143, 0, 255, 0.2);
  border-top-color: #8F00FF;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
.toast {
  pointer-events: auto;
  min-width: 280px; max-width: 380px;
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  background: rgba(17, 22, 52, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(143, 0, 255, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: flex; gap: 0.625rem; align-items: flex-start;
  animation: toast-in 0.2s ease;
}
.toast.success { border-color: rgba(16, 185, 129, 0.45); }
.toast.error { border-color: rgba(239, 68, 68, 0.45); }
.toast.warn { border-color: rgba(245, 158, 11, 0.45); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* Sidebar */
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.875rem;
  border-radius: 0.5rem;
  color: #94A3B8;
  font-size: 0.875rem;
  transition: all 0.15s;
  cursor: pointer;
  position: relative;
}
.sidebar-link i { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(143, 0, 255, 0.08); color: #E9D5FF; }
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(143, 0, 255, 0.18) 0%, rgba(255, 122, 0, 0.10) 100%);
  color: #fff;
  box-shadow: inset 2px 0 0 #8F00FF;
}
.sidebar-link .badge {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #8F00FF, #FF7A00);
  color: white;
  font-weight: 600;
}

/* Chat */
.msg-user { background: linear-gradient(135deg, rgba(143, 0, 255, 0.15), rgba(255, 122, 0, 0.08)); border-left: 2px solid #8F00FF; }
.msg-assistant { background: rgba(17, 22, 52, 0.55); border-left: 2px solid #FF7A00; }
.msg-system { background: rgba(100, 116, 139, 0.1); border-left: 2px solid #64748b; }
.msg pre { background: rgba(0,0,0,0.5); padding: 0.75rem; border-radius: 0.5rem; overflow-x: auto; font-size: 0.8rem; }
.msg code { font-family: 'JetBrains Mono', monospace; font-size: 0.85em; }
.msg :not(pre) > code { background: rgba(143, 0, 255, 0.15); padding: 0.1em 0.4em; border-radius: 0.25em; color: #E9D5FF; }
.msg h1, .msg h2, .msg h3 { font-weight: 700; margin: 0.75em 0 0.4em; color: #fff; }
.msg h1 { font-size: 1.25em; } .msg h2 { font-size: 1.1em; } .msg h3 { font-size: 1em; }
.msg ul, .msg ol { margin: 0.4em 0 0.4em 1.4em; }
.msg li { margin: 0.2em 0; }
.msg p { margin: 0.5em 0; }
.msg a { color: #FFA94D; text-decoration: underline; }
.msg blockquote { border-left: 3px solid #8F00FF; padding-left: 0.75em; margin: 0.5em 0; color: #CBD5E1; font-style: italic; }
.msg table { border-collapse: collapse; margin: 0.5em 0; }
.msg th, .msg td { border: 1px solid rgba(143, 0, 255, 0.25); padding: 0.4em 0.7em; }
.msg th { background: rgba(143, 0, 255, 0.12); }

/* Agent card */
.agent-tile {
  background: linear-gradient(135deg, rgba(17, 22, 52, 0.85), rgba(11, 16, 32, 0.6));
  border: 1px solid rgba(143, 0, 255, 0.2);
  border-radius: 14px;
  padding: 1.1rem;
  transition: all 0.22s ease;
  position: relative;
  overflow: hidden;
}
.agent-tile:hover { transform: translateY(-3px); border-color: rgba(143, 0, 255, 0.5); box-shadow: 0 12px 32px rgba(143, 0, 255, 0.25); }
.agent-tile::before { content: ''; position: absolute; top:0; left:0; right:0; height: 2px; background: linear-gradient(90deg, transparent, var(--agent-color, #8F00FF), transparent); opacity: 0.6; }

/* Provider card */
.provider-card {
  background: rgba(17, 22, 52, 0.6);
  border: 1px solid rgba(143, 0, 255, 0.18);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.2s ease;
}
.provider-card.configured { border-color: rgba(16, 185, 129, 0.5); box-shadow: 0 0 16px rgba(16, 185, 129, 0.15); }
.provider-card:hover { border-color: rgba(143, 0, 255, 0.45); }

/* Workflow node */
.wf-node {
  background: rgba(17, 22, 52, 0.92);
  border: 1px solid rgba(143, 0, 255, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  min-width: 180px;
  position: relative;
}
.wf-node::after {
  content: '↓';
  position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%);
  color: #8F00FF; font-size: 1.1rem;
}
.wf-node:last-child::after { display: none; }

/* Health bar */
.health-bar {
  height: 8px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  position: relative;
}
.health-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #8F00FF, #FF7A00);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(143, 0, 255, 0.6);
}

/* Shimmer placeholder */
.shimmer {
  background: linear-gradient(110deg, rgba(255,255,255,0.04) 8%, rgba(255,255,255,0.08) 18%, rgba(255,255,255,0.04) 33%);
  background-size: 1000px 100%;
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer { 0% { background-position: -1000px 0; } 100% { background-position: 1000px 0; } }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(11, 16, 32, 0.75);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fade-in 0.15s ease;
}
.modal {
  background: linear-gradient(135deg, rgba(17, 22, 52, 0.97), rgba(11, 16, 32, 0.97));
  border: 1px solid rgba(143, 0, 255, 0.3);
  border-radius: 16px;
  max-width: 640px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: modal-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* Console */
.console {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(143, 0, 255, 0.2);
  border-radius: 0.5rem;
  padding: 0.75rem;
  height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
  color: #CBD5E1;
}
.console .log-info { color: #93C5FD; }
.console .log-ok { color: #6EE7B7; }
.console .log-warn { color: #FCD34D; }
.console .log-err { color: #FCA5A5; }
.console .log-meta { color: #94A3B8; }

/* Cursor */
.cursor-blink::after { content: '▋'; color: #8F00FF; animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

/* Tabs */
.tab { padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; font-size: 0.85rem; color: #94A3B8; transition: all 0.15s; }
.tab:hover { color: #fff; background: rgba(143, 0, 255, 0.08); }
.tab.active { color: #fff; background: linear-gradient(135deg, rgba(143, 0, 255, 0.2), rgba(255, 122, 0, 0.12)); border: 1px solid rgba(143, 0, 255, 0.3); }

/* Onboarding glow */
.onboarding-pulse { animation: glow 2s ease-in-out infinite; }

/* Mobile adjustments */
@media (max-width: 768px) {
  .sidebar-link { padding: 0.75rem 1rem; }
}

/* Light mode */
html.light body { background: #F8FAFC; color: #1E293B; }
html.light .glass { background: rgba(255,255,255,0.7); border-color: rgba(143, 0, 255, 0.2); color: #1E293B; }
html.light .glass-strong { background: rgba(255,255,255,0.95); color: #1E293B; }
html.light .input, html.light .select, html.light .textarea { background: rgba(255,255,255,0.8); color: #1E293B; border-color: rgba(143, 0, 255, 0.25); }
html.light .sidebar-link { color: #475569; }
html.light .sidebar-link:hover { background: rgba(143, 0, 255, 0.06); color: #1E293B; }
html.light .console { background: rgba(15, 23, 42, 0.95); color: #CBD5E1; }
