/**
 * RaiseLab Design Tokens
 * AI-Powered Fundraising Preparation Platform
 *
 * Usage: Import this file at the top of your main CSS
 * These CSS variables define the entire design system
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ========================================
     COLOR PALETTE
     ======================================== */

  /* Primary Brand Colors */
  --color-primary-50: #EEF2FF;
  --color-primary-100: #E0E7FF;
  --color-primary-500: #6366F1;
  --color-primary-600: #4F46E5;
  --color-primary-700: #4338CA;
  --color-primary-800: #3730A3;

  /* Neutral / Slate Colors */
  --color-slate-50: #F8FAFC;
  --color-slate-100: #F1F5F9;
  --color-slate-200: #E2E8F0;
  --color-slate-300: #CBD5E1;
  --color-slate-400: #94A3B8;
  --color-slate-500: #64748B;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1E293B;
  --color-slate-900: #0F172A;

  /* Success / Emerald */
  --color-success-50: #ECFDF5;
  --color-success-100: #D1FAE5;
  --color-success-500: #10B981;
  --color-success-600: #059669;
  --color-success-700: #047857;

  /* Warning / Amber */
  --color-warning-50: #FFFBEB;
  --color-warning-100: #FEF3C7;
  --color-warning-500: #F59E0B;
  --color-warning-600: #D97706;
  --color-warning-700: #B45309;

  /* Error / Red */
  --color-error-50: #FEF2F2;
  --color-error-100: #FEE2E2;
  --color-error-500: #EF4444;
  --color-error-600: #DC2626;
  --color-error-700: #B91C1C;

  /* Blue (for info/status) */
  --color-blue-50: #EFF6FF;
  --color-blue-500: #3B82F6;
  --color-blue-600: #2563EB;

  /* ========================================
     SEMANTIC COLOR ALIASES
     ======================================== */

  /* Text Colors */
  --text-primary: var(--color-slate-900);
  --text-secondary: var(--color-slate-700);
  --text-tertiary: var(--color-slate-500);
  --text-placeholder: var(--color-slate-400);
  --text-inverse: #FFFFFF;

  /* Background Colors */
  --bg-base: var(--color-slate-50);
  --bg-surface: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-muted: var(--color-slate-100);

  /* Border Colors */
  --border-default: var(--color-slate-200);
  --border-muted: var(--color-slate-100);
  --border-focus: var(--color-primary-600);

  /* Interactive Colors */
  --interactive-primary: var(--color-primary-600);
  --interactive-primary-hover: var(--color-primary-700);
  --interactive-secondary: var(--color-slate-700);
  --interactive-secondary-hover: var(--color-slate-900);

  /* Status Colors for Investor CRM */
  --status-not-contacted: var(--color-slate-500);
  --status-intro-requested: var(--color-blue-500);
  --status-meeting-scheduled: var(--color-warning-500);
  --status-term-sheet: var(--color-success-500);
  --status-passed: var(--color-error-500);

  /* ========================================
     TYPOGRAPHY
     ======================================== */

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  --text-5xl: 3rem;       /* 48px */

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Letter Spacing */
  --tracking-tighter: -0.02em;
  --tracking-tight: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.01em;
  --tracking-wider: 0.05em;

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

  --space-0: 0;
  --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 */

  /* ========================================
     BORDERS & RADIUS
     ======================================== */

  --radius-none: 0;
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  --border-width: 1px;
  --border-width-2: 2px;

  /* ========================================
     SHADOWS
     ======================================== */

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

  /* Focus Ring Shadow */
  --shadow-focus: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--color-primary-600);

  /* ========================================
     TRANSITIONS
     ======================================== */

  --transition-fast: 150ms;
  --transition-normal: 200ms;
  --transition-slow: 300ms;
  --transition-slower: 500ms;

  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* ========================================
     Z-INDEX
     ======================================== */

  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal-backdrop: 40;
  --z-modal: 50;
  --z-popover: 60;
  --z-tooltip: 70;

  /* ========================================
     LAYOUT
     ======================================== */

  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;

  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --header-height: 64px;
}

/* ========================================
   BASE STYLES
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-base);
}

/* ========================================
   TYPOGRAPHY UTILITIES
   ======================================== */

.text-display {
  font-size: var(--text-5xl);
  font-weight: var(--font-bold);
  line-height: 1.1;
  letter-spacing: var(--tracking-tighter);
}

.text-h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  line-height: 1.2;
  letter-spacing: var(--tracking-tighter);
}

.text-h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  line-height: 1.3;
  letter-spacing: var(--tracking-tight);
}

.text-h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  line-height: 1.4;
}

.text-h4 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1.5;
}

.text-body {
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-relaxed);
}

.text-body-sm {
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
}

.text-caption {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: 1.4;
  letter-spacing: var(--tracking-wide);
}

.text-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* ========================================
   BUTTON COMPONENTS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  text-decoration: none;
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast) var(--ease-default);
  height: 44px;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

/* Primary Button */
.btn-primary {
  background-color: var(--interactive-primary);
  color: var(--text-inverse);
  border-color: var(--interactive-primary);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--interactive-primary-hover);
  border-color: var(--interactive-primary-hover);
}

/* Secondary Button */
.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

/* Ghost Button */
.btn-ghost {
  background-color: transparent;
  color: var(--text-tertiary);
  border-color: transparent;
  padding: var(--space-2) var(--space-3);
  height: auto;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-muted);
  color: var(--text-secondary);
}

