/// Design Tokens - Couleurs UnionFlow
///
/// Palette Vert Zen / Santé — Professionnelle et apaisante
/// MODE JOUR : Vert Forêt (#2E7D32) — Forest Green
/// MODE NUIT : Vert Ardoise (#1A2E1A) — Slate Green
library color_tokens;

import 'package:flutter/material.dart';

/// Tokens de couleurs UnionFlow - Design System Unifié
class ColorTokens {
  ColorTokens._();

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS PRIMAIRES - MODE JOUR (Vert Forêt)
  // ═══════════════════════════════════════════════════════════════════════════

  /// Couleur primaire principale - Vert Forêt
  static const Color primary = Color(0xFF2E7D32);
  static const Color primaryLight = Color(0xFF4CAF50);
  static const Color primaryDark = Color(0xFF1B5E20);
  static const Color primaryContainer = Color(0xFFE8F5E9);
  static const Color onPrimary = Color(0xFFFFFFFF);
  static const Color onPrimaryContainer = Color(0xFF003908);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS PRIMAIRES - MODE NUIT (Vert Ardoise)
  // ═══════════════════════════════════════════════════════════════════════════

  static const Color primaryDarkMode = Color(0xFF1A2E1A);
  static const Color primaryLightDarkMode = Color(0xFF2E4D2E);
  static const Color primaryDarkDarkMode = Color(0xFF0F1A0F);
  static const Color primaryContainerDarkMode = Color(0xFF1E3A1E);
  static const Color onPrimaryDarkMode = Color(0xFFE0F2E0);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS SECONDAIRES - Vert Menthe / Sauge
  // ═══════════════════════════════════════════════════════════════════════════

  static const Color secondary = Color(0xFF66BB6A);
  static const Color secondaryLight = Color(0xFFA5D6A7);
  static const Color secondaryDark = Color(0xFF388E3C);
  static const Color secondaryContainer = Color(0xFFC8E6C9);
  static const Color onSecondary = Color(0xFFFFFFFF);
  static const Color onSecondaryContainer = Color(0xFF002106);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS TERTIAIRES - Vert Lime / Accent
  // ═══════════════════════════════════════════════════════════════════════════

  static const Color tertiary = Color(0xFF8BC34A);
  static const Color tertiaryLight = Color(0xFFAED581);
  static const Color tertiaryDark = Color(0xFF558B2F);
  static const Color tertiaryContainer = Color(0xFFDCEDC8);
  static const Color onTertiary = Color(0xFFFFFFFF);
  static const Color onTertiaryContainer = Color(0xFF1B3A00);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS NEUTRES - MODE JOUR
  // ═══════════════════════════════════════════════════════════════════════════

  static const Color surface = Color(0xFFFFFFFF);
  static const Color surfaceVariant = Color(0xFFF1F8E9);
  static const Color surfaceContainer = Color(0xFFFFFFFF);
  static const Color surfaceContainerHigh = Color(0xFFF1F8E9);
  static const Color surfaceContainerHighest = Color(0xFFDCEDC8);
  static const Color background = Color(0xFFF1F8E9);

  static const Color onSurface = Color(0xFF1C2B1C);
  static const Color onSurfaceVariant = Color(0xFF4E6B4E);
  static const Color textSecondary = Color(0xFF4E6B4E);
  static const Color outline = Color(0xFFC8E6C9);
  static const Color outlineVariant = Color(0xFFDCEDC8);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS NEUTRES - MODE NUIT
  // ═══════════════════════════════════════════════════════════════════════════

  static const Color surfaceDarkMode = Color(0xFF1A2E1A);
  static const Color surfaceVariantDarkMode = Color(0xFF243824);
  static const Color backgroundDarkMode = Color(0xFF0F1A0F);

  static const Color onSurfaceDarkMode = Color(0xFFE0F2E0);
  static const Color onSurfaceVariantDarkMode = Color(0xFF90B890);
  static const Color outlineDarkMode = Color(0xFF3A5E3A);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS SÉMANTIQUES
  // ═══════════════════════════════════════════════════════════════════════════

