"use client";

import { ReactNode } from "react";
import { motion } from "framer-motion";

export function AuthCard({
  title,
  subtitle,
  children,
}: {
  title: string;
  subtitle?: string;
  children: ReactNode;
}) {
  return (
    <div className="relative flex min-h-dvh items-center justify-center overflow-hidden bg-ink px-4 py-10">
      <div className="pointer-events-none absolute -top-24 left-1/4 h-72 w-72 rounded-full bg-gold/15 blur-3xl" />
      <div className="pointer-events-none absolute bottom-0 right-1/4 h-72 w-72 rounded-full bg-teal/10 blur-3xl" />

      <motion.div
        initial={{ opacity: 0, y: 16 }}
        animate={{ opacity: 1, y: 0 }}
        transition={{ duration: 0.4 }}
        className="relative w-full max-w-sm rounded-3xl border border-white/10 bg-white/[0.05] p-8 shadow-2xl backdrop-blur-xl"
      >
        <div className="mb-7 flex flex-col items-center text-center">
          <div className="mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-gradient-to-br from-gold-bright to-gold-dim shadow-glow-gold">
            <span className="font-display text-xl font-bold text-ink">S</span>
          </div>
          <h1 className="font-display text-xl font-semibold tracking-tight text-paper">
            {title}
          </h1>
          {subtitle && <p className="mt-1.5 text-sm text-paper/60">{subtitle}</p>}
        </div>
        {children}
      </motion.div>
    </div>
  );
}
