/* ================================================================
   VITALITEK DESIGN TOKENS
   FR-007 Design System Foundation

   This file defines all design tokens as CSS custom properties.
   Import this file FIRST in any stylesheet or HTML page.

   Usage: var(--token-name)
   ================================================================ */

/* ============================================
   COLORS -- LIGHT MODE (default)
   ============================================ */
:root {
  /* Surfaces */
  --color-surface-primary: #FFFFFF;
  --color-surface-secondary: #F8F9FC;
  --color-surface-tertiary: #F0F0F5;
  --color-surface-elevated: #FFFFFF;

  /* Text */
  --color-text-primary: #1A1A2E;       /* 16.57:1 on white */
  --color-text-secondary: #4A4A68;     /* 8.22:1 on white */
  --color-text-tertiary: #6B7280;      /* 5.02:1 on white */
  --color-text-on-primary: #FFFFFF;
  --color-text-on-dark: #F0F0F5;

  /* Brand -- Warm coral/magenta inspired by logo */
  --color-primary: #C8457E;            /* 4.58:1 on white */
  --color-primary-dark: #A03366;       /* 6.12:1 on white */
  --color-primary-light: #F5E0EB;
  --color-primary-hover: #B33D72;

  /* Brand -- Calming teal secondary */
  --color-secondary: #1B7F8E;          /* 4.62:1 on white */
  --color-secondary-dark: #14626E;     /* 6.44:1 on white */
  --color-secondary-light: #E0F4F7;

  /* Semantic -- Success */
  --color-success: #177B4B;            /* 5.14:1 on white */
  --color-success-bg: #E6F5ED;
  --color-success-border: #A7D9BD;

  /* Semantic -- Warning */
  --color-warning: #92610A;            /* 5.53:1 on white */
  --color-warning-bg: #FFF7E6;
  --color-warning-border: #F0D080;

  /* Semantic -- Error / Critical */
  --color-error: #C42B2B;             /* 5.64:1 on white */
  --color-error-bg: #FEF0F0;
  --color-error-border: #F0A0A0;

  /* Semantic -- Info */
  --color-info: #1B6FA8;              /* 5.04:1 on white */
  --color-info-bg: #E8F3FC;
  --color-info-border: #90C0E8;

  /* Borders */
  --color-border: #D1D5DB;
  --color-border-subtle: #E5E7EB;
  --color-border-strong: #9CA3AF;

  /* Gray Scale (used by components for fine-grained neutral shading) */
  --color-white: #FFFFFF;
  --color-gray-25: #FCFCFD;
  --color-gray-50: #F9FAFB;
  --color-gray-100: #F3F4F6;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-400: #9CA3AF;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;
  --color-gray-700: #374151;
  --color-gray-800: #2A2A42;
  --color-gray-900: #111827;
  --color-black: #000000;

  /* Brand -- Extended primary palette */
  --color-primary-50: #FDF2F7;
  --color-primary-100: #FCE7F0;
  --color-primary-200: #FACDE2;
  --color-primary-500: #C8457E;
  --color-primary-600: #A03366;
  --color-primary-700: #9A2D5E;
  --color-primary-900: #4D1832;
  --color-primary-active: #A03366;

  /* Destructive / Danger (alias for error, used by buttons) */
  --color-destructive: #C42B2B;
  --color-destructive-hover: #A82222;
  --color-destructive-light: #FEF0F0;

  /* Semantic -- Light / Dark variants for component internals */
  --color-success-light: #D1FAE5;
  --color-success-dark: #0F5C36;
  --color-warning-light: #FEF3C7;
  --color-warning-dark: #784D08;
  --color-error-light: #FEE2E2;
  --color-error-dark: #991B1B;
  --color-info-light: #DBEAFE;
  --color-info-dark: #14507A;

  /* Focus */
  --color-focus-ring: #1A6BFF;
  --color-focus-ring-inner: #FFFFFF;
  --color-focus-ring-subtle: rgba(26, 107, 255, 0.25);

  /* ============================================
     TYPOGRAPHY
     ============================================ */
  --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-family-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas,
    'Liberation Mono', monospace;

  /* Shorthand alias used by components */
  --font-family: var(--font-family-sans);

  /* Font Sizes -- semantic names (rem-based for zoom support) */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.8125rem;    /* 13px */
  --text-base: 1rem;        /* 16px */
  --text-lg: 1.125rem;      /* 18px */
  --text-xl: 1.25rem;       /* 20px */
  --text-2xl: 1.5rem;       /* 24px */
  --text-3xl: 2rem;          /* 32px */
  --text-4xl: 2.5rem;        /* 40px */

  /* Font Sizes -- component aliases (same scale, alternate naming) */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.8125rem;    /* 13px */
  --font-size-base: 0.875rem;   /* 14px — default component body text */
  --font-size-md: 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.5rem;       /* 40px */
  --font-size-5xl: 3rem;          /* 48px — hero titles */
  --font-size-6xl: 3.75rem;       /* 60px */

  /* Font Weights */
  --font-weight-regular: 400;    /* alias for --font-weight-normal */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  --line-height-loose: 1.8;

  /* Letter Spacing */
  --letter-spacing-tight: -0.022em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;

  /* ============================================
     SPACING
     ============================================ */

  /* Standard density (dashboards, marketing, settings) */
  --space-xxs: 0.25rem;    /* 4px */
  --space-xs: 0.5rem;      /* 8px */
  --space-sm: 0.75rem;     /* 12px */
  --space-md: 1rem;         /* 16px */
  --space-lg: 1.5rem;       /* 24px */
  --space-xl: 2rem;          /* 32px */
  --space-2xl: 3rem;          /* 48px */
  --space-3xl: 4rem;          /* 64px */
  --space-4xl: 5rem;          /* 80px */

  /* Numeric spacing scale (used by components for precise control) */
  --space-0: 0;
  --space-0-5: 0.125rem;   /* 2px */
  --space-1: 0.25rem;      /* 4px */
  --space-1-5: 0.375rem;   /* 6px */
  --space-2: 0.5rem;       /* 8px */
  --space-2-5: 0.625rem;   /* 10px */
  --space-3: 0.75rem;      /* 12px */
  --space-4: 1rem;          /* 16px */
  --space-5: 1.25rem;       /* 20px */
  --space-6: 1.5rem;        /* 24px */
  --space-8: 2rem;           /* 32px */
  --space-10: 2.5rem;        /* 40px */
  --space-12: 3rem;          /* 48px */
  --space-16: 4rem;          /* 64px */
  --space-20: 5rem;          /* 80px */
  --space-24: 6rem;          /* 96px */
  --space-32: 8rem;           /* 128px */

  /* Workspace density (tighter for data-entry: superbill builder, tables) */
  --space-ws-xs: 0.25rem;   /* 4px */
  --space-ws-sm: 0.5rem;    /* 8px */
  --space-ws-md: 0.75rem;   /* 12px */
  --space-ws-lg: 1rem;       /* 16px */
  --space-ws-xl: 1.25rem;    /* 20px */

  /* ============================================
     LAYOUT
     ============================================ */
  --sidebar-width: 16rem;           /* 256px */
  --sidebar-width-collapsed: 3.5rem; /* 56px */
  --content-max-width: 75rem;       /* 1200px */
  --form-max-width: 48rem;          /* 768px */
  --detail-max-width: 56rem;        /* 896px */
  --auth-card-max-width: 28rem;     /* 448px */

  /* Container aliases (used by nav, hero, footer) */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 80rem;            /* 1280px */
  --container-max: 90rem;           /* 1440px */

  /* ============================================
     BREAKPOINTS (for reference; use in media queries)
     ============================================ */
  /* --breakpoint-sm: 30rem;    480px */
  /* --breakpoint-md: 48rem;    768px */
  /* --breakpoint-lg: 64rem;    1024px */
  /* --breakpoint-xl: 80rem;    1280px */
  /* --breakpoint-2xl: 96rem;   1536px */

  /* ============================================
     BORDERS & RADIUS
     ============================================ */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --radius-2xl: 1.25rem;    /* 20px */

  --border-width: 1px;
  --border-width-thick: 2px;
  --border-width-accent: 4px;

  /* ============================================
     SHADOWS
     ============================================ */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
  --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.20);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-focus: 0 0 0 3px var(--color-focus-ring-subtle);
  --shadow-focus-error: 0 0 0 3px rgba(196, 43, 43, 0.25);

  /* ============================================
     TRANSITIONS
     ============================================ */
  --transition-fast: 0.1s ease-out;
  --transition-base: 0.2s ease-out;    /* default component transition */
  --transition-normal: 0.2s ease-out;
  --transition-slow: 0.3s ease-out;
  --transition-slower: 500ms ease-in-out;

  /* ============================================
     Z-INDEX SCALE
     ============================================ */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-popover: 450;
  --z-tooltip: 550;
  --z-skip-link: 10000;
}


