<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OSRS Services | Skilling, Bossing, PvM, OSRS Gold</title>
    <link rel="stylesheet" href="styles.css">
    <link rel="icon" href="favicon.png" type="image/png">
    <style>
      /* Smooth Page Transition */
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      html {
        scroll-behavior: smooth;
      }

      body {
        margin: 0;
        font-family: 'Roboto', sans-serif;
        background: url('background.png') no-repeat center center fixed;
        background-size: cover;
        overflow-y: scroll;
        position: relative;
      }

      /* Custom Scrollbar */
      ::-webkit-scrollbar {
        width: 8px;
      }

      ::-webkit-scrollbar-track {
        background: #f1f1f1;
      }

      ::-webkit-scrollbar-thumb {
        background: #2ea2cc;
        border-radius: 4px;
      }

      ::-webkit-scrollbar-thumb:hover {
        background: #1f6bb5;
      }

      .navbar {
        background: rgba(9, 55, 144, 0);
        /* New color with 80% transparency */
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
        position: sticky;
        top: 0;
        z-index: 1000;
      }

      .navbar .logo img {
        height: 50px;
      }

      .navbar .logo a {
        text-decoration: none;
      }

      .navbar ul {
        list-style: none;
        display: flex;
        margin: 0;
        padding: 0;
      }

      .navbar ul li {
        position: relative;
      }

      .navbar ul li a {
        color: white;
        text-decoration: none;
        font-weight: 600;
        padding: 10px 15px;
        display: block;
      }

      .navbar ul li.has-dropdown>a::after {
        content: '\25BC';
        margin-left: 8px;
        font-size: 0.8em;
      }

      .navbar ul li:hover>a {
        background: rgba(6, 40, 104, 0.8);
      }

      .navbar ul li .dropdown {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background: rgba(6, 40, 104, 0.9);
        min-width: 200px;
        z-index: 1001;
      }

      .navbar ul li:hover .dropdown,
      .navbar ul li.show .dropdown {
        display: block;
      }

      .dropdown li {
        width: 100%;
      }

      .dropdown li a {
        padding: 10px;
        color: white;
      }

      .dropdown li a:hover {
        background-color: rgba(4, 30, 78, 0.9);
      }

      .menu-toggle {
        display: none;
        cursor: pointer;
        color: white;
        font-size: 1.5em;
        margin-left: 20px;
        z-index: 1001;
        transition: transform 0.3s ease;
      }

      .menu-toggle.active {
        transform: rotate(90deg);
      }

      @media (max-width: 768px) {
        .navbar ul {
          flex-direction: column;
          display: none;
          background: rgba(9, 55, 144, 0.9);
          position: absolute;
          top: 60px;
          right: 0;
          width: 100%;
          transition: all 0.5s ease-in-out;
        }

        .navbar ul.active {
          display: flex;
        }

        .menu-toggle {
          display: block;
        }

        .navbar ul.active li.has-dropdown .dropdown {
          display: none;
          position: static;
          background: rgba(6, 40, 104, 0.9);
        }

        .navbar ul.active li.has-dropdown.show .dropdown {
          display: block;
        }

        .navbar ul li.has-dropdown>a {
          display: flex;
          justify-content: space-between;
        }

        .navbar ul.active li.discord {
          text-align: center;
          margin-top: 20px;
        }

        .navbar ul.active li.discord a {
          display: inline-block;
        }

        .navbar ul.active li.discord a img {
          height: 40px;
        }

        .navbar .social {
          display: none;
        }
      }

      .hero {
        text-align: center;
        color: white;
        margin: 50px 20px;
        animation: fadeIn 1.5s ease-in-out;
      }

      .hero h1 {
        font-size: 2.5em;
        font-weight: bold;
        margin: 0;
      }

      .hero p {
        font-size: 1.2em;
        font-weight: bold;
        color: white;
        margin: 10px 0;
        background: none;
        border: none;
      }

      @keyframes fadeIn {
        from {
          opacity: 0;
        }

        to {
          opacity: 1;
        }
      }

      /* Hero Section Styling */
      .hero-section {
        text-align: center;
        margin: 50px auto;
        padding: 20px;
        color: white;
        font-family: 'Roboto', sans-serif;
        animation: fadeIn 1.5s ease-in-out;
      }

      .hero-section h1 {
        font-size: 3.5em;
        /* Increased font size */
        font-weight: bold;
        margin-bottom: 10px;
      }

      .hero-section p {
        font-size: 1.2em;
        margin: 5px 0;
      }

      .hero-section a {
        color: #2ea2cc;
        text-decoration: underline;
      }

      /* Image Links Section */
      .image-links {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 20px;
        margin: 50px auto;
        flex-wrap: wrap;
      }

      .image-card {
        text-align: center;
        position: relative;
        overflow: hidden;
        width: 180px;
        height: 180px;
        border-radius: 10px;
        background: rgba(9, 55, 144, 0.8);
        transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
        text-decoration: none;
        color: white;
      }

      .image-card img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 10px;
      }

      .image-card span {
        position: absolute;
        bottom: 10px;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 1em;
        font-weight: bold;
        background: rgba(0, 0, 0, 0.6);
        padding: 5px 0;
        transition: background 0.3s ease-in-out;
      }

      /* Hover Animation */
      .image-card:hover {
        transform: translateY(-5px) scale(1.05);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
      }

      .image-card:hover span {
        background: rgba(0, 0, 0, 0.8);
      }

      /* Trustpilot Review Section */
      .trustpilot-reviews {
        text-align: center;
        background: rgba(9, 55, 144, 0.1);
        padding: 40px 20px;
        margin: 40px auto;
      }

      .trustpilot-reviews h2 {
        font-size: 2em;
        margin-bottom: 20px;
        color: #ffffff;
        /* Change text color to white */
      }

      .review-container {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        justify-content: center;
      }

      .review {
        background: #ffffff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 20px;
        width: 300px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease;
      }

      .review:hover {
        transform: translateY(-5px);
      }

      .review-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 10px;
      }

      .review-header img {
        height: 24px;
      }

      .review-name {
        font-weight: bold;
        color: #093790;
        flex-grow: 1;
      }

      .review-rating {
        color: #ffcc00;
      }

      .review-text {
        font-size: 0.9em;
        color: #555;
        line-height: 1.4;
      }

      /* Disable Sticky Navbar on PC */
      @media (min-width: 769px) {
        .navbar {
          position: static;
          /* Remove sticky behavior on larger screens */
        }
      }

      /* Payment Options Section */
      .payment-options {
        text-align: center;
        margin: 50px auto;
        padding: 20px;
        background: rgba(9, 55, 144, 0.1);
        border-radius: 10px;
      }

      .payment-options h2 {
        font-size: 2em;
        font-weight: bold;
        margin-bottom: 20px;
        color: #ffffff;
        /* White text */
      }

      .payment-icons {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 20px;
      }

      .payment-icon {
        width: 120px;
        height: 70px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #ffffff;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease-in-out;
      }

      .payment-icon img {
        max-width: 60%;
        max-height: 60%;
        object-fit: contain;
      }

      .payment-icon:hover {
        transform: translateY(-5px) scale(1.1);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
      }

      /* About Section Styling */
      .about-section {
        background: rgba(9, 55, 144, 0.1);
        /* Slight blue background */
        padding: 50px 20px;
        display: flex;
        justify-content: center;
        align-items: center;
      }

      .about-container {
        display: flex;
        align-items: center;
        gap: 30px;
        max-width: 1200px;
        margin: 0 auto;
      }

      .about-image {
        flex: 1;
        max-width: 500px;
      }

      .about-image img {
        width: 100%;
        height: auto;
        border-radius: 10px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
      }

      .about-text {
        flex: 1;
        font-family: 'Roboto', sans-serif;
        color: #fff;
      }

      .about-text h2 {
        font-size: 2em;
        margin-bottom: 10px;
        color: #ffffff;
      }

      .about-text p {
        font-size: 1em;
        line-height: 1.6;
        margin-bottom: 15px;
      }

      /* Responsive Design */
      @media (max-width: 768px) {
        .about-container {
          flex-direction: column;
          text-align: center;
        }

        .about-image,
        .about-text {
          max-width: 100%;
        }

        .about-text h2 {
          font-size: 1.8em;
        }

        .about-text p {
          font-size: 0.9em;
        }
      }

      /* Why Choose OSRS-PVM Section Styling */
      .why-choose-section {
        text-align: center;
        padding: 50px 20px;
        background: rgba(9, 55, 144, 0);
        /* Slight blue background */
        color: #ffffff;
      }

      .why-choose-section h2 {
        font-size: 2.5em;
        margin-bottom: 30px;
        font-weight: bold;
      }

      .why-choose-container {
        display: flex;
        justify-content: center;
        align-items: stretch;
        gap: 20px;
        flex-wrap: wrap;
        max-width: 1200px;
        margin: 0 auto;
      }

      .why-choose-box {
        background: rgba(9, 55, 144, 0.2);
        /* Solid blue box */
        border-radius: 10px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        text-align: center;
        padding: 20px;
        flex: 1;
        min-width: 250px;
        transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
      }

      .why-choose-box h3 {
        font-size: 1.5em;
        margin-bottom: 10px;
        color: #ffffff;
      }

      .why-choose-box p {
        font-size: 1em;
        color: #d0e6ff;
        /* Light blue text */
      }

      .why-choose-box:hover {
        transform: translateY(-5px) scale(1.05);
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
      }

      /* Responsive Design */
      @media (max-width: 768px) {
        .why-choose-container {
          flex-direction: column;
          gap: 15px;
        }

        .why-choose-box {
          min-width: 100%;
        }

        .why-choose-section h2 {
          font-size: 2em;
        }
      }

      /* Footer Section Styling */
      .footer {
        background: rgba(9, 55, 144, 0.4);
        /* Transparent Dark Blue Footer */
        color: white;
        padding: 40px 20px;
        font-family: 'Roboto', sans-serif;
        backdrop-filter: blur(5px);
        /* Slight blur effect for clarity */
      }

      /* Footer Container */
      .footer-container {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 30px;
        max-width: 1200px;
        margin: 0 auto;
      }

      /* Left Section */
      .footer-left {
        flex: 1;
        min-width: 280px;
      }

      .footer-left img {
        width: 150px;
        margin-bottom: 15px;
      }

      .footer-left p {
        font-size: 0.9em;
        line-height: 1.6;
        color: #d0e6ff;
      }

      /* Middle Section */
      .footer-middle {
        flex: 1;
        min-width: 280px;
        text-align: center;
      }

      .footer-middle h3 {
        font-size: 1.2em;
        margin-bottom: 10px;
        text-transform: uppercase;
        color: #ffffff;
      }

      .footer-middle ul {
        list-style: none;
        padding: 0;
        text-align: center;
      }

      .footer-middle ul li {
        margin-bottom: 8px;
      }

      .footer-middle ul li a {
        color: #d0e6ff;
        text-decoration: none;
        transition: color 0.3s ease;
      }

      .footer-middle ul li a:hover {
        color: #2ea2cc;
      }

      /* Right Section */
      .footer-right {
        flex: 1;
        min-width: 280px;
        text-align: right;
      }

      .footer-right h3 {
        font-size: 1.2em;
        margin-bottom: 10px;
        text-transform: uppercase;
        color: #ffffff;
      }

      .footer-right p {
        font-size: 0.9em;
        line-height: 1.6;
        color: #d0e6ff;
        margin-bottom: 15px;
      }

      .footer-right h4 {
        font-size: 1em;
        margin-top: 20px;
        color: #ffffff;
      }

      .footer-social {
        margin-top: 10px;
        text-align: center;
        /* Center social icons on mobile */
      }

      .footer-social a {
        display: inline-block;
        margin: 5px;
        transition: transform 0.3s ease;
      }

      .footer-social img {
        width: 24px;
        height: 24px;
      }

      .footer-social a:hover {
        transform: scale(1.1);
      }

      /* Bottom Section */
      .footer-bottom {
        text-align: center;
        margin-top: 30px;
        font-size: 0.8em;
        color: #d0e6ff;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-top: 20px;
        background: transparent;
        /* Fully Transparent */
        backdrop-filter: none;
        /* Remove any blur effect */
      }

      /* Responsive Design */
      @media (max-width: 768px) {
        .footer-container {
          flex-direction: column;
          text-align: center;
          align-items: center;
          gap: 20px;
        }

        .footer-left,
        .footer-middle,
        .footer-right {
          text-align: center;
          margin-bottom: 20px;
        }

        .footer-left img {
          margin: 0 auto 10px;
        }

        .footer-middle ul {
          text-align: center;
        }

        .footer-right h3,
        .footer-right p {
          text-align: center;
        }

        .footer-social {
          text-align: center;
          margin-top: 10px;
        }
      }

      .centered-gif {
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 40px 0;
        /* Add space around the GIF */
        text-align: center;
      }

      .centered-gif img {
        max-width: 100%;
        height: auto;
        display: block;
        border-radius: 8px;
        /* Optional: adds rounded corners */
        transition: transform 0.3s ease-in-out;
      }

      .centered-gif img:hover {
        transform: scale(1.05);
        /* Slight zoom on hover */
      }

      /* Buy/Sell OSRS Gold Section */
      .gold-section {
        text-align: center;
        padding: 40px 20px;
        background: rgba(9, 55, 144, 0.2);
        border-radius: 10px;
        max-width: 600px;
        margin: 50px auto;
      }

      .gold-section h2 {
        font-size: 2em;
        margin-bottom: 20px;
        color: white;
      }

      /* Tabs */
      .tab-container {
        display: flex;
        justify-content: center;
        margin-bottom: 20px;
        gap: 10px;
      }

      .tab-btn {
        padding: 10px 20px;
        font-size: 1em;
        font-weight: bold;
        cursor: pointer;
        border: none;
        border-radius: 5px;
        background: #093790;
        color: white;
        transition: background 0.3s;
      }

      .tab-btn.active {
        background: #2ea2cc;
      }

      /* Tab Content */
      .tab-content {
        display: none;
        flex-direction: column;
        gap: 10px;
        text-align: left;
        margin: 0 auto;
        max-width: 400px;
      }

      .tab-content.active {
        display: flex;
      }

      .tab-content p {
        font-size: 1em;
        margin: 5px 0;
        color: white;
      }

      .tab-content label {
        font-size: 0.9em;
        margin-top: 10px;
        color: white;
      }

      .tab-content input {
        padding: 8px;
        margin-top: 5px;
        font-size: 1em;
        border: 1px solid #ccc;
        border-radius: 5px;
        width: 100%;
        box-sizing: border-box;
      }

      .submit-btn {
        margin-top: 20px;
        padding: 10px 20px;
        font-size: 1em;
        font-weight: bold;
        cursor: pointer;
        border: none;
        border-radius: 5px;
        background: #2ea2cc;
        color: white;
        transition: background 0.3s;
      }

      .submit-btn:hover {
        background: #1f6bb5;
      }

      /* Centered Animated Image */
      .centered-animated-image {
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 50px auto;
        padding: 20px;
      }

      .centered-animated-image img {
        width: 200px;
        /* Adjust size as needed */
        height: auto;
        animation: pulseImage 3s infinite ease-in-out;
        /* Subtle animation */
      }

      /* Keyframes for Subtle Pulse Animation */
      @keyframes pulseImage {
        0% {
          transform: scale(1);
          opacity: 1;
        }

        50% {
          transform: scale(1.05);
          opacity: 0.9;
        }

        100% {
          transform: scale(1);
          opacity: 1;
        }
      }

      /* Preloader Animation */
      #preloader {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #093790;
        /* Change to your theme color */
        z-index: 9999;
        display: none;
        opacity: 1;
        transition: opacity 0.5s ease-in-out;
      }

      /* Fade-in Animation for Pages */
      body {
        animation: fadeIn 0.8s ease-in-out;
      }

      @keyframes fadeIn {
        from {
          opacity: 0;
        }

        to {
          opacity: 1;
        }
      }
    </style>
    <script>
      function toggleMenu() {
        const menu = document.querySelector('.navbar ul');
        const toggle = document.querySelector('.menu-toggle');
        menu.classList.toggle('active');
        toggle.classList.toggle('active');
      }

      function toggleDropdown(event) {
        if (event.target.closest('li').classList.contains('has-dropdown')) {
          event.target.closest('li').classList.toggle('show');
        }
      }
    </script>
  </head>
  <body>
    <nav class="navbar">
      <div class="logo">
        <a href="./index.html">
          <img src="website_logo_transparent.png" alt="OSRS Services Logo">
        </a>
      </div>
      <div class="menu-toggle" onclick="toggleMenu()">☰</div>
      <ul onclick="toggleDropdown(event)">
        <li>
          <a href="./gold-items.html">OSRS Gold</a>
        </li>
        <li>
          <a href="./accounts.html">Accounts</a>
        </li>
        <li>
          <a href="./infernal-cape.html">Infernal Cape</a>
        </li>
        <li>
          <a href="./megascales.html">Megascales</a>
        </li>
        <li>
          <a href="./services.html">Services</a>
        </li>
      </ul>
      <ul>
        <li class="discord">
          <a href="https://discord.com/invite/osrspvmer" target="_blank">
            <img src="Discord.png" alt="Discord">
          </a>
        </li>
      </ul>
    </nav>
    <div class="centered-animated-image">
      <img src="tradegold.png" alt="Trade Gold">
    </div>
    <div id="preloader"></div>
    <!-- Buy/Sell OSRS Gold Section -->
    <section class="gold-section">
      <h2>Buy/Sell OSRS Gold</h2>
      <div class="tab-container">
        <button class="tab-btn active" onclick="switchTab('buy')">Buy</button>
        <button class="tab-btn" onclick="switchTab('sell')">Sell</button>
      </div>
      <!-- Buy Tab -->
      <div id="buy-tab" class="tab-content active">
        <p>Current buy rate: <strong id="buy-rate">$0.18/m</strong>
        </p>
        <label for="buy-amount">Millions (GP):</label>
        <input type="number" id="buy-amount" placeholder="Enter amount" maxlength="6" oninput="validateMillions(this); calculatePrice('buy')">
        <p>Total Price: $ <span id="buy-total">0.00</span>
        </p>
        <label for="buy-rsn">RSN:</label>
        <input type="text" id="buy-rsn" placeholder="Your RuneScape Name" maxlength="12" oninput="validateRSN(this)">
        <button class="submit-btn" onclick="submitForm('buy')">Buy Now</button>
      </div>
      <!-- Sell Tab -->
      <div id="sell-tab" class="tab-content">
        <p>Current sell rate: <strong id="sell-rate">$0.12/m</strong>
        </p>
        <label for="sell-amount">Millions (GP):</label>
        <input type="number" id="sell-amount" placeholder="Enter amount" maxlength="6" oninput="validateMillions(this); calculatePrice('sell')">
        <p>Total Price: $ <span id="sell-total">0.00</span>
        </p>
        <label for="sell-rsn">RSN:</label>
        <input type="text" id="sell-rsn" placeholder="Your RuneScape Name" maxlength="12" oninput="validateRSN(this)">
        <button class="submit-btn" onclick="submitForm('sell')">Sell Now</button>
      </div>
    </section>
    <script>
      // ✅ Global Variables
      let methods = null;
      let currentMethod = null;
      let currency = null;
      let currentCurrency = "USD";
      let itemsList = [];
      let login = false;
      let checkoutError = false;
      const currency_icons = {
        "AUD": "$",
        "BRL": "$",
        "CAD": "$",
        "CNY": "¥",
        "EUR": "€",
        "GBP": "£",
        "JPY": "¥",
        "NZD": "$",
        "USD": "$"
      };
      let currentGame = null;
      let price_rs3 = 0;
      let price_osrs = 0;
      // ✅ Fetch Prices from GitHub
      async function fetchPrices() {
        try {
          const response = await fetch('https://raw.githubusercontent.com/GeneralBacuum/test/refs/heads/main/prices.json');
          if (!response.ok) throw new Error('Failed to fetch prices');
          const data = await response.json();
          document.getElementById('buy-rate').innerText = `$${data.buy_price}/m`;
          document.getElementById('sell-rate').innerText = `$${data.sell_price}/m`;
          window.buyRate = data.buy_price;
          window.sellRate = data.sell_price;
        } catch (error) {
          console.error('Error fetching prices:', error);
          alert('Failed to load current prices. Please try again later.');
        }
      }
      // ✅ Switch Tabs (Buy/Sell)
      function switchTab(tab) {
        document.querySelectorAll('.tab-content').forEach(tabContent => tabContent.classList.remove('active'));
        document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active'));
        document.getElementById(`${tab}-tab`).classList.add('active');
        document.querySelector(`[onclick="switchTab('${tab}')"]`).classList.add('active');
      }
      // ✅ Validate Millions Input
      function validateMillions(input) {
        input.value = input.value.replace(/[^0-9]/g, '').slice(0, 6);
      }
      // ✅ Validate RSN Input
      function validateRSN(input) {
        input.value = input.value.replace(/[^a-zA-Z0-9 ]/g, '').slice(0, 12);
      }
      // ✅ Calculate Price
      function calculatePrice(type) {
        let rate = type === 'buy' ? window.buyRate : window.sellRate;
        let amount = document.getElementById(`${type}-amount`).value;
        let total = (amount * rate).toFixed(2);
        document.getElementById(`${type}-total`).innerText = total || '0.00';
      }
      // ✅ Submit Form to Live Chat
      function submitForm(type) {
        const amount = document.getElementById(`${type}-amount`).value;
        const rsn = document.getElementById(`${type}-rsn`).value;
        if (!amount || !rsn) {
          alert('Please fill in all fields.');
          return;
        }
        const action = type === 'buy' ? 'Buying' : 'Selling';
        const total = document.getElementById(`${type}-total`).innerText;
        const message = `I am ${action} ${amount}M worth of gold ($${total}), and my RSN is: ${rsn}`;
        send_chat_message(message);
      }
      // ✅ Send Message via Chat
      function send_chat_message(message) {
        if (window.smartsupp) {
          smartsupp('chat:open');
          smartsupp('chat:message', message);
          console.log('✅ Message sent to LiveChat:', message);
        } else {
          console.error('❌ Smartsupp not initialized.');
          alert('LiveChat is not ready. Please try again later.');
        }
      }
      // ✅ Load Items
      function load_items() {
        const pathSegments = window.location.pathname.split('/');
        const items_name = pathSegments.pop();
        const page = parseInt(new URLSearchParams(window.location.search).get('page')) || 1;
        const visiblePages = 6;
        const itemsPerPage = 16;
        $("ul.mini-menu a[href='/items/" + items_name + "']").addClass("act");
        $("ul.item_list").html("");
        $.get(`/api/items/`, function(data) {
          price_rs3 = data.price.rs3;
          price_osrs = data.price.osrs;
          itemsList = data[items_name.replace("-items", "")].reverse();
          const totalPages = Math.ceil(itemsList.length / itemsPerPage);
          let startPage = Math.max(1, page - Math.floor(visiblePages / 2));
          let endPage = Math.min(totalPages, page + Math.floor(visiblePages / 2));
          $(".pag-buttons").html("");
          if (startPage > 1) $(".pag-buttons").append(`
														<div class="num" onclick='change_page(1)'>
															<a href="#">1</a>
														</div>`);
          for (let i = startPage; i <= endPage; i++) {
            $(".pag-buttons").append(`
														<div class="num" onclick='change_page(${i})'>
															<a href="#">${i}</a>
														</div>`);
          }
          displayItems(itemsList, page, itemsPerPage, true);
        });
      }
      // ✅ Display Items
      function displayItems(items, page, itemsPerPage, req) {
        const pathSegments = window.location.pathname.split('/');
        const items_name = pathSegments.pop();
        const paginatedItems = items.slice((page - 1) * itemsPerPage, page * itemsPerPage);
        $("ul.item_list").html('');
        $(".loading-slide").show();
        paginatedItems.forEach(function(item, numid) {
          $("ul.item_list").append(`
            
														<li data-item_id="${item.id}" data-numid="${numid}">
															<div class="s-flex-center-between mini-header">
																<input type="text" readonly class="fixed" value="${item.stock ? 'In Stock' : 'Out of Stock'}">
																	<input type="number" numId="${numid}" class="fixed" value="1">
																	</div>
																	<h2>${item.name}</h2>
																	<button class="buy_item" onclick="buy_item(${numid})">Buy</button>
																	<button class="sell_item" onclick="sell_item(${numid})">Sell</button>
																</li>
        `);
        });
      }
      // ✅ Page Navigation
      function change_page(num) {
        const url = new URL(window.location);
        url.searchParams.set('page', num);
        history.pushState(null, '', url.toString());
        load_items();
        window.scrollTo(0, 420);
      }
      // ✅ Initialize on Load
      window.onload = fetchPrices;
      $(document).ready(() => {
        load_items();
        load_currency();
        load_methods();
      });
    </script>
    <footer class="footer">
      <div class="footer-container">
        <!-- Left Section: Logo and Description -->
        <div class="footer-section footer-left">
          <img src="website_logo_transparent.png" alt="OSRS Services Logo">
          <p> Providing efficient and affordable OSRS Services, we have completed over $250,000 in orders across numerous sites. Speak to Live Chat if you need any support. </p>
        </div>
        <!-- Middle Section: Help and Links -->
        <div class="footer-section footer-middle">
          <h3>Quick Links</h3>
          <ul>
            <li>
              <a href="./contact.html"></a>
            </li>
            <li>
              <a href="./blog.html"></a>
            </li>
            <li>
              <a href="./privacy.html"></a>
            </li>
            <li>
              <a href="https://discord.com/invite/osrspvmer">Discord</a>
            </li>
            <li>
              <a href="https://www.eldorado.gg/users/OSRSServicesPvM?tab=Feedback">Eldorado</a>
            </li>
            <li>
              <a href="https://www.sythe.org/threads/osrs-services-vouch-thread/#post-11617726">Sythe</a>
            </li>
            <li>
              <a href="https://uk.trustpilot.com/review/osrs-pvm.com">Trustpilot</a>
            </li>
          </ul>
        </div>
        <div class="footer-section footer-right">
          <h3>Our Commitment</h3>
          <p> Dedicated to offering secure and efficient OSRS services. Our team operates with professionalism and transparency, ensuring customer satisfaction. </p>
          <h4>Join our Discord <a href="https://discord.com/invite/osrspvmer">
              <img src="Discord.png" alt="Discord">
            </a>
          </h4>
        </div>
      </div>
      <div class="footer-bottom">
        <p>© 2025 OSRS Services. All rights reserved.</p>
      </div>
    </footer>
    <script src="chat.js"></script>
    <script src="script.js"></script>
  </body>
</html>