<section id="beranda" class="mx-auto grid max-w-7xl gap-8 px-4 sm:px-6 pb-12 sm:pb-16 pt-4 sm:pt-12 lg:grid-cols-[1.1fr_.9fr] lg:items-center">
  <div>
    <div class="mb-5 inline-flex items-center gap-2 rounded-full border border-gold-300/20 bg-gold-300/10 px-3 sm:px-4 py-2 text-xs sm:text-sm text-gold-200">
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-4 w-4 shrink-0"><path d="M20 13c0 5-3.5 7.5-8 9-4.5-1.5-8-4-8-9V5l8-3 8 3v8Z"/><path d="m9 12 2 2 4-4"/></svg>
      <span>EA teruji, laporan jelas, akses member lengkap</span>
    </div>
    <h1 class="font-display max-w-4xl text-3xl sm:text-4xl lg:text-6xl font-semibold leading-[1.1] tracking-tight">
      <%= settings.hero_title || 'Pusat resmi EA Trader Rebahan untuk melihat performa, membeli, dan mengakses member area.' %>
    </h1>
    <p class="mt-5 sm:mt-6 max-w-2xl text-base sm:text-lg leading-7 text-muted">
      <%= settings.hero_subtitle || 'Calon pembeli dapat melihat list EA, fitur, akun pantau, dan laporan performa sebelum membeli.' %>
    </p>
    <div class="mt-7 sm:mt-8 flex flex-wrap gap-3">
      <a href="#ea" class="btn btn-gold h-12 rounded-full px-6 text-sm sm:text-base">
        Lihat Semua EA
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-4 w-4"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
      </a>
      <a href="/auth/register" class="btn btn-outline h-12 rounded-full px-6 text-sm sm:text-base">Daftar Member</a>
    </div>
  </div>

  <div class="card p-4 sm:p-5">
    <div class="rounded-[18px] sm:rounded-[20px] border border-white/10 bg-[#0d0d0d] p-4 sm:p-5">
      <% if (featured) { %>
        <div class="flex items-center justify-between gap-3">
          <div class="min-w-0">
            <div class="text-xs text-muted">Akun Pantau Unggulan</div>
            <div class="mt-1 text-lg sm:text-xl font-display font-semibold truncate"><%= featured.title %></div>
          </div>
          <span class="pill pill-green shrink-0">● LIVE</span>
        </div>
        <div class="mt-4 sm:mt-5 grid grid-cols-3 gap-2 sm:gap-3">
          <div class="stat"><div class="stat-label">Profit</div><div class="stat-value text-gold-300"><%= featured.profit || '-' %></div></div>
          <div class="stat"><div class="stat-label">DD Max</div><div class="stat-value"><%= featured.dd || '-' %></div></div>
          <div class="stat"><div class="stat-label">Server</div><div class="stat-value text-base sm:text-lg truncate"><%= featured.ea_code || (featured.server || '-').split(' ')[0] %></div></div>
        </div>
        <div class="mt-4 sm:mt-5 rounded-2xl border border-white/10 bg-white/[0.03] p-3 sm:p-4">
          <svg viewBox="0 0 420 140" class="h-28 sm:h-36 w-full">
            <defs>
              <linearGradient id="line" x1="0" x2="1">
                <stop offset="0%" stop-color="#f59e0b"/>
                <stop offset="100%" stop-color="#fde68a"/>
              </linearGradient>
            </defs>
            <path d="M5 118 C42 112, 50 92, 84 95 S135 100, 160 74 S214 73, 240 55 S286 67, 314 35 S362 42, 415 18" fill="none" stroke="url(#line)" stroke-width="4" stroke-linecap="round" class="line-glow"/>
            <path d="M5 118 C42 112, 50 92, 84 95 S135 100, 160 74 S214 73, 240 55 S286 67, 314 35 S362 42, 415 18 L415 140 L5 140 Z" fill="#f59e0b" opacity="0.12"/>
          </svg>
        </div>
        <div class="mt-3 sm:mt-4 flex items-center justify-between text-xs sm:text-sm text-muted gap-3">
          <span class="mono text-xs truncate"><%= featured.server || '-' %><% if (featured.account_number) { %> • <%= featured.account_number %><% } %></span>
          <span class="text-emerald-300 shrink-0">Status aktif</span>
        </div>
      <% } else { %>
        <div class="text-center py-12 text-muted">
          <div class="text-4xl mb-3 opacity-30">📊</div>
          <div class="text-sm">Belum ada akun pantau unggulan.</div>
          <div class="text-xs mt-2 opacity-60">Admin bisa atur di panel <code>/admin/monitors</code></div>
        </div>
      <% } %>
    </div>
  </div>
