"use client";

import type { ParcelAnalysisGeology } from "@/types/site-finder";

interface Props {
  geology: ParcelAnalysisGeology;
}

export function GeologyBlock({ geology }: Props) {
  return (
    <div
      style={{
        borderRadius: 10,
        padding: "14px 16px",
        background: "#f8fafc",
        border: "1px solid #e2e8f0",
        display: "flex",
        flexDirection: "column",
        gap: 10,
      }}
    >
      <div style={{ fontSize: 12, fontWeight: 700, color: "#374151" }}>
        Геология
      </div>

      <div style={{ fontSize: 13, color: "#4b5563", lineHeight: 1.5 }}>
        {geology.note}
      </div>

      {/* Primary CTA */}
      <a
        href={geology.links.karpinsky_webgis}
        target="_blank"
        rel="noopener noreferrer"
        style={{
          display: "block",
          borderRadius: 8,
          padding: "10px 14px",
          background: "#1e40af",
          color: "#fff",
          fontSize: 13,
          fontWeight: 600,
          textDecoration: "none",
          textAlign: "center",
        }}
      >
        Открыть ВСЕГЕИ ГИС-Атлас &rarr;
      </a>

      {/* Secondary link */}
      <a
        href={geology.links.efgi_federal_registry}
        target="_blank"
        rel="noopener noreferrer"
        style={{
          fontSize: 12,
          color: "#6b7280",
          textDecoration: "underline",
          textAlign: "center",
        }}
      >
        ЕФГИ (требуется ЕСИА)
      </a>

      <div style={{ fontSize: 11, color: "#9ca3af", textAlign: "center" }}>
        {geology.lat.toFixed(6)}, {geology.lon.toFixed(6)}
      </div>
    </div>
  );
}
