/* =========================================================================
   PRFactory — LEGACY TOKEN COMPATIBILITY SHIM (Phase 17.1)

   This file no longer defines any concrete design values. Every concrete
   value now lives in the canonical token system (tokens.css → tokens/*),
   whose values come verbatim from the chosen mockup
   C:\temp\PRFactory\mockups\06-developer-dark-dual\styles.css.

   ~150 business components/pages still reference the OLD token vocabulary
   (--brand-primary, --primary-color, --space-md, --shadow-sm, --gray-*,
   --color-success, --badge-*-bg, --border-radius, --transition-*, …).
   Rewriting them is Phase 17.2. To make 17.1 additive and non-breaking,
   every still-referenced legacy token is re-declared here as an ALIAS that
   points at a canonical token. Because the canonical tokens are dual-mode,
   un-migrated pages automatically pick up the new dark/light palette
   through the cascade with zero per-file edits.

   This shim is DELETED at the end of Phase 17.2.

   NOTE: Bootstrap's own --bs-* variables are intentionally NOT aliased
   here. They are supplied by Bootstrap's stylesheet; globally overriding
   them would re-tint every Bootstrap-styled surface and regress existing
   pages in this slice. Migrating --bs-* usages is flagged for 17.2.
   ========================================================================= */

/* NOTE: tokens are intentionally NOT @imported here — the token partials
   are loaded as direct, content-hash-versioned <link>s in App.razor,
   BEFORE this file. Do not re-add the @import. */

