/**
 * JPSA Command Center - Design System
 * Version: 1.0.0
 * Created: 2026-01-06
 *
 * This file defines the foundational design tokens and base component styles.
 * Import this BEFORE any other stylesheets.
 */

:root {
  /* ========================================
     WARM PALETTE
     Base: #FAF9F7 (warm white, not cool #F9FAFB)
     ======================================== */
  --warm-50: #FAF9F7;
  --warm-100: #F5F3F0;
  --warm-200: #E7E5E4;
  --warm-300: #D6D3D1;
  --warm-400: #A8A29E;
  --warm-500: #78716C;
  --warm-600: #57534E;
  --warm-700: #44403C;
  --warm-800: #292524;
  --warm-900: #1C1917;

  /* ========================================
     BRAND COLORS
     ======================================== */
  --brand-blue: #00609C;
  --brand-blue-light: #E6F0F7;
  --brand-blue-dark: #004A7A;

  /* ========================================
     TIER COLORS
     Event classification by importance
     ======================================== */
  --tier-marquee: #D31245;
  --tier-medium: #00609C;
  --tier-small: #4C9C2E;
  --tier-committee: #57534E;

  /* ========================================
     SEMANTIC COLORS
     ======================================== */
  --success: #059669;
  --success-light: #D1FAE5;
  --success-dark: #047857;

  --warning: #D97706;
  --warning-light: #FEF3C7;
  --warning-dark: #B45309;

  --error: #DC2626;
  --error-light: #FEE2E2;
  --error-dark: #B91C1C;

  --info: #0284C7;
  --info-light: #E0F2FE;

  /* ========================================
     TYPOGRAPHY
     Font: Plus Jakarta Sans (already loaded)
     ======================================== */
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --text-micro: 11px;
  --text-small: 13px;
  --text-body: 14px;
  --text-large: 16px;
  --text-h3: 18px;
  --text-h2: 20px;
  --text-h1: 24px;
  --text-title: 28px;
  --text-display: 32px;
  --text-hero: 48px;

  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;

  /* Leading aliases (for compatibility) */
  --leading-tight: var(--line-height-tight);
  --leading-snug: var(--line-height-snug);
  --leading-normal: var(--line-height-normal);
  --leading-relaxed: var(--line-height-relaxed);

  /* ========================================
     SPACING
     Base unit: 4px
     ======================================== */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* ========================================
     SHADOWS
     Warm-tinted shadows (not pure black)
     ======================================== */
  --shadow-xs: 0 1px 2px rgba(41, 37, 36, 0.05);
  --shadow-sm: 0 2px 4px rgba(41, 37, 36, 0.06);
  --shadow-md: 0 4px 6px rgba(41, 37, 36, 0.07);
  --shadow-lg: 0 8px 16px rgba(41, 37, 36, 0.08);
  --shadow-xl: 0 16px 32px rgba(41, 37, 36, 0.10);
  --shadow-card: 0 2px 8px rgba(41, 37, 36, 0.04);

  /* ========================================
     BORDER RADIUS
     ======================================== */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* ========================================
     Z-INDEX SCALE
     ======================================== */
  --z-base: 0;
  --z-dropdown: 10;
  --z-nav: 20;
  --z-sticky: 30;
  --z-modal-overlay: 50;
  --z-modal: 100;
  --z-toast: 150;

  /* ========================================
     TRANSITIONS
     ======================================== */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;

  /* ========================================
     LAYOUT
     ======================================== */
  --content-max-width: 1100px;
  --sidebar-width: 220px;

  /* ========================================
     NIEMEYER DESIGN SYSTEM
     Architectural-inspired design overlay
     Enabled via USE_NIEMEYER_DESIGN feature flag
     ======================================== */

  /* Niemeyer Primary - Bold Orange */
  --niemeyer-orange: #E85D04;
  --niemeyer-orange-dark: #D05103;
  --niemeyer-orange-light: #FF7A1A;

  /* Niemeyer Architectural Browns */
  --niemeyer-brown: #3D2914;
  --niemeyer-brown-light: #6B4423;
  --niemeyer-cream: #FAF7F2;

  /* Niemeyer Building Colors (Tier-Specific) */
  --building-marquee: #D31245;      /* Red - Tallest tower */
  --building-medium: #00609C;       /* Blue - Dome */
  --building-small: #4C9C2E;        /* Green - Square */
  --building-committee: #57534E;    /* Gray - Bar */

  /* Niemeyer Typography */
  --font-niemeyer: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Niemeyer Type Scale */
  --niemeyer-hero: 48px;
  --niemeyer-title: 28px;
  --niemeyer-body: 14px;
  --niemeyer-label: 11px;

  /* Niemeyer Weights */
  --niemeyer-light: 300;
  --niemeyer-regular: 400;
  --niemeyer-medium: 500;

  /* Niemeyer Spacing (generous) */
  --niemeyer-gap-sm: 16px;
  --niemeyer-gap-md: 32px;
  --niemeyer-gap-lg: 48px;
  --niemeyer-gap-xl: 80px;
}

