@use "sass:map";

$sgh-color-palette: (
  // Primary Teal Scale - matches CSS variables
  50 : #e0f2f3,
  100 : #b3dee2,
  200 : #80c8cf,
  300 : #4db2bc,
  400 : #26a0ae,
  500 : #006068,  // Main primary color ⭐
  600 : #005860,
  700 : #004e55,
  800 : #00444b,
  900 : #003638,
  // Gold Accent Scale - matches CSS variables
  A100 : #fff8e1,
  A200 : #ffecb3,
  A400 : #ffe57f,
  A700 : #F3C300,  // Vibrant gold accent ⭐
  contrast: (
    50 : #000000,
    100 : #000000,
    200 : #000000,
    300 : #ffffff,
    400 : #ffffff,
    500 : #ffffff,
    600 : #ffffff,
    700 : #ffffff,
    800 : #ffffff,
    900 : #ffffff,
    A100 : #000000,
    A200 : #000000,
    A400 : #000000,
    A700 : #000000,
  ),
  default_status: (
    SUCCESS: #10b981,  // Emerald green - matches CSS variable
    DANGER: #ef4444,   // Bright red - matches CSS variable
    WARNING: #f59e0b,  // Amber - matches CSS variable
    INFO: #3b82f6,     // Blue - matches CSS variable
    REFUND: #8b5cf6    // Purple - matches CSS variable
  ),
  font_colors: (
    PRIMARY: #1a1a1a,    // Near black - matches CSS variable
    SECONDARY: #525252,  // Medium gray - matches CSS variable
    TERTIARY: #737373    // Light gray - matches CSS variable
  ),
  background_colors: (
    PRIMARY: #ffffff,   // Pure white - matches CSS variable
    SECONDARY: #f9fafb  // Subtle off-white - matches CSS variable
  ),
  chart_default_colors: (
    CHART_COLOR_1 : #50c4cd,   // Light bright teal - matches CSS variable
    CHART_COLOR_2 : #26a0ae,   // Medium bright teal - matches CSS variable
    CHART_COLOR_3 : #0499a8,   // Vibrant teal - matches CSS variable
    CHART_COLOR_4 : #006068,   // Primary teal - brand color ⭐
    CHART_COLOR_5 : #05aab8,   // Turquoise teal - matches CSS variable
    CHART_COLOR_6 : #4db2bc,   // Soft medium teal - matches CSS variable
    CHART_COLOR_7 : #017f91,   // Deep teal - matches CSS variable
    CHART_COLOR_8 : #2bb7c3,   // Bright turquoise - matches CSS variable
    CHART_COLOR_9 : #80c8cf,   // Pale teal - matches CSS variable
    CHART_COLOR_10 : #004e55,  // Dark teal - matches CSS variable
    CHART_COLOR_11 : #00444b,  // Very dark teal - matches CSS variable
    CHART_COLOR_12 : #0390a0,  // Ocean teal - matches CSS variable
    CHART_COLOR_13 : #00333a,  // Darkest teal - matches CSS variable
    CHART_COLOR_14 : #04a3b1,  // Aqua teal - matches CSS variable
  ),
  utility_colors: (
    WHITE: #ffffff,
    BLACK: #000000,
    LIGHT_GRAY_100: #f8f9fa,
    LIGHT_GRAY_200: #f5f5f5,
    LIGHT_GRAY_300: #f1f1f3,
    LIGHT_GRAY_400: #e8e8e8,
    LIGHT_GRAY_500: #e0e0e0,
    MEDIUM_GRAY_100: #dddddd,
    MEDIUM_GRAY_200: #707070,
    MEDIUM_GRAY_300: #6c757d,
    DARK_GRAY_100: #212121,
    DARK_GRAY_200: #1e1e1e,
    DARK_GRAY_300: #1a1a1a,
    TEAL_GREEN: #009879,
    DANGER_ALT: #dc3545,
    DANGER_DARK: #9a3d3d,
    SUCCESS_ALT: #2e7d32,
    BLUE_DARK: #1a237e
  ),
  code_block_colors: (
    BACKGROUND: #1e293b,  // Dark blue-gray - matches CSS variable
    TEXT: #e2e8f0         // Light gray-blue - matches CSS variable
  ),
  shadow_colors: (
    SHADOW_08: rgba(0, 0, 0, 0.05),   // Subtle depth - matches CSS variable
    SHADOW_10: rgba(0, 0, 0, 0.08),   // Light elevation - matches CSS variable
    SHADOW_12: rgba(0, 0, 0, 0.1),    // Medium elevation - matches CSS variable
    SHADOW_15: rgba(0, 0, 0, 0.12),   // High elevation - matches CSS variable
    PRIMARY_10: rgba(0, 96, 104, 0.12),   // Teal glow subtle - matches CSS variable
    PRIMARY_15: rgba(0, 96, 104, 0.18),   // Teal glow medium - matches CSS variable
    PRIMARY_20: rgba(0, 96, 104, 0.24),   // Teal glow strong - matches CSS variable
    PRIMARY_30: rgba(0, 96, 104, 0.32),   // Teal glow intense - matches CSS variable
    WHITE_10: rgba(255, 255, 255, 0.1),
    WHITE_20: rgba(255, 255, 255, 0.2),
    WHITE_30: rgba(255, 255, 255, 0.3)
  )
);

