/*
 * Copyright (c) 2026 LLYVerse — https://llyverse.org
 * Licensed under the LLYVerse License 1.0. See LICENSE. Credit to LLYVerse is required.
 */
/**
 * NovaAI App Redesign CSS Design System & Tokens (§9, §3)
 * Self-hosted, zero-CDN stylesheet for /novaai and /app.
 */

:root,
html[data-nova-theme="dark"] {
  --nova-bg-0: #06070d;
  --nova-bg-1: #0b0d17;
  --nova-bg-2: #111525;
  --nova-bg-3: #181d31;
  --nova-surface-glass: rgba(17, 21, 37, 0.84);
  --nova-border: rgba(255, 255, 255, 0.08);
  --nova-border-strong: rgba(255, 255, 255, 0.15);
  --nova-text-0: #f8fafc;
  --nova-text-1: #cbd5e1;
  --nova-text-2: #94a3b8;
  --nova-text-3: #64748b;

  /* Built-in Persona Signature Colors (§2.7, §9, Decisions 1 & 2) */
  --nova-persona-nova: #06b6d4;
  --nova-persona-astra: #c084fc;
  --nova-persona-astaria: #10b981;

  /* Active Accent */
  --nova-accent: #06b6d4;
  --nova-accent-soft: rgba(6, 182, 212, 0.14);
  --nova-danger: #f43f5e;
  --nova-danger-soft: rgba(244, 63, 94, 0.15);
  --nova-warning: #f59e0b;
  --nova-success: #10b981;

  --nova-sidebar-w: 280px;
  --nova-info-w: 340px;
  --nova-radius-sm: 8px;
  --nova-radius-md: 12px;
  --nova-radius-lg: 16px;
}

html[data-nova-theme="oled"] {
  --nova-bg-0: #000000;
  --nova-bg-1: #040508;
  --nova-bg-2: #0a0c12;
  --nova-bg-3: #121521;
  --nova-surface-glass: rgba(8, 10, 16, 0.92);
}

html[data-nova-theme="light"] {
  --nova-bg-0: #f8fafc;
  --nova-bg-1: #f1f5f9;
  --nova-bg-2: #ffffff;
  --nova-bg-3: #e2e8f0;
  --nova-surface-glass: rgba(255, 255, 255, 0.88);
  --nova-border: rgba(15, 23, 42, 0.10);
  --nova-border-strong: rgba(15, 23, 42, 0.18);
  --nova-text-0: #0f172a;
  --nova-text-1: #334155;
  --nova-text-2: #475569;
  --nova-text-3: #64748b;
}

html[data-nova-accent="violet"] {
  --nova-accent: #c084fc;
  --nova-accent-soft: rgba(192, 132, 252, 0.15);
}
html[data-nova-accent="emerald"] {
  --nova-accent: #10b981;
  --nova-accent-soft: rgba(16, 185, 129, 0.15);
}
html[data-nova-accent="amber"] {
  --nova-accent: #f59e0b;
  --nova-accent-soft: rgba(245, 158, 11, 0.15);
}
html[data-nova-accent="rose"] {
  --nova-accent: #f43f5e;
  --nova-accent-soft: rgba(244, 63, 94, 0.15);
}

/* Focus Accessibility (§10) */
.nova-app-root *:focus-visible {
  outline: 2px solid var(--nova-accent);
  outline-offset: 2px;
}

.nova-app-root {
  background: var(--nova-bg-0);
  color: var(--nova-text-0);
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

.nova-shell {
  display: flex;
  flex-direction: row;
  flex: 1 1 0%;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* Left Sidebar */
.nova-sidebar {
  width: var(--nova-sidebar-w);
  flex-shrink: 0;
  background: var(--nova-bg-1);
  border-right: 1px solid var(--nova-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  user-select: none;
}

.nova-agent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--nova-radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--nova-text-1);
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  min-height: 44px;
}

.nova-agent-row:hover {
  background: var(--nova-bg-2);
  color: var(--nova-text-0);
}

.nova-agent-row[aria-current="page"],
.nova-agent-row.is-active {
  background: var(--nova-bg-2);
  border-color: var(--nova-border-strong);
  color: var(--nova-text-0);
}

.nova-persona-dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  flex-shrink: 0;
}
.nova-persona-dot[data-persona="nova"] {
  background: var(--nova-persona-nova);
  box-shadow: 0 0 10px var(--nova-persona-nova);
}
.nova-persona-dot[data-persona="astra"] {
  background: var(--nova-persona-astra);
  box-shadow: 0 0 10px var(--nova-persona-astra);
}
.nova-persona-dot[data-persona="astaria"] {
  background: var(--nova-persona-astaria);
  box-shadow: 0 0 10px var(--nova-persona-astaria);
}

