/* ==========================================================================
   FLUXO OS CORE — KERNEL DESIGN SYSTEM (OFFICIAL FLUXO BRAND IDENTITY)
   ========================================================================== */

:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Official Fluxo Brand Palette */
  --bg-dark: #04070a;
  --bg-card: rgba(10, 16, 22, 0.75);
  --bg-card-hover: rgba(18, 28, 38, 0.88);
  --border-glass: rgba(204, 255, 0, 0.14);
  --border-glow: rgba(204, 255, 0, 0.45);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Signature Fluxo Colors */
  --lime-glow: #ccff00;
  --lime-bright: #d4ff00;
  --lime-dark: #8cc600;
  --gold-glow: #ffd700;
  --cyan-glow: #00f2fe;
  --purple-glow: #a855f7;
  --red-glow: #ff4757;

  /* Gradients */
  --gradient-fluxo: linear-gradient(135deg, #ccff00 0%, #8cc600 100%);
  --gradient-cosmic: linear-gradient(135deg, rgba(204, 255, 0, 0.18), rgba(255, 215, 0, 0.12));
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Canvas Cosmic Background */
#cosmic-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
}

.cosmic-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 25%, rgba(204, 255, 0, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 80% 85%, rgba(255, 215, 0, 0.06) 0%, transparent 40%);
  z-index: -1;
  pointer-events: none;
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  width: 300px;
  background: rgba(5, 8, 14, 0.94);
  backdrop-filter: blur(25px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  z-index: 10;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.brand-logo-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 20px rgba(204, 255, 0, 0.35);
}

.brand-text h2 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ffffff, var(--lime-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--lime-glow);
  letter-spacing: 0.5px;
}

/* Kernel Status Badge */
.kernel-status-badge {
  background: rgba(204, 255, 0, 0.06);
  border: 1px solid rgba(204, 255, 0, 0.25);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ping-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--lime-glow);
  box-shadow: 0 0 12px var(--lime-glow);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(204, 255, 0, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(204, 255, 0, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(204, 255, 0, 0); }
}

.status-label { font-size: 0.82rem; font-weight: 700; color: var(--lime-glow); }
.kernel-url { font-family: var(--font-mono); font-weight: 700; font-size: 0.92rem; color: #fff; }
.kernel-meta { font-size: 0.75rem; color: var(--text-muted); }

/* Nav Menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-heading {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 0.35rem;
  padding-left: 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.25s ease;
}

.nav-item:hover {
  background: rgba(204, 255, 0, 0.05);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-item.active {
  background: var(--gradient-cosmic);
  border: 1px solid var(--border-glow);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(204, 255, 0, 0.15);
}

.nav-item i {
  font-size: 1.15rem;
  color: var(--lime-glow);
}

.nav-pill {
  margin-left: auto;
  background: rgba(204, 255, 0, 0.2);
  color: var(--lime-glow);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}

.nav-pill.lime { background: var(--gradient-fluxo); color: #04070a; }

.nav-sparkle {
  margin-left: auto;
  background: var(--gradient-fluxo);
  color: #04070a;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-glass);
}

.system-mini-stats {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem;
  border-radius: 10px;
}

.mini-stat { display: flex; flex-direction: column; align-items: center; }
.mini-title { font-size: 0.65rem; color: var(--text-dim); font-weight: 700; }
.mini-value { font-size: 0.85rem; font-family: var(--font-mono); font-weight: 700; color: var(--text-main); }
.mini-value.lime { color: var(--lime-glow); }

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 300px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.top-header {
  height: 72px;
  background: rgba(5, 8, 14, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 9;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  padding: 0.6rem 1rem;
  border-radius: 12px;
  width: 420px;
  transition: all 0.3s ease;
}

.header-search:focus-within {
  border-color: var(--lime-glow);
  box-shadow: 0 0 15px rgba(204, 255, 0, 0.25);
}

.header-search i { color: var(--text-muted); }
.header-search input { background: transparent; border: none; outline: none; color: #fff; font-family: var(--font-main); width: 100%; }

.header-actions { display: flex; align-items: center; gap: 1rem; }

.status-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(204, 255, 0, 0.1);
  border: 1px solid rgba(204, 255, 0, 0.3);
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--lime-glow);
}

.user-profile { display: flex; align-items: center; gap: 0.75rem; padding-left: 0.5rem; }
.avatar { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; border: 2px solid var(--lime-glow); box-shadow: 0 0 10px rgba(204, 255, 0, 0.3); }
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 0.88rem; font-weight: 700; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
}

.btn-primary {
  background: var(--gradient-fluxo);
  color: #04070a;
  font-weight: 800;
  box-shadow: 0 4px 20px rgba(204, 255, 0, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(204, 255, 0, 0.55);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(204, 255, 0, 0.1);
  border-color: rgba(204, 255, 0, 0.3);
}

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.btn-ghost.danger:hover { color: var(--red-glow); background: rgba(255, 71, 87, 0.1); }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; }

/* Content Body & Tabs */
.content-body { padding: 2rem; flex: 1; }
.tab-view { display: none; flex-direction: column; gap: 1.75rem; animation: fadeIn 0.4s ease; }
.tab-view.active { display: flex; }

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

/* Glass Card Base */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.glass-card:hover { border-color: rgba(204, 255, 0, 0.25); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.stat-card { display: flex; flex-direction: column; gap: 0.5rem; }
.stat-header { display: flex; align-items: center; justify-content: space-between; }
.stat-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; }
.stat-icon { font-size: 1.4rem; }
.stat-icon.lime { color: var(--lime-glow); }
.stat-icon.cyan { color: var(--cyan-glow); }
.stat-icon.purple { color: var(--purple-glow); }
.stat-icon.gold { color: var(--gold-glow); }

.stat-value { font-size: 2.1rem; font-weight: 800; font-family: var(--font-mono); color: #fff; }
.stat-footer { font-size: 0.78rem; color: var(--text-muted); }
.trend.positive { color: var(--lime-glow); font-weight: 700; }

/* Architecture Flow Box (Module 1) */
.flow-diagram-card { display: flex; flex-direction: column; gap: 1.25rem; }

.arch-flow-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(3, 5, 10, 0.95);
  border: 1px solid var(--border-glass);
  padding: 1.5rem;
  border-radius: 14px;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  flex: 1;
}

.flow-step.active {
  border-color: var(--lime-glow);
  box-shadow: 0 0 20px rgba(204, 255, 0, 0.25);
  background: rgba(204, 255, 0, 0.05);
}

.step-badge { font-size: 0.65rem; font-weight: 800; color: var(--text-dim); }
.step-badge.lime { color: var(--lime-glow); }
.step-badge.purple { color: var(--purple-glow); }
.step-badge.cyan { color: var(--cyan-glow); }
.step-sub { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); }