// ============================================================================
// Legacy Button Color Variables (For backward compatibility)
// ============================================================================
$sgh-green-primary-lib: map.get($sgh-color-palette, 500);  // #006068 (teal)
$sgh-green-accent-lib: map.get($sgh-color-palette, A700);  // #F3C300 (gold)
$sgh-blue-primary-lib: #1976d2;  // Material blue
$sgh-light-primary-lib: map.get($sgh-color-palette, 500);  // #006068 (teal) - light theme
$sgh-dark-primary-lib: map.get($sgh-color-palette, 500);  // #006068 (teal) - dark theme
$sgh-cyan-primary-lib: map.get($sgh-color-palette, 500);  // #006068 (teal) - cyan theme
$sgh-warn-color: map.get(map.get($sgh-color-palette, 'default_status'), 'DANGER');  // #ef4444 (danger red)

// Theme-specific palettes
$sgh-blue-palette: (
  50 : #e3f2fd,
  100 : #bbdefb,
  200 : #90caf9,
  300 : #64b5f6,
  400 : #42a5f5,
  500 : #1976d2,  // Main blue
  600 : #1565c0,
  700 : #0d47a1,
  800 : #0a3d91,
  900 : #062f6e,
  A100 : #82b1ff,
  A200 : #448aff,
  A400 : #2979ff,
  A700 : #2962ff,
  contrast: (
    50 : #000000,
    100 : #000000,
    200 : #000000,
    300 : #000000,
    400 : #000000,
    500 : #ffffff,
    600 : #ffffff,
    700 : #ffffff,
    800 : #ffffff,
    900 : #ffffff,
    A100 : #000000,
    A200 : #ffffff,
    A400 : #ffffff,
    A700 : #ffffff,
  )
);

$sgh-white-palette: (
  50 : #ffffff,
  100 : #fafafa,
  200 : #f5f5f5,
  300 : #f0f0f0,
  400 : #dedede,
  500 : #c2c2c2,
  600 : #979797,
  700 : #818181,
  800 : #606060,
  900 : #3c3c3c,
  A100 : #ffffff,
  A200 : #eeeeee,
  A400 : #bdbdbd,
  A700 : #616161,
  contrast: (
    50 : #000000,
    100 : #000000,
    200 : #000000,
    300 : #000000,
    400 : #000000,
    500 : #000000,
    600 : #000000,
    700 : #ffffff,
    800 : #ffffff,
    900 : #ffffff,
    A100 : #000000,
    A200 : #000000,
    A400 : #000000,
    A700 : #ffffff,
  )
);

