/* Clearline Markets Brand Theme - Universal Brand CI Prompt Pack
   Master design token file — loaded FIRST on every page.
   All other CSS files must use these variables, never hardcode colors.
   THIS IS THE SINGLE SOURCE OF TRUTH for all design tokens.
*/
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* === FONTS (per D-06, D-07, D-08) === */
  --brand-font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --brand-font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --brand-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

  /* === BACKGROUNDS === */
  --bg-primary: #070B14;
  --bg-elevated: #0C1220;
  --bg-surface: #111827;
  --bg-hover: #1A2332;

  /* === TEXT === */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --text-disabled: #475569;

  /* === ACCENT === */
  --accent: #0DD3E7;
  --accent-hover: #0BBDD0;
  --accent-muted: rgba(13,211,231,0.15);
  --accent-glow: rgba(13,211,231,0.20);

  /* === BORDERS === */
  --border-default: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --border-accent: rgba(13,211,231,0.30);

  /* === STATUS === */
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;

  /* === RADIUS (per DESIGN-SYSTEM-RESEARCH.md Section 3 Geometry) === */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* === SHADOWS === */
  --shadow-soft: 0 8px 32px rgba(0,0,0,0.3);
  --shadow-lift: 0 24px 64px rgba(0,0,0,0.5);
  --shadow-dropdown: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(13,211,231,0.15);

  /* === TRANSITIONS === */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* === LAYOUT === */
  --max-width: 1200px;

  /* === BACKWARD-COMPAT ALIASES (per D-18) === */
  /* Old brand-* names map to new tokens so existing pages don't break */
  --brand-bg0: var(--bg-primary);
  --brand-bg1: var(--bg-elevated);
  --brand-surface0: var(--bg-elevated);
  --brand-surface1: var(--bg-surface);
  --brand-text0: var(--text-primary);
  --brand-text1: var(--text-secondary);
  --brand-muted: var(--text-tertiary);
  --brand-border: var(--border-hover);
  --brand-primary: var(--accent);
  --brand-primary-dark: var(--accent-hover);
  --brand-accent: var(--accent);
  --brand-success: var(--success);
  --brand-warning: var(--warning);
  --brand-error: var(--danger);
  --brand-radius-sm: var(--radius-sm);
  --brand-radius-md: var(--radius-md);
  --brand-radius-lg: var(--radius-lg);
  --brand-shadow-soft: var(--shadow-soft);
  --brand-shadow-lift: var(--shadow-lift);

  /* Old landing.css token aliases */
  --bg0: var(--bg-primary);
  --bg1: var(--bg-elevated);
  --surface0: var(--bg-elevated);
  --surface1: var(--bg-surface);
  --text0: var(--text-primary);
  --text1: var(--text-secondary);
  --muted: var(--text-tertiary);
  --border: var(--border-hover);

  /* Old institutional.css token aliases */
  --font-sans: var(--brand-font-body);
  --font-mono: var(--brand-font-mono);
  --transition: var(--transition-normal);
  /* NOTE: Do NOT re-alias --transition-fast here. The primary definition (150ms) above is correct.
     institutional.css had 160ms but that conflicts with the primary token. Pages using
     --transition-fast get the canonical 150ms value. */

  /* FIX UNDEFINED VARIABLES (per D-16) — these were referenced but never defined */
  --brand-card: var(--bg-elevated);
  --brand-input: var(--bg-surface);
  --brand-transition: var(--transition-normal);
  --brand-radius-pill: var(--radius-pill);
  --brand-shadow-glow: var(--shadow-glow);

  /* Old dashboard.css token aliases */
  --brand-secondary: var(--accent-hover);
}

body {
  font-family: var(--brand-font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(13,211,231,0.5);
  background: var(--bg-primary);
  object-fit: contain;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: var(--transition-normal);
  text-decoration: none;
  display: inline-block;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: var(--transition-normal);
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: var(--text-secondary);
}

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  box-shadow: none;
  padding: 2rem;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  transition: var(--transition-normal);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

/* Navbar scroll state — consumed by clearline-shared.js scroll handler */
.navbar.scrolled {
  background: rgba(7,11,20,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

h1, h2, h3 {
  font-family: var(--brand-font-body);
  font-weight: 700;
}

.muted {
  color: var(--brand-muted);
}

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(900px 600px at 20% 0%, rgba(13,211,231,0.16), transparent 60%),
              radial-gradient(900px 600px at 100% 40%, rgba(44,153,169,0.12), transparent 55%),
              linear-gradient(180deg, var(--bg-primary), var(--bg-elevated));
  padding: 24px;
}
.auth-shell { width: 100%; max-width: 520px; }
.auth-card {
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 32px 32px 28px;
  box-shadow: var(--shadow-lift);
  border: 1px solid var(--border-hover);
}
.auth-card h1 { margin: 0 0 6px; font-weight: 800; letter-spacing: -0.02em; }
.auth-card p { margin: 0; color: var(--text-tertiary); }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.auth-form label { font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; display: inline-block; }
.auth-form input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-hover); background: var(--bg-surface); color: var(--text-primary); }
.auth-form input:focus { outline: none; border-color: rgba(13,211,231,0.55); box-shadow: 0 0 0 3px rgba(13,211,231,0.15); }
.auth-actions { display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; color: var(--text-tertiary); }
.auth-actions a { color: var(--accent); text-decoration: none; }
.auth-actions a:hover { color: var(--accent-hover); }
.auth-footer { margin-top: 18px; color: var(--text-tertiary); font-size: 0.95rem; }
.auth-footer a { color: var(--accent); text-decoration: none; }
.auth-footer a:hover { color: var(--accent-hover); }

/* Dashboard layout */
.dashboard-page {
  background: radial-gradient(1200px 800px at 30% 0%, rgba(13,211,231,0.12), transparent 60%),
              linear-gradient(180deg, var(--bg-primary), var(--bg-elevated) 60%, var(--bg-primary));
  min-height: 100vh;
  margin: 0;
}
.dashboard-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 36px 18px; }
.dashboard-center { width: 100%; max-width: 820px; }
.dashboard-card { background: rgba(12,18,32,0.94); border-radius: 22px; box-shadow: var(--shadow-lift); padding: 34px; border: 1px solid var(--border-hover); color: var(--text-primary); }
.dashboard-header { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.dashboard-logout { margin-left: auto; }
.dashboard-section { margin-top: 22px; }
.dashboard-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; }
.dashboard-btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 8px; }
.dashboard-btn-glow { padding: 12px 22px; }
.dashboard-links { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 10px; margin-top: 8px; }
.dashboard-link { padding: 12px 14px; border: 1px solid var(--border-hover); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); text-decoration: none; box-shadow: var(--shadow-dropdown); }
.dashboard-link:hover { color: var(--accent-hover); border-color: var(--border-accent); }

/* Accessibility: high contrast for warnings/errors */
.note.warn {
  color: var(--warning);
}
.note.error {
  color: var(--danger);
}