.nova-unread-badge {
  background: var(--nova-accent);
  color: #030712;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
  line-height: 1.4;
}

/* Center Chat Column */
.nova-chat {
  background: var(--nova-bg-0);
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.nova-chat-header {
  height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--nova-border);
  background: var(--nova-surface-glass);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.nova-chat-stream {
  flex: 1 1 0%;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.nova-bubble {
  max-width: 76ch;
  padding: 12px 16px;
  border-radius: var(--nova-radius-lg);
  line-height: 1.6;
  font-size: 14.5px;
  word-break: break-word;
}

.nova-bubble-user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22), rgba(99, 102, 241, 0.22));
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--nova-text-0);
  border-bottom-right-radius: 4px;
}

.nova-bubble-assistant {
  background: var(--nova-bg-2);
  border: 1px solid var(--nova-border);
  color: var(--nova-text-0);
  border-top-left-radius: 4px;
}

.nova-bubble-notice {
  margin: 0 auto;
  max-width: 64ch;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  text-align: center;
}

.nova-bubble-error {
  background: var(--nova-danger-soft);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

/* Composer */
.nova-composer-wrap {
  padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px) + var(--nova-kb-offset, 0px));
  background: var(--nova-bg-0);
  border-top: 1px solid var(--nova-border);
  flex-shrink: 0;
}

.nova-composer {
  background: var(--nova-bg-2);
  border: 1px solid var(--nova-border-strong);
  border-radius: var(--nova-radius-lg);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.nova-composer:focus-within {
  border-color: var(--nova-accent);
}

.nova-composer-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--nova-text-0);
  font-size: 14.5px;
  line-height: 1.5;
  resize: none;
  max-height: 180px;
  outline: none;
}

/* Stop Button & Paused Banner (§15.2) */
.nova-stop-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--nova-radius-sm);
  background: var(--nova-danger-soft);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fda4af;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 34px;
  transition: background 0.15s ease;
}
.nova-stop-button:hover {
  background: rgba(244, 63, 94, 0.28);
  color: #ffffff;
}

.nova-paused-banner {
  background: rgba(244, 63, 94, 0.16);
  border-bottom: 1px solid rgba(244, 63, 94, 0.4);
  color: #fecdd3;
  padding: 8px 18px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

/* Info Pane (Right Column) */
.nova-info-pane {
  width: var(--nova-info-w);
  flex-shrink: 0;
  background: var(--nova-bg-1);
  border-left: 1px solid var(--nova-border);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}
.nova-info-pane.is-hidden {
  display: none !important;
}

/* Command Palette & Modal Backdrops (Memory Vault, Settings, Persona Settings) */
.nova-palette-backdrop,
.nova-command-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.76);
  backdrop-filter: blur(6px);
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  overflow-y: auto;
}

.is-hidden,
.nova-top-menu.is-hidden,
.nova-top-menu.hidden,
.nova-palette-backdrop.is-hidden,
.nova-command-backdrop.is-hidden {
  display: none !important;
}

.nova-palette {
  width: min(620px, 92vw);
  background: var(--nova-bg-2);
  border: 1px solid var(--nova-border-strong);
  border-radius: var(--nova-radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

/* Approval Card (§15.1, §5.3) */
.nova-card-approval {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--nova-radius-md);
  padding: 14px 16px;
  margin-top: 8px;
}

/* Mobile Scrim (§8.1) */
.nova-mobile-scrim {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(3px);
  z-index: 55;
}

/* Responsive Mobile (<768px) (§8.1) */
@media (max-width: 767px) {
  .nova-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.65);
  }
  .nova-sidebar.is-mobile-open {
    transform: translateX(0);
  }
  .nova-info-pane {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(94vw, 380px);
    z-index: 60;
    box-shadow: -16px 0 40px rgba(0, 0, 0, 0.65);
  }
  /* 16px minimum font size on mobile inputs to prevent iOS Safari auto-zoom (§8.1) */
  .nova-composer-input,
  .nova-app-root input,
  .nova-app-root select,
  .nova-app-root textarea {
    font-size: 16px !important;
  }
}

/* Galaxy Fold Unfolded Inner Screen Dual-Pane Layout (§8.2) */
@media (horizontal-viewport-segments: 2), (min-width: 640px) and (max-width: 900px) and (max-aspect-ratio: 4/3) {
  .nova-sidebar {
    position: static;
    width: 260px;
    transform: none !important;
    box-shadow: none;
  }
}


