<?php
if (!isset($base_url)) {
  $base_url = '';
}
?>
<link rel="stylesheet" href="<?php echo $base_url; ?>/assets/css/index.css">

<style>
  .foot1-volume-strip {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    height: 170px;
    background: #f5f8fc;
    /* border-top: 1px dashed rgba(0, 0, 0, 0.28);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08); */
    display: flex;
    align-items: flex-end;
    gap: 2px;
    /* padding: 0 0 1px; */
    overflow: hidden;
  }

  .foot1-volume-strip .bar {
    flex: 1 1 auto;
    min-width: 2px;
    max-width: 10px;
    height: var(--h, 28px);
    opacity: 0.85;
  }

  .foot1-volume-strip .bar.green {
    background: #2e3440;
  }

  .foot1-volume-strip .bar.red {
    background: #f3cd28;
    /* border: 1px solid #6a6858; */
  }

  .foot1-brand-banner {
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 0 6px;
    text-align: center;
  }

  .foot1-brand-banner span {
    display: block;
    width: 100%;
    font-size: clamp(42px, 10vw, 170px);
    line-height: 0.9;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
  }

  .foot1-wiki-foot {
    overflow-x: clip;
  }

  .modal-overlay {
    padding: 16px;
  }

  .modal-box {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }

  .foot1-market-ticker-item {
    gap: 6px;
  }

  .foot1-selection-box {
    position: relative;
  }

  .foot1-current-country {
    appearance: none;
    font: inherit;
  }

  .foot1-country-dropdown {
    display: none;
    position: absolute;
    left: 0;
    bottom: calc(100% + 14px);
    width: min(760px, calc(100vw - 24px));
    max-height: min(58vh, 560px);
    overflow: auto;
    z-index: 50;
    background: #ffffff;
    color: #1f2937;
    border-radius: 18px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 18px;
  }

  .foot1-country-dropdown.is-open {
    display: block;
  }

  .foot1-country-dropdown-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }

  .foot1-country-dropdown-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
  }

  .foot1-country-search {
    width: min(300px, 100%);
    border: 1px solid #d5dae2;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    color: #111827;
    background: #f8fafc;
  }

  .foot1-country-search:focus {
    border-color: #9aa4b2;
    background: #fff;
  }

  .foot1-country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px 14px;
  }

  .foot1-country-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 10px 8px;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, transform 0.2s ease;
  }

  .foot1-country-item:hover {
    background: #f3f6fb;
    transform: translateY(-1px);
  }

  .foot1-country-item.is-hidden {
    display: none;
  }

  .foot1-country-item-flag {
    width: 28px;
    height: 20px;
    border-radius: 3px;
    object-fit: cover;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
  }

  .foot1-country-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .foot1-country-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
  }

  .foot1-country-item-domain {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.2;
    word-break: break-word;
  }

  .foot1-country-item.is-active {
    background: #eef3ff;
  }

  @media (max-width: 1100px) {
    .foot1-page-width {
      flex-direction: column;
      gap: 28px;
    }

    .foot1-country-group {
      flex: 1 1 auto;
      max-width: 100%;
    }

    .foot1-information-group {
      min-width: 0;
      width: 100%;
    }

    .foot1-website-box {
      font-size: 12px;
    }
  }

  @media (max-width: 768px) {
    .foot1-wiki-foot {
      padding: 32px 0 54px;
    }

    .foot1-volume-strip {
      height: 110px;
      gap: 1px;
      width: 100%;
      left: 0;
      right: 0;
      margin: 0;
    }

    .foot1-brand-banner {
      padding: 10px 0 4px;
    }

    .foot1-brand-banner span {
      letter-spacing: 0.03em;
      font-size: clamp(34px, 12vw, 88px);
    }

    .foot1-page-width {
      padding: 0 14px;
      gap: 22px;
    }

    .foot1-country-group {
      gap: 12px;
    }

    .foot1-bottom-logo {
      width: 150px;
      margin-bottom: 12px;
    }

    .foot1-choice-txt {
      font-size: 13px;
    }

    .foot1-current-country {
      width: 100%;
      justify-content: flex-start;
    }

    .foot1-country-dropdown {
      display: none;
      position: absolute;
      left: 0;
      bottom: calc(100% + 14px);
      width: min(760px, calc(100vw - 24px));
      max-height: min(58vh, 560px);
      overflow: auto;
      z-index: 50;
      background: #ffffff;
      color: #1f2937;
      border-radius: 18px;
      box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
      border: 1px solid rgba(15, 23, 42, 0.08);
      padding: 18px;
    }

    .foot1-country-dropdown.is-open {
      display: block;
    }

    .foot1-country-dropdown-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 14px;
    }

    .foot1-country-dropdown-title {
      font-size: 18px;
      font-weight: 700;
      color: #111827;
    }

    .foot1-country-search {
      width: min(300px, 100%);
      border: 1px solid #d5dae2;
      border-radius: 999px;
      padding: 10px 14px;
      font-size: 14px;
      outline: none;
      color: #111827;
      background: #f8fafc;
    }

    .foot1-country-search:focus {
      border-color: #9aa4b2;
      background: #fff;
    }

    .foot1-country-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 10px 14px;
    }

    .foot1-country-item {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      border: 0;
      background: transparent;
      padding: 10px 8px;
      border-radius: 12px;
      cursor: pointer;
      text-align: left;
      transition: background 0.2s ease, transform 0.2s ease;
    }

    .foot1-country-item:hover {
      background: #f3f6fb;
      transform: translateY(-1px);
    }

    .foot1-country-item.is-hidden {
      display: none;
    }

    .foot1-country-item-flag {
      width: 28px;
      height: 20px;
      border-radius: 3px;
      object-fit: cover;
      flex: 0 0 auto;
      box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
    }

    .foot1-country-item-text {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
    }

    .foot1-country-item-name {
      font-size: 14px;
      font-weight: 600;
      color: #111827;
      line-height: 1.2;
    }

    .foot1-country-item-domain {
      font-size: 12px;
      color: #6b7280;
      line-height: 1.2;
      word-break: break-word;
    }

    .foot1-country-item.is-active {
      background: #eef3ff;
    }

    .foot1-information-group {
      min-width: 0;
    }

    .foot1-links-box {
      gap: 8px;
    }

    .foot1-segment {
      display: none;
    }

    .foot1-single-link {
      font-size: 13px;
    }

    .foot1-website-box {
      font-size: 11px;
      line-height: 1.55;
    }

    .foot1-market-ticker-item {
      font-size: 12px;
      padding: 0 10px;
    }
  }

  @media (max-width: 480px) {
    .foot1-wiki-foot {
      padding: 26px 0 48px;
    }

    .modal-overlay {
      padding: 12px;
    }

    .modal-box {
      width: 100%;
      max-width: none;
      padding: 18px 16px;
      border-radius: 10px;
    }

    .close-btn {
      top: 10px;
      right: 12px;
      font-size: 22px;
    }

    .modal-box h2 {
      font-size: 1.1rem;
      margin-bottom: 14px;
    }

    .modal-box p {
      font-size: 13px;
      line-height: 1.55;
    }

    .foot1-brand-banner span {
      font-size: clamp(28px, 14vw, 68px);
      letter-spacing: 0.02em;
    }

    .foot1-volume-strip {
      height: 92px;
    }

    .foot1-market-ticker-bg {
      height: 34px;
    }

    .foot1-market-ticker-item {
      font-size: 11px;
      padding: 0 8px;
    }

    .foot1-ticker-symbol,
    .foot1-ticker-value,
    .foot1-ticker-change {
      margin-right: 6px;
    }

    .foot1-page-width {
      padding: 0 12px;
      gap: 18px;
    }

    .foot1-current-country {
      padding: 7px 12px;
    }

    .foot1-country-dropdown {
      padding: 14px;
      border-radius: 14px;
      width: calc(100vw - 24px);
      bottom: calc(100% + 10px);
    }

    .foot1-country-dropdown-title {
      font-size: 16px;
    }

    .foot1-country-grid {
      grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    }

    .foot1-country-item-name {
      font-size: 13px;
    }

    .foot1-country-item-domain {
      font-size: 11px;
    }

    .foot1-obey-txt {
      font-size: 11px;
    }

    .foot1-bottom-logo {
      width: 132px;
    }

    .foot1-website-box {
      font-size: 10.5px;
    }
  }
