// smart_select_card.dart — 节点页置顶「智能选择」推荐卡(纯展示)
//
// accent-subtle 底 + clay 渐变 zap 图标 + 「推荐」胶囊 + 脱敏文案,默认选中。
import 'package:flutter/material.dart';

import '../l10n/app_text.dart';
import '../pangolin_theme.dart';
import 'pangolin_icons.dart';

class SmartSelectCard extends StatelessWidget {
  const SmartSelectCard({super.key, required this.t, required this.selected, required this.onTap});

  final AppText t;
  final bool selected;
  final VoidCallback onTap;

  @override
  Widget build(BuildContext context) {
    final c = context.pangolin;
    return Material(
      color: c.accentSubtle,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(PangolinRadius.xl),
        side: BorderSide(color: selected ? c.accent : c.accentBorder, width: 1.5),
      ),
      clipBehavior: Clip.antiAlias,
      child: InkWell(
        onTap: onTap,
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 15),
          child: Row(
            children: [
              Container(
                width: 42,
                height: 42,
                decoration: BoxDecoration(
                  gradient: const LinearGradient(
                    begin: Alignment.topLeft,
                    end: Alignment.bottomRight,
                    colors: [PangolinColors.clay500, PangolinColors.clay700],
                  ),
                  borderRadius: BorderRadius.circular(PangolinRadius.md),
                ),
                child: const Icon(PangolinIcons.zap, size: 21, color: PangolinColors.white),
              ),
              const SizedBox(width: 13),
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Row(children: [
                      Flexible(
                        child: Text(t.smartSelect,
                            style: PangolinText.body
                                .copyWith(color: c.fg1, fontWeight: FontWeight.w700, fontSize: 15.5)),
                      ),
                      const SizedBox(width: 8),
                      Container(
                        padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
                        decoration: BoxDecoration(color: c.accent, borderRadius: BorderRadius.circular(PangolinRadius.full)),
                        child: Text(t.recommended,
                            style: PangolinText.caption.copyWith(
                                color: c.fgOnAccent, fontWeight: FontWeight.w700, fontSize: 10)),
                      ),
                    ]),
                    const SizedBox(height: 3),
                    Text(t.smartSub,
                        style: PangolinText.caption.copyWith(color: c.fg2, fontWeight: FontWeight.w400, height: 1.5)),
                  ],
                ),
              ),
              if (selected) ...[
                const SizedBox(width: 8),
                Icon(PangolinIcons.check, size: 19, color: c.accent),
              ],
            ],
          ),
        ),
      ),
    );
  }
}
