import { Check, X } from "lucide-react";
import { MASTER_COMPARISON_MATRIX } from "@/lib/alternatives-data";
import styles from "@/app/compare/compare.module.css";

interface MasterComparisonTableProps {
  title?: string;
  subtitle?: string;
}

export default function MasterComparisonTable({
  title = "Master Bio Link Comparison",
  subtitle = "How sinss.lol stacks up against guns.lol, Vaults.lol, feds.lol, and e-z.bio.",
}: MasterComparisonTableProps) {
  return (
    <section className={styles.tableCard} aria-label={title}>
      <div style={{ padding: "24px 24px 16px" }}>
        <h2 className={styles.sectionTitle} style={{ fontSize: "1.3rem" }}>
          {title}
        </h2>
        <p className={styles.sectionSubtitle}>{subtitle}</p>
      </div>
      <div className={styles.tableWrapper}>
        <table className={styles.comparisonTable}>
          <thead>
            <tr>
              <th style={{ width: "28%" }}>Feature</th>
              <th className={styles.highlightTh} style={{ width: "20%" }}>
                sinss.lol
              </th>
              <th style={{ width: "13%" }}>guns.lol</th>
              <th style={{ width: "13%" }}>Vaults.lol</th>
              <th style={{ width: "13%" }}>feds.lol</th>
              <th style={{ width: "13%" }}>e-z.bio</th>
            </tr>
          </thead>
          <tbody>
            {MASTER_COMPARISON_MATRIX.map((row) => (
              <tr key={row.feature}>
                <td>
                  <span className={styles.featureName}>{row.feature}</span>
                  <span className={styles.featureSub}>{row.sub}</span>
                </td>
                <td className={styles.highlightCol}>
                  <span className={styles.tagIncluded}>
                    <Check size={16} /> {row.sinss}
                  </span>
                </td>
                <td>
                  <span className={row.guns.startsWith("Yes") ? styles.tagIncluded : styles.tagPaid}>
                    {row.guns.startsWith("Yes") ? <Check size={15} /> : <X size={15} />} {row.guns}
                  </span>
                </td>
                <td>
                  <span
                    className={
                      row.vaults.startsWith("Yes")
                        ? styles.tagIncluded
                        : styles.tagPaid
                    }
                  >
                    {row.vaults.startsWith("Yes") ? <Check size={15} /> : null} {row.vaults}
                  </span>
                </td>
                <td>
                  <span className={row.feds.startsWith("Yes") ? styles.tagIncluded : styles.tagPaid}>
                    {row.feds.startsWith("Yes") ? <Check size={15} /> : <X size={15} />} {row.feds}
                  </span>
                </td>
                <td>
                  <span className={row.ez.startsWith("Yes") ? styles.tagIncluded : styles.tagPaid}>
                    {row.ez.startsWith("Yes") ? <Check size={15} /> : <X size={15} />} {row.ez}
                  </span>
                </td>
              </tr>
            ))}
          </tbody>
        </table>
      </div>
    </section>
  );
}
