/* global React, ReactDOM */
const { useState, useEffect } = React;

// ─────────────────────────────────────────────────────────────
// App
// ─────────────────────────────────────────────────────────────
function App() {
  const theme = "dark";
  const [emailSent, setEmailSent] = useState(false);
  const [email, setEmail] = useState("");

  useEffect(() => {
    document.documentElement.dataset.theme = theme;
  }, []);

  const SCRIPT_URL = "https://script.google.com/macros/s/AKfycbzGI2ZeavzMgStTea6_j4NAOG2ORZzrLwZCvcMosUGL3VcO0hVRSDr-Ht0cIRHEhRYd_Q/exec";

  const handleSubmit = (e) => {
    e.preventDefault();
    if (!email) return;
    fetch(SCRIPT_URL, {
      method: "POST",
      mode: "no-cors",
      body: JSON.stringify({ email }),
    }).catch(() => {});
    setEmailSent(true);
    setEmail("");
    setTimeout(() => setEmailSent(false), 4000);
  };

  return (
    <div className={`page ${theme}`}>
      {/* Ambient backdrop — recreates the corporate cover feel */}
      <div className="backdrop">
        <div className="ember" />
        <div className="ember ember-2" />
        <div className="grain" />
      </div>

      {/* Massive curved arc — recreated as inline SVG (matches the brand mark) */}
      <div className="arc-wrap" aria-hidden="true">
          <svg className="arc" viewBox="0 0 600 900" preserveAspectRatio="xMidYMid meet" fill="none">
            <defs>
              <linearGradient id="arcGrad" x1="0" y1="0" x2="0.2" y2="1">
                <stop offset="0%" stopColor="var(--arc-color)" stopOpacity="0.0" />
                <stop offset="15%" stopColor="var(--arc-color)" stopOpacity="0.55" />
                <stop offset="50%" stopColor="var(--arc-color)" stopOpacity="0.95" />
                <stop offset="85%" stopColor="var(--arc-color)" stopOpacity="0.55" />
                <stop offset="100%" stopColor="var(--arc-color)" stopOpacity="0.0" />
              </linearGradient>
            </defs>
            {/* Pronounced crescent — outer sweep + inner sweep meeting at thin tips */}
            <path
            d="M 60 30 C 520 140, 600 720, 140 870 C 560 700, 470 220, 60 30 Z"
            fill="url(#arcGrad)" />
            {/* Two signature dots from the logo */}
            <circle cx="40" cy="340" r="7" fill="var(--arc-color)" opacity="0.55" />
            <circle cx="80" cy="600" r="6" fill="var(--arc-color)" opacity="0.45" />
          </svg>
        </div>

      {/* Top bar */}
      <header className="top">
        <div className="top-left">
          <img
            src={theme === "dark" ? "assets/spot-logo-white.png" : "assets/spot-logo-color.png"}
            alt="Spot"
            className="logo" style={{ width: "65px", height: "65px" }} />
          
        </div>
        <div className="top-right">
          <span className="status-dot" />
          <span className="status-text" style={{ color: "rgb(244, 234, 224)" }}>WE ARE SPOT</span>
        </div>
      </header>

      {/* Main */}
      <main className="main" style={{ padding: "10px 0px 12px" }}>
        <div className="coming-soon" aria-label="Próximamente">
          <span className="cs-dot" />
          <span className="cs-text">PRÓXIMAMENTE</span>
        </div>

        <h1 className="hero-title">
          <span className="hero-line">La noche</span>
          <span className="hero-line">
            tiene un <em>Spot</em><span className="dot">.</span>
          </span>
        </h1>

        <p className="hero-sub">
          La primera plataforma paraguaya de reservas para la vida nocturna.
          Mesas, entradas y eventos — directo desde tu celular.
        </p>

        {/* Email capture */}
        <form className="notify" onSubmit={handleSubmit}>
          <div className="notify-field">
            <input
              type="email"
              placeholder="tu@email.com"
              value={email}
              onChange={(e) => setEmail(e.target.value)}
              required
              aria-label="Email" />
            
            <button type="submit">
              {emailSent ? "✓ Listo" : "Avisame"}
              <span className="arrow">→</span>
            </button>
          </div>
          <p className="notify-hint">
            {emailSent ?
            "Recibido. Te escribimos pronto." :
            "Dejá tu email para novedades, prensa o cualquier consulta."}
          </p>
        </form>
      </main>

      {/* Footer / contact */}
      <footer className="bottom">
        <div className="bottom-grid">
          <div className="contact-block">
            <span className="cb-label">Contacto</span>
            <a href="mailto:admin@wearespotapp.com" className="cb-link">
              admin@wearespotapp.com
            </a>
            <a href="tel:+595981298138" className="cb-link">
              +595 981 298 138
            </a>
          </div>

          <div className="contact-block">
            <span className="cb-label">Ubicación</span>
            <span className="cb-text">Asunción, Paraguay</span>
            <span className="cb-text muted">wearespotapp.com</span>
          </div>

          <div className="contact-block">
            <span className="cb-label">Seguinos</span>
            <div className="socials">
              <a href="https://www.instagram.com/wearespotpy/" target="_blank" rel="noopener noreferrer" aria-label="Instagram" className="social">
                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="2" width="20" height="20" rx="5" ry="5" /><path d="M16 11.37A4 4 0 1112.63 8 4 4 0 0116 11.37z" /><line x1="17.5" y1="6.5" x2="17.51" y2="6.5" /></svg>
              </a>
              <a href="#" aria-label="TikTok" className="social">
                <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M19.59 6.69a4.83 4.83 0 01-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 01-2.88 2.5 2.89 2.89 0 01-2.89-2.89 2.89 2.89 0 012.89-2.89c.28 0 .54.04.79.1V9.01a6.34 6.34 0 00-.79-.05 6.34 6.34 0 00-6.34 6.34 6.34 6.34 0 006.34 6.34 6.34 6.34 0 006.33-6.34V8.69a8.18 8.18 0 004.78 1.52V6.76a4.86 4.86 0 01-1.01-.07z" /></svg>
              </a>
              <a href="#" aria-label="WhatsApp" className="social">
                <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><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.437 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>
              </a>
            </div>
          </div>
        </div>

        <div className="bottom-bar">
          <span>© 2026 Spot. Todos los derechos reservados.</span>
          <span className="muted">
</span>
        </div>
      </footer>

    </div>);

}

ReactDOM.createRoot(document.getElementById("root")).render(<App />);