/* ===== SOPHIA STARS - UNIFIED BASE STYLES ===== */
/* Consolidated CSS variables and base styles from text-readability-fixes.css and professional-enhancements.css */

:root {
  /* ===== BRAND COLORS ===== */
  --brand-navy: #003057;
  --brand-maroon: #660000;
  --brand-accent: #880000;
  
  /* Aliases for design-system.css */
  --primary-navy: #003057;
  --primary-maroon: #660000;
  --secondary-gray: #6c757d;
  --accent-gold: #ffc107;
  
  /* Additional brand colors for reengagement-optimized.css */
  --primary-blue: #1a365d;
  --primary-gold: #d69e2e;
  --secondary-navy: #2c5282;
  
  /* ===== TEXT COLORS ===== */
  --text-primary: #2c3e50;
  --text-secondary: #5a6c7d;
  --text-light: #6c757d;
  --text-muted: #95a5a6;
  --text-inverse: #ffffff;
  
  /* ===== BACKGROUND COLORS ===== */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-dark: #2c3e50;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  
  /* ===== SEMANTIC COLORS ===== */
  --success: #28a745;
  --success-light: #d4edda;
  --warning: #ffc107;
  --warning-light: #fff3cd;
  --danger: #dc3545;
  --danger-light: #f8d7da;
  --info: #17a2b8;
  --info-light: #d1ecf1;
  
  /* Additional semantic color aliases */
  --success-green: #38a169;
  --warning-amber: #ed8936;
  --error-red: #e53e3e;
  --info-blue: #3182ce;
  
  /* Gray palette for design-system.css */
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --medium-gray: #6c757d;
  --dark-gray: #343a40;
  --black: #000000;
  
  /* Modern gray scale for reengagement-optimized.css */
  --gray-50: #f7fafc;
  --gray-100: #edf2f7;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e0;
  --gray-400: #a0aec0;
  --gray-500: #718096;
  --gray-600: #4a5568;
  --gray-700: #2d3748;
  --gray-800: #1a202c;
  --gray-900: #171923;
  
  /* ===== INTERACTIVE ELEMENTS ===== */
  --hover-bg: #f8f9fa;
  --active-bg: #e9ecef;
  --border-color: #dee2e6;
  --border-light: #f1f5f9;
  --focus-ring: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
  
  /* ===== SHADOWS ===== */
  --shadow-xs: 0 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 2px 4px rgba(0,0,0,0.07), 0 1px 1.5px rgba(0,0,0,0.05);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
  --shadow-elevated: 0 8px 25px rgba(0,0,0,0.15), 0 3px 10px rgba(0,0,0,0.1);
  
  /* ===== SPACING ===== */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */
  --spacing-3xl: 4rem;     /* 64px */
  
  /* Aliases for design-system.css and reengagement-optimized.css */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  
  /* ===== TYPOGRAPHY ===== */
  --font-family-primary: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  --font-family-mono: 'SF Mono', Monaco, 'Roboto Mono', monospace;
  
  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --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 */
  
  /* Aliases for design-system.css */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  
  --line-height-tight: 1.25;
  --line-height-base: 1.5;
  --line-height-loose: 1.75;
  
  /* ===== BORDER RADIUS ===== */
  --border-radius-sm: 0.25rem;
  --border-radius: 0.375rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;
  --border-radius-full: 9999px;
  
  /* Aliases for consistency with design-system.css and reengagement-optimized.css */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;
  
  /* ===== TRANSITIONS ===== */
  --transition-fast: all 0.15s ease;
  --transition: all 0.3s ease;
  --transition-slow: all 0.5s ease;
  --transition-bounce: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Animation durations for reengagement-optimized.css */
  --duration-150: 150ms;
  --duration-200: 200ms;
  --duration-300: 300ms;
  
  /* Easing functions */
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* ===== Z-INDEX SCALE ===== */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  
  /* ===== BREAKPOINTS (for reference) ===== */
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;
  --breakpoint-2xl: 1400px;
}

/* ===== GLOBAL RESETS & BASE STYLES ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: var(--line-height-base);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-md);
  font-weight: 400;
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== TYPOGRAPHY IMPROVEMENTS ===== */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }
h6 { font-size: var(--font-size-sm); }