// Natera theme palettes (for legacy support)
$natera-blue-palette: (
  50 : #e1f5fe,
  100 : #b3e5fc,
  200 : #81d4fa,
  300 : #4fc3f7,
  400 : #29b6f6,
  500 : #004c97,  // Main natera blue
  600 : #00438a,
  700 : #003a7d,
  800 : #003170,
  900 : #002863,
  A100 : #82b1ff,
  A200 : #448aff,
  A400 : #2979ff,
  A700 : #2962ff,
  contrast: (
    50 : #000000,
    100 : #000000,
    200 : #000000,
    300 : #000000,
    400 : #000000,
    500 : #ffffff,
    600 : #ffffff,
    700 : #ffffff,
    800 : #ffffff,
    900 : #ffffff,
    A100 : #000000,
    A200 : #ffffff,
    A400 : #ffffff,
    A700 : #ffffff,
  )
);

$natera-lightblue-palette: (
  50 : #e1f5fe,
  100 : #b3e5fc,
  200 : #81d4fa,
  300 : #4fc3f7,
  400 : #29b6f6,
  500 : #40c4ff,  // Main natera light blue
  600 : #00b8d4,
  700 : #0097a7,
  800 : #00838f,
  900 : #006064,
  A100 : #80d8ff,
  A200 : #40c4ff,
  A400 : #00b0ff,
  A700 : #0091ea,
  contrast: (
    50 : #000000,
    100 : #000000,
    200 : #000000,
    300 : #000000,
    400 : #000000,
    500 : #000000,
    600 : #ffffff,
    700 : #ffffff,
    800 : #ffffff,
    900 : #ffffff,
    A100 : #000000,
    A200 : #000000,
    A400 : #000000,
    A700 : #ffffff,
  )
);

// Function to get main colors
@function sgh-color($color-key) {
  @return map.get($sgh-color-palette, $color-key);
}

// Function to get contrast colors
@function sgh-contrast-color($color-key) {
  $contrast-map: map.get($sgh-color-palette, 'contrast');
  @return map.get($contrast-map, $color-key);
}

// Function to get status colors
@function sgh-status-color($status-key) {
  $status-map: map.get($sgh-color-palette, 'default_status');
  @return map.get($status-map, $status-key);
}

// Function to get font colors
@function sgh-font-color($font-key) {
  $font-map: map.get($sgh-color-palette, 'font_colors');
  @return map.get($font-map, $font-key);
}

// Function to get background colors
@function sgh-bg-color($bg-key) {
  $bg-map: map.get($sgh-color-palette, 'background_colors');
  @return map.get($bg-map, $bg-key);
}

// Function to get chart colors
@function sgh-chart-color($chart-key) {
  $chart-map: map.get($sgh-color-palette, 'chart_default_colors');
  @return map.get($chart-map, $chart-key);
}

// Function to get utility colors
@function sgh-utility-color($utility-key) {
  $utility-map: map.get($sgh-color-palette, 'utility_colors');
  @return map.get($utility-map, $utility-key);
}

// Function to get code block colors
@function sgh-code-color($code-key) {
  $code-map: map.get($sgh-color-palette, 'code_block_colors');
  @return map.get($code-map, $code-key);
}

// Function to get shadow colors
@function sgh-shadow-color($shadow-key) {
  $shadow-map: map.get($sgh-color-palette, 'shadow_colors');
  @return map.get($shadow-map, $shadow-key);
}

// ============================================================================
// CSS Custom Property Functions (For Dynamic Theme Support)
// ============================================================================
// These functions return CSS custom properties (CSS variables) instead of
// static values, enabling dynamic theme switching at runtime.
// Use these when you want components to respond to theme changes.
// ============================================================================

