import React from 'react';
import { Check } from 'lucide-react';
import clsx from 'clsx';

export function Checkbox({ label, checked, onChange, className }) {
  return (
    <label className={clsx("flex items-center gap-2 cursor-pointer group", className)}>
      <div 
        className={clsx(
          "w-5 h-5 rounded border flex items-center justify-center transition-all duration-200",
          checked 
            ? "bg-primary border-primary text-deep-sea" 
            : "bg-white/5 border-white/20 group-hover:border-primary/50"
        )}
      >
        <input 
          type="checkbox" 
          className="hidden" 
          checked={checked} 
          onChange={(e) => onChange(e.target.checked)} 
        />
        {checked && <Check className="w-3.5 h-3.5 stroke-[3]" />}
      </div>
      {label && <span className="text-sm text-gray-300 group-hover:text-white transition-colors select-none">{label}</span>}
    </label>
  );
}
