/* ==========================================================================
   MAXPort design tokens: the SINGLE source of truth for the UI style.
   See docs/UI-STYLE-GUIDE.md. Change brand colors, fonts, radius, etc. HERE only.
   Layer 1: primitives (raw palette), never used directly in views/components.
   Layer 2: semantic tokens (--mp-*), used by theme.css and components.css.
   All text/background pairs meet WCAG 2.2 AA contrast (4.5:1 for body text).
   ========================================================================== */

:root {
  /* ---- Primitives: palette ---- */
  --mp-blue-50: #eff6ff;
  --mp-blue-100: #dbeafe;
  --mp-blue-300: #93c5fd;
  --mp-blue-600: #2563eb;
  --mp-blue-700: #1d4ed8;
  --mp-blue-800: #1e40af;

  --mp-slate-50: #f8fafc;
  --mp-slate-100: #f1f5f9;
  --mp-slate-200: #e2e8f0;
  --mp-slate-300: #cbd5e1;
  --mp-slate-400: #94a3b8;
  --mp-slate-600: #475569;
  --mp-slate-700: #334155;
  --mp-slate-800: #1e293b;
  --mp-slate-900: #0f172a;
  --mp-slate-950: #0b1220;

  --mp-green-100: #dcfce7;
  --mp-green-700: #15803d;
  --mp-amber-100: #fef3c7;
  --mp-amber-700: #b45309;
  --mp-red-100: #fee2e2;
  --mp-red-700: #b91c1c;
  --mp-red-800: #991b1b;
  --mp-sky-100: #e0f2fe;
  --mp-sky-700: #0369a1;
  --mp-green-400: #4ade80;
  --mp-amber-400: #fbbf24;
  --mp-amber-500: #f59e0b;
  --mp-red-400: #f87171;
  --mp-blue-400: #60a5fa;
  --mp-orange-400: #fb923c;
  --mp-orange-600: #ea580c;
  --mp-purple-400: #c084fc;
  --mp-purple-600: #9333ea;

  /* ---- Semantic: brand & status ---- */
  --mp-color-primary: var(--mp-blue-600);
  --mp-color-primary-hover: var(--mp-blue-700);
  --mp-color-primary-active: var(--mp-blue-800);
  --mp-color-primary-subtle: var(--mp-blue-50);
  --mp-color-on-primary: #ffffff;

  --mp-color-success: var(--mp-green-700);
  --mp-color-success-subtle: var(--mp-green-100);
  --mp-color-warning: var(--mp-amber-700);
  --mp-color-warning-subtle: var(--mp-amber-100);
  --mp-color-danger: var(--mp-red-700);
  --mp-color-danger-subtle: var(--mp-red-100);
  --mp-color-info: var(--mp-sky-700);
  --mp-color-info-subtle: var(--mp-sky-100);

  /* ---- Semantic: surfaces & text ---- */
  --mp-color-bg: var(--mp-slate-50);          /* page background */
  --mp-color-surface: #ffffff;                /* cards, navbar, panels */
  --mp-color-surface-muted: var(--mp-slate-100);
  --mp-color-text: var(--mp-slate-900);
  --mp-color-text-muted: var(--mp-slate-600);
  --mp-color-border: var(--mp-slate-200);
  --mp-color-border-strong: var(--mp-slate-300);
  --mp-color-link: var(--mp-blue-700);
  --mp-color-link-hover: var(--mp-blue-800);
  --mp-color-focus-ring: rgba(37, 99, 235, 0.45);
  --mp-color-code: var(--mp-blue-800);
  /* QR codes stay black on white in both themes: scanners need that contrast (D44). */
  --mp-color-qr-background: #ffffff;

  /* ---- Semantic: file browser (folder & file-type icon colours, like Google Drive / OneDrive) ---- */
  --mp-color-folder: var(--mp-amber-500);
  --mp-color-file-pdf: var(--mp-red-700);
  --mp-color-file-document: var(--mp-blue-600);
  --mp-color-file-spreadsheet: var(--mp-green-700);
  --mp-color-file-presentation: var(--mp-orange-600);
  --mp-color-file-image: var(--mp-purple-600);
  --mp-color-file-other: var(--mp-slate-600);

  /* ---- Layout: signed-in app shell ---- */
  --mp-sidebar-width: 16.5rem;   /* fits "Shared with customers" on one line */

  /* ---- Typography ---- */
  --mp-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mp-font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --mp-font-size-xs: 0.75rem;    /* 12px */
  --mp-font-size-sm: 0.875rem;   /* 14px */
  --mp-font-size-base: 1rem;     /* 16px */
  --mp-font-size-lg: 1.125rem;   /* 18px */
  --mp-font-size-xl: 1.25rem;    /* 20px */
  --mp-font-size-2xl: 1.5rem;    /* 24px */
  --mp-font-size-3xl: 1.875rem;  /* 30px */
  --mp-font-weight-normal: 400;
  --mp-font-weight-medium: 500;
  --mp-font-weight-semibold: 600;
  --mp-font-weight-bold: 700;
  --mp-line-height-base: 1.5;
  --mp-line-height-tight: 1.25;

  /* ---- Spacing (4px grid) ---- */
  --mp-space-1: 0.25rem;  /* 4px */
  --mp-space-2: 0.5rem;   /* 8px */
  --mp-space-3: 0.75rem;  /* 12px */
  --mp-space-4: 1rem;     /* 16px */
  --mp-space-5: 1.5rem;   /* 24px */
  --mp-space-6: 2rem;     /* 32px */
  --mp-space-7: 3rem;     /* 48px */

  /* ---- Shape & elevation ---- */
  --mp-radius-sm: 0.25rem;
  --mp-radius: 0.5rem;
  --mp-radius-lg: 0.75rem;
  --mp-radius-pill: 999px;
  --mp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --mp-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --mp-shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.10);

  /* ---- Layout & motion ----
     Breakpoints (Bootstrap 5.3; CSS variables can't be used inside @media, so these are the reference values):
       xs  < 576px   phones (portrait)
       sm  ≥ 576px   large phones / phones landscape
       md  ≥ 768px   tablets & iPad portrait (768–834px)
       lg  ≥ 992px   iPad landscape, small laptops
       xl  ≥ 1200px  laptops / desktops
       xxl ≥ 1400px  large desktops */
  --mp-content-max-width: 1200px;
  --mp-page-gutter: var(--mp-space-3);        /* grows with screen size, see components.css */
  --mp-touch-target: 44px;                    /* min tap size on touch devices (Apple HIG / WCAG 2.5.5) */
  --mp-transition: 150ms ease-in-out;
}

