/* ============================================
   AFCON 360 THEME VARIABLES
   Designed by: UI Expert
   Purpose: Central theme configuration
   ============================================ */

:root {
  /* ===== BRAND COLORS (Your AFCON Green Theme) ===== */
  --brand-primary: #2d5a2d;
  --brand-primary-rgb: 45, 90, 45;
  --brand-primary-dark: #1a3a1a;
  --brand-primary-light: #e8f0e8;
  --brand-primary-hover: #3a6b3a;
  --brand-accent: #ffcc00;
  --brand-accent-rgb: 255, 204, 0;
  --brand-accent-dark: #e6a800;

  /* ===== SEMANTIC COLORS ===== */
  --success: #006400;
  --success-rgb: 0, 100, 0;
  --success-light: #e8f5e8;
  --danger: #dc3545;
  --danger-rgb: 220, 53, 69;
  --warning: #ffcc00;
  --warning-rgb: 255, 204, 0;
  --info: #17a2b8;
  --info-rgb: 23, 162, 184;
  --blue: #2563eb;
  --blue-rgb: 37, 99, 235;
  --orange: #ea580c;
  --orange-rgb: 234, 88, 12;
  --dark: #1a1a1a;
  --light: #f8f9fa;

  /* ===== TEXT COLORS ===== */
  --text-primary: #1a1a1a;
  --text-secondary: #374151;
  --text-muted: #495057;
  --text-tertiary: #6c757d;
  --text-light: #ffffff;
  --text-disabled: #adb5bd;

  /* ===== BACKGROUND COLORS ===== */
  --bg-body: #f2f4f2;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8f9fa;
  --bg-elevated: #ffffff;
  --bg-muted: #e9ecef;

  /* ===== BORDER COLORS ===== */
  --border-light: #e9ecef;
  --border-medium: #dee2e6;
  --border-dark: #ced4da;

  /* ===== TYPOGRAPHY ===== */
  --font-family-heading: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-family-body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;

  --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: 3rem;      /* 48px */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* ===== SPACING SCALE (8px base) ===== */
  --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-7: 2rem;      /* 32px */
  --space-8: 2.5rem;    /* 40px */
  --space-9: 3rem;      /* 48px */
  --space-10: 4rem;     /* 64px */
  --space-11: 5rem;     /* 80px */
  --space-12: 6rem;     /* 96px */

  /* ===== BORDER 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;

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

  /* ===== 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: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ===== LAYOUT ===== */
  --container-max-width: 1280px;
  --container-padding: 1.5rem;
  --header-height: 60px;
  --footer-height: auto;

  /* ===== Z-INDEX STACK ===== */
  --z-negative: -1;
  --z-elevate: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-drawer: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-toast: 600;
  --z-tooltip: 700;

  /* ===== MOCKUP DESIGN SYSTEM (AFCON 360 REFINED) ===== */
  --color-background-primary: var(--bg-surface);
  --color-background-secondary: var(--bg-surface-alt);
  --color-background-tertiary: var(--bg-body);
  --color-background-info: var(--info-light);
  --color-background-warning: var(--warning-light);
  
  --color-text-primary: var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --color-text-tertiary: var(--text-tertiary);
  --color-text-info: var(--info);
  --color-text-success: var(--success);
  --color-text-danger: var(--danger);
  --color-text-warning: var(--brand-accent-dark);

  /* ===== SEMANTIC ACTION TOKENS (mode-agnostic) ===== */
  --color-primary: var(--brand-primary);
  --color-primary-hover: var(--brand-primary-hover);
  --color-on-primary: var(--text-light);
  --ring-color: var(--brand-accent);

  --color-border-tertiary: var(--border-light);
  
  --border-radius-sm: var(--radius-sm);
  --border-radius-md: var(--radius-md);
  --border-radius-lg: var(--radius-lg);

  /* ===== OPACITY ===== */
  --opacity-disabled: 0.5;
  --opacity-hover: 0.8;
  --opacity-overlay: 0.6;

  /* ===== USER OVERRIDES (Set by ThemeManager JS) ===== */
  --user-font-scale: 1;
  --user-font-family: var(--font-family-body);
  --user-line-height: var(--line-height-normal);
  --user-letter-spacing: normal;
  --user-word-spacing: normal;
  --user-contrast-filter: none;
  --user-bg: transparent;
  --user-text: transparent;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) {
    --text: #e0e0e0;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #8a8a8a;
    --bg: #121212;
    --bg-body: #121212;
    --bg-surface: #1e1e1e;
    --bg-surface-alt: #2d2d2d;
    --bg-elevated: #252525;
    --border-light: #2d2d2d;
    --border-medium: #404040;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --color-primary: #3a7a3a;
    --color-primary-hover: #4e9a4e;
  }
}

/* Force dark mode - only applied when user explicitly enables via theme settings */
body.dark-mode {
  --text: #e0e0e0;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-muted: #8a8a8a;
  --bg: #121212;
  --bg-body: #121212;
  --bg-surface: #1e1e1e;
  --bg-surface-alt: #2d2d2d;
  --bg-elevated: #252525;
  --border-light: #2d2d2d;
  --border-medium: #404040;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --color-primary: #3a7a3a;
  --color-primary-hover: #4e9a4e;
}

/* Force light mode - default theme */
body.light-mode {
  --text-primary: #1a1a1a;
  --text-secondary: #374151;
  --text-muted: #495057;
  --bg-body: #f2f4f2;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8f9fa;
  --bg-elevated: #ffffff;
  --border-light: #e9ecef;
  --border-medium: #dee2e6;
}

/* Default to light mode by adding light-mode class to body */
body {
  /* Default to light mode colors */
  --text-primary: #1a1a1a;
  --text-secondary: #374151;
  --text-muted: #495057;
  --bg-body: #f2f4f2;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8f9fa;
  --bg-elevated: #ffffff;
  --border-light: #e9ecef;
  --border-medium: #dee2e6;
}

/* ===== USER ACCESSIBILITY OVERRIDES ===== */
body.user-preferences {
  font-size: calc(var(--font-size-base) * var(--user-font-scale));
  font-family: var(--user-font-family);
  line-height: var(--user-line-height);
  letter-spacing: var(--user-letter-spacing);
  word-spacing: var(--user-word-spacing);
  filter: var(--user-contrast-filter);
}

/* Dyslexic Font Mode */
body.dyslexic-font {
  --user-font-family: 'Open Dyslexic', 'Lexend', 'Comic Sans MS', 'Chalkboard SE', sans-serif;
  letter-spacing: 0.05em;
  word-spacing: 0.1em;
}

/* High Contrast Modes */
body.contrast-yellow-black {
  --user-contrast-filter: none;
  background-color: #000000 !important;
  color: #ffff00 !important;
}
body.contrast-yellow-black * {
  border-color: #ffff00 !important;
}
body.contrast-yellow-black a {
  color: #00ffff !important;
}
body.contrast-yellow-black button,
body.contrast-yellow-black .btn {
  background-color: #ffff00 !important;
  color: #000000 !important;
}

body.contrast-white-black {
  background-color: #ffffff !important;
  color: #000000 !important;
}
body.contrast-white-black a {
  color: #0000ff !important;
}
body.contrast-white-black button,
body.contrast-white-black .btn {
  background-color: #000000 !important;
  color: #ffffff !important;
}

/* Reduced Motion */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* ===== FOCUS INDICATORS (Accessibility) ===== */
:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-surface-alt);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brand-primary);
}
