// SPDX-FileCopyrightText: © 2025 Nøkken.io <nokken.io@proton.me>
// SPDX-License-Identifier: AGPL-3.0
//
//  app_theme.dart
//  Theme system
//
import 'package:flutter/material.dart';
import 'package:nokken/src/core/ui/theme/app_colors.dart';

/// Main theme class with comprehensive style definitions
class AppTheme {
  //----------------------------------------------------------------------------
  // SPACING CONSTANTS
  //----------------------------------------------------------------------------

  /// Standard spacing unit for margins, padding, etc.
  static const double spacing = 8.0;
  static const double doubleSpacing = spacing * 2;
  static const double tripleSpacing = spacing * 3;

  /// Standard padding for containers
  static const double padding = 16.0;

  /// Standard padding for cards
  static const double cardPadding = 16.0;

  /// Standard spacing between cards
  static const double cardSpacing = 24.0;

  /// Standard padding for navigation elements
  static const double navbarPadding = 8.0;

  //----------------------------------------------------------------------------
  // STANDARD EDGE INSETS
  //----------------------------------------------------------------------------

  /// Standard padding for cards
  static const EdgeInsets standardCardPadding = EdgeInsets.all(cardPadding);

  /// Standard margins for screens
  static const EdgeInsets standardScreenMargins = EdgeInsets.all(padding);

  /// Standard padding for navigation bar icons
  static const EdgeInsets navigationBarPadding =
      EdgeInsets.symmetric(horizontal: navbarPadding, vertical: 0);

  ///
  /// EMOJI STYLES
  ///
  static const String emojiStyle = "Noto Color Emoji";

  //----------------------------------------------------------------------------
// BASE COLORS
//----------------------------------------------------------------------------
  static const Color black = Color(0xFF050505);
  static const Color white = Color(0xFFF9F9F9);
  static const Color darkgrey = Color(0xFF151515);
  static const Color grey = Color(0xFF909090);
//----------------------------------------------------------------------------
// NOTIFICATION TYPE COLORS
//----------------------------------------------------------------------------
  static const oralMedColorDark = Color(0xFF8A7EFF);
  static const injectionColorDark = Color(0xFFBF7AFF);
  static const patchColorDark = Color(0xFF45AAF2);
  static const topicalColorDark = Color(0xFFB8A9DB);
  static const oralMedColorLight = Color(0xFF5B48DA);
  static const injectionColorLight = Color(0xFF8854D0);
  static const patchColorLight = Color(0xFF3867D6);
  static const topicalColorLight = Color(0xFF9F86C0);
  static const bloodworkColorDark = Color(0xFFFF5D7E);
  static const doctorApptColorDark = Color(0xFFFF9F45);
  static const surgeryColorDark = Color(0xFFFFD166);
  static const bloodworkColorLight = Color(0xFFE63946);
  static const doctorApptColorLight = Color(0xFFE67E22);
  static const surgeryColorLight = Color(0xFFE6B800);

//
// MOOD COLORS
//
  static const moodGreatDark = Color(0xFF00E0A0);
  static const moodGoodDark = Color(0xFF74E878);
  static const moodOkayDark = Color(0xFFFFD166);
  static const moodMehDark = Color(0xFFFF9F45);
  static const moodBadDark = Color(0xFFFF5D7E);
  static const moodGreatLight = Color(0xFF00B280);
  static const moodGoodLight = Color(0xFF5AC85A);
  static const moodOkayLight = Color(0xFFE6B800);
  static const moodMehLight = Color(0xFFE67E22);
  static const moodBadLight = Color(0xFFE63946);

//----------------------------------------------------------------------------
// DARK THEME COLORS
//----------------------------------------------------------------------------
  static const Color greyDark = Color(0xFF252525);
  static const Color lightgreyDark = Color(0xFF9BA0B4);
  static const Color blueDark = Color(0xFF00D0A0);
  static const Color lightblueDark = Color(0xFF00F0B8);
  static const Color darkblueDark = Color(0xFF00A080);
  static const Color orangeDark = Color(0xFFFF6B6B);
  static const Color pinkDark = Color(0xFFFF85A1);
  static const Color lightpinkDark = Color(0xFFFFABC1);
  static const Color greenDark = Color(0xFF00E0A0);
//----------------------------------------------------------------------------
// LIGHT THEME COLORS
//----------------------------------------------------------------------------
  static const Color greyLight = Color(0xFFE3E5ED);
  static const Color lightgreyLight = Color(0xFFF5F7FA);
  static const Color blueLight = Color(0xFF00B890);
  static const Color lightblueLight = Color(0xFF33D0A8);
  static const Color darkblueLight = Color(0xFF009878);
  static const Color orangeLight = Color(0xFFE65100);
  static const Color pinkLight = Color(0xFFD81B60);
  static const Color lightpinkLight = Color(0xFFEC407A);
  static const Color greenLight = Color(0xFF00B890);
  //----------------------------------------------------------------------------
  // COLOR SCHEMES
  //----------------------------------------------------------------------------