/* Button Sizes */
.btn-sm {
  height: 36px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn-lg {
  height: 52px;
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* ========================================
   FORM INPUTS
   ======================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  height: 44px;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast) var(--ease-default),
              box-shadow var(--transition-fast) var(--ease-default);
}

.form-input::placeholder {
  color: var(--text-placeholder);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-50);
}

.form-input:disabled {
  background-color: var(--bg-muted);
  cursor: not-allowed;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error-500);
}

/* Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right var(--space-3) center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: var(--space-10);
}

/* ========================================
   CARDS
   ======================================== */

.card {
  background-color: var(--bg-surface);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
}

.card-interactive {
  cursor: pointer;
  transition: box-shadow var(--transition-fast) var(--ease-default),
              border-color var(--transition-fast) var(--ease-default);
}

.card-interactive:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-slate-300);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.card-description {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

/* Feature Card */
.feature-card {
  padding: var(--space-8);
  text-align: left;
}

.feature-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary-50);
  border-radius: var(--radius-lg);
  color: var(--color-primary-600);
}

.feature-card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin-top: var(--space-4);
  color: var(--text-primary);
}

.feature-card-description {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
  line-height: var(--leading-relaxed);
}

/* ========================================
   STATUS BADGES
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
}

.badge-not-contacted {
  background-color: var(--color-slate-100);
  color: var(--status-not-contacted);
}

.badge-intro-requested {
  background-color: var(--color-blue-50);
  color: var(--status-intro-requested);
}

.badge-meeting-scheduled {
  background-color: var(--color-warning-50);
  color: var(--status-meeting-scheduled);
}

.badge-term-sheet {
  background-color: var(--color-success-50);
  color: var(--status-term-sheet);
}

.badge-passed {
  background-color: var(--color-error-50);
  color: var(--status-passed);
}

/* ========================================
   SCORE INDICATORS
   ======================================== */

.score-circle {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: var(--font-bold);
  border: 8px solid;
}

.score-high {
  border-color: var(--color-success-500);
  color: var(--color-success-500);
}

.score-medium {
  border-color: var(--color-warning-500);
  color: var(--color-warning-500);
}

.score-low {
  border-color: var(--color-error-500);
  color: var(--color-error-500);
}

.score-bar {
  height: 8px;
  background-color: var(--color-slate-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width var(--transition-slower) var(--ease-out);
}

.score-bar-fill.high { background-color: var(--color-success-500); }
.score-bar-fill.medium { background-color: var(--color-warning-500); }
.score-bar-fill.low { background-color: var(--color-error-500); }

/* ========================================
   UPLOAD ZONE
   ======================================== */

.upload-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background-color: var(--bg-muted);
  padding: var(--space-12);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast) var(--ease-default);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--color-primary-600);
  background-color: var(--color-primary-50);
}

.upload-zone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  color: var(--text-tertiary);
}

.upload-zone.drag-over .upload-zone-icon {
  color: var(--color-primary-600);
}

.upload-zone-title {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.upload-zone-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.upload-zone-hint {
  font-size: var(--text-xs);
  color: var(--text-placeholder);
  margin-top: var(--space-2);
}

/* ========================================
   TABLES
   ======================================== */

.table-container {
  background-color: var(--bg-surface);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  background-color: var(--bg-muted);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-tertiary);
  text-align: left;
  border-bottom: var(--border-width) solid var(--border-default);
}

.table td {
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: var(--border-width) solid var(--border-muted);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover {
  background-color: var(--bg-muted);
}

/* ========================================
   MODAL
   ======================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  animation: fadeIn var(--transition-fast) var(--ease-out);
}

.modal {
  background-color: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--transition-normal) var(--ease-out);
  z-index: var(--z-modal);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: var(--border-width) solid var(--border-default);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-6);
  border-top: var(--border-width) solid var(--border-default);
}

/* ========================================
   NAVIGATION
   ======================================== */

.nav-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: var(--border-width) solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.nav-logo {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-link {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition-fast) var(--ease-default);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--color-primary-600);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: var(--border-width) solid var(--border-default);
  height: calc(100vh - var(--header-height));
  position: fixed;
  top: var(--header-height);
  left: 0;
  padding: var(--space-4);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  text-decoration: none;
  transition: all var(--transition-fast) var(--ease-default);
}

.sidebar-nav-item:hover {
  background-color: var(--bg-muted);
  color: var(--text-secondary);
}

.sidebar-nav-item.active {
  background-color: var(--color-primary-50);
  color: var(--color-primary-600);
}

.sidebar-nav-item svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-slate-200) 0%,
    var(--color-slate-100) 50%,
    var(--color-slate-200) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-20) 0;
}

.section-muted {
  background-color: var(--bg-muted);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .text-display {
    font-size: var(--text-4xl);
  }

  .text-h1 {
    font-size: var(--text-3xl);
  }

  .text-h2 {
    font-size: var(--text-xl);
  }

  .section {
    padding: var(--space-12) 0;
  }

  .container {
    padding: 0 var(--space-4);
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal) var(--ease-default);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .modal {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .upload-zone {
    padding: var(--space-8);
  }

  /* Stack table on mobile */
  .table-responsive {
    overflow-x: auto;
  }
}
