/* MemoryForge AI Labs — Shared Components */

/* ========== NAVIGATION ========== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 26, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 var(--space-xl);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.nav-brand .logo {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: white;
}

.nav-links {
  display: flex;
  gap: var(--space-xs);
  margin: 0 auto;
  list-style: none;
}

.nav-links a {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: rgba(79, 195, 247, 0.08);
}

.nav-links a.active {
  color: var(--accent-blue);
  background: rgba(79, 195, 247, 0.12);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #2196f3);
  border-color: transparent;
  color: white;
  font-weight: 600;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #64d8ff, var(--accent-blue));
  box-shadow: var(--glow-blue);
}

.btn-lg {
  padding: var(--space-md) var(--space-2xl);
  font-size: var(--fs-base);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--fs-xs);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-color);
}

.btn-ghost:hover {
  background: rgba(79, 195, 247, 0.06);
}

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--glow-blue);
}

.card-title {
  font-size: var(--fs-md);
  margin-bottom: var(--space-sm);
}

.card-text {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== BADGES / CHIPS ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue {
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent-blue);
}

.badge-green {
  background: rgba(129, 199, 132, 0.15);
  color: var(--accent-green);
}

.badge-orange {
  background: rgba(255, 183, 77, 0.15);
  color: var(--accent-orange);
}

.badge-red {
  background: rgba(229, 115, 115, 0.15);
  color: var(--accent-red);
}

.badge-purple {
  background: rgba(186, 104, 200, 0.15);
  color: var(--accent-purple);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
}

.chip:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(79, 195, 247, 0.06);
}

.chip.active {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(79, 195, 247, 0.12);
}

/* ========== SCORE BARS ========== */
.score-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-xs);
}

.score-bar-label {
  width: 80px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
}

.score-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  background: var(--accent-blue);
}

.score-bar-fill.green { background: var(--accent-green); }
.score-bar-fill.orange { background: var(--accent-orange); }
.score-bar-fill.red { background: var(--accent-red); }

.score-bar-value {
  width: 35px;
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== GAUGE ========== */
.gauge-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.gauge-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  font-family: var(--font-mono);
}

.gauge-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========== TABS ========== */
.tab-bar {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0;
}

.tab-btn {
  padding: var(--space-sm) var(--space-lg);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.tab-content {
  display: none;
  padding: var(--space-lg) 0;
}

.tab-content.active {
  display: block;
  animation: slide-in-up 0.3s ease;
}

/* ========== DROPDOWN / SELECT ========== */
.select-wrap {
  position: relative;
  display: inline-flex;
}

.select-custom {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  padding: var(--space-xs) var(--space-xl) var(--space-xs) var(--space-md);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.select-custom:hover,
.select-custom:focus {
  border-color: var(--accent-blue);
  outline: none;
}

.select-wrap::after {
  content: '\25BE';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.7rem;
}

/* ========== SLIDER ========== */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

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

.slider-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slider-value {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--accent-blue);
  font-weight: 600;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.5);
}

/* ========== TOAST ========== */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: slide-in-right 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.warning { border-left: 3px solid var(--accent-orange); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }

/* ========== TABLE ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.data-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: rgba(79, 195, 247, 0.03);
}

/* ========== TOGGLE SWITCH ========== */
.toggle-switch {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.toggle-opt {
  padding: var(--space-xs) var(--space-lg);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  font-family: var(--font-sans);
}

.toggle-opt.active {
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent-blue);
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slide-in-up 0.3s ease;
}

.modal-title {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-md);
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--fs-lg);
  cursor: pointer;
}

/* ========== TOOLBAR ========== */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-xl);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== FOOTER ========== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
}

.footer-brand {
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin: var(--space-md) 0;
  list-style: none;
}

.footer-links a {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--accent-blue);
}

.footer-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--space-md);
}

/* ========== LOADING ========== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== PIPELINE TRACE ========== */
.pipeline {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  overflow-x: auto;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-width: 100px;
  text-align: center;
  transition: all var(--transition-base);
  opacity: 0.4;
}

.pipeline-step.active {
  opacity: 1;
  border-color: var(--accent-green);
  background: rgba(129, 199, 132, 0.06);
}

.pipeline-step-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-primary);
}

.pipeline-step-detail {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-arrow {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  flex-shrink: 0;
  transition: color var(--transition-base);
}

.pipeline-arrow.active {
  color: var(--accent-green);
}
