<?php include __DIR__ . '/../includes/header.php';

$ea = [
  'id'=>'FX336408',
  'display'=>'FX336408',
  'status'=>'Active',
  'platform'=>'MT5',
  'account_type'=>'ECN',
  'location'=>'Beijing',
  'since'=>'Jan 2024',
  'aum'=>716658,
  'pnl'=>-4990.61,
  'win_rate'=>70.00,
  'trades'=>1284,
  'yield'=>-0.69,
  'equity_peak'=>729540.00,
  'avg_hold'=>'4.2h',
  'risk_level'=>12.34,
  'monthly'=>[
    ['label'=>'Jan','pct'=>2.14,'trades'=>'198 trades · 72%','bar'=>'40px','pos'=>true],
    ['label'=>'Feb','pct'=>1.87,'trades'=>'221 trades · 68%','bar'=>'35px','pos'=>true],
    ['label'=>'Mar','pct'=>-0.34,'trades'=>'189 trades · 62%','bar'=>'8px','pos'=>false],
    ['label'=>'Apr','pct'=>1.05,'trades'=>'244 trades · 71%','bar'=>'20px','pos'=>true],
    ['label'=>'May','pct'=>-0.69,'trades'=>'92 trades · 70%','bar'=>'13px','pos'=>false],
  ],
  'ls'=>[
    ['pair'=>'XAUUSD','long'=>72,'short'=>28],
    ['pair'=>'EURUSD','long'=>38,'short'=>62],
    ['pair'=>'GBPUSD','long'=>55,'short'=>45],
    ['pair'=>'USDJPY','long'=>29,'short'=>71],
    ['pair'=>'USDCAD','long'=>60,'short'=>40],
  ],
  'broker'=>['name'=>'Blackwell Global','reg'=>'✓ Regulated','min_spread'=>'0.1 pips','execution'=>'Market'],
  'stats'=>['profit_factor'=>1.87,'sharpe'=>1.24,'max_dd'=>12.34,'win_rate'=>70.00]
];
?>

<style>
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
--ivory:#FAFAF7;--white:#fff;--navy:#0F1628;--gold:#B8890A;--gold-light:#F5EDD3;--gold-ring:#D4A82A;
--silver:#8E9BAA;--muted:#7D8799;--border:#EDE9DF;--bf:#F4F1EB;
--profit:#0F7A5A;--profit-bg:#EDFAF4;--loss:#C94848;--loss-bg:#FDF0F0;--blue:#1D5FCC;--blue-bg:#EEF4FF;
}
body{font-family:'Plus Jakarta Sans',system-ui,sans-serif;background:var(--ivory);color:var(--navy);font-size:13px;}
/* layout container to center page */
.container{max-width:1100px;margin:0 auto;padding:0 20px;}
@keyframes slideUp{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}

