import 'package:flutter/material.dart';

/// تم بصری حکم‌شو (الهام‌گرفته از اپ مرجع: قرمز تیره و طلایی).
class AppColors {
  static const bg = Color(0xFF3A0A12);
  static const bgDark = Color(0xFF240108);
  static const panel = Color(0xFF5A0E1A);
  static const gold = Color(0xFFE9B949);
  static const goldDark = Color(0xFFB8860B);
  static const accent = Color(0xFFB81D2A);
  static const green = Color(0xFF2E7D32);
  static const text = Color(0xFFF5E9D0);
}

class AppTheme {
  static ThemeData build() {
    const fontFamily = 'Dana';
    final base = ThemeData.dark(useMaterial3: true);
    return base.copyWith(
      scaffoldBackgroundColor: AppColors.bg,
      primaryColor: AppColors.accent,
      colorScheme: base.colorScheme.copyWith(
        primary: AppColors.gold,
        secondary: AppColors.accent,
        surface: AppColors.panel,
      ),
      textTheme: base.textTheme.apply(
        fontFamily: fontFamily,
        bodyColor: AppColors.text,
        displayColor: AppColors.text,
      ),
      appBarTheme: const AppBarTheme(
        backgroundColor: AppColors.bgDark,
        foregroundColor: AppColors.gold,
        centerTitle: true,
      ),
      inputDecorationTheme: InputDecorationTheme(
        filled: true,
        fillColor: AppColors.bgDark.withValues(alpha: 0.6),
        hintStyle: const TextStyle(color: Colors.white38),
        border: OutlineInputBorder(
          borderRadius: BorderRadius.circular(12),
          borderSide: const BorderSide(color: AppColors.goldDark),
        ),
        enabledBorder: OutlineInputBorder(
          borderRadius: BorderRadius.circular(12),
          borderSide: const BorderSide(color: AppColors.goldDark),
        ),
        focusedBorder: OutlineInputBorder(
          borderRadius: BorderRadius.circular(12),
          borderSide: const BorderSide(color: AppColors.gold, width: 2),
        ),
      ),
      elevatedButtonTheme: ElevatedButtonThemeData(
        style: ElevatedButton.styleFrom(
          backgroundColor: AppColors.accent,
          foregroundColor: AppColors.text,
          minimumSize: const Size.fromHeight(54),
          elevation: 8,
          shadowColor: Colors.black,
          textStyle: const TextStyle(
              fontFamily: fontFamily, fontSize: 18, fontWeight: FontWeight.bold),
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(14),
            side: const BorderSide(color: AppColors.gold, width: 1.5),
          ),
        ).copyWith(
          // افکتِ فشار: کمی فرورفتن هنگام لمس برای حسِ عمق.
          elevation: WidgetStateProperty.resolveWith(
            (states) => states.contains(WidgetState.pressed) ? 2.0 : 8.0,
          ),
        ),
      ),
    );
  }
}