  /// Dark mode color scheme
  static final ColorScheme darkColorScheme = ColorScheme.dark(
    primary: blueDark,
    secondary: orangeDark,
    tertiary: greenDark,
    surface: darkgrey,
    surfaceContainer: greyDark.withAlpha(220),
    onPrimary: white,
    onSecondary: white,
    onTertiary: white,
    onSurface: white,
    onSurfaceVariant: lightgreyDark,
    error: Color(0xFFFF5252),
    errorContainer: Color(0xFF800020).withAlpha(160),
    shadow: black.withAlpha(40),
    outline: lightgreyDark.withAlpha(120),
    inverseSurface: lightgreyLight,
    onInverseSurface: black,
    inversePrimary: darkblueLight,
  );

  /// Light mode color scheme
  static final ColorScheme lightColorScheme = ColorScheme.light(
    primary: blueLight,
    secondary: orangeLight,
    tertiary: greenLight,
    surface: white,
    surfaceContainer: greyLight,
    onPrimary: white,
    onSecondary: white,
    onTertiary: white,
    onSurface: Color(0xFF212121),
    onSurfaceVariant: darkgrey.withAlpha(180),
    error: Color(0xFFD32F2F),
    errorContainer: Color(0xFFFFDAD6),
    shadow: black.withAlpha(25),
    outline: greyLight.withAlpha(180),
    inverseSurface: darkgrey,
    onInverseSurface: white,
    inversePrimary: lightblueDark,
  );

  /// Default text field decoration used throughout the app
  static const defaultTextFieldDecoration = InputDecoration(
    border: OutlineInputBorder(),
    contentPadding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
  );

  //----------------------------------------------------------------------------
  // TEXT STYLES
  //----------------------------------------------------------------------------

  static final TextStyle displayLarge = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 45,
    fontWeight: FontWeight.w400,
    letterSpacing: -0.25,
    height: 1.12,
    color: AppColors.onSurface,
  );

  static final TextStyle displayMedium = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 32,
    fontWeight: FontWeight.w400,
    letterSpacing: 0,
    height: 1.16,
    color: AppColors.onSurface,
  );

  static final TextStyle displaySmall = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 24,
    fontWeight: FontWeight.w400,
    letterSpacing: 0,
    height: 1.22,
    color: AppColors.onSurface,
  );

// Headline Styles
  static final TextStyle headlineLarge = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 28,
    fontWeight: FontWeight.w700,
    letterSpacing: 0,
    height: 1.25,
    color: AppColors.onSurface,
  );

  static final TextStyle headlineMedium = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 22,
    fontWeight: FontWeight.w700,
    letterSpacing: 0,
    height: 1.29,
    color: AppColors.onSurface,
  );

  static final TextStyle headlineSmall = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 18,
    fontWeight: FontWeight.w600,
    letterSpacing: 0,
    height: 1.33,
    color: AppColors.onSurface,
  );

// Title Styles
  static final TextStyle titleLarge = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 20,
    fontWeight: FontWeight.w600,
    letterSpacing: 0,
    height: 1.27,
    color: AppColors.onSurface,
  );

  static final TextStyle titleMedium = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 14,
    fontWeight: FontWeight.w600,
    letterSpacing: 0.15,
    height: 1.5,
    color: AppColors.onSurface,
  );

  static final TextStyle titleSmall = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 12,
    fontWeight: FontWeight.w600,
    letterSpacing: 0.1,
    height: 1.43,
    color: AppColors.onSurface,
  );