/* ---- Dark mode (Bootstrap 5.3 color modes: <html data-bs-theme="dark">) ---- */
[data-bs-theme="dark"] {
  --mp-color-primary-subtle: rgba(37, 99, 235, 0.18);
  --mp-color-success-subtle: rgba(21, 128, 61, 0.22);
  --mp-color-warning-subtle: rgba(180, 83, 9, 0.25);
  --mp-color-danger-subtle: rgba(185, 28, 28, 0.25);
  --mp-color-info-subtle: rgba(3, 105, 161, 0.25);

  --mp-color-bg: var(--mp-slate-950);
  --mp-color-surface: var(--mp-slate-900);
  --mp-color-surface-muted: var(--mp-slate-800);
  --mp-color-text: var(--mp-slate-100);
  --mp-color-text-muted: var(--mp-slate-400);
  --mp-color-border: var(--mp-slate-800);
  --mp-color-border-strong: var(--mp-slate-700);
  --mp-color-link: var(--mp-blue-300);
  --mp-color-link-hover: var(--mp-blue-100);
  --mp-color-focus-ring: rgba(147, 197, 253, 0.55);

  --mp-color-folder: var(--mp-amber-400);
  --mp-color-file-pdf: var(--mp-red-400);
  --mp-color-file-document: var(--mp-blue-400);
  --mp-color-file-spreadsheet: var(--mp-green-400);
  --mp-color-file-presentation: var(--mp-orange-400);
  --mp-color-file-image: var(--mp-purple-400);
  --mp-color-file-other: var(--mp-slate-400);
  --mp-color-code: var(--mp-blue-300);

  --mp-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --mp-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  --mp-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  :root { --mp-transition: 0ms; }
}
