"use client";

import React from "react";
import { t } from "@/content/locales";

interface GameOverScreenProps {
  credits: number;
  onRestart: () => void;
}

export default function GameOverScreen({
  credits,
  onRestart,
}: GameOverScreenProps) {
  return (
    <div className="fixed inset-0 z-[100] flex items-center justify-center bg-black/90 backdrop-blur-xl animate-in fade-in duration-1000">
      {/* simple starfield background */}
      <div className="absolute inset-0 pointer-events-none">
        <div
          className="absolute inset-0 opacity-30"
          style={{
            backgroundImage: `
              radial-gradient(1px 1px at 20px 30px, #fff, 100%, rgba(0,0,0,0)),
              radial-gradient(1px 1px at 40px 70px, #fff, 100%, rgba(0,0,0,0)),
              radial-gradient(1px 1px at 50px 160px, #ddd, 100%, rgba(0,0,0,0)),
              radial-gradient(1px 1px at 90px 40px, #fff, 100%, rgba(0,0,0,0)),
              radial-gradient(1px 1px at 130px 80px, #fff, 100%, rgba(0,0,0,0)),
              radial-gradient(1px 1px at 160px 120px, #ddd, 100%, rgba(0,0,0,0))
            `,
            backgroundSize: "200px 200px",
            backgroundRepeat: "repeat",
          }}
        />
        <div
          className="absolute inset-0 opacity-50"
          style={{
            backgroundImage: `
              radial-gradient(1.5px 1.5px at 100px 150px, #fff, 100%, rgba(0,0,0,0)),
              radial-gradient(1.5px 1.5px at 300px 400px, #ddd, 100%, rgba(0,0,0,0)),
              radial-gradient(1.5px 1.5px at 500px 100px, #fff, 100%, rgba(0,0,0,0))
            `,
            backgroundSize: "450px 450px",
            backgroundRepeat: "repeat",
          }}
        />
      </div>

      <div className="text-center space-y-6 p-12 border-2 border-red-600 bg-red-950/20 rounded-lg  bg-black/80 backdrop-blur-sm shadow-[0_0_50px_rgba(220,38,38,0.5)]">
        <h1 className="font-starjedi text-6xl text-red-600">
          {t.GAME_OVER.TITLE}
        </h1>
        <p className="text-gray-400 font-mono">{t.GAME_OVER.SUBTITLE}</p>

        <div className="py-4">
          <p className="text-sm text-gray-500 uppercase tracking-widest">
            {t.GAME_OVER.SCORE_LABEL}
          </p>
          <p className="text-3xl font-bold text-yellow-500">
            {credits.toLocaleString()} Credits
          </p>
        </div>

        <button
          onClick={onRestart}
          className="px-8 py-4 bg-red-600 hover:bg-red-700 text-white font-bold uppercase tracking-widest transition-all transform hover:scale-105 active:scale-95 shadow-[0_0_20px_rgba(220,38,38,0.4)]"
        >
          {t.GAME_OVER.RESTART_BUTTON}
        </button>
      </div>
    </div>
  );
}
