import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";

describe("Design Tokens (prototype-style.css)", () => {
  const cssPath = resolve(__dirname, "../../assets/css/main.css");
  const cssContent = readFileSync(cssPath, "utf-8");

  it("should define --bg variable in :root", () => {
    expect(cssContent).toContain("--bg: #131313");
  });

  it("should define --panel variable in :root", () => {
    expect(cssContent).toContain("--panel: #1a1a1a");
  });

  it("should define --color-accent variable in :root", () => {
    expect(cssContent).toContain("--color-accent: #EC6925");
  });

  it("should define --surface variable in :root", () => {
    expect(cssContent).toContain("--surface: #212121");
  });

  it("should define --text variable in :root", () => {
    expect(cssContent).toContain("--text: #ffffff");
  });

  it("should define --text-muted variable in :root", () => {
    expect(cssContent).toContain("--text-muted: #d4d4d4");
  });

  it("should define radius tokens", () => {
    expect(cssContent).toContain("--radius-sm: 2px");
    expect(cssContent).toContain("--radius-md: 3px");
    expect(cssContent).toContain("--radius-lg: 4px");
  });

  it("should define transition tokens", () => {
    expect(cssContent).toContain("--transition-fast: 150ms ease");
  });

  it("should define hms-* CSS classes", () => {
    expect(cssContent).toContain(".hms-header");
    expect(cssContent).toContain(".hms-hero");
    expect(cssContent).toContain(".hms-card");
    expect(cssContent).toContain(".hms-btn");
    expect(cssContent).toContain(".hms-btn-primary");
    expect(cssContent).toContain(".hms-btn-secondary");
    expect(cssContent).toContain(".hms-nav-btn");
    expect(cssContent).toContain(".hms-badge");
    expect(cssContent).toContain(".hms-input");
    expect(cssContent).toContain(".hms-skeleton");
    expect(cssContent).toContain(".hms-spinner");
    expect(cssContent).toContain(".hms-speaker-grid");
    expect(cssContent).toContain(".hms-footer");
    expect(cssContent).toContain(".hms-gallery");
    expect(cssContent).toContain(".hms-eq-card");
    expect(cssContent).toContain(".hms-chip");
  });

  it("should include Tailwind directives", () => {
    expect(cssContent).toContain("@tailwind base");
    expect(cssContent).toContain("@tailwind components");
    expect(cssContent).toContain("@tailwind utilities");
  });
});

describe("Tailwind Config", () => {
  const configPath = resolve(__dirname, "../../tailwind.config.ts");
  const configContent = readFileSync(configPath, "utf-8");

  it("should extend colors with accent", () => {
    expect(configContent).toContain("accent");
    expect(configContent).toContain("#EC6925");
  });

  it("should configure Inter font family", () => {
    expect(configContent).toContain("Inter");
  });
});

describe("Nuxt Config", () => {
  const configPath = resolve(__dirname, "../../nuxt.config.ts");
  const configContent = readFileSync(configPath, "utf-8");

  it("should include noindex robots meta tag", () => {
    expect(configContent).toContain("noindex");
    expect(configContent).toContain("nofollow");
  });

  it("should include JSON-LD LocalBusiness script", () => {
    expect(configContent).toContain("LocalBusiness");
    expect(configContent).toContain("schema.org");
  });

  it("should include routeRules for SSR/CSR", () => {
    expect(configContent).toContain("routeRules");
    expect(configContent).toContain("/mietkatalog");
    expect(configContent).toContain("/admin");
  });

  it("should include Tailwind CSS module", () => {
    expect(configContent).toContain("@nuxtjs/tailwindcss");
  });
});