.flow-arrow { font-size: 1.4rem; color: var(--lime-glow); }

/* Data Table */
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 1rem; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; border-bottom: 1px solid var(--border-glass); }
.data-table td { padding: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 0.88rem; }

.tenant-cell { display: flex; align-items: center; gap: 0.75rem; }
.tenant-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gradient-fluxo);
  color: #04070a;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
}
.tenant-avatar.purple { background: linear-gradient(135deg, #a855f7, #7e22ce); color: #fff; }

.status-badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.65rem; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.status-badge.online { background: rgba(204, 255, 0, 0.12); color: var(--lime-glow); border: 1px solid rgba(204, 255, 0, 0.3); }

.badge-lime { background: rgba(204, 255, 0, 0.18); color: var(--lime-glow); }
.badge-cyan { background: rgba(0, 242, 254, 0.15); color: var(--cyan-glow); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: var(--purple-glow); }
.badge-gold { background: rgba(255, 215, 0, 0.15); color: var(--gold-glow); }

/* RBAC & Router Grids */
.rbac-grid, .ai-router-grid, .memory-grid, .plugins-grid, .market-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.rbac-card, .router-box, .mem-box, .plugin-card, .market-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rbac-perm-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
.mem-icon { font-size: 2rem; }

/* Plugin Toggle Switch */
.plugin-header { display: flex; align-items: center; justify-content: space-between; }
.plugin-icon { font-size: 2rem; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .3s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--lime-glow); }
input:checked + .slider:before { transform: translateX(20px); background-color: #04070a; }

/* Pub/Sub Stream Console */
.full-console-card { display: flex; flex-direction: column; gap: 1rem; }
.timeline-console {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(3, 5, 10, 0.95);
  padding: 1.25rem;
  border-radius: 14px;
  height: 460px;
  overflow-y: auto;
  font-family: var(--font-mono);
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--lime-glow);
  border-radius: 8px;
}

/* Utilities & Scrollbars */
.font-mono { font-family: var(--font-mono); }
.text-lime { color: var(--lime-glow); }
.text-cyan { color: var(--cyan-glow); }
.text-purple { color: var(--purple-glow); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(4, 7, 10, 0.5); }
::-webkit-scrollbar-thumb { background: rgba(204, 255, 0, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--lime-glow); }
