<?php $lang=stb_lang(); $B='/NewSite'; $f=$lang==='fa'; 
$login_label_url = $lang==='fa' ? 'https://crm.stbbrokers.com/fa':'https://crm.stbbrokers.com/';
$register_label_url = $lang==='fa' ? 'https://crm.stbbrokers.com/fa/register':'https://crm.stbbrokers.com/register/';
?>
<style>
/* ══════════════════════════════════════════════════════════════
   LEVERAGE & MARGIN — Futuristic Animated
══════════════════════════════════════════════════════════════ */
.lv-rev{opacity:0;transform:translateY(28px);transition:opacity .7s cubic-bezier(.16,1,.3,1),transform .7s cubic-bezier(.16,1,.3,1)}
.lv-rev.vis{opacity:1;transform:none}
.lv-rev.d1{transition-delay:.12s}.lv-rev.d2{transition-delay:.24s}.lv-rev.d3{transition-delay:.36s}

/* Hero BG */
.lv-hero-bg{position:absolute;inset:0;
  background:radial-gradient(ellipse 70% 50% at 50% -10%,rgba(200,16,46,.15),transparent),
  radial-gradient(ellipse 40% 40% at 85% 80%,rgba(20,224,163,.06),transparent),
  repeating-linear-gradient(0deg,transparent,transparent 59px,rgba(200,16,46,.02) 60px),
  repeating-linear-gradient(90deg,transparent,transparent 59px,rgba(200,16,46,.02) 60px)}
.lv-particles{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:0}
.lv-particle{position:absolute;width:2px;height:2px;background:rgba(200,16,46,.3);border-radius:50%;animation:lv-float linear infinite}
@keyframes lv-float{0%{transform:translateY(0);opacity:0}10%{opacity:1}90%{opacity:1}100%{transform:translateY(-100vh);opacity:0}}

/* ── Leverage Tier Cards (visual impact) ── */
.lv-tiers{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:56px}
@media(max-width:900px){.lv-tiers{grid-template-columns:repeat(2,1fr)}}
@media(max-width:500px){.lv-tiers{grid-template-columns:1fr}}
.lv-tier{background:#0a0c10;border:1px solid rgba(255,255,255,.06);border-radius:16px;
  padding:28px 24px;position:relative;overflow:hidden;text-align:center;
  transition:all .3s;cursor:default}
.lv-tier::before{content:'';position:absolute;top:0;left:0;right:0;height:2px;
  background:var(--tc,#C8102E);transform:scaleX(0);transform-origin:center;
  transition:transform .4s cubic-bezier(.16,1,.3,1)}
.lv-tier:hover{border-color:rgba(255,255,255,.12);transform:translateY(-4px);
  box-shadow:0 20px 50px rgba(0,0,0,.5)}
.lv-tier:hover::before{transform:scaleX(1)}
/* Glow behind value */
.lv-tier::after{content:'';position:absolute;top:30%;left:50%;transform:translateX(-50%);
  width:100px;height:60px;border-radius:50%;background:radial-gradient(circle,var(--tc)15,transparent 70%);
  opacity:0;transition:opacity .3s;pointer-events:none}
.lv-tier:hover::after{opacity:1}
.lv-tier-icon{width:44px;height:44px;border-radius:11px;margin:0 auto 16px;
  background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.07);
  display:flex;align-items:center;justify-content:center}