</style>


<div class="foot1-volume-strip" aria-hidden="true">
  <span class="bar red" style="--h: 36px;"></span>
  <span class="bar green" style="--h: 40px;"></span>
  <span class="bar red" style="--h: 32px;"></span>
  <span class="bar green" style="--h: 28px;"></span>
  <span class="bar red" style="--h: 30px;"></span>
  <span class="bar green" style="--h: 34px;"></span>
  <span class="bar red" style="--h: 42px;"></span>
  <span class="bar green" style="--h: 38px;"></span>
  <span class="bar red" style="--h: 52px;"></span>
  <span class="bar green" style="--h: 70px;"></span>
  <span class="bar red" style="--h: 168px;"></span>
  <span class="bar red" style="--h: 145px;"></span>
  <span class="bar green" style="--h: 86px;"></span>
  <span class="bar red" style="--h: 62px;"></span>
  <span class="bar green" style="--h: 50px;"></span>
  <span class="bar red" style="--h: 26px;"></span>
  <span class="bar green" style="--h: 22px;"></span>
  <span class="bar red" style="--h: 20px;"></span>
  <span class="bar green" style="--h: 24px;"></span>
  <span class="bar red" style="--h: 18px;"></span>
  <span class="bar green" style="--h: 22px;"></span>
  <span class="bar red" style="--h: 28px;"></span>
  <span class="bar green" style="--h: 32px;"></span>
  <span class="bar green" style="--h: 136px;"></span>
  <span class="bar red" style="--h: 84px;"></span>
  <span class="bar green" style="--h: 72px;"></span>
  <span class="bar red" style="--h: 58px;"></span>
  <span class="bar green" style="--h: 40px;"></span>
  <span class="bar red" style="--h: 30px;"></span>
  <span class="bar green" style="--h: 24px;"></span>
  <span class="bar red" style="--h: 18px;"></span>
  <span class="bar green" style="--h: 16px;"></span>
  <span class="bar red" style="--h: 22px;"></span>
  <span class="bar green" style="--h: 18px;"></span>
  <span class="bar red" style="--h: 20px;"></span>
  <span class="bar green" style="--h: 24px;"></span>
  <span class="bar red" style="--h: 30px;"></span>
  <span class="bar green" style="--h: 44px;"></span>
  <span class="bar red" style="--h: 86px;"></span>
  <span class="bar green" style="--h: 168px;"></span>
  <span class="bar red" style="--h: 126px;"></span>
  <span class="bar red" style="--h: 92px;"></span>
  <span class="bar green" style="--h: 62px;"></span>
  <span class="bar green" style="--h: 84px;"></span>
  <span class="bar red" style="--h: 34px;"></span>
  <span class="bar green" style="--h: 22px;"></span>
  <span class="bar red" style="--h: 18px;"></span>
  <span class="bar green" style="--h: 24px;"></span>
  <span class="bar red" style="--h: 30px;"></span>
  <span class="bar green" style="--h: 130px;"></span>
  <span class="bar red" style="--h: 66px;"></span>
  <span class="bar green" style="--h: 54px;"></span>
  <span class="bar red" style="--h: 42px;"></span>
  <span class="bar green" style="--h: 36px;"></span>
  <span class="bar red" style="--h: 28px;"></span>
  <span class="bar green" style="--h: 30px;"></span>
  <span class="bar red" style="--h: 26px;"></span>
  <span class="bar green" style="--h: 32px;"></span>
  <span class="bar red" style="--h: 36px;"></span>
  <span class="bar green" style="--h: 40px;"></span>
  <span class="bar red" style="--h: 34px;"></span>
  <span class="bar green" style="--h: 38px;"></span>
  <span class="bar red" style="--h: 42px;"></span>
  <span class="bar green" style="--h: 30px;"></span>
  <span class="bar red" style="--h: 24px;"></span>
  <span class="bar green" style="--h: 20px;"></span>
  <span class="bar red" style="--h: 18px;"></span>
  <span class="bar green" style="--h: 22px;"></span>
  <span class="bar red" style="--h: 26px;"></span>
  <span class="bar green" style="--h: 36px;"></span>
  <span class="bar red" style="--h: 70px;"></span>
  <span class="bar green" style="--h: 102px;"></span>
  <span class="bar red" style="--h: 62px;"></span>
  <span class="bar green" style="--h: 50px;"></span>
  <span class="bar red" style="--h: 42px;"></span>
  <span class="bar green" style="--h: 28px;"></span>
  <span class="bar red" style="--h: 34px;"></span>
  <span class="bar green" style="--h: 30px;"></span>
  <span class="bar red" style="--h: 38px;"></span>
  <span class="bar green" style="--h: 42px;"></span>
  <span class="bar red" style="--h: 46px;"></span>
  <span class="bar green" style="--h: 52px;"></span>
  <span class="bar red" style="--h: 34px;"></span>
  <span class="bar green" style="--h: 24px;"></span>
  <span class="bar red" style="--h: 22px;"></span>
  <span class="bar green" style="--h: 20px;"></span>
  <span class="bar red" style="--h: 18px;"></span>
  <span class="bar green" style="--h: 24px;"></span>
  <span class="bar red" style="--h: 30px;"></span>
  <span class="bar green" style="--h: 36px;"></span>
  <span class="bar red" style="--h: 34px;"></span>
  <span class="bar green" style="--h: 30px;"></span>
  <span class="bar red" style="--h: 38px;"></span>
  <span class="bar green" style="--h: 42px;"></span>
  <span class="bar red" style="--h: 46px;"></span>
  <span class="bar green" style="--h: 52px;"></span>
  <span class="bar red" style="--h: 34px;"></span>
  <span class="bar green" style="--h: 24px;"></span>
  <span class="bar red" style="--h: 22px;"></span>
  <span class="bar green" style="--h: 20px;"></span>
  <span class="bar red" style="--h: 18px;"></span>
  <span class="bar green" style="--h: 24px;"></span>
  <span class="bar red" style="--h: 30px;"></span>
  <span class="bar green" style="--h: 36px;"></span>
  <span class="bar green" style="--h: 102px;"></span>
  <span class="bar red" style="--h: 62px;"></span>
  <span class="bar green" style="--h: 50px;"></span>
  <span class="bar red" style="--h: 42px;"></span>
  <span class="bar green" style="--h: 28px;"></span>
  <span class="bar red" style="--h: 34px;"></span>
  <span class="bar green" style="--h: 30px;"></span>
  <span class="bar red" style="--h: 38px;"></span>
  <span class="bar red" style="--h: 36px;"></span>
  <span class="bar green" style="--h: 40px;"></span>
  <span class="bar red" style="--h: 32px;"></span>
  <span class="bar green" style="--h: 28px;"></span>
  <span class="bar red" style="--h: 36px;"></span>
  <span class="bar green" style="--h: 40px;"></span>
  <span class="bar red" style="--h: 32px;"></span>
  <span class="bar green" style="--h: 28px;"></span>
  <span class="bar red" style="--h: 30px;"></span>
  <span class="bar green" style="--h: 34px;"></span>
  <span class="bar red" style="--h: 42px;"></span>
  <span class="bar green" style="--h: 38px;"></span>
  <span class="bar red" style="--h: 52px;"></span>
  <span class="bar green" style="--h: 70px;"></span>
  <span class="bar red" style="--h: 168px;"></span>
  <span class="bar red" style="--h: 145px;"></span>
