import 'package:flutter/material.dart';

import 'package:asciineverdie/src/shared/retro_colors.dart';

/// 앱 테마 (Dark Fantasy 스타일)
ThemeData buildAppTheme() => ThemeData(
  colorScheme: RetroColors.darkColorScheme,
  scaffoldBackgroundColor: RetroColors.deepBrown,
  useMaterial3: true,
  // 카드/다이얼로그 레트로 배경
  cardColor: RetroColors.darkBrown,
  dialogTheme: const DialogThemeData(
    backgroundColor: Color(0xFF24283B),
    titleTextStyle: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 15,
      color: Color(0xFFE0AF68),
    ),
  ),
  // 앱바 레트로 스타일
  appBarTheme: const AppBarTheme(
    backgroundColor: Color(0xFF24283B),
    foregroundColor: Color(0xFFC0CAF5),
    titleTextStyle: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 15,
      color: Color(0xFFE0AF68),
    ),
  ),
  // 버튼 테마 (inherit: false로 애니메이션 lerp 오류 방지)
  filledButtonTheme: FilledButtonThemeData(
    style: FilledButton.styleFrom(
      backgroundColor: const Color(0xFF3D4260),
      foregroundColor: const Color(0xFFC0CAF5),
      textStyle: const TextStyle(
        inherit: false,
        fontFamily: 'PressStart2P',
        fontSize: 14,
        color: Color(0xFFC0CAF5),
      ),
    ),
  ),
  outlinedButtonTheme: OutlinedButtonThemeData(
    style: OutlinedButton.styleFrom(
      foregroundColor: const Color(0xFFE0AF68),
      side: const BorderSide(color: Color(0xFFE0AF68), width: 2),
      textStyle: const TextStyle(
        inherit: false,
        fontFamily: 'PressStart2P',
        fontSize: 14,
        color: Color(0xFFE0AF68),
      ),
    ),
  ),
  textButtonTheme: TextButtonThemeData(
    style: TextButton.styleFrom(
      foregroundColor: const Color(0xFFC0CAF5),
      textStyle: const TextStyle(
        inherit: false,
        fontFamily: 'PressStart2P',
        fontSize: 14,
        color: Color(0xFFC0CAF5),
      ),
    ),
  ),
  // 텍스트 테마
  textTheme: const TextTheme(
    headlineLarge: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 20,
      color: Color(0xFFE0AF68),
    ),
    headlineMedium: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 16,
      color: Color(0xFFE0AF68),
    ),
    headlineSmall: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 15,
      color: Color(0xFFE0AF68),
    ),
    titleLarge: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 15,
      color: Color(0xFFC0CAF5),
    ),
    titleMedium: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 14,
      color: Color(0xFFC0CAF5),
    ),
    titleSmall: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 14,
      color: Color(0xFFC0CAF5),
    ),
    bodyLarge: TextStyle(fontSize: 18, color: Color(0xFFC0CAF5)),
    bodyMedium: TextStyle(fontSize: 17, color: Color(0xFFC0CAF5)),
    bodySmall: TextStyle(fontSize: 15, color: Color(0xFFC0CAF5)),
    labelLarge: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 14,
      color: Color(0xFFC0CAF5),
    ),
    labelMedium: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 14,
      color: Color(0xFFC0CAF5),
    ),
    labelSmall: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 13,
      color: Color(0xFFC0CAF5),
    ),
  ),
  // 칩 테마
  chipTheme: const ChipThemeData(
    backgroundColor: Color(0xFF2A2E3F),
    labelStyle: TextStyle(
      fontFamily: 'PressStart2P',
      fontSize: 14,
      color: Color(0xFFC0CAF5),
    ),
    side: BorderSide(color: Color(0xFF545C7E)),
  ),
  // 리스트 타일 테마
  listTileTheme: const ListTileThemeData(
    textColor: Color(0xFFC0CAF5),
    iconColor: Color(0xFFE0AF68),
  ),
  // 프로그레스 인디케이터
  progressIndicatorTheme: const ProgressIndicatorThemeData(
    color: Color(0xFFE0AF68),
    linearTrackColor: Color(0xFF3B4261),
  ),
);
