/**
 * FlowGrip design tokens
 * Spec: /docs/design/ui-visual-language.md
 */

:root {
  /* Spacing (4px grid) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-caption: 0.75rem;
  --font-size-label: 0.875rem;
  --font-size-body: 0.875rem;
  --font-size-h2: 1rem;
  --font-size-h1: 1.25rem;
  --font-size-display: 1.5rem;
  --font-size-sm: 0.8125rem;

  /* Backoffice (light) */
  --color-bg-page: #f9fafb;
  --color-bg-surface: #ffffff;
  --color-bg-muted: #f3f4f6;
  --color-border: #e5e7eb;
  --color-text-primary: #111827;
  --color-text-secondary: #6b7280;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-text: #ffffff;
  --color-destructive: #dc2626;
  --color-destructive-hover: #b91c1c;
  --color-destructive-text: #ffffff;
  --color-success: #059669;
  --color-success-bg: #d1fae5;
  --color-success-text: #065f46;
  --color-warning: #d97706;
  --color-warning-hover: #b45309;
  --color-warning-text-btn: #ffffff;
  --color-warning-bg: #fef3c7;
  --color-warning-text: #92400e;
  --color-danger-bg: #fee2e2;
  --color-danger-text: #991b1b;
  --color-info-bg: #dbeafe;
  --color-info-text: #1e40af;
  --color-focus-ring: rgba(37, 99, 235, 0.25);

  /* Radius & elevation */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --overlay-bg: rgba(0, 0, 0, 0.5);

  /* Motion */
  --duration-fast: 150ms;
  --duration-normal: 200ms;

  /* Component sizing */
  --input-min-height: 2.375rem;
  --touch-target-min: 44px;

  /* Form controls (base) */
  --input-radius: var(--radius-md);
  --input-border-hover: #a1a1aa;
  --input-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --input-shadow-focus: 0 0 0 3px var(--color-focus-ring);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2371717a' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

/* Portal guest surface (dark auth — login, password reset) */
[data-surface="portal-guest"],
[data-surface="portal"] {
  --color-bg-page: #0c0c0e;
  --color-bg-surface: #27272a;
  --color-bg-muted: #18181b;
  --color-border: #52525b;
  --color-text-primary: #fafafa;
  --color-text-secondary: #a1a1aa;
  --color-primary: #f59e0b;
  --color-primary-hover: #d97706;
  --color-primary-text: #18181b;
  --color-focus-ring: rgba(245, 158, 11, 0.35);
}

/* Portal app surface (light authenticated PWA) */
[data-surface="portal-app"] {
  --color-bg-page: #f9fafb;
  --color-bg-surface: #ffffff;
  --color-bg-muted: #f3f4f6;
  --color-border: #e5e7eb;
  --color-text-primary: #111827;
  --color-text-secondary: #6b7280;
  --color-primary: #c41e3a;
  --color-primary-hover: #b91c1c;
  --color-primary-text: #ffffff;
  --color-portal-nav: #003366;
  --color-portal-nav-border: #1e3a5f;
  --color-portal-nav-text: #ffffff;
  --color-portal-link: #003366;
  --color-portal-link-hover: #1d4ed8;
  --color-focus-ring: rgba(196, 30, 58, 0.25);
}

/* Marketing surface (future www — tokens only until #3) */
[data-surface="marketing"] {
  --color-bg-page: #ffffff;
  --color-bg-surface: #ffffff;
  --color-bg-muted: #f8fafc;
  --color-border: #e2e8f0;
  --color-text-primary: #0f172a;
  --color-text-secondary: #64748b;
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-text: #ffffff;
  --color-focus-ring: rgba(79, 70, 229, 0.25);
  --color-accent-bjj: #d97706;
  --color-hero-bg: #0f172a;
  --color-hero-text: #f8fafc;
  --marketing-max-width: 72rem;
  --marketing-section-py: clamp(3rem, 8vw, 5rem);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-normal: 0ms;
  }
}

/* Backoffice v2 — indigo/slate (spec: backoffice-ux-redesign) */
[data-surface="backoffice"] {
  --color-bg-page: #f4f4f5;
  --color-bg-surface: #ffffff;
  --color-bg-muted: #f4f4f5;
  --color-border: #e4e4e7;
  --color-text-primary: #18181b;
  --color-text-secondary: #71717a;
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-text: #ffffff;
  --color-focus-ring: rgba(79, 70, 229, 0.25);
  --color-info-bg: #eef2ff;
  --color-info-text: #3730a3;
  --color-bono-bg: #f3e8ff;
  --color-bono-text: #6b21a8;
  --color-primary-muted-bg: #eef2ff;
  --color-primary-muted-bg-end: #e0e7ff;
  --color-primary-muted-border: #c7d2fe;
  --color-primary-muted-border-hover: #a5b4fc;
  --color-primary-muted-text: #4338ca;
  --color-primary-muted-text-strong: #3730a3;
  --color-primary-gradient-end: #818cf8;

  --shell-header-height: 3.5rem;
  --shell-sidebar-width-collapsed: 4rem;
  --shell-sidebar-width-expanded: 15rem;
  --shell-header-bg: #ffffff;
  --shell-header-border: #e4e4e7;
  --shell-sidebar-bg: #fafafa;
  --shell-sidebar-border: #e4e4e7;
  --shell-sidebar-text: #52525b;
  --shell-sidebar-text-hover: #18181b;
  --shell-sidebar-active-bg: #eef2ff;
  --shell-sidebar-active-text: #4f46e5;
  --shell-sidebar-active-border: #c7d2fe;

  --input-border-hover: #a1a1aa;
  --input-shadow: 0 1px 2px 0 rgba(24, 24, 27, 0.04);
}
