"use client";

/* Secondary CTA that opens the global callback popup (or dialer on touch). */
export default function ExpertCta({
  label = "Talk to an Expert",
  dark = false,
  className,
}: {
  label?: string;
  dark?: boolean;
  className?: string;
}) {
  if (className) {
    return (
      <button
        type="button"
        onClick={() => window.dispatchEvent(new Event("mx:open-callback"))}
        className={className}
      >
        {label}
      </button>
    );
  }
  return (
    <button
      type="button"
      onClick={() => window.dispatchEvent(new Event("mx:open-callback"))}
      className={
        dark
          ? "inline-flex min-h-[48px] items-center justify-center gap-2 rounded-lg border border-white/35 bg-white/[0.06] px-6 text-[15px] font-semibold text-white hover:bg-white/[0.12]"
          : "inline-flex min-h-[48px] items-center justify-center gap-2 rounded-lg border border-line bg-white px-6 text-[15px] font-semibold text-ink hover:border-brand hover:text-brand"
      }
    >
      {label}
    </button>
  );
}
