import Image from "next/image";
import Link from "next/link";
import { siteConfig } from "@/lib/site-config";

export function Footer() {
  return (
    <footer
      id="contact"
      className="border-t border-white/10 bg-[var(--color-navy)] text-stone-200"
    >
      <div className="mx-auto max-w-7xl px-4 py-16 md:px-8">
        <div className="grid gap-12 md:grid-cols-2 lg:grid-cols-12">
          <div className="lg:col-span-4">
            <Image
              src="/images/shitaye-logo-mono.png"
              alt="Shitaye Suite Hotel"
              width={400}
              height={333}
              className="h-12 w-auto max-w-[240px] brightness-0 invert sm:h-14"
            />
            <p className="mt-5 text-sm leading-relaxed text-stone-300">{siteConfig.address}</p>
            <p className="mt-2 text-sm text-stone-300">{siteConfig.city}, Ethiopia</p>
            <p className="mt-4">
              <a
                href={siteConfig.googleMapsDirectionsUrl}
                target="_blank"
                rel="noopener noreferrer"
                className="text-sm font-semibold text-[var(--color-accent)] underline-offset-4 transition hover:text-white hover:underline"
              >
                Directions on Google Maps
              </a>
            </p>
          </div>

          <div className="lg:col-span-3">
            <h3 className="text-xs font-semibold uppercase tracking-widest text-stone-400">
              Reservations & email
            </h3>
            <ul className="mt-4 space-y-2 text-sm">
              <li>
                <a
                  href={`mailto:${siteConfig.email}`}
                  className="break-all text-white hover:text-white"
                >
                  {siteConfig.email}
                </a>
              </li>
              {siteConfig.phones.map((p) => (
                <li key={p}>
                  <a
                    href={`tel:${p.replace(/\s/g, "")}`}
                    className="text-stone-200 hover:text-white"
                  >
                    {p}
                  </a>
                </li>
              ))}
            </ul>
          </div>

          <div className="lg:col-span-3">
            <h3 className="text-xs font-semibold uppercase tracking-widest text-stone-400">
              Departments
            </h3>
            <ul className="mt-4 space-y-4 text-sm">
              {siteConfig.departments.map((d) => (
                <li key={d.label}>
                  <p className="font-medium text-white">{d.label}</p>
                  {d.phones.map((p) => (
                    <a
                      key={p}
                      href={`tel:${p.replace(/\s/g, "")}`}
                      className="block text-stone-300 hover:text-white"
                    >
                      {p}
                    </a>
                  ))}
                </li>
              ))}
            </ul>
          </div>

          <div className="lg:col-span-2">
            <h3 className="text-xs font-semibold uppercase tracking-widest text-stone-400">
              Follow us
            </h3>
            <ul className="mt-4 flex flex-wrap gap-3">
              <li>
                <a
                  href={siteConfig.social.facebook}
                  target="_blank"
                  rel="noopener noreferrer"
                  className="flex h-10 w-10 items-center justify-center rounded-full border border-stone-500 text-white transition hover:border-transparent hover:bg-[var(--color-accent)] hover:text-[var(--color-on-accent)] hover:shadow-[var(--shadow-mustard)]"
                  aria-label="Facebook"
                >
                  <IconFacebook />
                </a>
              </li>
              <li>
                <a
                  href={siteConfig.social.instagram}
                  target="_blank"
                  rel="noopener noreferrer"
                  className="flex h-10 w-10 items-center justify-center rounded-full border border-stone-500 text-white transition hover:border-transparent hover:bg-[var(--color-accent)] hover:text-[var(--color-on-accent)] hover:shadow-[var(--shadow-mustard)]"
                  aria-label="Instagram"
                >
                  <IconInstagram />
                </a>
              </li>
              <li>
                <a
                  href={siteConfig.social.twitter}
                  target="_blank"
                  rel="noopener noreferrer"
                  className="flex h-10 w-10 items-center justify-center rounded-full border border-stone-500 text-white transition hover:border-transparent hover:bg-[var(--color-accent)] hover:text-[var(--color-on-accent)] hover:shadow-[var(--shadow-mustard)]"
                  aria-label="Twitter / X"
                >
                  <IconTwitter />
                </a>
              </li>
              <li>
                <a
                  href={siteConfig.social.whatsapp}
                  target="_blank"
                  rel="noopener noreferrer"
                  className="flex h-10 w-10 items-center justify-center rounded-full border border-stone-500 text-white transition hover:border-transparent hover:bg-[var(--color-accent)] hover:text-[var(--color-on-accent)] hover:shadow-[var(--shadow-mustard)]"
                  aria-label="WhatsApp"
                >
                  <IconWhatsApp />
                </a>
              </li>
            </ul>

            <h3 className="mt-8 text-xs font-semibold uppercase tracking-widest text-stone-400">
              Quick links
            </h3>
            <ul className="mt-3 space-y-2 text-sm">
              <li>
                <Link href="/booking" className="text-stone-200 hover:text-white">
                  Room booking
                </Link>
              </li>
              <li>
                <Link href="/#rooms" className="text-stone-200 hover:text-white">
                  Rooms
                </Link>
              </li>
              <li>
                <Link href="/guest" className="text-stone-200 hover:text-white">
                  Guest hub
                </Link>
              </li>
              <li>
                <Link href="/login" className="text-stone-200 hover:text-white">
                  Sign in
                </Link>
              </li>
              <li>
                <Link href="/profile" className="text-stone-200 hover:text-white">
                  My stay
                </Link>
              </li>
              <li>
                <Link href="/services" className="text-stone-200 hover:text-white">
                  Spa & gym services
                </Link>
              </li>
              <li>
                <Link href="/#wellness" className="text-stone-200 hover:text-white">
                  Gym & Spa
                </Link>
              </li>
              <li>
                <Link href="/#dining" className="text-stone-200 hover:text-white">
                  Dining
                </Link>
              </li>
              <li>
                <Link href="/#location" className="text-stone-200 hover:text-white">
                  Location & map
                </Link>
              </li>
              <li>
                <Link href="/meetings/serenity" className="text-stone-200 hover:text-white">
                  Serenity meeting room
                </Link>
              </li>
            </ul>
          </div>
        </div>

        <p className="mt-12 border-t border-white/10 pt-8 text-center text-xs text-stone-400">
          © {new Date().getFullYear()} Shitaye Suite Hotel. All rights reserved.
        </p>
      </div>
    </footer>
  );
}

