/**
 * shared.css — FASTER Lab workspace shared design system.
 * Provides: unified CSS variables, skeleton loaders, mobile nav fade,
 * breadcrumb, user-badge, and utility classes used across all pages.
 *
 * Pages import this AFTER their own :root block so the unified tokens
 * override any page-specific divergence.
 */

/* ─── Global font-size floor (all pages) ─────────────────────────────────── */
html { font-size: clamp(16px, 1.2vw + 4px, 22px); }
body { font-size: clamp(18px, 1.6vw, 22px); font-family: 'DM Sans', sans-serif; }
input, button, select, textarea { font-size: inherit; }

/* ─── Unified design tokens ──────────────────────────────────────────────── */
:root {
  /* Fonts — single consistent stack */
  --font: 'DM Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;

  /* Accent — one cyan across the whole product */
  --accent:  #00ccf5;
  --accent2: #00a8cc;
  --ac:      #00ccf5;   /* alias used by index / planning / assets */

  /* Surfaces (sub-page naming wins; aliased for index / assets naming) */
  --bg:       #090d12;
  --surface:  #111720;  /* --s1 alias */
  --surface2: #181f2a;  /* --s2 alias */
  --surface3: #1e2736;  /* --s3 alias */
  --s1: #111720;
  --s2: #181f2a;
  --s3: #1e2736;
  --s4: #252e3e;

  /* Borders */
  --border:  #232e3d;
  --border2: #2e3f54;
  --b1: #232e3d;
  --b2: #2e3f54;
  --b3: #374660;

  /* Text */
  --text:  #dde6f0;
  --muted: #6a7d94;
  --muted2:#3e5068;
  --t1: #dde6f0;
  --t2: #6a7d94;
  --t3: #3e5068;
  --t4: #253040;

  /* Semantic colors */
  --green:  #22c55e; --green-bg:  rgba(34,197,94,.1);
  --red:    #ef4444; --red-bg:    rgba(239,68,68,.1);
  --amber:  #f59e0b; --amber-bg:  rgba(245,158,11,.1);
  --blue:   #3b82f6; --blue-bg:   rgba(59,130,246,.1);
  --purple: #a855f7; --purple-bg: rgba(168,85,247,.1);
  --teal:   #14b8a6; --teal-bg:   rgba(20,184,166,.1);
  --orange: #f97316; --orange-bg: rgba(249,115,22,.1);
  --gr: #0fda7a; --re: #ff3d5a; --am: #ffb020;
  --pu: #9b5fff; --bl: #3a87ff; --te: #00dec8; --or: #ff7525;

  /* Radius */
  --r:   8px;
  --rl:  12px;
  --rxl: 16px;
}

/* ─── Light mode token overrides ─────────────────────────────────────────── */
[data-theme="light"] {
  --bg:       #f0f4f8;
  --surface:  #ffffff;
  --surface2: #f5f8fb;
  --surface3: #edf2f7;
  --s1: #ffffff;
  --s2: #f5f8fb;
  --s3: #edf2f7;
  --s4: #e2e8f0;

  --border:  #cbd5e1;
  --border2: #94a3b8;
  --b1: #cbd5e1;
  --b2: #94a3b8;
  --b3: #64748b;

  --text:  #0f172a;
  --muted: #475569;
  --muted2:#64748b;
  --t1: #0f172a;
  --t2: #475569;
  --t3: #64748b;
  --t4: #94a3b8;

  /* Accent stays cyan, slightly deepened for light backgrounds */
  --ac:     #0099bb;
  --accent: #0099bb;
  --accent2:#0077aa;

  /* Semantic colours stay the same — they're vivid enough on light too */
}

