import 'package:flutter/material.dart';

/// Aggressive, high-contrast Shadow Oak theme.
///
/// Visual direction: urban soccer / techy / grunge badge style.
/// Sharp corners, deep purple primary, near-black surfaces, heavy weight
/// type with negative tracking on headings and uppercase tracking on labels.
class AppTheme {
  AppTheme._();

  static const purple = Color(0xFF8B30C8);
  static const purpleLight = Color(0xFFBF77F6);
  static const black = Color(0xFF0A0A0A);
  static const surface = Color(0xFF141414);
  static const surfaceVariant = Color(0xFF1E1E1E);

  static final dark = ThemeData(
    useMaterial3: true,
    brightness: Brightness.dark,
    scaffoldBackgroundColor: black,
    colorScheme: const ColorScheme.dark(
      primary: purple,
      onPrimary: Colors.white,
      primaryContainer: Color(0xFF3D1260),
      onPrimaryContainer: purpleLight,
      secondary: purpleLight,
      onSecondary: Colors.black,
      secondaryContainer: Color(0xFF2A1045),
      onSecondaryContainer: purpleLight,
      surface: surface,
      onSurface: Colors.white,
      surfaceContainerHighest: surfaceVariant,
      onSurfaceVariant: Color(0xFFBBBBBB),
      outline: Color(0xFF444444),
      outlineVariant: Color(0xFF2A2A2A),
      error: Color(0xFFF44336),
      onError: Colors.white,
    ),
    // Sharp shapes throughout
    cardTheme: CardThemeData(
      color: surface,
      elevation: 0,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(4),
        side: const BorderSide(color: Color(0xFF2A2A2A)),
      ),
      margin: EdgeInsets.zero,
    ),
    appBarTheme: const AppBarTheme(
      backgroundColor: Color(0xFF0A0A0A),
      foregroundColor: Colors.white,
      elevation: 0,
      centerTitle: false,
      titleTextStyle: TextStyle(
        color: Colors.white,
        fontSize: 20,
        fontWeight: FontWeight.w900,
        letterSpacing: 1.5,
      ),
      surfaceTintColor: Colors.transparent,
    ),
    navigationBarTheme: NavigationBarThemeData(
      backgroundColor: surface,
      indicatorColor: const Color(0xFF3D1260),
      labelTextStyle: WidgetStateProperty.resolveWith((states) {
        final selected = states.contains(WidgetState.selected);
        return TextStyle(
          fontSize: 10,
          fontWeight: FontWeight.w700,
          letterSpacing: 0.5,
          color: selected ? purpleLight : const Color(0xFF888888),
        );
      }),
      iconTheme: WidgetStateProperty.resolveWith((states) {
        final selected = states.contains(WidgetState.selected);
        return IconThemeData(
          color: selected ? purpleLight : const Color(0xFF888888),
          size: 22,
        );
      }),
      height: 64,
      elevation: 0,
      surfaceTintColor: Colors.transparent,
      shadowColor: Colors.transparent,
    ),
    filledButtonTheme: FilledButtonThemeData(
      style: FilledButton.styleFrom(
        backgroundColor: purple,
        foregroundColor: Colors.white,
        shape: const RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.circular(4)),
        ),
        textStyle: const TextStyle(
          fontWeight: FontWeight.w800,
          letterSpacing: 1.2,
        ),
        padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 24),
      ),
    ),
    outlinedButtonTheme: OutlinedButtonThemeData(
      style: OutlinedButton.styleFrom(
        foregroundColor: purpleLight,
        side: const BorderSide(color: Color(0xFF8B30C8)),
        shape: const RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.circular(4)),
        ),
        textStyle: const TextStyle(
          fontWeight: FontWeight.w700,
          letterSpacing: 1.0,
        ),
        padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 20),
      ),
    ),
    inputDecorationTheme: InputDecorationTheme(
      filled: true,
      fillColor: surfaceVariant,
      border: OutlineInputBorder(
        borderRadius: BorderRadius.circular(4),
        borderSide: const BorderSide(color: Color(0xFF444444)),
      ),
      enabledBorder: OutlineInputBorder(
        borderRadius: BorderRadius.circular(4),
        borderSide: const BorderSide(color: Color(0xFF555555)),
      ),
      focusedBorder: OutlineInputBorder(
        borderRadius: BorderRadius.circular(4),
        borderSide: const BorderSide(color: purple, width: 2),
      ),
      labelStyle: const TextStyle(color: Color(0xFF888888)),
      hintStyle: const TextStyle(color: Color(0xFF555555)),
    ),
    chipTheme: ChipThemeData(
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
      side: BorderSide.none,
    ),
    dividerTheme: const DividerThemeData(
      color: Color(0xFF1E1E1E),
      thickness: 1,
    ),
    textTheme: const TextTheme(
      displayLarge: TextStyle(fontWeight: FontWeight.w900, letterSpacing: -1.5),
      displayMedium: TextStyle(fontWeight: FontWeight.w900, letterSpacing: -1.0),
      displaySmall: TextStyle(fontWeight: FontWeight.w800, letterSpacing: -0.5),
      headlineLarge: TextStyle(fontWeight: FontWeight.w800),
      headlineMedium: TextStyle(fontWeight: FontWeight.w800),
      headlineSmall: TextStyle(fontWeight: FontWeight.w700),
      titleLarge: TextStyle(fontWeight: FontWeight.w700),
      titleMedium: TextStyle(fontWeight: FontWeight.w600, letterSpacing: 0.5),
      titleSmall: TextStyle(fontWeight: FontWeight.w600, letterSpacing: 0.8),
      labelLarge: TextStyle(fontWeight: FontWeight.w700, letterSpacing: 1.2),
      labelMedium: TextStyle(fontWeight: FontWeight.w600, letterSpacing: 0.8),
      labelSmall: TextStyle(fontWeight: FontWeight.w600, letterSpacing: 1.0),
    ),
  );

  static final light = dark; // dark-only app for now
}