:root {
  /* ===== Typography ===== */
  --font-family-base: var(--font-sans);
  --font-family-heading: var(--font-sans);
  --font-family-mono: var(--font-mono);

  --font-size-xs: var(--fs-xs);
  --font-size-sm: var(--fs-sm);
  --font-size-base: var(--fs-body);
  --font-size-lg: var(--fs-h3);
  --font-size-xl: var(--fs-h2);
  --font-size-2xl: var(--fs-h1);

  --font-weight-normal: var(--fw-regular);
  --font-weight-medium: var(--fw-medium);
  --font-weight-semibold: var(--fw-semibold);

  --line-height-tight: var(--lh-tight);
  --line-height-base: var(--lh-normal);

  /* ===== Brand / accent ===== */
  --brand-primary: var(--color-accent);
  --brand-primary-dark: var(--color-accent-press);
  --brand-primary-light: var(--color-accent-hover);
  --brand-secondary: var(--color-text-secondary);
  --brand-secondary-dark: var(--color-text-muted);
  --brand-secondary-light: var(--color-text-faint);

  --accent-purple: var(--color-accent);
  --accent-purple-light: var(--color-accent-hover);
  --accent-indigo: var(--color-accent);
  --accent-cyan: var(--color-accent);
  --accent-teal: var(--color-accent);

  --primary-color: var(--color-accent);
  --secondary-color: var(--color-text-secondary);
  --success-color: var(--color-success);
  --danger-color: var(--color-danger);
  --warning-color: var(--color-warning);
  --info-color: var(--color-info);
  --light-color: var(--color-surface-2);
  --dark-color: var(--color-text);

  /* ===== Semantic colors (legacy old→new aliases only) =====
     --color-{success,danger,warning,info} and their -text companions are
     canonical tokens defined in tokens/_color.css; they are consumed by
     name and MUST NOT be self-redeclared here (a `--x: var(--x)` cycle
     invalidates the canonical value). Only the legacy -bg/-border names
     (which differ from the canonical -soft/-line names) are aliased. */
  --color-success-bg: var(--color-success-soft);
  --color-success-border: var(--color-success-line);

  --color-danger-bg: var(--color-danger-soft);
  --color-danger-border: var(--color-danger-line);

  --color-warning-bg: var(--color-warning-soft);
  --color-warning-border: var(--color-warning-line);

  --color-info-bg: var(--color-info-soft);
  --color-info-border: var(--color-info-line);

  /* ===== Workflow state colors ===== */
  --state-triggered: var(--color-text-muted);
  --state-analyzing: var(--color-info);
  --state-analyzing-bg: var(--color-info-soft);
  --state-analyzing-text: var(--color-info-text);
  --state-questions: var(--color-warning);
  --state-planning: var(--color-accent);
  --state-review: var(--color-warning);
  --state-approved: var(--color-success);
  --state-rejected: var(--color-danger);
  --state-implementing: var(--color-info);
  --state-completed: var(--color-success);
  --state-failed: var(--color-danger);
  --state-cancelled: var(--color-text-muted);

  /* ===== Neutral / grayscale ===== */
  --gray-50: var(--color-surface-2);
  --gray-100: var(--color-surface-2);
  --gray-200: var(--color-surface-3);
  --gray-300: var(--color-border);
  --gray-400: var(--color-border-strong);
  --gray-500: var(--color-text-faint);
  --gray-600: var(--color-text-muted);
  --gray-700: var(--color-text-secondary);
  --gray-800: var(--color-text-secondary);
  --gray-900: var(--color-text);

  /* ===== UI element colors ===== */
  --border-color: var(--color-border);
  --border-color-light: var(--color-border-soft);
  --border-color-dark: var(--color-border-strong);

  --text-color: var(--color-text);
  --text-color-primary: var(--color-text);
  --text-color-secondary: var(--color-text-secondary);
  --text-color-muted: var(--color-text-muted);

  --bg-color: var(--color-surface-1);
  --bg-color-alt: var(--color-bg-base);
  --bg-color-primary: var(--color-surface-1);
  --bg-color-secondary: var(--color-bg-sunken);
  --bg-color-tertiary: var(--color-surface-2);
  --bg-color-code: var(--color-bg-sunken);
  --bg-color-hover: var(--color-surface-2);

  /* ===== Status badge colors ===== */
  --badge-primary-bg: var(--color-accent-soft);
  --badge-primary-text: var(--color-accent-text);
  --badge-success-bg: var(--color-success-soft);
  --badge-success-text: var(--color-success-text);
  --badge-danger-bg: var(--color-danger-soft);
  --badge-danger-text: var(--color-danger-text);
  --badge-warning-bg: var(--color-warning-soft);
  --badge-warning-text: var(--color-warning-text);
  --badge-info-bg: var(--color-info-soft);
  --badge-info-text: var(--color-info-text);

  /* ===== Bootstrap component color mirrors (legacy --bootstrap-* only;
           NOT Bootstrap's own --bs-*) ===== */
  --bootstrap-primary: var(--color-accent);
  --bootstrap-primary-bg-subtle: var(--color-accent-soft);
  --bootstrap-success: var(--color-success);
  --bootstrap-success-bg-subtle: var(--color-success-soft);
  --bootstrap-danger: var(--color-danger);
  --bootstrap-danger-bg-subtle: var(--color-danger-soft);
  --bootstrap-warning: var(--color-warning);
  --bootstrap-warning-bg-subtle: var(--color-warning-soft);
  --bootstrap-warning-text: var(--color-warning-text);
  --bootstrap-info: var(--color-info);
  --bootstrap-info-bg-subtle: var(--color-info-soft);
  --bootstrap-secondary: var(--color-text-secondary);
  --bootstrap-secondary-bg-subtle: var(--color-neutral-soft);

  /* ===== Link colors ===== */
  --link-color: var(--color-accent-text);
  --link-hover-color: var(--color-accent-hover);

  /* ===== Diff colors (GitDiffViewer) ===== */
  --diff-added-bg: var(--color-success-soft);
  --diff-added-line: var(--color-success-line);
  --diff-deleted-bg: var(--color-danger-soft);
  --diff-deleted-line: var(--color-danger-line);
  --diff-hunk-bg: var(--color-info-soft);
  --diff-hunk-color: var(--color-info-text);

  /* ===== File status colors ===== */
  --file-added-bg: var(--color-success-soft);
  --file-added-border: var(--color-success-line);
  --file-deleted-bg: var(--color-danger-soft);
  --file-deleted-border: var(--color-danger-line);
  --file-modified-bg: var(--color-warning-soft);
  --file-modified-border: var(--color-warning-line);

  /* ===== Code colors ===== */
  --code-bg: var(--color-bg-sunken);
  --code-text: var(--color-accent-text);
  --code-border: var(--color-border);

  /* ===== Spacing (t-shirt → 8px scale) ===== */
  --space-xs: var(--space-1);
  --space-sm: var(--space-2);
  --space-md: var(--space-4);
  --space-lg: var(--space-5);
  --space-xl: var(--space-6);
  --space-2xl: var(--space-7);

  /* ===== Borders / radius ===== */
  --border-width: 1px;
  --border-width-thick: 2px;
  --border-width-extra-thick: 4px;
  --border-radius-sm: var(--radius-xs);
  --border-radius: var(--radius-sm);
  --border-radius-lg: var(--radius-md);
  --border-radius-full: var(--radius-pill);

  /* ===== Shadows =====
     --shadow-sm/md/lg are canonical tokens (tokens/_shadow.css, with the
     light refinement in _color.css). They share the canonical names, so
     consumers resolve them directly — NO same-name redeclaration here
     (it would self-cycle and break the value). */

  /* ===== Transitions =====
     --transition-fast/base/slow are canonical tokens (tokens/_motion.css).
     Same-name, resolved directly — no self-redeclaration. */

  /* ===== Z-index layers ===== */
  /* Below every other layer: the boot overlay must never cover the startup-error
     bar or the reconnect band, which are the only things that can explain why it
     is still up. */
  --z-index-boot: 900;
  --z-index-base: 1000;
  --z-index-dropdown: 1030;
  --z-index-sticky: 1050;
  --z-index-tooltip: 1060;
  --z-index-modal: 9999;

  /* ===== Layout ===== */
  --navbar-height: var(--topbar-h);
  --sidebar-width: var(--sidebar-w);
  --max-content-width: var(--content-max);

  /* ===== Sidebar colors ===== */
  --sidebar-bg: var(--color-sidebar-bg);
  --sidebar-bg-dark: var(--color-sidebar-bg);
  --sidebar-text: var(--color-text-secondary);
  --sidebar-text-active: var(--color-text);
  --sidebar-link-hover-bg: var(--color-surface-2);
  --sidebar-link-active-bg: var(--color-sidebar-active);
  --sidebar-brand-gradient-start: var(--color-accent);
  --sidebar-brand-gradient-end: var(--color-accent);
  --sidebar-section-text: var(--color-text-faint);
  --sidebar-divider: var(--color-divider);

  /* ===== Top bar colors ===== */
  --topbar-bg: var(--color-surface-1);
  --topbar-border: var(--color-border);
  --topbar-text: var(--color-text-secondary);

  /* ===== Chat / agent message colors ===== */
  --chat-user-bg: var(--color-accent);
  --chat-user-text: var(--color-text-on-accent);
  --chat-assistant-bg: var(--color-surface-2);
  --chat-tool-bg: var(--color-warning-soft);
  --chat-tool-border: var(--color-warning-line);
  --chat-reasoning-bg: var(--color-info-soft);
  --chat-reasoning-border: var(--color-info-line);
}
