/**
 * Visual Consistency System (Task 019)
 * 
 * Unified CSS custom properties system for consistent design throughout the application
 * Built on top of Argon Dashboard 2 styling patterns
 */

/* ====================================
   CSS Custom Properties (Variables)
   ==================================== */

:root {
  /* ===== CORE COLOR PALETTE ===== */
  
  /* Primary Brand Colors (Argon Dashboard) */
  --color-primary: #dc3545;
  --color-primary-rgb: 220, 53, 69;
  --color-primary-hover: #c82333;
  --color-primary-focus: rgba(220, 53, 69, 0.15);
  
  /* Secondary Brand Colors */
  --color-secondary: #8392ab;
  --color-secondary-rgb: 131, 146, 171;
  --color-secondary-hover: #727f96;
  --color-secondary-focus: rgba(131, 146, 171, 0.15);
  
  /* Status Colors (Perfect alignment met status-badge component) */
  --color-success: #2dce89;
  --color-success-rgb: 45, 206, 137;
  --color-success-hover: #24a46d;
  --color-success-focus: rgba(45, 206, 137, 0.15);
  
  --color-info: #11cdef;
  --color-info-rgb: 17, 205, 239;
  --color-info-hover: #0da5c0;
  --color-info-focus: rgba(17, 205, 239, 0.15);
  
  --color-warning: #fb6340;
  --color-warning-rgb: 251, 99, 64;
  --color-warning-hover: #fa3a0e;
  --color-warning-focus: rgba(251, 99, 64, 0.15);
  
  --color-danger: #f5365c;
  --color-danger-rgb: 245, 54, 92;
  --color-danger-hover: #ec0c38;
  --color-danger-focus: rgba(245, 54, 92, 0.15);
  
  --color-dark: #212529;
  --color-dark-rgb: 33, 37, 41;
  --color-dark-hover: #16181b;
  --color-dark-focus: rgba(33, 37, 41, 0.15);
  
  /* ===== TYPOGRAPHY SCALE ===== */
  
  /* Font Families */
  --font-family-primary: "Open Sans", sans-serif;
  --font-family-headings: "Open Sans", sans-serif;
  --font-family-monospace: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  /* Font Sizes (1.2x ratio scaling) */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-md: 1.125rem;     /* 18px */
  --font-size-lg: 1.25rem;      /* 20px */
  --font-size-xl: 1.5rem;       /* 24px */
  --font-size-2xl: 1.875rem;    /* 30px */
  --font-size-3xl: 2.25rem;     /* 36px */
  --font-size-4xl: 2.75rem;     /* 44px */
  
  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;
  
  /* ===== TEXT COLORS ===== */
  
  --text-color-primary: #344767;
  --text-color-secondary: #67748e;
  --text-color-muted: #8392ab;
  --text-color-light: #a3b5cc;
  --text-color-white: #ffffff;
  --text-color-dark: #212529;
  
  /* Text on colored backgrounds */
  --text-on-primary: #ffffff;
  --text-on-secondary: #ffffff;
  --text-on-success: #ffffff;
  --text-on-info: #ffffff;
  --text-on-warning: #ffffff;
  --text-on-danger: #ffffff;
  --text-on-dark: #ffffff;
  
  /* ===== BACKGROUND COLORS ===== */
  
  --bg-body: #f8f9fa;
  --bg-white: #ffffff;
  --bg-light: #f8f9fa;
  --bg-gray-50: #f8f9fa;
  --bg-gray-100: #f1f3f4;
  --bg-gray-200: #e9ecef;
  --bg-gray-300: #dee2e6;
  
  /* ===== GRADIENTS (Argon Dashboard Style) ===== */
  
  --gradient-primary: linear-gradient(87deg, #dc3545 0, #c82333 100%);
  --gradient-secondary: linear-gradient(87deg, #6c757d 0, #8392ab 100%);
  --gradient-success: linear-gradient(87deg, #2dce89 0, #2dcecc 100%);
  --gradient-info: linear-gradient(87deg, #11cdef 0, #1171ef 100%);
  --gradient-warning: linear-gradient(87deg, #fb6340 0, #fbb140 100%);
  --gradient-danger: linear-gradient(87deg, #f5365c 0, #f56036 100%);
  --gradient-dark: linear-gradient(87deg, #212529 0, #495057 100%);
  
  /* ===== SPACING SCALE ===== */
  
  --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 */
  
  /* ===== BORDER RADIUS ===== */
  
  --radius-none: 0;
  --radius-sm: 0.125rem;    /* 2px */
  --radius-base: 0.25rem;   /* 4px */
  --radius-md: 0.375rem;    /* 6px */
  --radius-lg: 0.5rem;     /* 8px */
  --radius-xl: 0.75rem;    /* 12px */
  --radius-2xl: 1rem;      /* 16px */
  --radius-full: 9999px;
  
  /* ===== SHADOWS ===== */
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Argon specific shadows */
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-primary: 0 10px 25px rgba(220, 53, 69, 0.3);
  --shadow-success: 0 10px 25px rgba(45, 206, 137, 0.3);
  --shadow-info: 0 10px 25px rgba(17, 205, 239, 0.3);
  --shadow-warning: 0 10px 25px rgba(251, 99, 64, 0.3);
  --shadow-danger: 0 10px 25px rgba(245, 54, 92, 0.3);
  
  /* ===== TRANSITIONS ===== */
  
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  --transition-colors: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  --transition-transform: transform 0.2s ease;
  --transition-all: all 0.2s ease;
  
  /* ===== Z-INDEX SCALE ===== */
  
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-offcanvas: 1045;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

/* ====================================
   UTILITY CLASSES (CSS Variables)
   ==================================== */

/* Typography Utilities */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }
.text-4xl { font-size: var(--font-size-4xl); }

/* Font Weight Utilities */
.font-light { font-weight: var(--font-weight-light); }
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-extrabold { font-weight: var(--font-weight-extrabold); }

/* Line Height Utilities */
.leading-tight { line-height: var(--line-height-tight); }
.leading-snug { line-height: var(--line-height-snug); }
.leading-normal { line-height: var(--line-height-normal); }
.leading-relaxed { line-height: var(--line-height-relaxed); }
.leading-loose { line-height: var(--line-height-loose); }

/* Text Color Utilities */
.text-primary { color: var(--text-color-primary); }
.text-secondary { color: var(--text-color-secondary); }
.text-muted { color: var(--text-color-muted); }
.text-light { color: var(--text-color-light); }
.text-white { color: var(--text-color-white); }
.text-dark { color: var(--text-color-dark); }

/* ====================================
   COMPONENT STANDARDIZATION
   ==================================== */

/* Unified Button System */
.btn-unified {
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition: var(--transition-all);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* WCAG touch target */
  gap: var(--space-2);
}

/* Button Size Variations */
.btn-unified.btn-sm {
  font-size: var(--font-size-xs);
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
}

.btn-unified.btn-lg {
  font-size: var(--font-size-base);
  padding: var(--space-4) var(--space-6);
  min-height: 48px;
}

/* Button Color Variations (Argon Dashboard Style) */
.btn-unified.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-primary);
}

.btn-unified.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-unified.btn-secondary {
  background: var(--gradient-secondary);
  color: var(--text-on-secondary);
}

.btn-unified.btn-success {
  background: var(--gradient-success);
  color: var(--text-on-success);
  box-shadow: var(--shadow-success);
}

.btn-unified.btn-info {
  background: var(--gradient-info);
  color: var(--text-on-info);
  box-shadow: var(--shadow-info);
}

.btn-unified.btn-warning {
  background: var(--gradient-warning);
  color: var(--text-on-warning);
  box-shadow: var(--shadow-warning);
}

.btn-unified.btn-danger {
  background: var(--gradient-danger);
  color: var(--text-on-danger);
  box-shadow: var(--shadow-danger);
}

/* Unified Card System */
.card-unified {
  background: var(--bg-white);
  border: 1px solid var(--bg-gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  transition: var(--transition-transform);
}

.card-unified:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-unified .card-header-unified {
  padding: var(--space-6) var(--space-6) var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--bg-gray-100);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

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

.card-unified .card-footer-unified {
  padding: var(--space-3) var(--space-6) var(--space-6) var(--space-6);
  border-top: 1px solid var(--bg-gray-100);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Unified Form System */
.form-unified .form-control {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-color-primary);
  background-color: var(--bg-white);
  border: 1px solid var(--bg-gray-300);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  min-height: 48px; /* WCAG & iOS zoom prevention */
  transition: var(--transition-colors);
}

.form-unified .form-control:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-color: var(--color-primary);
  box-shadow: var(--color-primary-focus);
}

.form-unified .form-label {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-color-secondary);
  margin-bottom: var(--space-2);
}

/* Unified Typography Scale */
.heading-1 {
  font-family: var(--font-family-headings);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-color-primary);
  margin-bottom: var(--space-6);
}

.heading-2 {
  font-family: var(--font-family-headings);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-color-primary);
  margin-bottom: var(--space-5);
}

.heading-3 {
  font-family: var(--font-family-headings);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  color: var(--text-color-primary);
  margin-bottom: var(--space-4);
}

.heading-4 {
  font-family: var(--font-family-headings);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  color: var(--text-color-primary);
  margin-bottom: var(--space-3);
}

.heading-5 {
  font-family: var(--font-family-headings);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  color: var(--text-color-primary);
  margin-bottom: var(--space-3);
}

.heading-6 {
  font-family: var(--font-family-headings);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  color: var(--text-color-secondary);
  margin-bottom: var(--space-2);
}

/* Body Text Variations */
.body-text {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--text-color-primary);
}

.body-text-sm {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-color-secondary);
}