</section>

<!-- mini stats -->
<section class="mx-auto max-w-7xl px-4 sm:px-6 pb-12 sm:pb-16">
  <div class="grid grid-cols-2 md:grid-cols-4 gap-3 sm:gap-4">
    <div class="stat"><div class="stat-label">EA Premium</div><div class="stat-value"><%= settings.stat_eas || '20+' %></div></div>
    <div class="stat"><div class="stat-label">Akun Pantau</div><div class="stat-value"><%= settings.stat_accounts || 'Real' %></div></div>
    <div class="stat"><div class="stat-label">Backtest</div><div class="stat-value"><%= settings.stat_backtest || 'Tersedia' %></div></div>
    <div class="stat"><div class="stat-label">Akses Member</div><div class="stat-value"><%= settings.stat_access || '24/7' %></div></div>
  </div>
</section>

<!-- EA catalog -->
<section id="ea" class="mx-auto max-w-7xl px-4 sm:px-6 py-8 sm:py-10">
  <div class="mb-6 sm:mb-7 flex flex-col md:flex-row md:items-end justify-between gap-3 sm:gap-4">
    <div>
      <div class="text-xs sm:text-sm uppercase tracking-[0.28em] text-gold-300/70">Katalog EA</div>
      <h2 class="mt-2 text-2xl sm:text-3xl font-display font-semibold">Pilih EA sesuai karakter trading</h2>
    </div>
    <div class="text-xs sm:text-sm text-muted">Tap kartu untuk detail lengkap</div>
  </div>

  <div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
    <% eas.forEach(function(ea){ %>
      <a href="/ea/<%= ea.slug %>" class="card card-hover p-5 group">
        <div class="flex items-center justify-between">
          <span class="pill"><%= ea.code %></span>
          <span class="flex items-center gap-1 text-xs text-gold-200">
            <svg viewBox="0 0 24 24" fill="currentColor" class="h-3.5 w-3.5"><path d="m12 2 3.09 6.26L22 9.27l-5 4.87L18.18 21 12 17.77 5.82 21 7 14.14l-5-4.87 6.91-1.01L12 2Z"/></svg>
            <%= ea.rating %>
          </span>
        </div>
        <h3 class="mt-4 text-xl font-display font-semibold group-hover:text-gold-200 transition"><%= ea.name %></h3>
        <p class="mt-3 min-h-14 sm:min-h-16 text-sm leading-6 text-muted"><%= ea.tagline %></p>
        <div class="mt-4 flex flex-wrap gap-1.5 sm:gap-2">
          <% (ea.features || []).slice(0,4).forEach(function(f){ %><span class="pill"><%= f %></span><% }); %>
        </div>
        <div class="mt-5 flex items-end justify-between border-t border-white/5 pt-4">
          <div>
            <div class="text-xs text-muted">Harga</div>
            <div class="mt-1 font-medium text-gold-200"><%= ea.price_label || ('Rp' + Number(ea.price).toLocaleString('id-ID')) %></div>
          </div>
          <div class="text-right">
            <div class="text-xs text-muted">Akun pantau</div>
            <div class="mt-1 font-medium"><%= ea.watch_profit || '-' %></div>
          </div>
        </div>
      </a>
    <% }); %>
  </div>
</section>