/* Inputs/selects in light mode */
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #fff;
  color: #0f172a;
  border-color: #cbd5e1;
}
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder { color: #94a3b8; }

/* ─── Theme toggle button (injected by auth.js + index.html) ─────────────── */
#faster-theme-btn {
  background: var(--s2);
  border: 1px solid var(--b1);
  border-radius: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: border-color .15s;
  flex-shrink: 0;
  line-height: 1;
}
#faster-theme-btn:hover { border-color: var(--ac); }

/* Google Fonts — unified stack loaded once via shared.css */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* ─── Skeleton loader ─────────────────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  border-radius: var(--r);
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface2) 50%,
    var(--surface) 75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

/* Preset skeleton shapes */
.sk-line  { height: 14px; margin-bottom: 8px; }
.sk-line.short { width: 40%; }
.sk-line.med   { width: 65%; }
.sk-line.full  { width: 100%; }
.sk-block { height: 80px;  width: 100%; }
.sk-stat  { height: 90px;  border-radius: var(--rl); }
.sk-row   { height: 44px;  border-radius: 6px; margin-bottom: 4px; }

/* Skeleton wrapper used in stats/tables */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.skeleton-table { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }

/* ─── Mobile nav fade affordance ─────────────────────────────────────────── */
/*
 * Wrap .nav-items / .nav-tabs in a <div class="nav-scroll-wrap"> to get
 * the right-edge gradient that hints at hidden tabs.
 */
.nav-scroll-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.nav-scroll-wrap .nav-items,
.nav-scroll-wrap .nav-tabs {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}
.nav-scroll-wrap .nav-items::-webkit-scrollbar,
.nav-scroll-wrap .nav-tabs::-webkit-scrollbar { display: none; }

/* Gradient fade at the right edge */
.nav-scroll-wrap::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 48px;
  background: linear-gradient(to right, transparent, var(--surface));
  pointer-events: none;
  z-index: 1;
}

/* ─── Breadcrumb / back-home link ────────────────────────────────────────── */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  text-decoration: none;
  padding: 3px 8px 3px 4px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  white-space: nowrap;
  margin-right: 4px;
}
.breadcrumb:hover {
  background: var(--surface2);
  color: var(--text);
}
.breadcrumb .bc-arrow { font-size: 13px; }

/* ─── User identity badge (shown in nav-right after user selection) ───────── */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.user-badge:hover { border-color: var(--border2); color: var(--text); }
.user-badge .ub-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── Global search overlay (⌘K) ────────────────────────────────────────── */
#gs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 9000;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 32px;
}
#gs-overlay.open { display: flex; }

#gs-box {
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  overflow: hidden;
}

#gs-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
#gs-input-wrap .gs-icon { color: var(--muted); font-size: 16px; flex-shrink: 0; }
#gs-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
}
#gs-input::placeholder { color: var(--muted); }
#gs-kbd {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}

#gs-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px 0;
}
.gs-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-family: var(--mono);
  padding: 10px 18px 4px;
}
.gs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background .1s;
}
.gs-item:hover, .gs-item.focused { background: var(--surface2); }
.gs-item-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.gs-item-name { font-size: 13px; color: var(--text); }
.gs-item-sub  { font-size: 11px; color: var(--muted); margin-top: 1px; }
.gs-item-module {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted2);
  background: var(--surface3);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}
#gs-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
#gs-loading {
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
}

/* ─── Activity feed widget ───────────────────────────────────────────────── */
.activity-feed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
}
.activity-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.activity-feed-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.af-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--green);
}
.af-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: skeleton-shimmer 0s; /* reuse keyframe name won't work; use pulse */
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.af-list { max-height: 340px; overflow-y: auto; }
.af-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.af-item:last-child { border-bottom: none; }
.af-item:hover { background: var(--surface2); }
.af-item-icon {
  font-size: 15px;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.af-item-body { flex: 1; min-width: 0; }
.af-item-msg  { font-size: 12px; color: var(--text); line-height: 1.5; }
.af-item-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px;
}
.af-empty {
  padding: 28px 18px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ─── (User selection modal removed — replaced by login screen) ──────────── */