// Label Styles
  static final TextStyle labelLarge = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 14,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.1,
    height: 1.43,
    color: AppColors.onSurface,
  );

  static final TextStyle labelMedium = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 12,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.5,
    height: 0.83,
    color: AppColors.onSurface,
  );

  static final TextStyle labelSmall = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 10,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.5,
    height: 1,
    color: AppColors.onSurface,
  );

// Body Styles
  static final TextStyle bodyLarge = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 16,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.5,
    height: 1.5,
    color: AppColors.onSurface,
  );

  static final TextStyle bodyMedium = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 14,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.25,
    height: 1.33,
    color: AppColors.onSurface,
  );

  static final TextStyle bodySmall = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 12,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.4,
    height: 1.25,
    color: AppColors.onSurface,
  );

  // Additional Utility Text Styles
  static final TextStyle buttonText = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 14,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.40,
    height: 0.75,
    color: AppColors.onSurface,
  );

  static final TextStyle caption = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 12,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.4,
    height: 1.33,
    color: AppColors.onSurfaceVariant.withAlpha(180),
  );

  static final TextStyle overline = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 10,
    fontWeight: FontWeight.w400,
    letterSpacing: 1.5,
    height: 1.6,
    textBaseline: TextBaseline.alphabetic,
    color: AppColors.onSurface,
  );