.lv-tier-icon svg{stroke:var(--tc,#C8102E);fill:none;width:20px;height:20px}
.lv-tier-val{font-size:36px;font-weight:800;color:#fff;margin-bottom:6px;line-height:1;position:relative;z-index:1}
.lv-tier-val em{font-style:normal;font-size:.45em;color:var(--tc,#C8102E);vertical-align:super}
.lv-tier-label{font-size:14px;font-weight:700;color:rgba(255,255,255,.6);margin-bottom:4px}
.lv-tier-sub{font-size:11.5px;color:rgba(255,255,255,.3);line-height:1.5}
.lv-tier-margin{margin-top:14px;padding-top:12px;border-top:1px solid rgba(255,255,255,.06);
  font-size:11px;color:rgba(255,255,255,.25)}
.lv-tier-margin em{font-style:normal;color:var(--tc);font-weight:700}

/* ── Detailed Leverage Table Widget ── */
.lv-widget{border-radius:20px;overflow:hidden;background:linear-gradient(160deg,#080a0f,#0c0e14);
  border:1px solid rgba(255,255,255,.07);margin-bottom:56px;position:relative}
.lv-widget::before{content:'';position:absolute;inset:0;
  background:radial-gradient(ellipse 50% 40% at 20% 0%,rgba(200,16,46,.04),transparent);pointer-events:none}
.lv-widget::after{content:'';position:absolute;top:0;left:0;right:0;height:1px;
  background:linear-gradient(90deg,transparent,rgba(200,16,46,.4),transparent);animation:lv-sweep 5s linear infinite}
@keyframes lv-sweep{0%,100%{opacity:.3}50%{opacity:1}}
.lv-widget-bar{display:flex;align-items:center;justify-content:space-between;
  padding:18px 28px;border-bottom:1px solid rgba(255,255,255,.06);position:relative;z-index:2}
@media(max-width:600px){.lv-widget-bar{padding:14px 16px;flex-wrap:wrap;gap:10px}}
.lv-widget-title{font-size:13px;font-weight:700;color:rgba(255,255,255,.5);
  display:flex;align-items:center;gap:8px}
.lv-widget-title::before{content:'';width:6px;height:6px;border-radius:50%;background:#C8102E;
  box-shadow:0 0 8px rgba(200,16,46,.5);animation:lv-dot 2s infinite}
@keyframes lv-dot{0%,100%{box-shadow:0 0 4px rgba(200,16,46,.3)}50%{box-shadow:0 0 14px rgba(200,16,46,.7)}}
.lv-widget-badge{font-size:11px;font-weight:700;padding:5px 12px;border-radius:8px;
  background:rgba(20,224,163,.06);border:1px solid rgba(20,224,163,.15);color:#14e0a3}
.lv-tbl-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;position:relative;z-index:1}
.lv-tbl{width:100%;border-collapse:collapse;min-width:650px}
.lv-tbl th{padding:12px 24px;font-size:9.5px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;
  color:rgba(255,255,255,.2);background:rgba(255,255,255,.02);border-bottom:1px solid rgba(255,255,255,.06);text-align:left}
.lv-tbl td{padding:13px 24px;font-size:13px;color:rgba(255,255,255,.5);
  border-bottom:1px solid rgba(255,255,255,.035);transition:all .15s}
.lv-tbl td:first-child{font-weight:700;color:#fff}
.lv-tbl tr:last-child td{border-bottom:none}
.lv-tbl tbody tr{cursor:default;transition:background .15s}
.lv-tbl tbody tr:hover td{background:rgba(200,16,46,.04);color:rgba(255,255,255,.75)}
/* Leverage value highlight */
.lv-tbl .lv-val{font-weight:800;color:#C8102E}
.lv-tbl .lv-margin{color:#14e0a3;font-weight:600}
.lv-tbl .lv-contract{font-family:'SF Mono',monospace;font-size:12px;color:rgba(255,255,255,.4)}
/* Row stagger */
.lv-tbl tbody tr{opacity:0;animation:lv-row .3s ease-out forwards}
@keyframes lv-row{to{opacity:1}}
@media(max-width:700px){.lv-scroll-hint{display:block;text-align:center;font-size:11px;color:rgba(255,255,255,.2);padding:6px}}

/* ── Interactive Margin Calculator ── */
.lv-calc{display:grid;grid-template-columns:1fr 1fr;gap:0;border-radius:20px;overflow:hidden;
  background:linear-gradient(135deg,#080a0f,#0c0e14);border:1px solid rgba(255,255,255,.07);
  margin-bottom:56px;position:relative}
@media(max-width:800px){.lv-calc{grid-template-columns:1fr}}
.lv-calc::before{content:'';position:absolute;inset:0;
  background:radial-gradient(ellipse 60% 50% at 80% 20%,rgba(20,224,163,.04),transparent);pointer-events:none}
.lv-calc-form{padding:40px 36px;position:relative;z-index:1}
@media(max-width:800px){.lv-calc-form{padding:28px 20px}}
.lv-calc-kicker{font-size:10px;font-weight:700;letter-spacing:.15em;text-transform:uppercase;
  color:rgba(20,224,163,.7);margin-bottom:12px;display:flex;align-items:center;gap:8px}
.lv-calc-kicker::before{content:'';width:6px;height:6px;border-radius:50%;background:#14e0a3;
  box-shadow:0 0 8px #14e0a3;animation:lv-dot-g 2s infinite}
@keyframes lv-dot-g{0%,100%{box-shadow:0 0 4px #14e0a3}50%{box-shadow:0 0 14px rgba(20,224,163,.6)}}
.lv-calc-title{font-size:24px;font-weight:800;color:#fff;margin-bottom:8px;line-height:1.2}
.lv-calc-title em{font-style:normal;color:#14e0a3}
.lv-calc-desc{font-size:13.5px;color:rgba(255,255,255,.4);line-height:1.6;margin-bottom:28px}
.lv-calc-field{margin-bottom:18px}
.lv-calc-label{font-size:11px;font-weight:700;color:rgba(255,255,255,.35);letter-spacing:.06em;
  text-transform:uppercase;margin-bottom:6px;display:block}
.lv-calc-input{width:100%;padding:10px 14px;border-radius:10px;font-size:14px;font-weight:600;
  background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);color:#fff;outline:none;
  transition:all .2s;font-variant-numeric:tabular-nums}
.lv-calc-input:focus{border-color:rgba(20,224,163,.4);box-shadow:0 0 16px rgba(20,224,163,.08)}
.lv-calc-select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;background-size:10px;padding-right:32px}
/* Result panel */
.lv-calc-result{padding:40px 36px;border-left:1px solid rgba(255,255,255,.06);
  display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;
  position:relative;z-index:1}
@media(max-width:800px){.lv-calc-result{padding:28px 20px;border-left:none;border-top:1px solid rgba(255,255,255,.06)}}
.lv-calc-result-label{font-size:10px;font-weight:700;letter-spacing:.15em;text-transform:uppercase;
  color:rgba(255,255,255,.25);margin-bottom:12px}
.lv-calc-result-val{font-size:48px;font-weight:800;color:#14e0a3;line-height:1;margin-bottom:6px;
  font-variant-numeric:tabular-nums;transition:all .4s;text-shadow:0 0 30px rgba(20,224,163,.3)}
@media(max-width:560px){.lv-calc-result-val{font-size:36px}}
.lv-calc-result-sub{font-size:12px;color:rgba(255,255,255,.3);margin-bottom:24px}
.lv-calc-result-info{display:flex;flex-direction:column;gap:8px;width:100%;max-width:220px}
.lv-calc-info-row{display:flex;justify-content:space-between;font-size:12px;
  padding:6px 0;border-bottom:1px solid rgba(255,255,255,.04)}
.lv-calc-info-label{color:rgba(255,255,255,.3)}
.lv-calc-info-val{color:rgba(255,255,255,.7);font-weight:700}

/* ── Risk features ── */
.lv-risk-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:56px}
@media(max-width:700px){.lv-risk-grid{grid-template-columns:1fr}}
.lv-risk-card{background:#0a0c10;border:1px solid rgba(255,255,255,.06);border-radius:14px;
  padding:24px;display:flex;gap:16px;transition:all .25s;position:relative;overflow:hidden}
.lv-risk-card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;
  background:var(--rc,#C8102E);opacity:0;transition:opacity .25s}
.lv-risk-card:hover{border-color:rgba(255,255,255,.12);background:#0d0f14}
.lv-risk-card:hover::before{opacity:1}
.lv-risk-icon{width:40px;height:40px;border-radius:10px;flex-shrink:0;
  background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.07);
  display:flex;align-items:center;justify-content:center}
.lv-risk-icon svg{stroke:var(--rc,#C8102E);fill:none;width:18px;height:18px}
.lv-risk-title{font-size:14px;font-weight:700;color:#fff;margin-bottom:5px}
.lv-risk-desc{font-size:12.5px;color:rgba(255,255,255,.4);line-height:1.6}

/* Mobile */
@media(max-width:560px){
  .ip-hero-stats{gap:20px}
  .ip-hero-ctas{flex-direction:column}
  .ip-hero-ctas a{text-align:center;justify-content:center}
  .lv-risk-card{flex-direction:column;gap:12px}
  .lv-tier-val{font-size:28px}
}

/* ── Dynamic Leverage Table ── */
.lv-dyn-lev-wrap {
  margin-bottom: 56px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.07);
  background: #0a0c10;
  padding: 28px 24px;
}
.lv-dyn-lev-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lv-dyn-lev-desc {
  font-size: 13.5px;
  color: rgba(255,255,255,.5);
  margin-bottom: 20px;
  line-height: 1.6;
}
body.rtl .lv-dyn-lev-title, body.rtl .lv-dyn-lev-desc {
  text-align: right;
}
.lv-dyn-lev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media(max-width: 768px) {
  .lv-dyn-lev-grid {
    grid-template-columns: 1fr;
  }
}
.lv-dyn-lev-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
body.rtl .lv-dyn-lev-table {
  text-align: right;
}
.lv-dyn-lev-table th {
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-weight: 700;
}
.lv-dyn-lev-table td {
  padding: 12px;
  font-size: 13px;
  color: rgba(255,255,255,.8);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.lv-dyn-lev-table tr:last-child td {
  border-bottom: none;
}
.lv-dyn-lev-group-title {
  font-size: 14px;
  font-weight: 700;
  color: #C8102E;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
body.rtl .lv-dyn-lev-group-title {
  justify-content: flex-start;
}
.lv-dyn-lev-table td strong {
  color: #fff;
}
</style>

<article class="ip-page">
<!-- ═══ HERO ═══ -->
<div class="ip-hero" style="position:relative;overflow:hidden">
  <div class="lv-hero-bg"></div>
  <div class="ip-hero-glow"></div>
  <div class="lv-particles" id="lv-particles"></div>
  <div class="ip-container" style="position:relative;z-index:1">
    <nav class="ip-breadcrumb">
      <a href="<?php echo stb_url($B.'/'); ?>"><?php echo $f?'خانه':'Home';?></a>
      <span class="ip-breadcrumb-sep">›</span>
      <span><?php echo $f?'اهرم و مارجین':'Leverage & Margin';?></span>
    </nav>
    <div class="ip-kicker"><span class="ip-kicker-dot"></span><?php echo $f?'بروکر STB':'STB BROKER';?></div>
    <h1 class="ip-h1"><?php echo $f?'اهرم <em>انعطاف‌پذیر</em>':'Flexible <em>Leverage</em>';?></h1>
    <p class="ip-hero-desc"><?php echo $f?'معامله پوزیشن‌های بزرگ‌تر با سرمایه کمتر. STB تا ۱:۳۰۰ اهرم ارائه می‌دهد — برای تقویت استراتژی شما با مدیریت ریسک مسئولانه.':'Trade larger positions with smaller capital. STB offers up to 1:300 leverage — designed to amplify your strategy with responsible risk management.';?></p>
    <div class="ip-hero-stats">
      <div><div class="ip-stat-val">1:300</div><div class="ip-stat-lbl"><?php echo $f?'حداکثر فارکس':'Max Forex';?></div></div>
      <div><div class="ip-stat-val">1:100</div><div class="ip-stat-lbl"><?php echo $f?'طلا و کالا':'Gold & Commodities';?></div></div>
      <div><div class="ip-stat-val">1:20</div><div class="ip-stat-lbl"><?php echo $f?'کریپتو و سهام':'Crypto & Equities';?></div></div>
      <div><div class="ip-stat-val">0.01</div><div class="ip-stat-lbl"><?php echo $f?'حداقل لات':'Min Lot Size';?></div></div>
    </div>
    <div class="ip-hero-ctas">
      <a href="<?php echo esc_html($register_label_url);?>" class="ip-btn-red"><?php echo $f?'شروع معامله':'Start Trading';?> <svg viewBox="0 0 24 24"><path d="M5 12h14M12 5l7 7-7 7" stroke-width="2" stroke-linecap="round"/></svg></a>
      <a href="<?php echo stb_url($B.'/trading-accounts/'); ?>" class="ip-btn-ghost"><?php echo $f?'مشاهده حساب‌ها':'View Accounts';?></a>
    </div>
  </div>
</div>

<!-- ═══ LEVERAGE TIER CARDS ═══ -->
<section class="ip-section">
  <div class="ip-container">
    <h2 class="ip-section-title lv-rev"><?php echo $f?'سطوح <em>اهرم</em> بر اساس کلاس دارایی':'Leverage <em>Tiers</em> by Asset Class';?></h2>
    <p class="ip-section-desc lv-rev d1"><?php echo $f?'اهرم به صورت مسئولانه ارائه می‌شود. دارندگان حساب حرفه‌ای می‌توانند اهرم بالاتر درخواست کنند.':'Leverage is offered responsibly. Professional account holders may request higher leverage.';?></p>

    <div class="lv-tiers lv-rev d2">
      <?php $tiers = $f ? [
        ['#C8102E','<circle cx="12" cy="12" r="10" stroke-width="1.5"/><path d="M2 12h20M12 2a15.3 15.3 0 010 20 15.3 15.3 0 000 20" stroke-width="1.5"/>',
         '1:300','فارکس','۷۰ جفت‌ارز اصلی، فرعی و اگزاتیک','0.33'],
        ['#C8102E','<circle cx="12" cy="12" r="5" stroke-width="1.5"/><path d="M12 1v4M12 19v4M4.22 4.22l2.83 2.83M16.95 16.95l2.83 2.83M1 12h4M19 12h4" stroke-width="1.5"/>',
         '1:100','طلا، کالاها و شاخص‌ها','XAUUSD، نفت، S&P 500، DAX و بیشتر','1.0'],
        ['#14e0a3','<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke-width="1.5"/>',
         '1:20','ارز دیجیتال','BTC، ETH، SOL و ۵۷ رمزارز دیگر','5.0'],
        ['#14e0a3','<rect x="2" y="3" width="20" height="14" rx="2" stroke-width="1.5"/><path d="M8 21h8M12 17v4" stroke-width="1.5" stroke-linecap="round"/>',
         '1:20','سهام (CFD)','۲۱۲+ سهام آمریکا، اروپا و آسیا','5.0'],
      ] : [
        ['#C8102E','<circle cx="12" cy="12" r="10" stroke-width="1.5"/><path d="M2 12h20M12 2a15.3 15.3 0 010 20 15.3 15.3 0 000 20" stroke-width="1.5"/>',
         '1:300','Forex','70 major, minor & exotic currency pairs','0.33'],
        ['#C8102E','<circle cx="12" cy="12" r="5" stroke-width="1.5"/><path d="M12 1v4M12 19v4M4.22 4.22l2.83 2.83M16.95 16.95l2.83 2.83M1 12h4M19 12h4" stroke-width="1.5"/>',
         '1:100','Gold, Commodities & Indices','XAUUSD, Oil, S&P 500, DAX and more','1.0'],
        ['#14e0a3','<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke-width="1.5"/>',
         '1:20','Cryptocurrencies','BTC, ETH, SOL and 57 crypto CFDs','5.0'],
        ['#14e0a3','<rect x="2" y="3" width="20" height="14" rx="2" stroke-width="1.5"/><path d="M8 21h8M12 17v4" stroke-width="1.5" stroke-linecap="round"/>',
         '1:20','Equities (CFD)','212+ US, European & Asian stocks','5.0'],
      ];
      foreach($tiers as $t): ?>
      <div class="lv-tier" style="--tc:<?php echo $t[0]; ?>">
        <div class="lv-tier-icon"><svg viewBox="0 0 24 24"><?php echo $t[1]; ?></svg></div>
        <div class="lv-tier-val"><?php echo $t[2]; ?></div>
        <div class="lv-tier-label"><?php echo $t[3]; ?></div>
        <div class="lv-tier-sub"><?php echo $t[4]; ?></div>
        <div class="lv-tier-margin"><?php echo $f?'حداقل مارجین':'Min Margin';?>: <em><?php echo $t[5]; ?>%</em></div>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- ═══ DETAILED LEVERAGE TABLE ═══ -->
<section class="ip-section alt">
  <div class="ip-container">
    <div class="lv-widget lv-rev">
      <div class="lv-widget-bar">
        <div class="lv-widget-title"><?php echo $f?'جدول اهرم و مارجین':'LEVERAGE & MARGIN TABLE';?></div>
        <div class="lv-widget-badge"><?php echo $f?'حساب Prime':'Prime Account';?></div>
      </div>
      <div class="lv-tbl-wrap">
        <table class="lv-tbl">
          <thead><tr>
            <th><?php echo $f?'کلاس دارایی':'Asset Class';?></th>
            <th><?php echo $f?'نمادهای شاخص':'Example Symbols';?></th>
            <th><?php echo $f?'حداکثر اهرم':'Max Leverage';?></th>
            <th><?php echo $f?'مارجین':'Margin %';?></th>
            <th><?php echo $f?'حجم قرارداد':'Contract Size';?></th>
            <th><?php echo $f?'حداقل لات':'Min Lot';?></th>
          </tr></thead>
          <tbody>
            <?php $rows = $f ? [
              ['فارکس — اصلی','EURUSD, GBPUSD, USDJPY','1:300','0.33%','100,000','0.01'],
              ['فارکس — فرعی','AUDCAD, EURGBP, NZDJPY','1:200','0.5%','100,000','0.01'],
              ['فارکس — اگزاتیک','USDTRY, USDMXN, USDZAR','1:100','1%','100,000','0.01'],
              ['طلا (XAUUSD)','XAUUSD, XAUEUR','1:100','1%','100 oz','0.01'],
              ['طلا گرمی','Gold24k, Gold18k','1:100','1%','100 گرم','0.01'],
              ['نقره','XAGUSD, XAGEUR','1:100','1%','5,000 oz','0.01'],
              ['پالادیوم و پلاتین','XPDUSD, XPTUSD','1:50','2%','100 oz','0.01'],
              ['نفت خام','BRNUSD, WTIUSD','1:100','1%','1,000 بشکه','0.01'],
              ['گاز طبیعی','NGCUSD','1:50','2%','10,000','0.01'],
              ['شاخص‌های جهانی','SPXUSD, NDXUSD, DAXEUR','1:100','1%','10','0.1'],
              ['ارز دیجیتال — اصلی','BTCUSD, ETHUSD','1:20','5%','1','0.01'],
              ['ارز دیجیتال — آلت‌کوین','SOLUSD, BNBUSD, ADAUSD','1:10','10%','1','0.01'],
              ['سهام آمریکا','Apple, Tesla, NVIDIA','1:20','5%','100 سهم','0.1'],
              ['سهام اروپا','BMW, LVMH, Siemens','1:20','5%','100 سهم','0.1'],
              ['سهام آسیا','Tencent, Xiaomi, AIA','1:20','5%','100 سهم','0.1'],
              ['اسپات','XAUUSDspot, BTCUSDspot','1:10','10%','متغیر','0.01'],
            ] : [
              ['Forex — Majors','EURUSD, GBPUSD, USDJPY','1:300','0.33%','100,000','0.01'],
              ['Forex — Minors','AUDCAD, EURGBP, NZDJPY','1:200','0.5%','100,000','0.01'],
              ['Forex — Exotics','USDTRY, USDMXN, USDZAR','1:100','1%','100,000','0.01'],
              ['Gold (XAUUSD)','XAUUSD, XAUEUR','1:100','1%','100 oz','0.01'],
              ['Gold per Gram','Gold24k, Gold18k','1:100','1%','100 grams','0.01'],
              ['Silver','XAGUSD, XAGEUR','1:100','1%','5,000 oz','0.01'],
              ['Palladium & Platinum','XPDUSD, XPTUSD','1:50','2%','100 oz','0.01'],
              ['Crude Oil','BRNUSD, WTIUSD','1:100','1%','1,000 barrels','0.01'],
              ['Natural Gas','NGCUSD','1:50','2%','10,000','0.01'],
              ['Global Indices','SPXUSD, NDXUSD, DAXEUR','1:100','1%','10','0.1'],
              ['Crypto — Majors','BTCUSD, ETHUSD','1:20','5%','1','0.01'],
              ['Crypto — Altcoins','SOLUSD, BNBUSD, ADAUSD','1:10','10%','1','0.01'],
              ['US Equities','Apple, Tesla, NVIDIA','1:20','5%','100 shares','0.1'],
              ['EU Equities','BMW, LVMH, Siemens','1:20','5%','100 shares','0.1'],
              ['Asian Equities','Tencent, Xiaomi, AIA','1:20','5%','100 shares','0.1'],
              ['Spot Assets','XAUUSDspot, BTCUSDspot','1:10','10%','Variable','0.01'],
            ];
            foreach($rows as $i=>$r): ?>
            <tr style="animation-delay:<?php echo $i*0.04; ?>s">
              <td><?php echo $r[0]; ?></td>
              <td class="lv-contract"><?php echo $r[1]; ?></td>
              <td class="lv-val"><?php echo $r[2]; ?></td>
              <td class="lv-margin"><?php echo $r[3]; ?></td>
              <td><?php echo $r[4]; ?></td>
              <td><?php echo $r[5]; ?></td>
            </tr>
            <?php endforeach; ?>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</section>

<!-- ═══ SECTION: Dynamic Leverage Table ═══ -->
<section class="ip-section">
  <div class="ip-container">
    <div class="lv-dyn-lev-wrap lv-rev d1">
      <div class="lv-dyn-lev-title">
        <svg viewBox="0 0 24 24" width="20" height="20" stroke="#C8102E" stroke-width="2" fill="none"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" stroke-linecap="round" stroke-linejoin="round"/></svg>
        <?php echo $f ? 'اهرم معاملاتی شناور (پویا)' : 'Dynamic Leverage System'; ?>
      </div>
      <p class="lv-dyn-lev-desc">
        <?php echo $f 
          ? 'اهرم حساب‌های معاملاتی Zero بر اساس حجم پوزیشن معاملاتی (ارزش اسمی پوزیشن) به صورت خودکار تغییر می‌کند. این تغییر به ازای هر نماد اعمال می‌شود:' 
          : 'Leverage on Zero accounts dynamically updates based on the total position size (Notional Value). This is calculated per instrument:'; ?>
      </p>
      <div class="lv-dyn-lev-grid">
        
        <!-- Group 1: FX & Commodities -->
        <div>
          <div class="lv-dyn-lev-group-title">
            <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 8v4l3 3" stroke-linecap="round"/></svg>
            <?php echo $f ? 'جفت‌ارزها، فلزات، شاخص‌ها و انرژی‌ها' : 'FX, Metals, Indices & Energies'; ?>
          </div>
          <table class="lv-dyn-lev-table">
            <thead>
              <tr>
                <th><?php echo $f ? 'ارزش اسمی پوزیشن' : 'Position Notional'; ?></th>
                <th><?php echo $f ? 'اهرم پویا' : 'Dynamic Leverage'; ?></th>
                <th><?php echo $f ? 'حداکثر اهرم مجاز' : 'Max Allowed Leverage'; ?></th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><?php echo $f ? 'تا $۹,۹۹۹' : 'From $0 To $9.99 K'; ?></td>
                <td><strong><?php echo $f ? '۱۰۰٪ اهرم حساب' : '100% of account leverage'; ?></strong></td>
                <td><?php echo $f ? 'تا ۱:۲۰۰' : 'up to 1:200'; ?></td>
              </tr>
              <tr>
                <td><?php echo $f ? 'از $۱۰,۰۰۰ تا $۲۹,۹۹۹' : 'From $10 K To $29.99 K'; ?></td>
                <td><strong><?php echo $f ? '۳۳٪ اهرم حساب' : '33% of account leverage'; ?></strong></td>
                <td>-</td>
              </tr>
              <tr>
                <td><?php echo $f ? 'از $۳۰,۰۰۰ تا $۰.۹۹M' : 'From $30 K To $0.99 M'; ?></td>
                <td><strong><?php echo $f ? '۵٪ اهرم حساب' : '5% of account leverage'; ?></strong></td>
                <td>-</td>
              </tr>
              <tr>
                <td><?php echo $f ? 'بیشتر از $۱M' : 'More than $1 M'; ?></td>
                <td><strong><?php echo $f ? '۱٪ اهرم حساب' : '1% of account leverage'; ?></strong></td>
                <td>-</td>
              </tr>
            </tbody>
          </table>
        </div>

        <!-- Group 2: Crypto -->
        <div>
          <div class="lv-dyn-lev-group-title" style="color: #14e0a3;">
            <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" stroke-width="2"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke-linecap="round" stroke-linejoin="round"/></svg>
            <?php echo $f ? 'ارزهای دیجیتال (کریپتو)' : 'Cryptocurrencies (Crypto)'; ?>
          </div>
          <table class="lv-dyn-lev-table">
            <thead>
              <tr>
                <th><?php echo $f ? 'ارزش اسمی پوزیشن' : 'Position Notional'; ?></th>
                <th><?php echo $f ? 'اهرم پویا' : 'Dynamic Leverage'; ?></th>
                <th><?php echo $f ? 'حداکثر اهرم مجاز' : 'Max Allowed Leverage'; ?></th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><?php echo $f ? 'تا $۹,۹۹۹' : 'From $0 To $9.99 K'; ?></td>
                <td><strong>۱:۷۵</strong></td>
                <td><?php echo $f ? 'تا ۱:۷۵' : 'up to 1:75'; ?></td>
              </tr>
              <tr>
                <td><?php echo $f ? 'از $۱۰,۰۰۰ تا $۲۹,۹۹۹' : 'From $10 K To $29.99 K'; ?></td>
                <td><strong>۱:۲۵</strong></td>
                <td>-</td>
              </tr>
              <tr>
                <td><?php echo $f ? 'از $۳۰,۰۰۰ تا $۰.۹۹M' : 'From $30 K To $0.99 M'; ?></td>
                <td><strong>۱:۵</strong></td>
                <td>-</td>
              </tr>
              <tr>
                <td><?php echo $f ? 'بیشتر از $۱M' : 'More than $1 M'; ?></td>
                <td><strong>۱:۱</strong></td>
                <td>-</td>
              </tr>
            </tbody>
          </table>
        </div>

      </div>
    </div>
  </div>
</section>

<!-- ═══ MARGIN CALCULATOR ═══ -->
<section class="ip-section">
  <div class="ip-container">
    <h2 class="ip-section-title lv-rev"><?php echo $f?'ماشین‌حساب <em>مارجین</em>':'Margin <em>Calculator</em>';?></h2>
    <p class="ip-section-desc lv-rev d1"><?php echo $f?'مارجین مورد نیاز برای پوزیشن خود را محاسبه کنید.':'Calculate the margin required for your position.';?></p>
    <div class="lv-calc lv-rev d2">
      <div class="lv-calc-form">
        <div class="lv-calc-kicker"><?php echo $f?'ابزار تعاملی':'INTERACTIVE TOOL';?></div>
        <h3 class="lv-calc-title"><?php echo $f?'مارجین مورد نیاز را <em>محاسبه کنید</em>':'Calculate Required <em>Margin</em>';?></h3>
        <p class="lv-calc-desc"><?php echo $f?'حجم، اهرم و قیمت ابزار را وارد کنید تا مارجین لازم را ببینید.':'Enter your lot size, leverage and instrument price to see the required margin.';?></p>
        <div class="lv-calc-field">
          <label class="lv-calc-label"><?php echo $f?'حجم (لات)':'Lot Size';?></label>
          <input type="number" class="lv-calc-input" id="lv-lots" value="1" min="0.01" step="0.01">
        </div>
        <div class="lv-calc-field">
          <label class="lv-calc-label"><?php echo $f?'حجم قرارداد':'Contract Size';?></label>
          <input type="number" class="lv-calc-input" id="lv-contract" value="100000" min="1">
        </div>
        <div class="lv-calc-field">
          <label class="lv-calc-label"><?php echo $f?'قیمت ابزار (USD)':'Instrument Price (USD)';?></label>
          <input type="number" class="lv-calc-input" id="lv-price" value="1.1000" min="0" step="0.0001">
        </div>
        <div class="lv-calc-field">
          <label class="lv-calc-label"><?php echo $f?'اهرم':'Leverage';?></label>
          <select class="lv-calc-input lv-calc-select" id="lv-leverage">
            <option value="300">1:300</option>
            <option value="200">1:200</option>
            <option value="100" selected>1:100</option>
            <option value="50">1:50</option>
            <option value="20">1:20</option>
            <option value="10">1:10</option>
          </select>
        </div>
      </div>
      <div class="lv-calc-result">
        <div class="lv-calc-result-label"><?php echo $f?'مارجین مورد نیاز':'REQUIRED MARGIN';?></div>
        <div class="lv-calc-result-val" id="lv-result">$1,100.00</div>
        <div class="lv-calc-result-sub" id="lv-result-sub"><?php echo $f?'بر اساس ورودی‌های شما':'Based on your inputs';?></div>
        <div class="lv-calc-result-info">
          <div class="lv-calc-info-row"><span class="lv-calc-info-label"><?php echo $f?'ارزش پوزیشن':'Position Value';?></span><span class="lv-calc-info-val" id="lv-pos-val">$110,000</span></div>
          <div class="lv-calc-info-row"><span class="lv-calc-info-label"><?php echo $f?'نسبت مارجین':'Margin Ratio';?></span><span class="lv-calc-info-val" id="lv-margin-ratio">1%</span></div>
          <div class="lv-calc-info-row"><span class="lv-calc-info-label"><?php echo $f?'اهرم':'Leverage';?></span><span class="lv-calc-info-val" id="lv-lev-display">1:100</span></div>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- ═══ RISK MANAGEMENT ═══ -->
<section class="ip-section alt">
  <div class="ip-container">
    <h2 class="ip-section-title lv-rev"><?php echo $f?'مدیریت ریسک <em>تعبیه‌شده</em>':'Risk Management <em>Built In</em>';?></h2>
    <p class="ip-section-desc lv-rev d1"><?php echo $f?'زیرساخت STB از معامله‌گران در هر سطح اهرم محافظت می‌کند.':'STB\'s infrastructure protects traders at every level of leverage usage.';?></p>
    <div class="lv-risk-grid lv-rev d2">
      <?php $risks = $f ? [
        ['#C8102E','<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" stroke-width="1.5"/>',
         'محافظت از موجودی منفی','حساب شما هرگز به زیر صفر نمی‌رسد — STB ضررهای فراتر از موجودی را جبران می‌کند.'],
        ['#14e0a3','<path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" stroke-width="1.5"/><line x1="12" y1="9" x2="12" y2="13" stroke-width="1.5"/><line x1="12" y1="17" x2="12.01" y2="17" stroke-width="2"/>',
         'هشدار مارجین کال','هشدارهای خودکار وقتی سطح مارجین به آستانه استاپ‌اوت نزدیک می‌شود.'],
        ['#C8102E','<path d="M12 2v20M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6" stroke-width="1.5" stroke-linecap="round"/>',
         'مارجین پویا','مارجین مورد نیاز بر اساس حجم پوزیشن باز به صورت خودکار تنظیم می‌شود.'],
      ] : [
        ['#C8102E','<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" stroke-width="1.5"/>',
         'Negative Balance Protection','Your account cannot go below zero — STB absorbs losses beyond your balance.'],
        ['#14e0a3','<path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" stroke-width="1.5"/><line x1="12" y1="9" x2="12" y2="13" stroke-width="1.5"/><line x1="12" y1="17" x2="12.01" y2="17" stroke-width="2"/>',
         'Margin Call Alerts','Automated warnings when your margin level approaches the stop-out threshold.'],
        ['#C8102E','<path d="M12 2v20M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6" stroke-width="1.5" stroke-linecap="round"/>',
         'Dynamic Margin Requirements','Margin requirements automatically adjust based on your open position size.'],
      ];
      foreach($risks as $r): ?>
      <div class="lv-risk-card" style="--rc:<?php echo $r[0]; ?>">
        <div class="lv-risk-icon"><svg viewBox="0 0 24 24"><?php echo $r[1]; ?></svg></div>
        <div><div class="lv-risk-title"><?php echo $r[2]; ?></div><div class="lv-risk-desc"><?php echo $r[3]; ?></div></div>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- ═══ CTA ═══ -->
<section class="ip-section">
  <div class="ip-container">
    <div class="ip-cta-strip lv-rev">
      <div class="ip-cta-strip-text">
        <h3><?php echo $f?'آماده استفاده از اهرم هستید؟':'Ready to use leverage?';?></h3>
        <p><?php echo $f?'حساب خود را در ۵ دقیقه باز کنید. محافظت از موجودی منفی به صورت استاندارد.':'Open your account in 5 minutes. Negative balance protection as standard.';?></p>
      </div>
      <div class="ip-cta-strip-btns">
        <a href="<?php echo esc_html($register_label_url);?>" class="ip-btn-red"><?php echo $f?'افتتاح حساب':'Open Account';?></a>
        <a href="<?php echo stb_url($B.'/faq/'); ?>" class="ip-btn-ghost"><?php echo $f?'سوالات متداول':'FAQ';?></a>
      </div>
    </div>
  </div>
</section>
</article>

<script>
(function(){
  /* Scroll reveal */
  var obs=new IntersectionObserver(function(e){e.forEach(function(en){if(en.isIntersecting){en.target.classList.add('vis');obs.unobserve(en.target)}})},{threshold:.1});
  document.querySelectorAll('.lv-rev').forEach(function(el){obs.observe(el)});

  /* Particles */
  var pc=document.getElementById('lv-particles');
  if(pc){for(var i=0;i<15;i++){var p=document.createElement('div');p.className='lv-particle';
    p.style.left=Math.random()*100+'%';p.style.top=Math.random()*100+'%';
    p.style.animationDuration=(4+Math.random()*6)+'s';p.style.animationDelay=Math.random()*5+'s';
    p.style.width=p.style.height=(1+Math.random()*2)+'px';pc.appendChild(p);}}

  /* Margin Calculator */
  function calcMargin(){
    var lots=parseFloat(document.getElementById('lv-lots').value)||0;
    var contract=parseFloat(document.getElementById('lv-contract').value)||0;
    var price=parseFloat(document.getElementById('lv-price').value)||0;
    var lev=parseFloat(document.getElementById('lv-leverage').value)||1;
    var posVal=lots*contract*price;
    var margin=posVal/lev;
    var ratio=(1/lev*100);
    document.getElementById('lv-result').textContent='$'+margin.toLocaleString('en-US',{minimumFractionDigits:2,maximumFractionDigits:2});
    document.getElementById('lv-pos-val').textContent='$'+posVal.toLocaleString('en-US',{minimumFractionDigits:0,maximumFractionDigits:0});
    document.getElementById('lv-margin-ratio').textContent=ratio.toFixed(2)+'%';
    document.getElementById('lv-lev-display').textContent='1:'+lev;
  }
  ['lv-lots','lv-contract','lv-price','lv-leverage'].forEach(function(id){
    var el=document.getElementById(id);
    if(el)el.addEventListener('input',calcMargin);
  });
  calcMargin();
})();
</script>