</div>

<footer class="foot1-wiki-foot" id="foot1-foot">
  <div class="foot1-container">
    <section class="foot1-page-width">
      <div class="foot1-country-group">
        <a href="/en" target="_blank" class="foot1-bottom-logo-link">
          <img src="<?php echo $base_url; ?>/assets/images/logo.png" alt="TraderSafety Logo" class="foot1-bottom-logo">
        </a>
        <span class="foot1-choice-txt">Select Country/Region</span>
        <div class="foot1-selection-box">
          <button type="button" class="foot1-current-country" id="foot1CountryToggle" aria-expanded="false" aria-controls="foot1CountryDropdown">
            <img src="https://img.souhei.com.cn/flag/d7ed3e7b4fdbf486/IN.png_wiki-template-global" alt="" class="foot1-current-flag">
            <span class="foot1-current-designation">India</span>
            <img src="https://osshead.interface003.com/headfoot/Content/images/arrow-up.svg" alt="" class="foot1-arrow-up">
          </button>
          <div class="foot1-country-dropdown" id="foot1CountryDropdown" aria-hidden="true">
            <div class="foot1-country-dropdown-head">
              <span class="foot1-country-dropdown-title">Select Country/Region</span>
              <input type="search" class="foot1-country-search" id="foot1CountrySearch" placeholder="Search by Region">
            </div>
            <div class="foot1-country-grid" id="foot1CountryGrid"></div>
          </div>
        </div>
        <span class="foot1-obey-txt">※ The content of this website abides with local laws and regulations.</span>
      </div>

      <div class="foot1-information-group">
        <div class="foot1-links-box">
          <a href="<?php echo $base_url; ?>/footerlinks/about.php" target="_blank" class="foot1-single-link">
            About Us
          </a><i class="foot1-segment">|</i>

          <a href="<?php echo $base_url; ?>/footerlinks/contact.php" target="_blank" class="foot1-single-link">
            Contact Us
          </a><i class="foot1-segment">|</i>

          <a href="<?php echo $base_url; ?>#" class="foot1-single-link" onclick="openRiskWarning(event)">
            Risk Warning
          </a><i class="foot1-segment">|</i>

          <a href="<?php echo $base_url; ?>/footerlinks/terms.php?tab=terms" target="_blank" class="foot1-single-link">
            Terms of Use
          </a><i class="foot1-segment">|</i>

          <a href="<?php echo $base_url; ?>/footerlinks/terms.php?tab=privacy" target="_blank" class="foot1-single-link">
            Privacy Policy
          </a><i class="foot1-segment">|</i>

          <a href="<?php echo $base_url; ?>/footerlinks/contract.php" target="_blank" class="foot1-single-link">
            Cooperation
          </a><i class="foot1-segment">|</i>
        </div>

        <div class="foot1-website-box">
          <div>Trader Safety LIMITED , a financial brokerage company regulated by the Financial Conduct Authority (registration no. 16394229), the Cyprus Securities and Exchange Commission (licence no. 079/17), the Securities Commission of The Bahamas (license no. SIA-G116), and the Financial Sector Conduct Authority (FSCA) (authorisation no. 46151). Registered Address: England and Wales.</div>
          <div>Official Email：supports@tradersafety.com；</div>
          <div>Mobile Phone Number : 8001133344；8001133343</div>
          <div>Telegram：8001133344</div>
          <div>License or other information error corrections, please send the information to：supports@tradersafety.com</div>
          <div>Cooperation：supports@tradersafety.com</div>
        </div>
      </div>
    </section>
  </div>
  <div class="foot1-brand-banner" aria-hidden="true">
    <span>TRADER SAFETY</span>
  </div>
