/* ==========================================================================
   BRANDING TOKENS — SINGLE SOURCE OF TRUTH
   ==========================================================================
   This file is the ONLY source for brand tokens: colors, typography, shadows,
   radii, and brand-bound text utilities. Do NOT add layout/utility/responsive 
   classes here. Layout belongs in components.css or layout.css.
   
   To change colors or typography: edit this file first, then propagate via
   var() references in consumer files.
*/

/* ── Font Imports (Google Fonts preconnect in index.html) ── */
:root {
  /* Font families */
  --font-family-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  
  /* Font weights */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* ── Typography Scale ── */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;         /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;     /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 1.875rem;    /* 30px */
  --font-size-4xl: 2.25rem;     /* 36px */
  --font-size-5xl: 3rem;        /* 48px */
  
  /* Line heights */
  --line-height-tight: 1.1;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;
  
  /* Letter spacing */
  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.02em;

  /* ── Color Palette: Brand Yellow (Amber) ── */
  --color-primary: #F59E0B;          /* Brand accent - amber-500 */
  --color-accent: #F59E0B;         /* Yellow accent (alias) */
  --color-primary-soft: rgba(245, 158, 11, 0.15);
  --color-primary-hover: #D97706;      /* Amber-600 - pressed state */
  
  /* ── Backgrounds ── */
  --color-bg: #FFFFFF;               /* White base */
  --color-surface: #FAFAFA;         /* Subtle elevation */
  --color-surface-raised: #F4F4F5; /* Card backgrounds */
  
  /* ── Text Colors ── */
  --color-text: #18181B;            /* Primary text - neutral-800 */
  --color-text-secondary: #52525B;    /* Secondary text - neutral-500 */
  --color-text-muted: #52525B;        /* Muted - neutral-500: passes 4.5:1 */
  
  /* ── Border Colors ── */
  --color-border: #E4E4E7;           /* Default border - neutral-200 */
  --color-border-strong: #A1A1AA;  /* Emphasized border - neutral-300 */
  
  /* ── Semantic Colors ── */
  --color-success: #10B981;          /* Emerald */
  --color-warning: #F59E0B;         /* Amber (same as brand) */
  --color-danger: #EF4444;           /* Red-500 */
  --color-info: #3B82F6;          /* Blue-500 */
  
  /* ── Neutral Scale (50-950) ── */
  --color-neutral-50: #FAFAFA;
  --color-neutral-100: #F4F4F5;
  --color-neutral-200: #E4E4E7;
  --color-neutral-300: #A1A1AA;
  --color-neutral-400: #71717A;
  --color-neutral-500: #52525B;
  --color-neutral-600: #3F3F46;
  --color-neutral-700: #27272A;
  --color-neutral-800: #18181B;
  --color-neutral-900: #09090B;
  --color-neutral-950: #0A0A0A;
  
  /* ── Shadows (brand-on-white aesthetic) ── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-primary: 0 4px 20px rgba(245, 158, 11, 0.35);   /* Brand glow */
  --shadow-primary-hover: 0 8px 32px rgba(245, 158, 11, 0.5);

  /* ── Border Radii ── */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* ── Legacy / Backward Compatibility Aliases ── */
  /* (For existing code migration - prefer new tokens above) */
  --bg-primary: var(--color-bg);
  --bg-secondary: var(--color-neutral-100);
  --bg-elevated: var(--color-surface);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text-secondary);
  --text-tertiary: var(--color-text-muted);
  --border-default: var(--color-border);
  --border-accent: rgba(217, 119, 6, 0.30);
  --glass-bg: rgba(246, 241, 229, 0.03);
  --glass-border: rgba(246, 241, 229, 0.08);
  --glass-hover: rgba(246, 241, 229, 0.06);
  --accent-primary: var(--color-primary);
  --accent-primary-soft: rgba(245, 158, 11, 0.15);
  --accent-warm: #F59E0B;
  --accent-blue: #3B82F6;
  --accent-pink: #EC4899;
  --accent-green: var(--color-success);
  --gradient-hero: linear-gradient(135deg, #D97706 0%, #F59E0B 100%);
  --gradient-1: linear-gradient(135deg, #D97706 0%, #F59E0B 100%);
}

/* ── Typography Utility Classes (text-only, no layout) ── */

/* Display - Largest hero */
.text-display {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  line-height: 1.05;
}

/* Heading 1 */
.text-h1 {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  line-height: var(--line-height-tight);
}

/* Heading 2 */
.text-h2 {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

/* Heading 3 */
.text-h3 {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

/* Heading 4 */
.text-h4 {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  line-height: 1.4;
}

/* Body - Main content */
.text-body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  letter-spacing: var(--letter-spacing-normal);
  line-height: var(--line-height-relaxed);
}

/* Caption - Small labels, tags */
.text-caption {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  line-height: var(--line-height-normal);
  text-transform: uppercase;
}

/* Mono - Code / technical */
.text-mono {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  letter-spacing: var(--letter-spacing-normal);
  line-height: var(--line-height-relaxed);
}

/* ── Global Font Rendering (crisp text on macOS/Windows) ── */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  font-kerning: normal;
}

/* ── LLM Config Section Classes (mirrors KR Dashboard) ── */
.llmc-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.llmc-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.llmc-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.llmc-header-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: 0;
}
.llmc-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.llmc-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  background: var(--color-success);
  color: white;
}
.llmc-section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--glass-border);
}
.llmc-section-divider-icon {
  flex-shrink: 0;
  color: var(--accent-primary);
}
.llmc-section-divider-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.llmc-section-divider-text strong {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}
.llmc-section-divider-text span {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-weight: var(--font-weight-regular);
}
.llmc-section-divider-line {
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}
.llmc-toggles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}
.llmc-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.llmc-toggle-card.disabled {
  opacity: 0.7;
  background: rgba(239, 68, 68, 0.1);
}
.llmc-toggle-icon {
  font-size: 1.25rem;
}
.llmc-toggle-label {
  font-weight: var(--font-weight-medium);
}
.llmc-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  display: inline-block;
}
.llmc-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.llmc-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-success);
  border-radius: 20px;
  transition: 0.2s;
}
.llmc-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  transform: translateX(0);
}
.llmc-toggle-switch input:checked + .llmc-toggle-slider {
  background: var(--color-success);
}
.llmc-toggle-switch input:checked + .llmc-toggle-slider:before {
  transform: translateX(16px);
}
.llmc-phases-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.llmc-phase-card {
  padding: 0.75rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.llmc-phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.llmc-phase-name {
  font-weight: var(--font-weight-medium);
}
.llmc-phase-badge {
  font-size: var(--font-size-xs);
  padding: 0.125rem 0.5rem;
  background: rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-full);
  color: var(--color-info);
}
.llmc-chain-list {
  display: none;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
}
.llmc-chain-list.visible {
  display: block;
}
.llmc-chain-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  cursor: grab;
}
.llmc-chain-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.llmc-chain-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}
.llmc-chain-rank {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-border);
  border-radius: 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}
.llmc-llm-icon {
  font-size: var(--font-size-sm);
}
.llmc-llm-label {
  flex: 1;
  font-size: var(--font-size-sm);
}
.llmc-drag-handle {
  color: var(--text-secondary);
}
.llmc-models-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.llmc-model-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.llmc-model-icon {
  font-size: 1.25rem;
}
.llmc-model-key {
  flex: 1;
  font-weight: var(--font-weight-medium);
}
.llmc-model-input {
  flex: 1;
  max-width: 200px;
  padding: 0.375rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}
.llmc-model-input:focus {
  outline: none;
  border-color: var(--color-info);
}
.llmc-timeout-input {
  width: 80px;
  text-align: right;
  padding: 0.375rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}
.llmc-phase-model-mapping {
  overflow-x: auto;
}