  static const Color success = Color(0xFF2E7D32);
  static const Color successLight = Color(0xFF4CAF50);
  static const Color successDark = Color(0xFF1B5E20);
  static const Color successContainer = Color(0xFFE8F5E9);
  static const Color onSuccess = Color(0xFFFFFFFF);
  static const Color onSuccessContainer = Color(0xFF003908);

  static const Color error = Color(0xFFDC2626);
  static const Color errorLight = Color(0xFFEF4444);
  static const Color errorDark = Color(0xFFB91C1C);
  static const Color errorContainer = Color(0xFFFEF2F2);
  static const Color onError = Color(0xFFFFFFFF);
  static const Color onErrorContainer = Color(0xFF410002);

  static const Color warning = Color(0xFFF59E0B);
  static const Color warningLight = Color(0xFFFBBF24);
  static const Color warningDark = Color(0xFFD97706);
  static const Color warningContainer = Color(0xFFFEF3C7);
  static const Color onWarning = Color(0xFFFFFFFF);
  static const Color onWarningContainer = Color(0xFF2D1B00);

  static const Color info = Color(0xFF0288D1);
  static const Color infoLight = Color(0xFF29B6F6);
  static const Color infoDark = Color(0xFF01579B);
  static const Color infoContainer = Color(0xFFE1F5FE);
  static const Color onInfo = Color(0xFFFFFFFF);
  static const Color onInfoContainer = Color(0xFF001D36);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS DE NAVIGATION
  // ═══════════════════════════════════════════════════════════════════════════

  static const Color navigationBackground = Color(0xFFFFFFFF);
  static const Color navigationSelected = Color(0xFF2E7D32);
  static const Color navigationUnselected = Color(0xFF4E6B4E);
  static const Color navigationIndicator = Color(0xFFE8F5E9);

  static const Color navigationBackgroundDarkMode = Color(0xFF1A2E1A);
  static const Color navigationSelectedDarkMode = Color(0xFFA5D6A7);
  static const Color navigationUnselectedDarkMode = Color(0xFF90B890);
  static const Color navigationIndicatorDarkMode = Color(0xFF2E4D2E);

  // ═══════════════════════════════════════════════════════════════════════════
  // OMBRES ET EFFETS
  // ═══════════════════════════════════════════════════════════════════════════

  static const Color shadow = Color(0x1A1C2B1C);
  static const Color shadowMedium = Color(0x331C2B1C);
  static const Color shadowHigh = Color(0x4D1C2B1C);

  static const Color glassBackground = Color(0x80FFFFFF);
  static const Color glassBorder = Color(0x33FFFFFF);
  static const Color glassOverlay = Color(0x0DFFFFFF);

  // ═══════════════════════════════════════════════════════════════════════════
  // GRADIENTS
  // ═══════════════════════════════════════════════════════════════════════════

  static const List<Color> primaryGradient = [
    Color(0xFF1B5E20),
    Color(0xFF2E7D32),
    Color(0xFF388E3C),
  ];

  static const List<Color> primaryGradientDarkMode = [
    Color(0xFF0F1A0F),
    Color(0xFF1A2E1A),
    Color(0xFF243824),
  ];

  static const List<Color> secondaryGradient = [
    Color(0xFF388E3C),
    Color(0xFF66BB6A),
  ];

  static const List<Color> successGradient = [
    Color(0xFF2E7D32),
    Color(0xFF4CAF50),
  ];

  // ═══════════════════════════════════════════════════════════════════════════
  // MÉTHODES UTILITAIRES
  // ═══════════════════════════════════════════════════════════════════════════

  static Color withOpacity(Color color, double opacity) {
    return color.withOpacity(opacity);
  }

  static Color lighten(Color color, [double amount = 0.1]) {
    final hsl = HSLColor.fromColor(color);
    final lightness = (hsl.lightness + amount).clamp(0.0, 1.0);
    return hsl.withLightness(lightness).toColor();
  }

  static Color darken(Color color, [double amount = 0.1]) {
    final hsl = HSLColor.fromColor(color);
    final lightness = (hsl.lightness - amount).clamp(0.0, 1.0);
    return hsl.withLightness(lightness).toColor();
  }
}
