/* ============================================
   PRO ALI SMART Audit Copilot — Design System
   ============================================
   Core design tokens, CSS custom properties,
   and base styles for the entire platform.
   ============================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Noto+Sans+KR:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================
   1. CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* ── Primary Colors ── */
  --color-primary: #1B2A4A;
  --color-primary-light: #2E4A7A;
  --color-primary-lighter: #3D5F99;
  --color-primary-dark: #0F1B33;
  --color-primary-50: #EBF0F9;
  --color-primary-100: #C7D4ED;
  --color-primary-200: #9FB5DE;
  --color-primary-500: #3B6BC7;
  --color-primary-600: #2E5AAF;
  --color-primary-700: #1B2A4A;

  /* ── Secondary (Starbucks Green) ── */
  --color-secondary: #1E6B45;
  --color-secondary-light: #28855A;
  --color-secondary-dark: #154D32;
  --color-secondary-50: #E8F5EE;

  /* ── Accent (AI Purple) ── */
  --color-accent: #7C3AED;
  --color-accent-light: #A78BFA;
  --color-accent-dark: #5B21B6;
  --color-accent-50: #F3EEFF;
  --color-accent-glow: rgba(124, 58, 237, 0.3);

  /* ── Semantic Colors ── */
  --color-success: #059669;
  --color-success-light: #34D399;
  --color-success-50: #ECFDF5;
  --color-warning: #D97706;
  --color-warning-light: #FBBF24;
  --color-warning-50: #FFFBEB;
  --color-danger: #DC2626;
  --color-danger-light: #F87171;
  --color-danger-50: #FEF2F2;
  --color-info: #2563EB;
  --color-info-light: #60A5FA;
  --color-info-50: #EFF6FF;

  /* ── Neutral Colors ── */
  --color-white: #FFFFFF;
  --color-black: #000000;
  --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: #1F2937;
  --color-gray-900: #111827;

  /* ── Surface & Background (Light Mode) ── */
  --color-bg: #F0F2F5;
  --color-bg-secondary: #E8EBF0;
  --color-surface: rgba(255, 255, 255, 0.85);
  --color-surface-hover: rgba(255, 255, 255, 0.95);
  --color-surface-elevated: rgba(255, 255, 255, 0.92);
  --color-glass: rgba(255, 255, 255, 0.25);
  --color-glass-border: rgba(255, 255, 255, 0.35);
  --color-glass-hover: rgba(255, 255, 255, 0.35);
  --color-overlay: rgba(0, 0, 0, 0.5);

  /* ── Text Colors ── */
  --color-text: #111827;
  --color-text-secondary: #4B5563;
  --color-text-tertiary: #9CA3AF;
  --color-text-inverse: #FFFFFF;
  --color-text-link: #2563EB;
  --color-text-on-primary: #FFFFFF;

  /* ── Border ── */
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-strong: rgba(0, 0, 0, 0.15);
  --color-border-focus: #7C3AED;

  /* ── Gradients ── */
  --gradient-primary: linear-gradient(135deg, #1B2A4A 0%, #2E4A7A 50%, #3D5F99 100%);
  --gradient-accent: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
  --gradient-hero: linear-gradient(160deg, #0F1B33 0%, #1B2A4A 30%, #2E4A7A 60%, #7C3AED 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.6) 100%);
  --gradient-success: linear-gradient(135deg, #059669 0%, #34D399 100%);
  --gradient-warning: linear-gradient(135deg, #D97706 0%, #FBBF24 100%);
  --gradient-danger: linear-gradient(135deg, #DC2626 0%, #F87171 100%);
  --gradient-mesh: radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
                   radial-gradient(ellipse at 80% 20%, rgba(59, 107, 199, 0.06) 0%, transparent 50%),
                   radial-gradient(ellipse at 40% 80%, rgba(30, 107, 69, 0.05) 0%, transparent 50%);

  /* ── Typography ── */
  --font-primary: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --text-display: 3rem;      /* 48px */
  --text-h1: 2.25rem;        /* 36px */
  --text-h2: 1.75rem;        /* 28px */
  --text-h3: 1.375rem;       /* 22px */
  --text-h4: 1.125rem;       /* 18px */
  --text-body: 1rem;         /* 16px */
  --text-sm: 0.875rem;       /* 14px */
  --text-xs: 0.75rem;        /* 12px */

  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;
  --letter-tight: -0.025em;
  --letter-normal: 0em;

  /* ── Spacing ── */
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --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 */

  /* ── Border Radius ── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.16);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-glow-accent: 0 0 30px rgba(124, 58, 237, 0.2);
  --shadow-glow-primary: 0 0 30px rgba(27, 42, 74, 0.2);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);

  /* ── Transitions ── */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Z-Index ── */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;

  /* ── Glassmorphism ── */
  --glass-blur: 20px;
  --glass-blur-heavy: 40px;

  /* ── Layout ── */
  --sidebar-width: 280px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --content-max-width: 1440px;
  --container-padding: var(--space-6);
}

/* ============================================
   2. Dark Mode Tokens
   ============================================ */
[data-theme="dark"] {
  --color-primary: #4A7CFF;
  --color-primary-light: #6B9AFF;
  --color-primary-lighter: #8BB4FF;
  --color-primary-dark: #2E5AAF;
  --color-primary-50: #1A2340;
  --color-primary-700: #4A7CFF;

  --color-secondary: #2ECC71;
  --color-secondary-light: #58D68D;
  --color-secondary-dark: #27AE60;
  --color-secondary-50: #1A3A2A;

  --color-accent: #A78BFA;
  --color-accent-light: #C4B5FD;
  --color-accent-dark: #7C3AED;
  --color-accent-50: #2D1F5E;
  --color-accent-glow: rgba(167, 139, 250, 0.3);

  --color-success: #34D399;
  --color-success-light: #6EE7B7;
  --color-success-50: #1A3A2A;
  --color-warning: #FBBF24;
  --color-warning-light: #FCD34D;
  --color-warning-50: #3A341A;
  --color-danger: #F87171;
  --color-danger-light: #FCA5A5;
  --color-danger-50: #3A1A1A;
  --color-info: #60A5FA;
  --color-info-light: #93C5FD;
  --color-info-50: #1A2A3A;

  --color-gray-50: #1A1B2E;
  --color-gray-100: #1F2041;
  --color-gray-200: #2A2C4A;
  --color-gray-300: #3D3F5C;
  --color-gray-400: #6B6D8A;
  --color-gray-500: #9395B0;
  --color-gray-600: #B8BAD0;
  --color-gray-700: #D5D7E5;
  --color-gray-800: #EAEBF2;
  --color-gray-900: #F5F5FA;

  --color-bg: #0D0E1A;
  --color-bg-secondary: #141528;
  --color-surface: rgba(30, 30, 55, 0.75);
  --color-surface-hover: rgba(40, 40, 70, 0.85);
  --color-surface-elevated: rgba(35, 35, 60, 0.85);
  --color-glass: rgba(255, 255, 255, 0.06);
  --color-glass-border: rgba(255, 255, 255, 0.1);
  --color-glass-hover: rgba(255, 255, 255, 0.1);
  --color-overlay: rgba(0, 0, 0, 0.7);

  --color-text: #F5F5FA;
  --color-text-secondary: #B8BAD0;
  --color-text-tertiary: #6B6D8A;
  --color-text-inverse: #111827;
  --color-text-link: #60A5FA;

  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.15);
  --color-border-focus: #A78BFA;

  --gradient-primary: linear-gradient(135deg, #1A2340 0%, #2E4A7A 50%, #4A7CFF 100%);
  --gradient-accent: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
  --gradient-hero: linear-gradient(160deg, #050510 0%, #0D0E1A 30%, #1A2340 60%, #5B21B6 100%);
  --gradient-card: linear-gradient(145deg, rgba(30,30,55,0.8) 0%, rgba(20,20,40,0.6) 100%);
  --gradient-mesh: radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.12) 0%, transparent 50%),
                   radial-gradient(ellipse at 80% 20%, rgba(74, 124, 255, 0.08) 0%, transparent 50%),
                   radial-gradient(ellipse at 40% 80%, rgba(46, 204, 113, 0.06) 0%, transparent 50%);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.5);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow-accent: 0 0 40px rgba(167, 139, 250, 0.25);
  --shadow-glow-primary: 0 0 40px rgba(74, 124, 255, 0.25);
}

/* ============================================
   3. CSS Reset & Base
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* ── Typography Base ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--letter-tight);
  color: var(--color-text);
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); }

p {
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

a {
  color: var(--color-text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font-primary);
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
  color: inherit;
}

input, select, textarea {
  font-family: var(--font-primary);
  font-size: var(--text-body);
  color: var(--color-text);
  outline: none;
}

/* ── Selection ── */
::selection {
  background-color: var(--color-accent);
  color: var(--color-white);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--color-gray-600);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-500);
}

/* ── Focus Visible ── */
:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Utility Classes ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-gradient {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-primary {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}
