import 'package:flutter/material.dart';

import '../tema/pluriwave_theme.dart';

class PluriWaveScaffold extends StatelessWidget {
  const PluriWaveScaffold({
    super.key,
    required this.body,
    this.appBar,
    this.bottomNavigationBar,
    this.floatingActionButton,
  });

  final PreferredSizeWidget? appBar;
  final Widget body;
  final Widget? bottomNavigationBar;
  final Widget? floatingActionButton;

  @override
  Widget build(BuildContext context) {
    final t = context.pluriTokens;
    return Scaffold(
      backgroundColor: t.deepViolet,
      appBar: appBar,
      bottomNavigationBar: bottomNavigationBar,
      floatingActionButton: floatingActionButton,
      extendBody: true,
      body: DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
            colors: [
              const Color(0xFF07121A),
              const Color(0xFF0D1B24),
              const Color(0xFF0E4A4F),
              const Color(0xFF07121A),
            ],
            stops: const [0, 0.34, 0.68, 1],
          ),
        ),
        child: Stack(
          fit: StackFit.expand,
          children: [
            Positioned(
              left: -120,
              top: -120,
              child: _AuroraOrb(size: 300, color: const Color(0xFF21D4D9).withValues(alpha: 0.18)),
            ),
            Positioned(
              right: -150,
              top: 160,
              child: _AuroraOrb(size: 340, color: const Color(0xFF7EE4C2).withValues(alpha: 0.12)),
            ),
            Positioned(
              left: -90,
              bottom: 80,
              child: _AuroraOrb(size: 260, color: t.warmCoral.withValues(alpha: 0.10)),
            ),
            body,
          ],
        ),
      ),
    );
  }
}

class _AuroraOrb extends StatelessWidget {
  const _AuroraOrb({required this.size, required this.color});
  final double size;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return IgnorePointer(
      child: Container(
        width: size,
        height: size,
        decoration: BoxDecoration(
          shape: BoxShape.circle,
          gradient: RadialGradient(colors: [color, color.withValues(alpha: 0)]),
        ),
      ),
    );
  }
}