.body-text-xs {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-color-muted);
}

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

@media (max-width: 767.98px) {
  :root {
    /* Scale down font sizes for mobile */
    --font-size-4xl: 2.25rem;    /* 36px */
    --font-size-3xl: 1.875rem;   /* 30px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-xl: 1.25rem;     /* 20px */
  }
}

/* ====================================
   ACCESSIBILITY IMPROVEMENTS
   ==================================== */

/* Focus visible for keyboard navigation */
.btn-unified:focus-visible,
.form-unified .form-control:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --text-color-primary: #000000;
    --text-color-secondary: #333333;
    --bg-white: #ffffff;
    --bg-gray-100: #f5f5f5;
  }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-body: #1a1a1a;
    --bg-white: #2d2d2d;
    --text-color-primary: #ffffff;
    --text-color-secondary: #cccccc;
    --text-color-muted: #999999;
  }
}

/* ====================================
   COMPONENT COMPATIBILITY LAYER
   ==================================== */

/* Ensure compatibility with existing Argon Dashboard classes */
.bg-gradient-primary { background: var(--gradient-primary) !important; }
.bg-gradient-secondary { background: var(--gradient-secondary) !important; }
.bg-gradient-success { background: var(--gradient-success) !important; }
.bg-gradient-info { background: var(--gradient-info) !important; }
.bg-gradient-warning { background: var(--gradient-warning) !important; }
.bg-gradient-danger { background: var(--gradient-danger) !important; }
.bg-gradient-dark { background: var(--gradient-dark) !important; }

/* Legacy font-weight classes compatibility */
.font-weight-bold { font-weight: var(--font-weight-bold); }
.font-weight-bolder { font-weight: var(--font-weight-extrabold); }
.font-weight-normal { font-weight: var(--font-weight-normal); }
.font-weight-light { font-weight: var(--font-weight-light); }

/* ====================================
   PERFORMANCE OPTIMIZATIONS
   ==================================== */

/* Will-change hints for animations */
.card-unified:hover,
.btn-unified:hover {
  will-change: transform, box-shadow;
}

/* Hardware acceleration for smooth transitions */
.btn-unified,
.card-unified {
  transform: translateZ(0);
  backface-visibility: hidden;
}