/* HERO */
.hero{background:var(--white);border-bottom:1px solid var(--border);padding:18px 20px 0;}
.bc{font-size:10px;font-weight:700;letter-spacing:.7px;text-transform:uppercase;color:var(--muted);margin-bottom:14px;display:flex;align-items:center;gap:5px;}
.bc span{color:#CBD5E1;}
.ps{display:flex;align-items:flex-end;justify-content:space-between;flex-wrap:wrap;gap:12px;padding-bottom:16px;}
.pl{display:flex;align-items:center;gap:14px;}
.av{width:58px;height:58px;border-radius:14px;background:var(--gold-light);border:2px solid var(--gold-ring);display:flex;align-items:center;justify-content:center;font-family:Georgia,serif;font-size:20px;font-weight:700;font-style:italic;color:var(--gold);flex-shrink:0;}
.nick{font-family:Georgia,serif;font-size:22px;font-weight:700;margin-bottom:6px;}
.nick em{font-style:italic;color:var(--gold);}
.tags{display:flex;gap:5px;flex-wrap:wrap;}
.tag{display:inline-flex;align-items:center;gap:4px;font-size:10px;font-weight:700;padding:3px 8px;border-radius:5px;border:1px solid var(--border);background:var(--ivory);color:var(--muted);}
.tag.g{background:var(--profit-bg);color:var(--profit);border-color:#A3E6C8;}
.tag.b{background:var(--blue-bg);color:var(--blue);border-color:#BADAF5;}
.tag.o{background:var(--gold-light);color:var(--gold);border-color:var(--gold-ring);}
.actions{display:flex;gap:8px;}
.btn{display:inline-flex;align-items:center;gap:5px;font-size:11px;font-weight:700;padding:8px 14px;border-radius:8px;border:none;cursor:pointer;transition:.2s;font-family:inherit;}
.btn-out{background:var(--white);color:var(--navy);border:1px solid var(--border);}
.btn-out:hover{border-color:var(--gold-ring);color:var(--gold);}
.btn-gold{background:var(--gold);color:var(--navy);}
.btn-gold:hover{background:var(--gold-ring);}
/* KPI strip */
.kpi-strip{display:grid;grid-template-columns:repeat(4,1fr);gap:1px;background:var(--border);border-top:1px solid var(--border);margin:0 -20px;}
.kc{background:var(--white);padding:14px 16px;}
.kl{font-size:9px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:var(--muted);margin-bottom:6px;}
.ka{width:18px;height:2px;border-radius:2px;margin-bottom:6px;}
.kv{font-family:Georgia,serif;font-size:18px;font-weight:700;color:var(--navy);line-height:1;}
.kv.g{color:var(--profit)}.kv.r{color:var(--loss)}.kv.o{color:var(--gold)}.kv.b{color:var(--blue)}
.ks{font-size:10px;color:var(--muted);font-weight:500;margin-top:4px;}
/* hero tabs */
.htabs{display:flex;gap:0;border-top:1px solid var(--border);margin:0 -20px;padding:0 20px;}
.ht{font-size:12px;font-weight:700;color:var(--muted);padding:11px 16px;cursor:pointer;border:none;background:none;position:relative;font-family:inherit;transition:.2s;}
.ht.active{color:var(--navy);}
.ht.active::after{content:'';position:absolute;bottom:-1px;left:0;right:0;height:2px;background:var(--navy);border-radius:2px 2px 0 0;}

/* CONTENT */
.content{padding:18px 20px 0;}
.layout{display:grid;grid-template-columns:1fr 280px;gap:20px;align-items:start;}

/* CARD */
.card{background:var(--white);border:1px solid var(--border);border-radius:12px;overflow:hidden;margin-bottom:18px;animation:slideUp .4s ease both;box-shadow:0 1px 3px rgba(15,22,40,.04);}
.ch{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);}
.ct{font-family:Georgia,serif;font-size:15px;font-weight:700;}
.ct em{font-style:italic;color:var(--gold);}
.cb{padding:16px 18px;}

/* MONTHLY */
.mg{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;}
.mc{background:var(--ivory);border:1px solid var(--border);border-radius:9px;padding:11px;text-align:center;}
.mn{font-size:9px;font-weight:800;letter-spacing:.5px;text-transform:uppercase;color:var(--muted);margin-bottom:7px;}
.my{font-family:Georgia,serif;font-size:17px;font-weight:700;margin-bottom:8px;}
.my.pos{color:var(--profit)}.my.neg{color:var(--loss)}
.mbw{height:40px;display:flex;align-items:flex-end;justify-content:center;margin-bottom:7px;}
.mb{width:24px;border-radius:3px 3px 0 0;transition:height 1s cubic-bezier(.16,1,.3,1);}
.mb.pos{background:linear-gradient(180deg,var(--profit-bg),var(--profit));}
.mb.neg{background:linear-gradient(0deg,var(--loss-bg),var(--loss));}
.mm{font-size:9px;color:var(--muted);font-weight:600;}

/* YIELD SVG */
.yc{width:100%;height:80px;display:block;}

/* LS BARS */
.lsr{display:flex;align-items:center;gap:10px;margin-bottom:9px;}
.lsr:last-child{margin-bottom:0;}
.lsp{font-size:11px;font-weight:700;width:52px;flex-shrink:0;font-family:monospace;}
.lst{flex:1;display:flex;height:17px;border-radius:3px;overflow:hidden;gap:1px;}
.lsl2{background:var(--profit);height:100%;border-radius:3px 0 0 3px;display:flex;align-items:center;padding-left:5px;font-size:8px;font-weight:800;color:#fff;transition:width .8s cubic-bezier(.16,1,.3,1);}
.lss{background:var(--loss);height:100%;border-radius:0 3px 3px 0;display:flex;align-items:center;padding-right:5px;font-size:8px;font-weight:800;color:#fff;justify-content:flex-end;transition:width .8s cubic-bezier(.16,1,.3,1);}
.lspct{min-width:40px;display:flex;flex-direction:column;align-items:flex-end;}
.lspct span{font-size:10px;font-weight:700;line-height:1.3;}

/* TRADES TABLE */
.tt{width:100%;border-collapse:collapse;}
.tt th{font-size:9px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;color:var(--muted);padding:8px 10px;text-align:left;border-bottom:1px solid var(--border);}
.tt td{padding:9px 10px;font-size:11px;font-weight:600;color:var(--navy);border-bottom:1px solid var(--bf);vertical-align:middle;}
.tt tr:last-child td{border-bottom:none;}
.tt tr:hover td{background:var(--ivory);}
.db{display:inline-flex;align-items:center;gap:3px;font-size:9px;font-weight:800;padding:2px 6px;border-radius:3px;}
.buy{background:var(--profit-bg);color:var(--profit);}
.sell{background:var(--loss-bg);color:var(--loss);}
.pp{color:var(--profit)}.pn{color:var(--loss)}

/* SIDEBAR */
.wc{background:linear-gradient(135deg,var(--navy) 0%,#1e3a6e 100%);border-radius:12px;padding:18px 16px;text-align:center;margin-bottom:16px;position:relative;overflow:hidden;animation:slideUp .4s .1s ease both;}
.wc::before{content:'';position:absolute;top:-25px;right:-25px;width:80px;height:80px;border-radius:50%;background:rgba(212,168,42,.12);}
.wci{font-size:22px;margin-bottom:8px;position:relative;z-index:1;}
.wct{font-family:Georgia,serif;font-size:14px;font-weight:700;color:#fff;margin-bottom:4px;position:relative;z-index:1;}
.wct em{font-style:italic;color:var(--gold-ring);}
.wcs{font-size:10px;color:rgba(255,255,255,.6);margin-bottom:12px;position:relative;z-index:1;}
.wcb{display:inline-flex;align-items:center;gap:5px;background:var(--gold);color:var(--navy);font-size:11px;font-weight:800;padding:8px 16px;border-radius:7px;border:none;cursor:pointer;position:relative;z-index:1;}

.ic{background:var(--white);border:1px solid var(--border);border-radius:12px;overflow:hidden;margin-bottom:16px;animation:slideUp .4s ease both;}
.ich{display:flex;align-items:center;gap:7px;padding:12px 15px;border-bottom:1px solid var(--border);font-size:10px;font-weight:800;letter-spacing:.5px;text-transform:uppercase;color:var(--navy);}
.ich i{color:var(--gold);font-size:11px;}
.icb{padding:14px 15px;}
.dr{display:flex;align-items:center;justify-content:space-between;padding:7px 0;border-bottom:1px solid var(--bf);gap:6px;}
.dr:last-child{border-bottom:none;}
.dk{font-size:11px;color:var(--muted);font-weight:500;}
.dv{font-size:11px;font-weight:700;color:var(--navy);display:flex;align-items:center;gap:4px;}
.spg{display:grid;grid-template-columns:1fr 1fr;gap:7px;}
.sp2{background:var(--ivory);border:1px solid var(--border);border-radius:7px;padding:10px;}
.spl2{font-size:9px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;color:var(--muted);margin-bottom:3px;}
.spa{width:14px;height:2px;border-radius:2px;background:var(--gold);margin-bottom:3px;}
.spv{font-family:Georgia,serif;font-size:15px;font-weight:700;color:var(--navy);}
.spv.g{color:var(--profit)}.spv.r{color:var(--loss)}.spv.b{color:var(--blue)}
.rtw{margin-top:12px;}
.rl{display:flex;justify-content:space-between;font-size:10px;font-weight:600;color:var(--muted);margin-bottom:5px;}
.rtr{height:5px;background:var(--bf);border-radius:3px;overflow:hidden;}
.rf{height:100%;border-radius:3px;background:linear-gradient(90deg,var(--profit),#F5C842,var(--loss));width:12.34%;}
</style>

<!-- HERO -->
<div class="hero">
  <div class="bc"><span>Home</span><span>/</span><span>VPS</span><span>/</span><span>EA Rankings</span><span>/</span><strong style="color:var(--navy)"><?php echo htmlspecialchars($ea['id'],ENT_QUOTES); ?></strong></div>
  <div class="ps">
    <div class="pl">
      <div class="av"><?php echo htmlspecialchars(substr($ea['id'],0,2),ENT_QUOTES); ?></div>
      <div>
        <div class="nick"><em><?php echo htmlspecialchars($ea['display'],ENT_QUOTES); ?></em></div>
        <div class="tags">
          <span class="tag g">● <?php echo htmlspecialchars($ea['status'],ENT_QUOTES); ?></span>
          <span class="tag b">⊞ <?php echo htmlspecialchars($ea['platform'],ENT_QUOTES); ?></span>
          <span class="tag o">◈ <?php echo htmlspecialchars($ea['account_type'],ENT_QUOTES); ?></span>
          <span class="tag"><?php echo '🇨🇳 ' . htmlspecialchars($ea['location'],ENT_QUOTES); ?></span>
          <span class="tag">📅 Since <?php echo htmlspecialchars($ea['since'],ENT_QUOTES); ?></span>
        </div>
      </div>
    </div>
    <div class="actions">
      <button class="btn btn-out">↗ Share</button>
      <button class="btn btn-out">🔔 Alert</button>
      <button class="btn btn-gold">⭐ Follow EA</button>
    </div>
  </div>

  <div class="kpi-strip">
    <div class="kc"><div class="kl">Asset Under Mgmt.</div><div class="ka" style="background:var(--gold)"></div><div class="kv o"><?php echo '$' . number_format($ea['aum'],0, '.', ','); ?></div><div class="ks">USD</div></div>
    <div class="kc"><div class="kl">Total PnL</div><div class="ka" style="background:var(--loss)"></div><div class="kv <?php echo $ea['pnl']<0 ? 'r' : 'o'; ?>"><?php echo number_format($ea['pnl'],2); ?></div><div class="ks">USD</div></div>
    <div class="kc"><div class="kl">Win Rate</div><div class="ka" style="background:var(--blue)"></div><div class="kv b"><?php echo number_format($ea['win_rate'],2) . '%'; ?></div><div class="ks"><?php echo number_format($ea['trades']); ?> trades</div></div>
    <div class="kc"><div class="kl">Yield</div><div class="ka" style="background:var(--loss)"></div><div class="kv <?php echo $ea['yield']<0 ? 'r' : 'o'; ?>"><?php echo ($ea['yield']>0?'+':'') . number_format($ea['yield'],2) . '%'; ?></div><div class="ks">This period</div></div>
  </div>

  <div class="htabs">
    <button class="ht active">Overview</button>
    <button class="ht">Trade History</button>
    <button class="ht">Analytics</button>
    <button class="ht">Risk Report</button>
  </div>
  </div>

<div class="container">
  <!-- CONTENT -->
  <div class="content">
  <div class="layout">
    <div>
      <!-- Monthly -->
      <div class="card" style="animation-delay:.04s">
        <div class="ch"><div class="ct">Monthly <em>Performance</em></div><span style="font-size:10px;color:var(--muted);font-weight:600">Jan – May 2026</span></div>
        <div class="cb">
          <div class="mg" id="mg">
            <?php foreach($ea['monthly'] as $m): $posClass = $m['pos'] ? 'pos' : 'neg'; ?>
              <div class="mc"><div class="mn"><?php echo htmlspecialchars($m['label'],ENT_QUOTES); ?></div><div class="my <?php echo $posClass; ?>"><?php echo ($m['pct']>0?'+':'') . number_format($m['pct'],2) . '%'; ?></div><div class="mbw"><div class="mb <?php echo $posClass; ?>" style="height:0" data-h="<?php echo htmlspecialchars($m['bar'],ENT_QUOTES); ?>"></div></div><div class="mm"><?php echo htmlspecialchars($m['trades'],ENT_QUOTES); ?></div></div>
            <?php endforeach; ?>
          </div>
        </div>
      </div>

      <!-- Yield chart -->
      <div class="card" style="animation-delay:.08s">
        <div class="ch">
          <div class="ct">Yield <em>Trend</em></div>
          <span style="display:flex;align-items:center;gap:5px;font-size:10px;font-weight:600;color:var(--muted)"><span style="width:12px;height:3px;border-radius:2px;background:var(--blue);display:inline-block"></span>Cumulative</span>
        </div>
        <div class="cb" style="padding-bottom:10px">
          <svg class="yc" viewBox="0 0 600 80" preserveAspectRatio="none">
            <defs><linearGradient id="yg" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#1D5FCC" stop-opacity=".15"/><stop offset="100%" stop-color="#1D5FCC" stop-opacity="0"/></linearGradient></defs>
            <path d="M0,62 C50,58 95,36 140,34 C185,32 225,50 270,47 C315,44 355,26 400,22 C445,18 490,38 540,34 L600,30 L600,80 L0,80Z" fill="url(#yg)"/>
            <path d="M0,62 C50,58 95,36 140,34 C185,32 225,50 270,47 C315,44 355,26 400,22 C445,18 490,38 540,34 L600,30" stroke="var(--blue)" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
            <circle cx="0" cy="62" r="3" fill="var(--white)" stroke="var(--blue)" stroke-width="2"/>
            <circle cx="140" cy="34" r="3" fill="var(--white)" stroke="var(--blue)" stroke-width="2"/>
            <circle cx="270" cy="47" r="3" fill="var(--white)" stroke="var(--blue)" stroke-width="2"/>
            <circle cx="400" cy="22" r="3" fill="var(--white)" stroke="var(--blue)" stroke-width="2"/>
            <circle cx="540" cy="34" r="3" fill="var(--white)" stroke="var(--blue)" stroke-width="2"/>
            <circle cx="600" cy="30" r="3" fill="var(--white)" stroke="var(--blue)" stroke-width="2"/>
            <line x1="0" y1="78" x2="600" y2="78" stroke="var(--border)" stroke-width="1"/>
          </svg>
        </div>
      </div>

      <!-- Long/Short -->
      <div class="card" style="animation-delay:.12s">
        <div class="ch">
          <div class="ct">Long / <em>Short</em> Distribution</div>
          <div style="display:flex;gap:10px">
            <span style="display:flex;align-items:center;gap:4px;font-size:10px;font-weight:600;color:var(--muted)"><span style="width:8px;height:8px;border-radius:50%;background:var(--profit);display:inline-block"></span>Long</span>
            <span style="display:flex;align-items:center;gap:4px;font-size:10px;font-weight:600;color:var(--muted)"><span style="width:8px;height:8px;border-radius:50%;background:var(--loss);display:inline-block"></span>Short</span>
          </div>
        </div>
        <div class="cb" id="lsblock">
          <?php foreach($ea['ls'] as $item): ?>
            <div class="lsr"><div class="lsp"><?php echo htmlspecialchars($item['pair'],ENT_QUOTES); ?></div><div class="lst"><div class="lsl2" style="width:0" data-w="<?php echo (int)$item['long']; ?>%"><?php echo (int)$item['long']; ?>%</div><div class="lss" style="width:0" data-w="<?php echo (int)$item['short']; ?>%"><?php echo (int)$item['short']; ?>%</div></div><div class="lspct"><span style="color:var(--profit)"><?php echo (int)$item['long']; ?>%</span><span style="color:var(--loss)"><?php echo (int)$item['short']; ?>%</span></div></div>
          <?php endforeach; ?>
        </div>
      </div>

      <!-- Trades -->
      <div class="card" style="animation-delay:.16s">
        <div class="ch"><div class="ct">Recent <em>Closed Trades</em></div><a href="#" style="font-size:11px;font-weight:700;color:var(--blue);text-decoration:none">View All →</a></div>
        <div style="overflow-x:auto">
          <table class="tt">
            <thead><tr><th>Time</th><th>Pair</th><th>Dir.</th><th>Lots</th><th>Open</th><th>Close</th><th>PnL</th><th>Dur.</th></tr></thead>
            <tbody>
              <tr><td style="color:var(--muted);font-size:10px">05-04 14:22</td><td style="font-weight:800;font-family:monospace">XAUUSD</td><td><span class="db buy">BUY</span></td><td>0.10</td><td style="font-family:monospace;font-size:10px">3280.50</td><td style="font-family:monospace;font-size:10px">3285.20</td><td><span class="pp">+47.00</span></td><td style="color:var(--muted);font-size:10px">1h 12m</td></tr>
              <tr><td style="color:var(--muted);font-size:10px">05-04 11:05</td><td style="font-weight:800;font-family:monospace">EURUSD</td><td><span class="db sell">SELL</span></td><td>0.20</td><td style="font-family:monospace;font-size:10px">1.08742</td><td style="font-family:monospace;font-size:10px">1.08810</td><td><span class="pn">-13.60</span></td><td style="color:var(--muted);font-size:10px">38m</td></tr>
              <tr><td style="color:var(--muted);font-size:10px">05-04 09:44</td><td style="font-weight:800;font-family:monospace">XAUUSD</td><td><span class="db buy">BUY</span></td><td>0.05</td><td style="font-family:monospace;font-size:10px">3271.00</td><td style="font-family:monospace;font-size:10px">3278.80</td><td><span class="pp">+39.00</span></td><td style="color:var(--muted);font-size:10px">2h 04m</td></tr>
              <tr><td style="color:var(--muted);font-size:10px">05-03 21:13</td><td style="font-weight:800;font-family:monospace">GBPUSD</td><td><span class="db buy">BUY</span></td><td>0.15</td><td style="font-family:monospace;font-size:10px">1.26830</td><td style="font-family:monospace;font-size:10px">1.26920</td><td><span class="pp">+13.50</span></td><td style="color:var(--muted);font-size:10px">55m</td></tr>
              <tr><td style="color:var(--muted);font-size:10px">05-03 16:58</td><td style="font-weight:800;font-family:monospace">USDJPY</td><td><span class="db sell">SELL</span></td><td>0.10</td><td style="font-family:monospace;font-size:10px">153.420</td><td style="font-family:monospace;font-size:10px">153.500</td><td><span class="pn">-8.00</span></td><td style="color:var(--muted);font-size:10px">22m</td></tr>
              <tr><td style="color:var(--muted);font-size:10px">05-03 13:40</td><td style="font-weight:800;font-family:monospace">XAUUSD</td><td><span class="db sell">SELL</span></td><td>0.08</td><td style="font-family:monospace;font-size:10px">3310.00</td><td style="font-family:monospace;font-size:10px">3306.40</td><td><span class="pp">+28.80</span></td><td style="color:var(--muted);font-size:10px">3h 18m</td></tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>

    <!-- SIDEBAR -->
    <div>
      <div class="wc">
        <div class="wci">⭐</div>
        <div class="wct">Track This <em>EA</em></div>
        <div class="wcs">Get real-time alerts on trade signals & yield milestones.</div>
        <button class="wcb">🔔 Add to Watchlist</button>
      </div>

      <div class="ic" style="animation-delay:.06s">
        <div class="ich"><i class="fas fa-id-card"></i> EA Details</div>
        <div class="icb">
          <div class="dr"><span class="dk">Account ID</span><span class="dv" style="font-family:monospace;font-size:10px"><?php echo htmlspecialchars($ea['id'] . '-' . $ea['account_type'] . '-' . $ea['platform'],ENT_QUOTES); ?></span></div>
          <div class="dr"><span class="dk">Platform</span><span class="dv"><?php echo htmlspecialchars($ea['platform'],ENT_QUOTES); ?></span></div>
          <div class="dr"><span class="dk">Account Type</span><span class="dv"><?php echo htmlspecialchars($ea['account_type'],ENT_QUOTES); ?></span></div>
          <div class="dr"><span class="dk">VPS Location</span><span class="dv"><?php echo htmlspecialchars('🇨🇳 ' . $ea['location'],ENT_QUOTES); ?></span></div>
          <div class="dr"><span class="dk">Live Since</span><span class="dv"><?php echo htmlspecialchars('15 ' . $ea['since'],ENT_QUOTES); ?></span></div>
          <div class="dr"><span class="dk">Total Trades</span><span class="dv"><?php echo number_format($ea['trades']); ?></span></div>
          <div class="dr"><span class="dk">Avg Hold Time</span><span class="dv"><?php echo htmlspecialchars($ea['avg_hold'],ENT_QUOTES); ?></span></div>
          <div class="dr"><span class="dk">Equity Peak</span><span class="dv" style="color:var(--profit)"><?php echo '$' . number_format($ea['equity_peak'],2); ?></span></div>
        </div>
      </div>

      <div class="ic" style="animation-delay:.10s">
        <div class="ich"><i class="fas fa-chart-bar"></i> Advanced Stats</div>
        <div class="icb">
          <div class="spg">
            <div class="sp2"><div class="spl2">Profit Factor</div><div class="spa"></div><div class="spv"><?php echo number_format($ea['stats']['profit_factor'],2); ?></div></div>
            <div class="sp2"><div class="spl2">Sharpe Ratio</div><div class="spa"></div><div class="spv"><?php echo number_format($ea['stats']['sharpe'],2); ?></div></div>
            <div class="sp2"><div class="spl2">Max Drawdown</div><div class="spa" style="background:var(--loss)"></div><div class="spv r"><?php echo number_format($ea['stats']['max_dd'],2); ?>%</div></div>
            <div class="sp2"><div class="spl2">Win Rate</div><div class="spa" style="background:var(--blue)"></div><div class="spv b"><?php echo number_format($ea['stats']['win_rate'],2); ?>%</div></div>
          </div>
          <div class="rtw">
            <div class="rl"><span>Risk Level</span><span style="color:var(--navy);font-weight:700">Moderate (12.34%)</span></div>
            <div class="rtr"><div class="rf" style="width:0" id="rf"></div></div>
          </div>
        </div>
      </div>

      <div class="ic" style="animation-delay:.14s">
        <div class="ich"><i class="fas fa-building-columns"></i> Broker</div>
        <div class="icb">
          <div style="display:flex;align-items:center;gap:10px;background:var(--ivory);border:1px solid var(--border);border-radius:8px;padding:11px;">
            <div style="width:36px;height:36px;border-radius:8px;background:var(--white);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:800;color:var(--muted);flex-shrink:0;">BG</div>
            <div><div style="font-size:12px;font-weight:700">Blackwell Global</div><div style="font-size:10px;color:var(--muted)">ECN · MT5</div></div>
          </div>
          <div style="margin-top:10px">
            <div class="dr"><span class="dk">Regulation</span><span class="dv" style="color:var(--profit)">✓ Regulated</span></div>
            <div class="dr"><span class="dk">Min. Spread</span><span class="dv">0.1 pips</span></div>
            <div class="dr"><span class="dk">Execution</span><span class="dv">Market</span></div>
          </div>
        </div>
      </div>
    </div>
  </div>
  </div>
</div>

<script>
(()=>{
  // monthly bars
  const bars=document.querySelectorAll('.mb[data-h]');
  const goM=()=>bars.forEach((b,i)=>setTimeout(()=>{b.style.height=b.dataset.h;},i*100));
  const io1=new IntersectionObserver(e=>{e.forEach(x=>{if(x.isIntersecting){goM();io1.disconnect();}});},{threshold:.2});
  io1.observe(document.getElementById('mg'));

  // ls bars
  const ls=document.querySelectorAll('[data-w]');
  const goL=()=>ls.forEach((b,i)=>setTimeout(()=>{b.style.width=b.dataset.w;},i*40));
  const io2=new IntersectionObserver(e=>{e.forEach(x=>{if(x.isIntersecting){goL();io2.disconnect();}});},{threshold:.2});
  io2.observe(document.getElementById('lsblock'));

  // risk fill
  setTimeout(()=>{document.getElementById('rf').style.width='<?php echo $ea['risk_level']; ?>%';},400);

  // tabs
  document.querySelectorAll('.ht').forEach(b=>{
    b.addEventListener('click',()=>{
      document.querySelectorAll('.ht').forEach(x=>x.classList.remove('active'));
      b.classList.add('active');
    });
  });
})();
</script>
<?php include __DIR__ . '/../includes/footer.php'; ?>
