/* Brain SaaS — White Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  /* Surfaces */
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-hover: #F5F5F5;
  --surface-active: #EFEFEF;

  /* Borders */
  --border: #E5E5E5;
  --border-subtle: #F0F0F0;
  --border-focus: #6366F1;

  /* Text */
  --text-primary: #1A1A1A;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);

  /* Radius */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Node type colors */
  --color-project: #6366F1;
  --color-person: #F59E0B;
  --color-contact: #D97706;
  --color-goal: #10B981;
  --color-task: #0EA5E9;
  --color-decision: #8B5CF6;
  --color-blocker: #F43F5E;
  --color-area: #14B8A6;
  --color-reminder: #F97316;
  --color-habit: #84CC16;
  --color-note: #CBD5E1;
  --color-event: #94A3B8;
  --color-observation: #B0BEC5;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
header {
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  gap: 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 52px;
}

.logo {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: 1px;
  text-transform: uppercase;
}

#search {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 220px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
#search::placeholder {
  color: var(--text-tertiary);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.layout-pills {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 3px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}
.layout-pill {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.layout-pill.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---- Filter Sidebar ---- */
#sidebar {
  position: fixed;
  top: 52px;
  left: 0;
  width: 160px;
  height: calc(100vh - 52px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  z-index: 50;
}

.filter-section {
  margin-bottom: 20px;
}
.filter-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.filter-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.filter-item.active {
  background: var(--surface-active);
  color: var(--text-primary);
}
.filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Graph Canvas ---- */
#cy {
  position: fixed;
  top: 52px;
  left: 160px;
  right: 0;
  bottom: 0;
  background: var(--bg);
}

/* ---- Detail Panel ---- */
#panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 150;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.08);
}
#panel.open {
  transform: translateX(0);
}

.p-type-bar {
  height: 3px;
  width: 100%;
}
.p-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
}
.p-close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.p-header {
  padding: 20px 24px 16px;
}
.p-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.p-meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}
.status-active { background: #ECFDF5; color: #059669; }
.status-in_progress { background: #EFF6FF; color: #2563EB; }
.status-pending { background: #FFFBEB; color: #D97706; }
.status-blocked { background: #FEF2F2; color: #DC2626; }
.status-completed { background: #F9FAFB; color: #6B7280; }
.status-stalled { background: #FFF7ED; color: #EA580C; }
.status-archived { background: #F9FAFB; color: #9CA3AF; }

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-secondary);
}
.type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.p-body {
  padding: 0 24px 24px;
}

.p-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin: 20px 0 8px;
}

.p-md {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Connection cards */
.conn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.conn:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.conn-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.conn-verb {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ---- Minimap ---- */
.cytoscape-navigator {
  position: fixed !important;
  bottom: 16px;
  right: 16px;
  width: 160px;
  height: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
  overflow: hidden;
}

/* ---- Empty State ---- */
.empty-state {
  position: fixed;
  top: 52px;
  left: 160px;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.empty-icon {
  width: 80px;
  height: 80px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}
.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.6;
}

/* ---- Landing Page ---- */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.landing-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.landing-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: 32px;
}
.tg-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #0088cc;
  color: white;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.tg-login-btn:hover {
  background: #006daa;
}

/* ---- Onboarding ---- */
.onboarding {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.onboarding-step {
  text-align: center;
  max-width: 480px;
}
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-project);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}
.step-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
}
.step-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.step-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn-primary {
  padding: 10px 20px;
  background: var(--color-project);
  color: white;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
  padding: 10px 20px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: var(--surface-hover);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  #sidebar {
    display: none;
  }
  #cy {
    left: 0;
  }
  .empty-state {
    left: 0;
  }
  #panel {
    width: 100%;
  }
}
@media (max-width: 640px) {
  .landing-title {
    font-size: 32px;
  }
  .landing-subtitle {
    font-size: 15px;
  }
  header {
    padding: 10px 12px;
  }
  #search {
    width: 140px;
  }
}