p {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
/* Skip link for keyboard navigation - WCAG 2.1 screen-reader-only pattern */
.skip-link {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  background: var(--brand-maroon);
  color: white;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  z-index: 10000;
  font-weight: 600;
  transition: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.skip-link:focus {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  white-space: normal !important;
  outline: 3px solid white;
  outline-offset: -3px;
}

/* Focus styles */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--brand-maroon);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

/* Enhanced focus for buttons */
button:focus-visible,
[role="button"]:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--brand-maroon);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(102, 0, 0, 0.15);
}

/* Enhanced focus for inputs and selects */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-navy);
  outline-offset: 0;
  box-shadow: 0 0 0 3px rgba(0, 48, 87, 0.15);
}

/* Enhanced focus for links */
a:focus-visible {
  outline: 2px solid var(--brand-navy);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Enhanced focus for cards */
.action-card:focus-visible,
.stat-card:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand-maroon);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(102, 0, 0, 0.1);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== COMMON COMPONENT FIXES ===== */
/* Action Card Text Fixes */
.action-card .label {
  color: var(--text-primary) !important;
  font-weight: 600;
  text-shadow: none;
}

.action-card .description {
  color: var(--text-secondary) !important;
  font-weight: 400;
}

/* Stat Card Text Fixes */
.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.stat-card .stat-value {
  color: var(--text-primary) !important;
  font-weight: 700;
}

.stat-card .stat-label {
  color: var(--text-secondary) !important;
  font-weight: 500;
}

/* Navigation Bar Enhancements */
.nav-bar {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  box-shadow: var(--shadow-sm);
}

.nav-title {
  font-weight: 600;
  letter-spacing: -0.025em;
}

/* ===== UTILITY CLASSES ===== */
/* Text utilities */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-light { color: var(--text-light) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-inverse { color: var(--text-inverse) !important; }

.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }

/* Background utilities */
.bg-primary { background-color: var(--bg-primary) !important; }
.bg-secondary { background-color: var(--bg-secondary) !important; }
.bg-tertiary { background-color: var(--bg-tertiary) !important; }

.bg-success { background-color: var(--success-light) !important; }
.bg-warning { background-color: var(--warning-light) !important; }
.bg-danger { background-color: var(--danger-light) !important; }
.bg-info { background-color: var(--info-light) !important; }

/* Spacing utilities */
.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacing-xs) !important; }
.p-2 { padding: var(--spacing-sm) !important; }
.p-3 { padding: var(--spacing-md) !important; }
.p-4 { padding: var(--spacing-lg) !important; }
.p-5 { padding: var(--spacing-xl) !important; }

.m-0 { margin: 0 !important; }
.m-1 { margin: var(--spacing-xs) !important; }
.m-2 { margin: var(--spacing-sm) !important; }
.m-3 { margin: var(--spacing-md) !important; }
.m-4 { margin: var(--spacing-lg) !important; }
.m-5 { margin: var(--spacing-xl) !important; }

/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* Flexbox utilities */
.justify-content-start { justify-content: flex-start !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }

.align-items-start { align-items: flex-start !important; }
.align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; }

/* Border utilities */
.border { border: 1px solid var(--border-color) !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid var(--border-color) !important; }
.border-bottom { border-bottom: 1px solid var(--border-color) !important; }

.rounded { border-radius: var(--border-radius) !important; }
.rounded-lg { border-radius: var(--border-radius-lg) !important; }
.rounded-xl { border-radius: var(--border-radius-xl) !important; }
.rounded-full { border-radius: var(--border-radius-full) !important; }

/* Shadow utilities */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-card) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Screen reader only */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ===== RESPONSIVE HELPERS ===== */
@media (max-width: 767px) {
  .d-md-none { display: none !important; }
  .d-md-block { display: block !important; }
}

@media (min-width: 768px) {
  .d-md-flex { display: flex !important; }
}

@media (max-width: 991px) {
  .d-lg-none { display: none !important; }
}

@media (min-width: 992px) {
  .d-lg-block { display: block !important; }
  .d-lg-flex { display: flex !important; }
}