// Function to get theme-aware colors using CSS variables
@function sgh-theme-color($color-key) {
  @return var(--sgh-color-#{$color-key});
}

// Function to get theme-aware contrast colors
@function sgh-theme-contrast-color($color-key) {
  @return var(--sgh-contrast-#{$color-key});
}

// Function to get theme-aware status colors
@function sgh-theme-status-color($status-key) {
  @if $status-key == 'SUCCESS' {
    @return var(--sgh-status-success);
  } @else if $status-key == 'DANGER' {
    @return var(--sgh-status-danger);
  } @else if $status-key == 'WARNING' {
    @return var(--sgh-status-warning);
  } @else if $status-key == 'INFO' {
    @return var(--sgh-status-info);
  } @else if $status-key == 'REFUND' {
    @return var(--sgh-status-refund);
  }
  @return null;
}

// Function to get theme-aware font colors
@function sgh-theme-font-color($font-key) {
  @if $font-key == 'PRIMARY' {
    @return var(--sgh-font-primary);
  } @else if $font-key == 'SECONDARY' {
    @return var(--sgh-font-secondary);
  } @else if $font-key == 'TERTIARY' {
    @return var(--sgh-font-tertiary);
  }
  @return null;
}

// Function to get theme-aware background colors
@function sgh-theme-bg-color($bg-key) {
  @if $bg-key == 'PRIMARY' {
    @return var(--sgh-bg-primary);
  } @else if $bg-key == 'SECONDARY' {
    @return var(--sgh-bg-secondary);
  }
  @return null;
}

// Function to get theme-aware chart colors
@function sgh-theme-chart-color($chart-key) {
  @if $chart-key == 'CHART_COLOR_1' {
    @return var(--sgh-chart-1);
  } @else if $chart-key == 'CHART_COLOR_2' {
    @return var(--sgh-chart-2);
  } @else if $chart-key == 'CHART_COLOR_3' {
    @return var(--sgh-chart-3);
  } @else if $chart-key == 'CHART_COLOR_4' {
    @return var(--sgh-chart-4);
  } @else if $chart-key == 'CHART_COLOR_5' {
    @return var(--sgh-chart-5);
  } @else if $chart-key == 'CHART_COLOR_6' {
    @return var(--sgh-chart-6);
  } @else if $chart-key == 'CHART_COLOR_7' {
    @return var(--sgh-chart-7);
  } @else if $chart-key == 'CHART_COLOR_8' {
    @return var(--sgh-chart-8);
  } @else if $chart-key == 'CHART_COLOR_9' {
    @return var(--sgh-chart-9);
  } @else if $chart-key == 'CHART_COLOR_10' {
    @return var(--sgh-chart-10);
  } @else if $chart-key == 'CHART_COLOR_11' {
    @return var(--sgh-chart-11);
  } @else if $chart-key == 'CHART_COLOR_12' {
    @return var(--sgh-chart-12);
  } @else if $chart-key == 'CHART_COLOR_13' {
    @return var(--sgh-chart-13);
  } @else if $chart-key == 'CHART_COLOR_14' {
    @return var(--sgh-chart-14);
  }
  @return null;
}

// Function to get theme-aware code block colors
@function sgh-theme-code-color($code-key) {
  @if $code-key == 'BACKGROUND' {
    @return var(--sgh-code-bg);
  } @else if $code-key == 'TEXT' {
    @return var(--sgh-code-text);
  }
  @return null;
}

// Function to get theme-aware shadow colors
@function sgh-theme-shadow-color($shadow-key) {
  @if $shadow-key == 'SHADOW_08' {
    @return var(--sgh-shadow-08);
  } @else if $shadow-key == 'SHADOW_10' {
    @return var(--sgh-shadow-10);
  } @else if $shadow-key == 'SHADOW_12' {
    @return var(--sgh-shadow-12);
  } @else if $shadow-key == 'SHADOW_15' {
    @return var(--sgh-shadow-15);
  } @else if $shadow-key == 'PRIMARY_10' {
    @return var(--sgh-shadow-primary-10);
  } @else if $shadow-key == 'PRIMARY_15' {
    @return var(--sgh-shadow-primary-15);
  } @else if $shadow-key == 'PRIMARY_20' {
    @return var(--sgh-shadow-primary-20);
  } @else if $shadow-key == 'PRIMARY_30' {
    @return var(--sgh-shadow-primary-30);
  }
  @return null;
}




