import prisma from "@/lib/prisma";
import Link from "next/link";

export default async function ServerFooter() {
  const facebookSetting = await prisma.setting.findUnique({ where: { key: "facebook_link" } });
  const instagramSetting = await prisma.setting.findUnique({ where: { key: "instagram_link" } });

  const facebookLink = facebookSetting?.value || "#";
  const instagramLink = instagramSetting?.value || "#";

  return (
    <footer style={{ backgroundColor: "var(--text-primary)", color: "white", padding: "4rem 2rem", textAlign: "center" }}>
      <h2 style={{ fontFamily: "var(--font-serif)", color: "var(--accent-gold)", marginBottom: "1rem" }}>LAZULI HOTEL</h2>
      <p style={{ color: "var(--text-secondary)", marginBottom: "1.5rem" }}>El Quseir, Marsa Alam, Egypt</p>
      
      <div style={{ display: "flex", justifyContent: "center", gap: "1.5rem", marginBottom: "2rem" }}>
        {facebookLink && facebookLink !== "#" && (
          <a href={facebookLink} target="_blank" rel="noopener noreferrer" style={{ color: "var(--accent-gold)", fontSize: "1.5rem", transition: "color 0.3s" }} aria-label="Facebook">
            <svg stroke="currentColor" fill="currentColor" strokeWidth="0" viewBox="0 0 320 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">
              <path d="M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z"></path>
            </svg>
          </a>
        )}
        {instagramLink && instagramLink !== "#" && (
          <a href={instagramLink} target="_blank" rel="noopener noreferrer" style={{ color: "var(--accent-gold)", fontSize: "1.5rem", transition: "color 0.3s" }} aria-label="Instagram">
            <svg stroke="currentColor" fill="currentColor" strokeWidth="0" viewBox="0 0 448 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">
              <path d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path>
            </svg>
          </a>
        )}
      </div>

      <p style={{ fontSize: "0.875rem", color: "var(--text-secondary)" }}>&copy; 2026 Lazuli Hotel. All rights reserved.</p>
    </footer>
  );
}