</footer>

<div id="riskWarningModal" class="modal-overlay">
  <div class="modal-box">
    <span class="close-btn" onclick="closeRiskWarning()">&times;</span>
    <h2>Risk Warning</h2>
    <p>
      The database of <strong>Trader Safety</strong> comes from the official regulatory authorities, such as the FCA, ASIC, etc. The published content is based on fairness, objectivity, and facts. Trader Safety does not accept PR fees, advertising fees, ranking fees, data cleaning fees, or any other illogical fees.
    </p>
    <p>
      Trader Safety aims to maintain consistency and synchronization of its database with authoritative sources such as regulatory agencies. However, it does not guarantee real-time updates of all data.
    </p>
    <p>
      Due to the complexity of the forex industry, some brokers may obtain legal licenses through deceptive means. If any information published by Trader Safety is found inaccurate, please use the 'Complaints' or 'Correction' features to notify us. We will verify and publish the results promptly.
    </p>
    <p>
      <strong>Special Note:</strong> The content on the Trader Safety website is for informational purposes only and should not be construed as investment advice. The decision to choose a forex broker lies solely with the client. Trader Safety is not responsible for any outcomes resulting from forex trading decisions. The client assumes full responsibility for all associated risks.
    </p>
  </div>
</div>

<section class="foot1-market-ticker-bg">
  <div class="foot1-market-ticker-container">
    <div class="foot1-market-ticker-marquee">
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">USDCHF</span>
        <span class="foot1-ticker-value">0.82850</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+0.00%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">GBPJPY</span>
        <span class="foot1-ticker-value">191.171</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+0.00%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">GBPUSD</span>
        <span class="foot1-ticker-value">1.33132</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+0.18%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">LTCUSD</span>
        <span class="foot1-ticker-value">85.91</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+1.19%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">NZDJPY</span>
        <span class="foot1-ticker-value">85.596</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+0.04%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">NZDUSD</span>
        <span class="foot1-ticker-value">0.59611</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+0.22%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">UKOUSD</span>
        <span class="foot1-ticker-value">66.100</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+0.47%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">USDCAD</span>
        <span class="foot1-ticker-value">1.38716</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+0.01%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">AUDCHF</span>
        <span class="foot1-ticker-value">0.53015</span>
        <span class="foot1-ticker-arrow up"></span>
        <span class="foot1-ticker-change up">+0.28%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
      <a class="foot1-market-ticker-item" href="<?php echo $base_url; ?>#">
        <span class="foot1-ticker-symbol">USDJPY</span>
        <span class="foot1-ticker-value">143.599</span>
        <span class="foot1-ticker-arrow down"></span>
        <span class="foot1-ticker-change down">-0.17%</span>
        <span class="foot1-ticker-sep">|</span>
      </a>
    </div>
  </div>