<!-- monitors -->
<section id="pantau" class="mx-auto max-w-7xl px-4 sm:px-6 py-12 sm:py-16">
  <div class="mb-6 sm:mb-7">
    <div class="text-xs sm:text-sm uppercase tracking-[0.28em] text-gold-300/70">Transparansi Performa</div>
    <h2 class="mt-2 text-2xl sm:text-3xl font-display font-semibold">Akun pantau sebelum membeli</h2>
  </div>
  <div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
    <% (monitors || []).forEach(function(m, idx){ %>
      <div class="card p-5">
        <div class="flex items-center justify-between">
          <div class="grid h-10 w-10 place-items-center rounded-2xl bg-gold-300/10 text-gold-300">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-5 w-5"><path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/></svg>
          </div>
          <div class="flex items-center gap-2">
            <% if (m.is_featured) { %><span class="pill pill-gold">⭐ Unggulan</span><% } %>
            <span class="pill pill-green">● <%= m.status %></span>
          </div>
        </div>
        <h3 class="mt-5 text-xl font-display font-semibold"><%= m.title %></h3>

        <div class="mt-3 grid grid-cols-2 gap-2">
          <div>
            <div class="text-xs text-muted-2 uppercase tracking-wide" style="font-size:10px">Profit</div>
            <div class="text-2xl font-display font-semibold text-gold-200 mt-0.5"><%= m.profit || '-' %></div>
          </div>
          <% if (m.dd) { %>
          <div>
            <div class="text-xs text-muted-2 uppercase tracking-wide" style="font-size:10px">DD Max</div>
            <div class="text-2xl font-display font-semibold mt-0.5"><%= m.dd %></div>
          </div>
          <% } %>
        </div>

        <!-- Credentials investor (read-only) -->
        <% if (m.server || m.account_number || m.account_password) { %>
          <div class="mt-4 pt-4 border-t border-white/5 space-y-2.5 text-xs">
            <% if (m.server) { %>
              <div class="flex items-center justify-between gap-2">
                <span class="text-muted-2 uppercase tracking-wide" style="font-size:10px">Server</span>
                <button type="button" class="mono text-white truncate hover:text-gold-200 transition" data-copy="<%= m.server %>" title="Tap untuk copy"><%= m.server %></button>
              </div>
            <% } %>
            <% if (m.account_number) { %>
              <div class="flex items-center justify-between gap-2">
                <span class="text-muted-2 uppercase tracking-wide" style="font-size:10px">Nomor Akun</span>
                <button type="button" class="mono text-white hover:text-gold-200 transition" data-copy="<%= m.account_number %>" title="Tap untuk copy"><%= m.account_number %></button>
              </div>
            <% } %>
            <% if (m.account_password) { %>
              <div class="flex items-center justify-between gap-2">
                <span class="text-muted-2 uppercase tracking-wide" style="font-size:10px">Password Investor</span>
                <button type="button" class="mono text-white hover:text-gold-200 transition" data-copy="<%= m.account_password %>" title="Tap untuk copy"><%= m.account_password %></button>
              </div>
            <% } %>
            <div class="text-muted-2 text-[10px] leading-relaxed pt-1">
              💡 Investor password — login MT4/MT5 untuk pantau tanpa bisa trade. Tap untuk copy.
            </div>
          </div>
        <% } %>

        <% if (m.link) { %>
          <a href="<%= m.link %>" target="_blank" rel="noopener" class="btn btn-outline mt-4 w-full rounded-full py-2.5 text-sm">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-4 w-4"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>
            Lihat MyFxBook
          </a>
        <% } %>
      </div>
    <% }); %>
  </div>
</section>

<!-- CTA -->
<section id="member" class="mx-auto max-w-7xl px-4 sm:px-6 pb-16 sm:pb-20 pt-4 sm:pt-6">
  <div class="rounded-[24px] sm:rounded-[34px] border border-gold-300/20 bg-gold-300/[0.09] p-6 sm:p-7 md:p-10">
    <div class="flex flex-col md:flex-row md:items-center justify-between gap-5 sm:gap-6">
      <div>
        <h2 class="text-2xl sm:text-3xl font-display font-semibold">Beli EA dengan proses yang lebih meyakinkan</h2>
        <p class="mt-3 max-w-2xl text-sm sm:text-base text-muted">Lihat bukti performa lebih dulu, pilih EA, isi detail order, lalu lakukan pembayaran. Setelah admin verifikasi, EA bisa di-download dari dashboard member dan dikirim ke email Anda.</p>
      </div>
      <a href="/auth/register" class="btn btn-gold h-12 rounded-full px-6 shrink-0 w-full md:w-auto">
        Daftar Sekarang
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-4 w-4"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
      </a>
    </div>
  </div>
</section>
