/* portal/css/design-system.css
 * Robbins Estate Law — Portal Design System
 * Session 40 — SaaS Redesign
 * Zero hardcoded hex values — all colors via CSS custom properties
 * =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── DARK THEME (default) ─────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:              #0a0f1e;
  --surface:         #131929;
  --surface-hover:   #1a2236;
  --surface-inset:   #0d1420;
  --border:          rgba(255, 255, 255, 0.08);
  --border-subtle:   rgba(255, 255, 255, 0.04);

  --text:            #f0f6fc;
  --text-muted:      #7d8590;
  --text-subtle:     #4d5a6a;

  --accent-brand:    #c5a059;
  --accent-brand-dk: #a68548;
  --accent-data:     #38bdf8;
  --accent-success:  #10b981;
  --accent-warning:  #f59e0b;
  --accent-danger:   #f87171;
  --accent-purple:   #a78bfa;

  --shadow-sm:       0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:       0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:       0 8px 32px rgba(0,0,0,0.6);
}

/* ── LIGHT THEME ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:              #f8fafc;
  --surface:         #ffffff;
  --surface-hover:   #f1f5f9;
  --surface-inset:   #f8fafc;
  --border:          #e2e8f0;
  --border-subtle:   #f1f5f9;

  --text:            #0f172a;
  --text-muted:      #64748b;
  --text-subtle:     #94a3b8;

  --accent-brand:    #b8860b;
  --accent-brand-dk: #8a6309;
  --accent-data:     #2563eb;
  --accent-success:  #059669;
  --accent-warning:  #d97706;
  --accent-danger:   #dc2626;
  --accent-purple:   #7c3aed;

  --shadow-sm:       0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:       0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:       0 8px 32px rgba(0,0,0,0.16);
}

/* ── Global transition for theme swap ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}
.no-transition * { transition: none !important; }

/* ── Base reset ───────────────────────────────────────────────────────────── */
html, body { margin: 0; padding: 0; min-height: 100vh; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
}
h1, h2 { font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }

.kpi-value {
  font-size: 2.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.page-title {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.page-lede {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ── Site Header ──────────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-brand);
  letter-spacing: -0.01em;
}

.site-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.site-meta strong { color: var(--text); }

/* ── Theme Toggle Button ──────────────────────────────────────────────────── */
.theme-toggle {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent-brand); }

/* ── Section Navigation ───────────────────────────────────────────────────── */
.section-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }

.section-nav a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.75rem 0.875rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.section-nav a:hover { color: var(--text); }

.section-nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent-brand);
  font-weight: 600;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
main {
  max-width: 1280px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 3rem;
}

/* ── Cards / Surfaces ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: rgba(197, 160, 89, 0.3);
  box-shadow: var(--shadow-md);
}

.card-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ── Status Badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
}

.badge-live {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-pending {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Pulsing dot for Live status */
.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-success);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Data Tables ──────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.data-table td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.data-table tr:hover td { background: var(--surface-hover); }

/* ── Skeleton Loading ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-hover) 25%,
    var(--surface)       50%,
    var(--surface-hover) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
  height: 1rem;
}

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

.skeleton-kpi  { height: 2.8rem; width: 120px; }
.skeleton-text { height: 0.875rem; width: 80%; }
.skeleton-text.short { width: 40%; }

/* ── Custom Scrollbar (dark theme) ───────────────────────────────────────── */
[data-theme="dark"] ::-webkit-scrollbar       { width: 6px; height: 6px; }
[data-theme="dark"] ::-webkit-scrollbar-track  { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ── Insights Two-Column Layout ───────────────────────────────────────────── */
.insights-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .insights-layout { grid-template-columns: 1fr; }
}

/* ── Chat panel placeholder ───────────────────────────────────────────────── */
.chat-panel {
  position: sticky;
  top: 72px;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer.site {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-subtle);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ── Delta / trend helpers ────────────────────────────────────────────────── */
.delta-positive { color: var(--accent-success); }
.delta-negative { color: var(--accent-danger); }
.delta-neutral  { color: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .site-header { padding: 0 1rem; }
  main { padding: 0 1rem 2rem; }
}