// Helper Styles
  static final TextStyle error = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 12,
    fontWeight: FontWeight.w400,
    color: AppColors.error.withRed(220),
    letterSpacing: 0.4,
    height: 1.33,
  );

  static final TextStyle link = TextStyle(
    fontFamily: 'Nunito',
    fontSize: 14,
    fontWeight: FontWeight.w500,
    color: AppColors.primary,
    decoration: TextDecoration.underline,
    letterSpacing: 0.25,
    height: 1.43,
  );

  //----------------------------------------------------------------------------
  // THEME DATA CONFIGURATION
  //----------------------------------------------------------------------------

  /// Get ThemeData based on specified theme mode
  static ThemeData getTheme(ThemeMode mode) {
    return mode == ThemeMode.light ? lightTheme : darkTheme;
  }

  //----------------------------------------------------------------------------
  // DARK THEME
  //----------------------------------------------------------------------------

  /// Dark theme configuration
  static final ThemeData darkTheme = ThemeData(
    useMaterial3: true,
    brightness: Brightness.dark,
    colorScheme: darkColorScheme,

    // Dark - Text Theme
    textTheme: TextTheme(
      displayLarge: displayLarge,
      displayMedium: displayMedium,
      displaySmall: displaySmall,
      headlineLarge: headlineLarge,
      headlineMedium: headlineMedium,
      headlineSmall: headlineSmall,
      titleLarge: titleLarge,
      titleMedium: titleMedium,
      titleSmall: titleSmall,
      bodyLarge: bodyLarge,
      bodyMedium: bodyMedium,
      bodySmall: bodySmall,
      labelLarge: labelLarge,
      labelMedium: labelMedium,
      labelSmall: labelSmall,
    ),

    // Dark - AppBar Theme
    appBarTheme: AppBarTheme(
      toolbarHeight: 40,
      backgroundColor: darkColorScheme.primary,
      foregroundColor:
          darkColorScheme.onPrimary, // Now using black on bright blue
      elevation: 0,
      centerTitle: true,
      titleTextStyle: headlineSmall.copyWith(color: darkColorScheme.onPrimary),
    ),

    // Dark - Card Theme
    cardTheme: CardTheme(
      elevation: 2,
      color: darkColorScheme.surfaceContainer,
      shadowColor: black.withAlpha(25),
    ),

    // Dark - Floating Action Button Theme
    floatingActionButtonTheme: FloatingActionButtonThemeData(
      backgroundColor: darkColorScheme.secondary,
      foregroundColor: darkColorScheme.onSecondary,
      elevation: 4,
    ),

    // Dark - Chip Theme
    chipTheme: ChipThemeData(
      backgroundColor: blueDark.withAlpha(25),
      labelStyle: labelLarge.copyWith(color: blueDark),
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
    ),

    // Dark - Checkbox Theme
    checkboxTheme: CheckboxThemeData(
      materialTapTargetSize: MaterialTapTargetSize.padded,
      splashRadius: 24, // for better touch feedback
      visualDensity: VisualDensity.comfortable,
      fillColor: WidgetStateProperty.resolveWith<Color>((states) {
        if (states.contains(WidgetState.selected)) {
          return greenDark;
        }
        return black.withAlpha(40);
      }),

      // Smooth size animation on click
      side: BorderSide(
        width: 1,
        color: WidgetStateColor.resolveWith((states) {
          if (states.contains(WidgetState.selected)) {
            return greenDark;
          }
          return black.withAlpha(40);
        }),
      ),
    ),

    // Dark - Dialog Theme
    dialogTheme: DialogTheme(
      elevation: 4,
      backgroundColor: darkColorScheme.surface,
      titleTextStyle: headlineSmall,
      contentTextStyle: bodyMedium,
    ),

    // Dark - Button Themes
    textButtonTheme: TextButtonThemeData(
      style: TextButton.styleFrom(
        textStyle: buttonText,
        foregroundColor: blueDark,
      ),
    ),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ElevatedButton.styleFrom(
        textStyle: buttonText,
        backgroundColor: blueDark,
        foregroundColor: black, // Better contrast
      ),
    ),
    outlinedButtonTheme: OutlinedButtonThemeData(
      style: OutlinedButton.styleFrom(
        textStyle: buttonText,
        foregroundColor: blueDark,
      ),
    ),

    // Dark - Input Theme
    inputDecorationTheme: InputDecorationTheme(
      border: const OutlineInputBorder(),
      contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
      labelStyle: labelMedium,
      hintStyle: bodyMedium.copyWith(color: white.withAlpha(128)),
      errorStyle: error,
    ),

    // Dark - Date picker theme
    datePickerTheme: DatePickerThemeData(
      backgroundColor: darkColorScheme.surface,
      headerBackgroundColor: darkColorScheme.primary,
      headerForegroundColor: darkColorScheme.onPrimary,
      headerHeadlineStyle:
          headlineSmall.copyWith(color: darkColorScheme.onPrimary),
      headerHelpStyle: labelMedium.copyWith(color: darkColorScheme.onPrimary),
      dayBackgroundColor: WidgetStateProperty.resolveWith<Color>((states) {
        if (states.contains(WidgetState.selected)) {
          return darkColorScheme.primary;
        }
        return Colors.transparent;
      }),
      dayForegroundColor: WidgetStateProperty.resolveWith<Color>((states) {
        if (states.contains(WidgetState.selected)) {
          return darkColorScheme.onPrimary;
        } else if (states.contains(WidgetState.disabled)) {
          return lightgreyDark;
        }
        return darkColorScheme.onSurface;
      }),
      dayStyle: bodyMedium,
      todayBackgroundColor:
          WidgetStateProperty.all(darkColorScheme.primary.withAlpha(25)),
      todayForegroundColor: WidgetStateProperty.all(darkColorScheme.primary),
      todayBorder: const BorderSide(color: white, width: 1.5),
      yearBackgroundColor: WidgetStateProperty.resolveWith<Color>((states) {
        if (states.contains(WidgetState.selected)) {
          return darkColorScheme.primary;
        }
        return Colors.transparent;
      }),
      yearForegroundColor: WidgetStateProperty.resolveWith<Color>((states) {
        if (states.contains(WidgetState.selected)) {
          return darkColorScheme.onPrimary;
        }
        return darkColorScheme.onSurface;
      }),
      yearStyle: bodyMedium,
    ),

    // Dark - Bottom Sheet Theme
    bottomSheetTheme: BottomSheetThemeData(
      backgroundColor: white,
      modalBackgroundColor: darkgrey,
      modalBarrierColor: black.withAlpha(128),
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
      ),
      surfaceTintColor: darkColorScheme.primary,
    ),

    // Dark - Navigation Bar Theme
    navigationBarTheme: NavigationBarThemeData(
      backgroundColor: darkgrey.withAlpha(220),
      height: 56,
      iconTheme: WidgetStateProperty.resolveWith((states) {
        if (states.contains(WidgetState.selected)) {
          return const IconThemeData(
            color: blueDark,
            size: 28,
          );
        }
        return const IconThemeData(
          color: white,
          size: 28,
        );
      }),
      labelTextStyle: WidgetStateProperty.resolveWith((states) {
        if (states.contains(WidgetState.selected)) {
          return labelSmall.copyWith(color: blueDark);
        }
        return labelSmall;
      }),
      indicatorColor: Colors.transparent,
      labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
    ),

    // Dark - Snackbar Theme
    snackBarTheme: SnackBarThemeData(
      backgroundColor: darkblueDark,
      contentTextStyle: bodyMedium.copyWith(color: white),
      actionTextColor: blueDark,
      behavior: SnackBarBehavior.floating,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(8),
      ),
    ),

    // Dark - TabBar Theme
    tabBarTheme: TabBarTheme(
      labelStyle: labelLarge,
      unselectedLabelStyle: labelLarge.copyWith(
        color: white.withAlpha(200),
      ),
      indicatorColor: blueDark,
      dividerColor: Colors.transparent,
    ),

    // Dark - Tooltip Theme
    tooltipTheme: TooltipThemeData(
      decoration: BoxDecoration(
        color: darkblueDark.withAlpha(230),
        borderRadius: BorderRadius.circular(4),
      ),
      textStyle: bodySmall.copyWith(color: white),
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
    ),
  );

  //----------------------------------------------------------------------------
  // LIGHT THEME
  //----------------------------------------------------------------------------

  /// Light theme configuration
  static final ThemeData lightTheme = ThemeData(
    useMaterial3: true,
    brightness: Brightness.light,
    colorScheme: lightColorScheme,

    // Light - Text Theme
    textTheme: TextTheme(
      displayLarge: displayLarge.copyWith(color: black),
      displayMedium: displayMedium.copyWith(color: black),
      displaySmall: displaySmall.copyWith(color: black),
      headlineLarge: headlineLarge.copyWith(color: black),
      headlineMedium: headlineMedium.copyWith(color: black),
      headlineSmall: headlineSmall.copyWith(color: black),
      titleLarge: titleLarge.copyWith(color: black),
      titleMedium: titleMedium.copyWith(color: black),
      titleSmall: titleSmall.copyWith(color: black),
      bodyLarge: bodyLarge.copyWith(color: black),
      bodyMedium: bodyMedium.copyWith(color: black),
      bodySmall: bodySmall.copyWith(color: black),
      labelLarge: labelLarge.copyWith(color: black),
      labelMedium: labelMedium.copyWith(color: black),
      labelSmall: labelSmall.copyWith(color: black),
    ),

    // Light - AppBar Theme
    appBarTheme: AppBarTheme(
      toolbarHeight: 36,
      backgroundColor: lightColorScheme.primary,
      foregroundColor: lightColorScheme.onPrimary,
      elevation: 0,
      centerTitle: true,
      titleTextStyle: headlineSmall.copyWith(color: white),
    ),

    // Light - Card Theme
    cardTheme: CardTheme(
      elevation: 2,
      color: lightColorScheme.surfaceContainer,
      shadowColor: black.withAlpha(25),
    ),

    // Light - Floating Action Button Theme
    floatingActionButtonTheme: FloatingActionButtonThemeData(
      backgroundColor: lightColorScheme.secondary,
      foregroundColor: lightColorScheme.onSecondary,
      elevation: 4,
    ),

    // Light - Chip Theme
    chipTheme: ChipThemeData(
      backgroundColor: blueLight.withAlpha(25),
      labelStyle: labelLarge.copyWith(color: blueLight),
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
    ),

    // Light - Checkbox Theme
    checkboxTheme: CheckboxThemeData(
      materialTapTargetSize: MaterialTapTargetSize.padded,
      splashRadius: 24,
      visualDensity: VisualDensity.comfortable,
      fillColor: WidgetStateProperty.resolveWith<Color>((states) {
        if (states.contains(WidgetState.selected)) {
          return greenLight;
        }
        return black.withAlpha(40);
      }),
      side: BorderSide(
        width: 1,
        color: WidgetStateColor.resolveWith((states) {
          if (states.contains(WidgetState.selected)) {
            return greenLight;
          }
          return black.withAlpha(40);
        }),
      ),
    ),

    // Light - Dialog Theme
    dialogTheme: DialogTheme(
      elevation: 4,
      backgroundColor: lightColorScheme.surface,
      titleTextStyle: headlineSmall.copyWith(color: black),
      contentTextStyle: bodyMedium.copyWith(color: black),
    ),

    // Light - Button Themes
    textButtonTheme: TextButtonThemeData(
      style: TextButton.styleFrom(
        textStyle: buttonText.copyWith(color: black),
        foregroundColor: darkblueLight,
      ),
    ),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ElevatedButton.styleFrom(
        textStyle: buttonText.copyWith(color: white),
        backgroundColor: darkblueLight,
        foregroundColor: white,
      ),
    ),
    outlinedButtonTheme: OutlinedButtonThemeData(
      style: OutlinedButton.styleFrom(
        textStyle: buttonText.copyWith(color: black),
        foregroundColor: darkblueLight,
      ),
    ),

    // Light - Input Theme
    inputDecorationTheme: InputDecorationTheme(
      border: const OutlineInputBorder(),
      contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
      labelStyle: labelMedium.copyWith(color: black),
      hintStyle: bodyMedium.copyWith(color: black.withAlpha(128)),
      errorStyle: error.copyWith(color: pinkLight.withRed(240)),
    ),

    // Light - Bottom Sheet Theme
    bottomSheetTheme: BottomSheetThemeData(
      backgroundColor: white,
      modalBackgroundColor: white,
      modalBarrierColor: black.withAlpha(128),
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
      ),
      surfaceTintColor: lightColorScheme.primary,
    ),

    // Light - Navigation Bar Theme
    navigationBarTheme: NavigationBarThemeData(
      backgroundColor: greyLight.withAlpha(200),
      height: 56,
      iconTheme: WidgetStateProperty.resolveWith((states) {
        if (states.contains(WidgetState.selected)) {
          return IconThemeData(
            color: darkblueLight,
            size: 28,
          );
        }
        return const IconThemeData(
          color: black,
          size: 28,
        );
      }),
      labelTextStyle: WidgetStateProperty.resolveWith((states) {
        if (states.contains(WidgetState.selected)) {
          return labelSmall.copyWith(color: darkblueLight);
        }
        return labelSmall;
      }),
      indicatorColor: Colors.transparent,
      labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
    ),

    // Light - Snackbar Theme
    snackBarTheme: SnackBarThemeData(
      backgroundColor: darkblueLight,
      contentTextStyle: bodyMedium.copyWith(color: white),
      actionTextColor: white,
      behavior: SnackBarBehavior.floating,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(8),
      ),
    ),

    // Light - TabBar Theme
    tabBarTheme: TabBarTheme(
      labelStyle: labelLarge.copyWith(color: darkblueLight),
      unselectedLabelStyle: labelLarge.copyWith(
        color: black.withAlpha(179),
      ),
      indicatorColor: darkblueLight,
      dividerColor: Colors.transparent,
    ),

    // Light - Tooltip Theme
    tooltipTheme: TooltipThemeData(
      decoration: BoxDecoration(
        color: darkblueLight.withAlpha(230),
        borderRadius: BorderRadius.circular(4),
      ),
      textStyle: bodySmall.copyWith(color: white),
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
    ),
  );

  //----------------------------------------------------------------------------
  // THEME HELPER METHODS
  //----------------------------------------------------------------------------

  /// Toggle between light and dark theme mode
  static ThemeMode toggleThemeMode(ThemeMode current) {
    ThemeMode newMode =
        current == ThemeMode.light ? ThemeMode.dark : ThemeMode.light;

    AppColors.setThemeMode(newMode);
    return newMode;
  }
}