function IconFacebook() {
  return (
    <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden>
      <path d="M22 12a10 10 0 10-11.5 9.95v-7.05h-2.5V12h2.5V9.5c0-2.48 1.5-3.85 3.73-3.85 1.07 0 2.19.19 2.19.19v2.4h-1.23c-1.22 0-1.6.76-1.6 1.53V12h2.72l-.43 2.9h-2.29v7.05A10 10 0 0022 12z" />
    </svg>
  );
}

function IconInstagram() {
  return (
    <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden>
      <path d="M7 2h10a5 5 0 015 5v10a5 5 0 01-5 5H7a5 5 0 01-5-5V7a5 5 0 015-5zm0 2a3 3 0 00-3 3v10a3 3 0 003 3h10a3 3 0 003-3V7a3 3 0 00-3-3H7zm5 3.5A5.5 5.5 0 1112 17.5 5.5 5.5 0 0112 7.5zm0 2a3.5 3.5 0 100 7 3.5 3.5 0 000-7zM17.8 6.3a1.2 1.2 0 11-2.4 0 1.2 1.2 0 012.4 0z" />
    </svg>
  );
}

function IconTwitter() {
  return (
    <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden>
      <path d="M18.244 3H21l-7.5 8.57L22 21h-6.9l-5.38-6.32L5.1 21H3l8-9.15L3 3h6.9l4.86 5.71L18.244 3z" />
    </svg>
  );
}

function IconWhatsApp() {
  return (
    <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden>
      <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.435 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z" />
    </svg>
  );
}
