import 'package:flutter/material.dart';

/// Meezi brand palette. Green #0F6E56 matches the dashboard / Koja web.
class MeeziColors {
  static const Color brand = Color(0xFF0F6E56);
  static const Color brandDark = Color(0xFF0B5544);
  static const Color accent = Color(0xFFE1F5EE);
  static const Color surface = Color(0xFFF9FAFB);
}

/// Centralized Meezi theme. Uses Vazirmatn when the font is bundled (see pubspec);
/// falls back to the platform font otherwise. Kept to stable Material 3 APIs.
class MeeziTheme {
  static ThemeData light() {
    final scheme = ColorScheme.fromSeed(
      seedColor: MeeziColors.brand,
      primary: MeeziColors.brand,
      brightness: Brightness.light,
    );
    return ThemeData(
      useMaterial3: true,
      colorScheme: scheme,
      fontFamily: 'Vazirmatn',
      scaffoldBackgroundColor: MeeziColors.surface,
      appBarTheme: const AppBarTheme(
        elevation: 0,
        centerTitle: true,
        backgroundColor: Colors.white,
        foregroundColor: Colors.black87,
      ),
      filledButtonTheme: FilledButtonThemeData(
        style: FilledButton.styleFrom(
          backgroundColor: MeeziColors.brand,
          foregroundColor: Colors.white,
          padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 18),
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
        ),
      ),
      outlinedButtonTheme: OutlinedButtonThemeData(
        style: OutlinedButton.styleFrom(
          foregroundColor: MeeziColors.brand,
          side: const BorderSide(color: MeeziColors.brand),
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
        ),
      ),
      inputDecorationTheme: InputDecorationTheme(
        filled: true,
        fillColor: Colors.white,
        border: OutlineInputBorder(
          borderRadius: BorderRadius.circular(12),
          borderSide: BorderSide(color: Colors.black.withValues(alpha: 0.10)),
        ),
        enabledBorder: OutlineInputBorder(
          borderRadius: BorderRadius.circular(12),
          borderSide: BorderSide(color: Colors.black.withValues(alpha: 0.10)),
        ),
        focusedBorder: OutlineInputBorder(
          borderRadius: BorderRadius.circular(12),
          borderSide: const BorderSide(color: MeeziColors.brand, width: 1.5),
        ),
      ),
    );
  }

  static ThemeData dark() {
    final scheme = ColorScheme.fromSeed(
      seedColor: MeeziColors.brand,
      brightness: Brightness.dark,
    );
    return ThemeData(
      useMaterial3: true,
      colorScheme: scheme,
      fontFamily: 'Vazirmatn',
    );
  }
}
