/// Design Tokens - Couleurs
/// 
/// Palette de couleurs sophistiquée inspirée des tendances UI/UX 2024-2025
/// Basée sur les principes de Material Design 3 et les meilleures pratiques
/// d'applications professionnelles d'entreprise.
library color_tokens;

import 'package:flutter/material.dart';

/// Tokens de couleurs primaires - Palette sophistiquée
class ColorTokens {
  ColorTokens._();

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS PRIMAIRES - Bleu professionnel moderne
  // ═══════════════════════════════════════════════════════════════════════════
  
  /// Couleur primaire principale - Bleu corporate moderne
  static const Color primary = Color(0xFF1E3A8A); // Bleu profond
  static const Color primaryLight = Color(0xFF3B82F6); // Bleu vif
  static const Color primaryDark = Color(0xFF1E40AF); // Bleu sombre
  static const Color primaryContainer = Color(0xFFDEEAFF); // Container bleu clair
  static const Color onPrimary = Color(0xFFFFFFFF); // Texte sur primaire
  static const Color onPrimaryContainer = Color(0xFF001D36); // Texte sur container

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS SECONDAIRES - Accent sophistiqué
  // ═══════════════════════════════════════════════════════════════════════════
  
  static const Color secondary = Color(0xFF6366F1); // Indigo moderne
  static const Color secondaryLight = Color(0xFF8B5CF6); // Violet clair
  static const Color secondaryDark = Color(0xFF4F46E5); // Indigo sombre
  static const Color secondaryContainer = Color(0xFFE0E7FF); // Container indigo
  static const Color onSecondary = Color(0xFFFFFFFF);
  static const Color onSecondaryContainer = Color(0xFF1E1B3A);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS TERTIAIRES - Accent complémentaire
  // ═══════════════════════════════════════════════════════════════════════════
  
  static const Color tertiary = Color(0xFF059669); // Vert émeraude
  static const Color tertiaryLight = Color(0xFF10B981); // Vert clair
  static const Color tertiaryDark = Color(0xFF047857); // Vert sombre
  static const Color tertiaryContainer = Color(0xFFD1FAE5); // Container vert
  static const Color onTertiary = Color(0xFFFFFFFF);
  static const Color onTertiaryContainer = Color(0xFF002114);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS NEUTRES - Échelle de gris sophistiquée
  // ═══════════════════════════════════════════════════════════════════════════
  
  static const Color surface = Color(0xFFFAFAFA); // Surface principale
  static const Color surfaceVariant = Color(0xFFF5F5F5); // Surface variante
  static const Color surfaceContainer = Color(0xFFFFFFFF); // Container surface
  static const Color surfaceContainerHigh = Color(0xFFF8F9FA); // Container élevé
  static const Color surfaceContainerHighest = Color(0xFFE5E7EB); // Container max
  
  static const Color onSurface = Color(0xFF1F2937); // Texte principal
  static const Color onSurfaceVariant = Color(0xFF6B7280); // Texte secondaire
  static const Color textSecondary = Color(0xFF6B7280); // Texte secondaire (alias)
  static const Color outline = Color(0xFFD1D5DB); // Bordures
  static const Color outlineVariant = Color(0xFFE5E7EB); // Bordures claires

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS SÉMANTIQUES - États et feedback
  // ═══════════════════════════════════════════════════════════════════════════
  
  /// Couleurs de succès
  static const Color success = Color(0xFF10B981); // Vert succès
  static const Color successLight = Color(0xFF34D399); // Vert clair
  static const Color successDark = Color(0xFF059669); // Vert sombre
  static const Color successContainer = Color(0xFFECFDF5); // Container succès
  static const Color onSuccess = Color(0xFFFFFFFF);
  static const Color onSuccessContainer = Color(0xFF002114);

  /// Couleurs d'erreur
  static const Color error = Color(0xFFDC2626); // Rouge erreur
  static const Color errorLight = Color(0xFFEF4444); // Rouge clair
  static const Color errorDark = Color(0xFFB91C1C); // Rouge sombre
  static const Color errorContainer = Color(0xFFFEF2F2); // Container erreur
  static const Color onError = Color(0xFFFFFFFF);
  static const Color onErrorContainer = Color(0xFF410002);

  /// Couleurs d'avertissement
  static const Color warning = Color(0xFFF59E0B); // Orange avertissement
  static const Color warningLight = Color(0xFFFBBF24); // Orange clair
  static const Color warningDark = Color(0xFFD97706); // Orange sombre
  static const Color warningContainer = Color(0xFFFEF3C7); // Container avertissement
  static const Color onWarning = Color(0xFFFFFFFF);
  static const Color onWarningContainer = Color(0xFF2D1B00);

  /// Couleurs d'information
  static const Color info = Color(0xFF0EA5E9); // Bleu info
  static const Color infoLight = Color(0xFF38BDF8); // Bleu clair
  static const Color infoDark = Color(0xFF0284C7); // Bleu sombre
  static const Color infoContainer = Color(0xFFE0F2FE); // Container info
  static const Color onInfo = Color(0xFFFFFFFF);
  static const Color onInfoContainer = Color(0xFF001D36);

  // ═══════════════════════════════════════════════════════════════════════════
  // COULEURS SPÉCIALISÉES - Interface avancée
  // ═══════════════════════════════════════════════════════════════════════════
  
  /// Couleurs de navigation
  static const Color navigationBackground = Color(0xFFFFFFFF);
  static const Color navigationSelected = Color(0xFF1E3A8A);
  static const Color navigationUnselected = Color(0xFF6B7280);
  static const Color navigationIndicator = Color(0xFF3B82F6);

  /// Couleurs d'élévation et ombres
  static const Color shadow = Color(0x1A000000); // Ombre légère
  static const Color shadowMedium = Color(0x33000000); // Ombre moyenne
  static const Color shadowHigh = Color(0x4D000000); // Ombre forte
  
  /// Couleurs de glassmorphism (tendance 2024-2025)
  static const Color glassBackground = Color(0x80FFFFFF); // Fond verre
  static const Color glassBorder = Color(0x33FFFFFF); // Bordure verre
  static const Color glassOverlay = Color(0x0DFFFFFF); // Overlay verre

  /// Couleurs de gradient (tendance moderne)
  static const List<Color> primaryGradient = [
    Color(0xFF1E3A8A),
    Color(0xFF3B82F6),
  ];
  
  static const List<Color> secondaryGradient = [
    Color(0xFF6366F1),
    Color(0xFF8B5CF6),
  ];
  
  static const List<Color> successGradient = [
    Color(0xFF059669),
    Color(0xFF10B981),
  ];

  // ═══════════════════════════════════════════════════════════════════════════
  // MÉTHODES UTILITAIRES
  // ═══════════════════════════════════════════════════════════════════════════
  
  /// Obtient une couleur avec opacité
  static Color withOpacity(Color color, double opacity) {
    return color.withOpacity(opacity);
  }
  
  /// Obtient une couleur plus claire
  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();
  }
  
  /// Obtient une couleur plus sombre
  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();
  }
}