/* ============================================
   DARK MODE OVERRIDES
   ============================================ */

/* Automatic: follows OS preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-surface-primary: #1A1A2E;
    --color-surface-secondary: #222238;
    --color-surface-tertiary: #2A2A42;
    --color-surface-elevated: #32324E;

    --color-text-primary: #E8E8F0;
    --color-text-secondary: #B0B0C8;
    --color-text-tertiary: #8888A0;

    --color-white: #E8E8F0;
    --color-gray-25: #1E1E34;
    --color-gray-50: #222238;
    --color-gray-100: #2A2A42;
    --color-gray-200: #3A3A55;
    --color-gray-300: #505070;
    --color-gray-400: #686888;
    --color-gray-500: #8888A0;
    --color-gray-600: #B0B0C8;
    --color-gray-700: #D0D0E0;
    --color-gray-900: #E8E8F0;

    --color-border: #3A3A55;
    --color-border-subtle: #2E2E48;
    --color-border-strong: #505070;

    --color-primary: #E0679D;
    --color-primary-dark: #C8457E;
    --color-primary-light: #3A2030;
    --color-primary-hover: #D05590;
    --color-primary-50: #3A2030;
    --color-primary-100: #4A2840;
    --color-primary-700: #E0679D;
    --color-primary-active: #D05590;

    --color-destructive: #F07070;
    --color-destructive-hover: #E05555;

    --color-secondary: #3ABFCF;
    --color-secondary-dark: #1B9FAF;
    --color-secondary-light: #1A2E32;

    --color-success: #3DD68C;
    --color-success-bg: #1A2E24;
    --color-success-border: #2A5040;
    --color-success-light: #1A2E24;
    --color-success-dark: #3DD68C;

    --color-warning: #F0B84A;
    --color-warning-bg: #2E2A1A;
    --color-warning-border: #5A4820;
    --color-warning-light: #2E2A1A;
    --color-warning-dark: #F0B84A;

    --color-error: #F07070;
    --color-error-bg: #2E1A1A;
    --color-error-border: #5A2828;
    --color-error-light: #2E1A1A;
    --color-error-dark: #F07070;

    --color-info: #5CA8E8;
    --color-info-bg: #1A2430;
    --color-info-border: #284060;
    --color-info-light: #1A2430;
    --color-info-dark: #5CA8E8;

    --color-focus-ring: #5CA8E8;
    --color-focus-ring-inner: #1A1A2E;
    --color-focus-ring-subtle: rgba(92, 168, 232, 0.25);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
    --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.8);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-focus: 0 0 0 3px rgba(92, 168, 232, 0.25);
    --shadow-focus-error: 0 0 0 3px rgba(240, 112, 112, 0.25);

    --color-nav-bg: rgba(26, 26, 46, 0.72);
    --color-nav-bg-scrolled: rgba(26, 26, 46, 0.92);
  }
}

/* Manual toggle via data-theme attribute on <html> */
[data-theme="dark"] {
  --color-surface-primary: #1A1A2E;
  --color-surface-secondary: #222238;
  --color-surface-tertiary: #2A2A42;
  --color-surface-elevated: #32324E;

  --color-text-primary: #E8E8F0;
  --color-text-secondary: #B0B0C8;
  --color-text-tertiary: #8888A0;

  --color-white: #E8E8F0;
  --color-gray-25: #1E1E34;
  --color-gray-50: #222238;
  --color-gray-100: #2A2A42;
  --color-gray-200: #3A3A55;
  --color-gray-300: #505070;
  --color-gray-400: #686888;
  --color-gray-500: #8888A0;
  --color-gray-600: #B0B0C8;
  --color-gray-700: #D0D0E0;
  --color-gray-900: #E8E8F0;

  --color-border: #3A3A55;
  --color-border-subtle: #2E2E48;
  --color-border-strong: #505070;

  --color-primary: #E0679D;
  --color-primary-dark: #C8457E;
  --color-primary-light: #3A2030;
  --color-primary-hover: #D05590;
  --color-primary-50: #3A2030;
  --color-primary-100: #4A2840;
  --color-primary-700: #E0679D;
  --color-primary-active: #D05590;

  --color-destructive: #F07070;
  --color-destructive-hover: #E05555;

  --color-secondary: #3ABFCF;
  --color-secondary-dark: #1B9FAF;
  --color-secondary-light: #1A2E32;

  --color-success: #3DD68C;
  --color-success-bg: #1A2E24;
  --color-success-border: #2A5040;
  --color-success-light: #1A2E24;
  --color-success-dark: #3DD68C;

  --color-warning: #F0B84A;
  --color-warning-bg: #2E2A1A;
  --color-warning-border: #5A4820;
  --color-warning-light: #2E2A1A;
  --color-warning-dark: #F0B84A;

  --color-error: #F07070;
  --color-error-bg: #2E1A1A;
  --color-error-border: #5A2828;
  --color-error-light: #2E1A1A;
  --color-error-dark: #F07070;

  --color-info: #5CA8E8;
  --color-info-bg: #1A2430;
  --color-info-border: #284060;
  --color-info-light: #1A2430;
  --color-info-dark: #5CA8E8;

  --color-focus-ring: #5CA8E8;
  --color-focus-ring-inner: #1A1A2E;
  --color-focus-ring-subtle: rgba(92, 168, 232, 0.25);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
  --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.8);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-focus: 0 0 0 3px rgba(92, 168, 232, 0.25);
  --shadow-focus-error: 0 0 0 3px rgba(240, 112, 112, 0.25);

  --color-nav-bg: rgba(26, 26, 46, 0.72);
  --color-nav-bg-scrolled: rgba(26, 26, 46, 0.92);
}
