'use client';

import Link from 'next/link';

interface AddToCartModalProps {
  isOpen: boolean;
  onClose: () => void;
  productName: string;
}

export default function AddToCartModal({ isOpen, onClose, productName }: AddToCartModalProps) {
  if (!isOpen) return null;

  return (
    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
      <div className="mx-4 max-w-sm rounded border border-line bg-paper p-8 shadow-lg">
        <h2 className="font-display text-xl">Added to bag</h2>
        <p className="mt-3 text-sm text-muted">
          <strong>{productName}</strong> has been added to your bag.
        </p>

        <div className="mt-8 flex gap-3">
          <button
            onClick={onClose}
            className="flex-1 border-2 border-ink px-6 py-3 text-sm font-medium text-ink hover:border-clay hover:bg-clay hover:text-paper"
          >
            Continue shopping
          </button>
          <Link
            href="/checkout"
            onClick={onClose}
            className="flex-1 bg-clay px-6 py-3 text-center text-sm font-medium text-paper hover:bg-clay-dark"
          >
            Go to checkout
          </Link>
        </div>
      </div>
    </div>
  );
}