</section>

<script>
  document.addEventListener('DOMContentLoaded', function() {
    const selectionBox = document.querySelector('.foot1-selection-box');
    const toggle = document.getElementById('foot1CountryToggle');
    const dropdown = document.getElementById('foot1CountryDropdown');
    const search = document.getElementById('foot1CountrySearch');
    const grid = document.getElementById('foot1CountryGrid');
    const currentFlag = document.querySelector('.foot1-current-flag');
    const currentDesignation = document.querySelector('.foot1-current-designation');

    if (!selectionBox || !toggle || !dropdown || !search || !grid || !currentFlag || !currentDesignation) {
      return;
    }

    const countries = [{
        name: 'Hong Kong',
        flag: 'https://flagcdn.com/w20/hk.png'
      },
      {
        name: 'Taiwan',
        flag: 'https://flagcdn.com/w20/tw.png'
      },
      {
        name: 'United States',
        flag: 'https://flagcdn.com/w20/us.png'
      },
      {
        name: 'South Korea',
        flag: 'https://flagcdn.com/w20/kr.png'
      },
      {
        name: 'United Kingdom',
        flag: 'https://flagcdn.com/w20/gb.png'
      },
      {
        name: 'Japan',
        flag: 'https://flagcdn.com/w20/jp.png'
      },
      {
        name: 'Indonesia',
        flag: 'https://flagcdn.com/w20/id.png'
      },
      {
        name: 'Vietnam',
        flag: 'https://flagcdn.com/w20/vn.png'
      },
      {
        name: 'Australia',
        flag: 'https://flagcdn.com/w20/au.png'
      },
      {
        name: 'Singapore',
        flag: 'https://flagcdn.com/w20/sg.png'
      },
      {
        name: 'Thailand',
        flag: 'https://flagcdn.com/w20/th.png'
      },
      {
        name: 'Cyprus',
        flag: 'https://flagcdn.com/w20/cy.png'
      },
      {
        name: 'Germany',
        flag: 'https://flagcdn.com/w20/de.png'
      },
      {
        name: 'Russia',
        flag: 'https://flagcdn.com/w20/ru.png'
      },
      {
        name: 'Philippines',
        flag: 'https://flagcdn.com/w20/ph.png'
      },
      {
        name: 'New Zealand',
        flag: 'https://flagcdn.com/w20/nz.png'
      },
      {
        name: 'India',
        flag: 'https://flagcdn.com/w20/in.png'
      },
      {
        name: 'France',
        flag: 'https://flagcdn.com/w20/fr.png'
      },
      {
        name: 'Spain',
        flag: 'https://flagcdn.com/w20/es.png'
      },
      {
        name: 'Malaysia',
        flag: 'https://flagcdn.com/w20/my.png'
      },
      {
        name: 'Nigeria',
        flag: 'https://flagcdn.com/w20/ng.png'
      },
      {
        name: 'Cambodia',
        flag: 'https://flagcdn.com/w20/kh.png'
      },
      {
        name: 'Italy',
        flag: 'https://flagcdn.com/w20/it.png'
      },
      {
        name: 'South Africa',
        flag: 'https://flagcdn.com/w20/za.png'
      },
      {
        name: 'Turkey',
        flag: 'https://flagcdn.com/w20/tr.png'
      },
      {
        name: 'Netherlands',
        flag: 'https://flagcdn.com/w20/nl.png'
      },
      {
        name: 'United Arab Emirates',
        flag: 'https://flagcdn.com/w20/ae.png'
      },
      {
        name: 'Colombia',
        flag: 'https://flagcdn.com/w20/co.png'
      },
      {
        name: 'Argentina',
        flag: 'https://flagcdn.com/w20/ar.png'
      },
      {
        name: 'Ecuador',
        flag: 'https://flagcdn.com/w20/ec.png'
      },
      {
        name: 'Egypt',
        flag: 'https://flagcdn.com/w20/eg.png'
      },
      {
        name: 'Morocco',
        flag: 'https://flagcdn.com/w20/ma.png'
      },
      {
        name: 'Mexico',
        flag: 'https://flagcdn.com/w20/mx.png'
      },
      {
        name: 'Peru',
        flag: 'https://flagcdn.com/w20/pe.png'
      },
      {
        name: 'Pakistan',
        flag: 'https://flagcdn.com/w20/pk.png'
      },
      {
        name: 'Tunisia',
        flag: 'https://flagcdn.com/w20/tn.png'
      },
      {
        name: 'Venezuela',
        flag: 'https://flagcdn.com/w20/ve.png'
      },
      {
        name: 'Iraq',
        flag: 'https://flagcdn.com/w20/iq.png'
      },
      {
        name: 'Bolivia',
        flag: 'https://flagcdn.com/w20/bo.png'
      },
      {
        name: 'Bangladesh',
        flag: 'https://flagcdn.com/w20/bd.png'
      },
      {
        name: 'Saudi Arabia',
        flag: 'https://flagcdn.com/w20/sa.png'
      },
      {
        name: 'Brazil',
        flag: 'https://flagcdn.com/w20/br.png'
      },
      {
        name: 'Chile',
        flag: 'https://flagcdn.com/w20/cl.png'
      },
      {
        name: 'Canada',
        flag: 'https://flagcdn.com/w20/ca.png'
      },
      {
        name: 'Ghana',
        flag: 'https://flagcdn.com/w20/gh.png'
      },
      {
        name: 'Kenya',
        flag: 'https://flagcdn.com/w20/ke.png'
      },
      {
        name: 'Sudan',
        flag: 'https://flagcdn.com/w20/sd.png'
      }
    ];

    const renderCountries = (items) => {
      grid.innerHTML = items.map((country) => `
        <button type="button" class="foot1-country-item" data-country="${country.name.toLowerCase()}" data-flag="${country.flag}" data-name="${country.name}">
          <img src="${country.flag}" alt="${country.name} flag" class="foot1-country-item-flag">
          <span class="foot1-country-item-text">
            <span class="foot1-country-item-name">${country.name}</span>
          </span>
        </button>
      `).join('');
    };

    const setOpen = (isOpen) => {
      dropdown.classList.toggle('is-open', isOpen);
      toggle.setAttribute('aria-expanded', String(isOpen));
      dropdown.setAttribute('aria-hidden', String(!isOpen));
      if (isOpen) {
        search.value = '';
        filterCountries('');
        search.focus();
      }
    };

    const filterCountries = (query) => {
      const normalizedQuery = query.trim().toLowerCase();
      grid.querySelectorAll('.foot1-country-item').forEach((item) => {
        const countryName = item.getAttribute('data-country') || '';
        item.classList.toggle('is-hidden', normalizedQuery.length > 0 && !countryName.includes(normalizedQuery));
      });
    };

    const setCountry = (name, flagUrl) => {
      currentFlag.src = flagUrl;
      currentFlag.alt = `${name} flag`;
      currentDesignation.textContent = name;
      grid.querySelectorAll('.foot1-country-item').forEach((item) => {
        item.classList.toggle('is-active', item.getAttribute('data-name') === name);
      });
    };

    renderCountries(countries);
    setCountry(currentDesignation.textContent.trim(), currentFlag.src);

    toggle.addEventListener('click', function(event) {
      event.stopPropagation();
      setOpen(!dropdown.classList.contains('is-open'));
    });

    dropdown.addEventListener('click', function(event) {
      event.stopPropagation();
      const item = event.target.closest('.foot1-country-item');
      if (!item) {
        return;
      }

      setCountry(item.getAttribute('data-name') || '', item.getAttribute('data-flag') || currentFlag.src);
      setOpen(false);
    });

    search.addEventListener('input', function() {
      filterCountries(search.value);
    });

    document.addEventListener('click', function(event) {
      if (!selectionBox.contains(event.target)) {
        setOpen(false);
      }
    });
  });
  
  // Risk Warning Modal Functions
  function openRiskWarning(event) {
    if (event) {
      event.preventDefault();
      event.stopPropagation();
    }
    const modal = document.getElementById('riskWarningModal');
    if (modal) {
      modal.style.display = 'flex';
      modal.style.alignItems = 'center';
      modal.style.justifyContent = 'center';
      document.body.style.overflow = 'hidden';
    }
  }

  function closeRiskWarning() {
    const modal = document.getElementById('riskWarningModal');
    if (modal) {
      modal.style.display = 'none';
      document.body.style.overflow = 'auto';
    }
  }

  // Close modal when clicking outside the modal-box
  document.addEventListener('click', function(event) {
    const modal = document.getElementById('riskWarningModal');
    const modalBox = document.querySelector('.modal-box');
    if (modal && modal.style.display === 'flex' && event.target === modal) {
      closeRiskWarning();
    }
  });

  // Close modal on Escape key
  document.addEventListener('keydown', function(event) {
    if (event.key === 'Escape') {
      closeRiskWarning();
    }
  });

</script>

<script src="<?php echo $base_url; ?>/assets/js/script.js"></script>