"use client";

import { useRouter } from "next/navigation";
import { motion } from "framer-motion";
import { Zap, Gift, Clock, ChevronRight, Trophy } from "lucide-react";
import BrandLogo from "@/components/BrandLogo";

export default function LandingPage() {
  const router = useRouter();

  return (
    <div className="relative flex min-h-dvh flex-col items-center bg-background px-5 py-10 overflow-y-auto scrollbar-none">
      {/* Ambient glow */}
      <div className="pointer-events-none fixed left-1/2 top-0 -translate-x-1/2 -translate-y-1/3 h-[420px] w-[420px] rounded-full bg-orange-500/8 blur-3xl" />
      <div className="pointer-events-none fixed left-1/4 top-1/2 h-[300px] w-[300px] rounded-full bg-purple-500/5 blur-3xl" />

      {/* Header */}
      <motion.div
        className="flex flex-col items-center gap-4"
        initial={{ y: -30, opacity: 0 }}
        animate={{ y: 0, opacity: 1 }}
        transition={{ duration: 0.6, ease: "easeOut" }}
      >
        <BrandLogo size={48} />
        <div className="text-center">
          <h1 className="text-2xl font-black tracking-tight text-heading">
            NoWhatever
          </h1>
          <p className="mt-1 text-[11px] font-medium tracking-[0.2em] text-muted">
            别说随便 · 亲密关系决策引擎
          </p>
        </div>
      </motion.div>

      <motion.p
        className="mt-4 max-w-68 text-center text-sm leading-relaxed text-tertiary"
        initial={{ opacity: 0 }}
        animate={{ opacity: 1 }}
        transition={{ delay: 0.2 }}
      >
        别再说"随便"了。
        <br />
        两个模式，覆盖你们所有的选择困难症。
      </motion.p>

      {/* Dual Cards */}
      <div className="mt-9 flex w-full max-w-sm flex-col gap-4">
        {/* Card A: Panic Mode */}
        <motion.button
          onClick={() => router.push("/panic")}
          className="group relative w-full overflow-hidden rounded-2xl bg-linear-to-br from-yellow-400 to-orange-500 p-5 pb-4 text-left shadow-xl shadow-orange-500/25 ring-1 ring-white/15 transition-shadow hover:shadow-2xl hover:shadow-orange-500/35"
          initial={{ x: -40, opacity: 0 }}
          animate={{ x: 0, opacity: 1 }}
          transition={{ duration: 0.5, delay: 0.3 }}
          whileHover={{ scale: 1.02, rotate: -0.5 }}
          whileTap={{ scale: 0.97 }}
        >
          <div className="absolute -right-4 -top-4 h-28 w-28 rounded-full bg-white/15 blur-2xl" />
          <div className="absolute -bottom-6 -left-6 h-20 w-20 rounded-full bg-yellow-300/20 blur-xl" />

          <div className="relative z-10">
            <div className="flex items-center gap-2.5">
              <div className="flex h-10 w-10 items-center justify-center rounded-xl bg-black/15 ring-1 ring-white/10">
                <Zap size={22} className="text-white" />
              </div>
              <div className="flex-1">
                <h2 className="text-lg font-black text-white">⚡️ 极速救场</h2>
                <p className="text-[10px] font-semibold tracking-wider text-white/60">
                  PANIC MODE
                </p>
              </div>
            </div>
            <p className="mt-3.5 text-sm font-medium leading-relaxed text-white/90">
              10秒内出结果，立刻闭嘴，听天由命
            </p>
            <div className="mt-3 flex items-center justify-between">
              <div className="flex items-center gap-1.5 text-xs font-bold text-white/50">
                <Clock size={12} />
                <span>即时决策 · 转盘匹配</span>
              </div>
              <div className="flex items-center gap-0.5 text-xs font-semibold text-white/40 transition-colors group-hover:text-white/70">
                进入
                <ChevronRight size={14} />
              </div>
            </div>
          </div>

          <motion.div
            className="absolute inset-0 rounded-2xl"
            whileHover={{
              x: [0, -2, 2, -2, 2, 0],
              transition: { duration: 0.4, repeat: Infinity },
            }}
          />
        </motion.button>

        {/* Card B: Adventure Roulette */}
        <motion.button
          onClick={() => router.push("/blindbox")}
          className="group relative w-full overflow-hidden rounded-2xl bg-linear-to-br from-indigo-900 to-purple-800 p-5 pb-4 text-left shadow-xl shadow-purple-600/20 ring-1 ring-white/15 transition-shadow hover:shadow-2xl hover:shadow-purple-500/30"
          initial={{ x: 40, opacity: 0 }}
          animate={{ x: 0, opacity: 1 }}
          transition={{ duration: 0.5, delay: 0.4 }}
          whileHover={{ scale: 1.02, rotate: 0.5 }}
          whileTap={{ scale: 0.97 }}
        >
          <div className="absolute -right-6 -top-6 h-32 w-32 rounded-full bg-purple-400/15 blur-2xl" />
          <div className="absolute -bottom-4 -left-4 h-24 w-24 rounded-full bg-indigo-300/15 blur-xl" />

          <div className="relative z-10">
            <div className="flex items-center gap-2.5">
              <div className="flex h-10 w-10 items-center justify-center rounded-xl bg-black/15 ring-1 ring-white/10">
                <Gift size={22} className="text-white" />
              </div>
              <div className="flex-1">
                <h2 className="text-lg font-black text-white">🎁 周末契约</h2>
                <p className="text-[10px] font-semibold tracking-wider text-white/60">
                  ADVENTURE ROULETTE
                </p>
              </div>
            </div>
            <p className="mt-3.5 text-sm font-medium leading-relaxed text-white/90">
              丢入疯狂想法，周末盲盒开奖，绝不反悔
            </p>
            <div className="mt-3 flex items-center justify-between">
              <div className="flex items-center gap-1.5 text-xs font-bold text-white/50">
                <Gift size={12} />
                <span>盲盒蓄水 · 仪式开奖</span>
              </div>
              <div className="flex items-center gap-0.5 text-xs font-semibold text-white/40 transition-colors group-hover:text-white/70">
                进入
                <ChevronRight size={14} />
              </div>
            </div>
          </div>

          <motion.div
            className="absolute inset-0 rounded-2xl"
            whileHover={{
              x: [0, -2, 2, -2, 2, 0],
              transition: { duration: 0.4, repeat: Infinity },
            }}
          />
        </motion.button>
      </div>

      {/* Achievements entry */}
      <motion.button
        onClick={() => router.push("/achievements")}
        className="mt-6 flex w-full max-w-sm items-center gap-3 rounded-xl bg-surface px-4 py-3 ring-1 ring-border transition-colors active:bg-elevated"
        initial={{ opacity: 0, y: 10 }}
        animate={{ opacity: 1, y: 0 }}
        transition={{ delay: 0.5 }}
        whileTap={{ scale: 0.98 }}
      >
        <div className="flex h-8 w-8 items-center justify-center rounded-lg bg-amber-600/15">
          <Trophy size={16} className="text-amber-400" />
        </div>
        <div className="flex-1 text-left">
          <p className="text-sm font-semibold text-heading">成就墙</p>
          <p className="text-[10px] text-muted">查看决策记录和契约成就</p>
        </div>
        <ChevronRight size={14} className="text-muted" />
      </motion.button>

      {/* Footer */}
      <motion.p
        className="mt-auto pt-10 text-center text-[10px] font-medium tracking-widest text-muted"
        initial={{ opacity: 0 }}
        animate={{ opacity: 1 }}
        transition={{ delay: 0.8 }}
      >
        NOWHATEVER — 拒绝随便，从今天开始
      </motion.p>

    </div>
  );
}
