/* ==========================================================================
   QUANTUM LAB / CORE SCIENTIFIC & ALGORITHMIC WORKBENCH
   Base Styles, Layout Structure & Typography
   File: css/base.css
   ========================================================================== */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan-dim);
}

/* Master Layout Framework */
#app-root {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Top Application Header */
.app-header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-base);
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-cyan);
}

.brand-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.brand-title .brand-accent {
  color: var(--accent-cyan);
}

.brand-version-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--accent-emerald);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.system-stats {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  color: var(--text-main);
  font-weight: 600;
}

.stat-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
}

/* Main Workspace Split View */
.workspace-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  user-select: none;
}

.sidebar-category {
  padding: var(--space-base) var(--space-md) var(--space-xs);
}

.sidebar-category-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-left: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.nav-item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.nav-link:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--bg-surface);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.module-section {
  display: none;
  flex-direction: column;
  gap: var(--space-xl);
  animation: fadeIn 0.2s ease-in-out;
}

.module-section.active {
  display: flex;
}

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

/* Section Header */
.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.module-header-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.module-header-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 800px;
}

.module-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Bottom Status Bar */
.app-statusbar {
  height: var(--statusbar-height);
  min-height: var(--statusbar-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-base);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  user-select: none;
}

.statusbar-left, .statusbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.statusbar-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.statusbar-item a {
  color: var(--accent-cyan);
  text-decoration: none;
}

/* Typography & General Primitives */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-main);
}

code, kbd, pre {
  font-family: var(--font-mono);
}

kbd {
  font-size: 0.7rem;
  padding: 2px 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  font-size: 0.8rem;
  color: var(--text-main);
  overflow-x: auto;
}
