/* ============================================================================
 * NEXUS - Estilos Espaciales (Modo Oscuro #09090b + Glassmorphism)
 * ============================================================================ */

:root {
  --bg-space: #09090b;
  --panel-bg: rgba(17, 17, 21, 0.72);
  --panel-bg-strong: rgba(15, 15, 19, 0.88);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-hover: rgba(255, 255, 255, 0.16);
  --text-primary: #f4f4f5;
  --text-muted: #a1a1aa;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--bg-space);
  color: var(--text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fondo espacial muy sutil sin ruido */
.nexus-backdrop {
  background-color: var(--bg-space);
  background-image:
    radial-gradient(circle at 18% 12%, rgba(59, 130, 246, 0.09), transparent 36%),
    radial-gradient(circle at 82% 84%, rgba(139, 92, 246, 0.08), transparent 40%);
}

.nexus-glass {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
}

.nexus-glass-strong {
  background: var(--panel-bg-strong);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--panel-border);
}

/* Scrollbars finos */
.nexus-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.nexus-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.nexus-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.nexus-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
}
.nexus-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Ocultar barra horizontal de píldoras manteniendo desplazamiento táctil */
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Drawer derecho */
.nexus-drawer {
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.nexus-drawer.is-open {
  transform: translateX(0);
}

/* Modales suaves */
.nexus-modal-backdrop {
  animation: nexusFadeIn 160ms ease-out;
}
@keyframes nexusFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.nexus-modal-panel {
  animation: nexusSlideUp 190ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes nexusSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pulso grabación de voz */
@keyframes pulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}
.recording-pulse {
  animation: pulseRing 1.5s infinite;
}

/* Markdown seguro en Drawer y Oráculo */
.nexus-prose {
  font-size: 0.925rem;
  line-height: 1.65;
  color: #e4e4e7;
  word-break: break-word;
}
.nexus-prose h1,
.nexus-prose h2,
.nexus-prose h3 {
  color: #fafafa;
  font-weight: 600;
  margin: 0.9em 0 0.4em;
  line-height: 1.3;
}
.nexus-prose h1 { font-size: 1.15rem; }
.nexus-prose h2 { font-size: 1.05rem; }
.nexus-prose h3 { font-size: 0.96rem; }
.nexus-prose p {
  margin: 0.45em 0;
}
.nexus-prose ul,
.nexus-prose ol {
  margin: 0.5em 0;
  padding-left: 1.25rem;
}
.nexus-prose ul {
  list-style: disc;
}
.nexus-prose ol {
  list-style: decimal;
}
.nexus-prose li {
  margin: 0.25em 0;
}
.nexus-prose blockquote {
  margin: 0.6em 0;
  padding: 0.35rem 0.75rem;
  border-left: 2px solid rgba(56, 189, 248, 0.5);
  color: #d4d4d8;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 0.375rem 0.375rem 0;
}
.nexus-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82em;
  padding: 0.12rem 0.35rem;
  border-radius: 0.3rem;
  background: rgba(255, 255, 255, 0.08);
  color: #7dd3fc;
}
.nexus-prose pre {
  margin: 0.65em 0;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: rgba(9, 9, 11, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
}
.nexus-prose pre code {
  padding: 0;
  background: transparent;
  color: #e4e4e7;
}
.nexus-prose strong {
  color: #ffffff;
  font-weight: 600;
}

/* Asegurar que el canvas de force-graph ocupa el 100% sin scroll */
#graph-canvas-host canvas {
  display: block;
  outline: none;
  touch-action: none;
}

/* Área segura en móviles con notch / barra inferior */
.safe-bottom {
  padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
}
.safe-top {
  padding-top: max(0.65rem, env(safe-area-inset-top));
}
