/* ==========================================================================
   PingSell Design Tokens v1.0.0 — Single Source of Truth (3-Layer System)
   Architecture: Primitive -> Semantic -> Component
   Domain: https://pingsell.vn
   ========================================================================== */

:root {
  /* ------------------------------------------------------------------------
     LAYER 1: PRIMITIVE TOKENS (Raw Scale Values)
     ------------------------------------------------------------------------ */
  /* Brand Electric Royal Blue */
  --ps-blue-50: #EFF6FF;
  --ps-blue-100: #DBEAFE;
  --ps-blue-200: #BFDBFE;
  --ps-blue-400: #60A5FA;
  --ps-blue-500: #3B82F6;
  --ps-blue-600: #2563EB;
  --ps-blue-700: #1D4ED8;
  --ps-blue-800: #1E40AF;
  --ps-blue-900: #1E3A8A;

  /* Closing Alert Coral Red (Reserved strictly for NEEDS_CLOSING & critical errors) */
  --ps-red-50: #FEF2F2;
  --ps-red-100: #FEE2E2;
  --ps-red-200: #FECACA;
  --ps-red-500: #EF4444;
  --ps-red-600: #DC2626;
  --ps-red-700: #B91C1C;

  /* Operational Neutral Slates (8-hour shift eye comfort) */
  --ps-white: #FFFFFF;
  --ps-slate-50: #F8FAFC;
  --ps-slate-100: #F1F5F9;
  --ps-slate-200: #E2E8F0;
  --ps-slate-300: #CBD5E1;
  --ps-slate-400: #94A3B8;
  --ps-slate-500: #64748B;
  --ps-slate-600: #475569;
  --ps-slate-700: #334155;
  --ps-slate-800: #1E293B;
  --ps-slate-900: #0F172A;

  /* Supporting Feedback */
  --ps-emerald-50: #ECFDF5;
  --ps-emerald-200: #A7F3D0;
  --ps-emerald-500: #10B981;
  --ps-emerald-700: #047857;

  --ps-amber-50: #FFFBEB;
  --ps-amber-200: #FDE68A;
  --ps-amber-500: #F59E0B;
  --ps-amber-700: #B45309;

  /* Typography Families */
  --font-display: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* Type Scale */
  --text-hero: clamp(2.125rem, 3.6vw + 1rem, 3.375rem);
  --text-h2: clamp(1.625rem, 2.2vw + 0.85rem, 2.375rem);
  --text-h3: 1.25rem;
  --text-h4: 1.0625rem;
  --text-body-lg: 1.125rem;
  --text-body: 1rem;
  --text-ui: 0.875rem;
  --text-caption: 0.75rem;
  --text-micro: 0.6875rem;

  /* Line Heights & Tracking */
  --leading-tight: 1.16;
  --leading-snug: 1.3;
  --leading-normal: 1.55;
  --leading-relaxed: 1.65;
  --tracking-tight: -0.028em;
  --tracking-normal: -0.01em;

  /* 4px Grid Spacing Scale */
  --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 */

  /* Layout Containers */
  --container-max: 76rem; /* 1216px */
  --container-pad: clamp(1rem, 3vw, 2rem);

  /* Border Radius */
  --radius-xs: 0.25rem; /* 4px */
  --radius-sm: 0.375rem;/* 6px */
  --radius-md: 0.625rem;/* 10px */
  --radius-lg: 0.875rem;/* 14px */
  --radius-xl: 1.25rem; /* 20px */
  --radius-2xl: 1.5rem; /* 24px */
  --radius-full: 9999px;

  /* Elevation Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px -1px rgba(15, 23, 42, 0.06), 0 1px 3px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 24px -6px rgba(15, 23, 42, 0.08), 0 4px 10px -4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 44px -12px rgba(15, 23, 42, 0.14), 0 8px 18px -6px rgba(15, 23, 42, 0.06);
  --shadow-brand: 0 10px 26px -6px rgba(37, 99, 235, 0.32);
  --shadow-closing: 0 10px 26px -6px rgba(220, 38, 38, 0.2);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 240ms;

  /* ------------------------------------------------------------------------
     LAYER 2: SEMANTIC TOKENS (Purpose & Role Aliases)
     ------------------------------------------------------------------------ */
  --bg-canvas: var(--ps-slate-50);
  --bg-surface: var(--ps-white);
  --bg-surface-muted: var(--ps-slate-100);
  --bg-surface-inverse: var(--ps-slate-900);
  --bg-surface-inverse-elevated: var(--ps-slate-800);

  --text-primary: var(--ps-slate-900);
  --text-secondary: var(--ps-slate-600);
  --text-muted: var(--ps-slate-500);
  --text-on-brand: var(--ps-white);
  --text-on-inverse: var(--ps-slate-50);
  --text-on-inverse-muted: var(--ps-slate-300);

  --border-subtle: var(--ps-slate-200);
  --border-strong: var(--ps-slate-300);
  --border-inverse: var(--ps-slate-700);

  --brand-primary: var(--ps-blue-600);
  --brand-primary-hover: var(--ps-blue-700);
  --brand-accent-dark: var(--ps-blue-400);
  --brand-subtle-bg: var(--ps-blue-50);
  --brand-subtle-border: var(--ps-blue-200);
  --brand-subtle-text: var(--ps-blue-800);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.34);

  /* Closing Alert Semantic Group (WCAG AA Verified) */
  --alert-closing-surface: var(--ps-red-50);
  --alert-closing-surface-hover: var(--ps-red-100);
  --alert-closing-border: var(--ps-red-500);
  --alert-closing-badge-bg: var(--ps-red-600);
  --alert-closing-badge-text: var(--ps-white);
  --alert-closing-text: var(--ps-red-700);

  /* Status Groups */
  --status-success-bg: var(--ps-emerald-50);
  --status-success-border: var(--ps-emerald-200);
  --status-success: var(--ps-emerald-500);
  --status-success-text: var(--ps-emerald-700);

  --status-warning-bg: var(--ps-amber-50);
  --status-warning-border: var(--ps-amber-200);
  --status-warning: var(--ps-amber-500);
  --status-warning-text: var(--ps-amber-700);

  /* Channel Source Badges */
  --channel-shopee: #EE4D2D;
  --channel-shopee-bg: #FFF1EE;
  --channel-shopee-text: #C23315;

  --channel-tiktok: #111827;
  --channel-tiktok-pink: #FE2C55;
  --channel-tiktok-cyan: #25F4EE;
  --channel-tiktok-bg: #F3F4F6;
  --channel-tiktok-text: #111827;

  --channel-zalo: #0068FF;
  --channel-zalo-bg: #EBF3FF;
  --channel-zalo-text: #0052CC;

  --channel-messenger: #0084FF;
  --channel-messenger-bg: #EBF5FF;
  --channel-messenger-text: #0059B3;

  --channel-telegram: #26A5E4;
  --channel-telegram-bg: #EBF8FE;
  --channel-telegram-text: #0B699B;

  --channel-web: var(--ps-emerald-500);
  --channel-web-bg: var(--ps-emerald-50);
  --channel-web-text: var(--ps-emerald-700);

  /* ------------------------------------------------------------------------
     LAYER 3: COMPONENT TOKENS
     ------------------------------------------------------------------------ */
  --header-height: 4.25rem; /* 68px */
  --btn-min-height: 2.75rem; /* 44px WCAG touch target */
  --btn-pad-x: var(--space-5);
  --btn-radius: var(--radius-md);

  --card-bg: var(--bg-surface);
  --card-border: var(--border-subtle);
  --card-radius: var(--radius-lg);
  --card-pad: var(--space-6);

  --inbox-closing-border-width: 4px;
  --widget-fab-size: 3.5rem;     /* 56px */
  --widget-popover-width: 21.25rem; /* 340px */
}

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