/* ==========================================
   BASE COMPONENT CLASSES
   These are optional classes that use the tokens.
   Components can use these OR apply tokens directly.
   ========================================== */

/* Button base */
.ds-btn {
  font-family: var(--font-family);
  font-weight: var(--font-semibold);
  font-size: var(--text-body);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.ds-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Button Sizes */
.ds-btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--text-small);
}

.ds-btn-md {
  height: 38px;
  padding: 0 var(--space-4);
  font-size: var(--text-body);
}

.ds-btn-lg {
  height: 44px;
  padding: 0 var(--space-6);
  font-size: var(--text-large);
}

/* Button Variants */
.ds-btn-primary {
  background: var(--brand-blue);
  color: white;
  border-color: var(--brand-blue);
}

.ds-btn-primary:hover {
  background: var(--brand-blue-dark);
  border-color: var(--brand-blue-dark);
}

.ds-btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-blue-light);
}

.ds-btn-secondary {
  background: var(--warm-100);
  color: var(--warm-700);
  border-color: var(--warm-200);
}

.ds-btn-secondary:hover {
  background: var(--warm-200);
  border-color: var(--warm-300);
}

.ds-btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--warm-200);
}

.ds-btn-secondary.active {
  background: var(--brand-blue);
  color: white;
  border-color: var(--brand-blue);
}

.ds-btn-ghost {
  background: transparent;
  color: var(--warm-600);
  border-color: transparent;
}

.ds-btn-ghost:hover {
  background: var(--warm-100);
}

.ds-btn-ghost:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--warm-200);
}

.ds-btn-ghost.active {
  background: var(--warm-200);
  color: var(--warm-800);
}

.ds-btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.ds-btn-danger:hover {
  background: var(--error-dark);
  border-color: var(--error-dark);
}

.ds-btn-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--error-light);
}

/* Card base */
.ds-card {
  background: white;
  border: 1px solid var(--warm-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* ==========================================
   MODAL SYSTEM (v137)
   Unified modal pattern for all dialogs
   ========================================== */

/* Modal wrapper - combines overlay + centering */
.ds-modal-wrapper {
  position: fixed;
  inset: 0;
  background: rgba(41, 37, 36, 0.5);
  z-index: var(--z-modal);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.ds-modal-wrapper.hidden {
  display: none;
}

/* Modal container */
.ds-modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

/* Modal size variants */
.ds-modal-sm { max-width: 400px; }
.ds-modal-md { max-width: 500px; }
.ds-modal-lg { max-width: 640px; }
.ds-modal-xl { max-width: 800px; }
.ds-modal-2xl { max-width: 1024px; }
.ds-modal-full { max-width: calc(100vw - var(--space-8)); }

/* Modal max height */
.ds-modal-scroll {
  max-height: 85vh;
}

/* Modal header */
.ds-modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--warm-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ds-modal-title {
  font-family: var(--font-family);
  font-size: var(--text-h3);
  font-weight: var(--font-semibold);
  color: var(--warm-800);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Modal close button */
.ds-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--warm-400);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ds-modal-close:hover {
  background: var(--warm-100);
  color: var(--warm-600);
}

.ds-modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-blue-light);
}

/* Modal body */
.ds-modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

/* Modal footer */
.ds-modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--warm-200);
  background: var(--warm-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
}

.ds-modal-footer-split {
  justify-content: space-between;
}

/* Legacy support - old overlay class */
.ds-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(41, 37, 36, 0.5);
  z-index: var(--z-modal-overlay);
  backdrop-filter: blur(2px);
}

/* Input base */
.ds-input {
  font-family: var(--font-family);
  font-size: var(--text-body);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--warm-300);
  border-radius: var(--radius-sm);
  background: white;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ds-input:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px var(--brand-blue-light);
}

/* Badge base */
.ds-badge {
  font-family: var(--font-family);
  font-size: var(--text-micro);
  font-weight: var(--font-semibold);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
}

/* Text utilities */
.ds-text-muted {
  color: var(--warm-500);
}

.ds-text-faint {
  color: var(--warm-400);
}

/* Heading utilities */
.ds-h1 {
  font-family: var(--font-family);
  font-size: var(--text-h1);
  font-weight: var(--font-bold);
  line-height: var(--line-height-tight);
  color: var(--warm-800);
}

.ds-h2 {
  font-family: var(--font-family);
  font-size: var(--text-h2);
  font-weight: var(--font-semibold);
  line-height: var(--line-height-tight);
  color: var(--warm-800);
}

.ds-h3 {
  font-family: var(--font-family);
  font-size: var(--text-h3);
  font-weight: var(--font-semibold);
  line-height: var(--line-height-tight);
  color: var(--warm-700);
}

/* ==========================================
   ICON SYSTEM (v136)
   Heroicons-compatible SVG icon utilities
   ========================================== */

.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  vertical-align: -0.125em;
}

.icon-xs {
  width: 12px;
  height: 12px;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-md {
  width: 20px;
  height: 20px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.icon-xl {
  width: 32px;
  height: 32px;
}

/* Icon button wrapper */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-xs);
  color: var(--warm-500);
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--warm-100);
  color: var(--warm-700);
}
